Template Numerical Library version\ main:94209208
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
TNL::Containers::StaticVector< Size, Real > Class Template Reference

Vector with constant size. More...

#include <TNL/Containers/StaticVector.h>

Inheritance diagram for TNL::Containers::StaticVector< Size, Real >:
Inheritance graph
[legend]
Collaboration diagram for TNL::Containers::StaticVector< Size, Real >:
Collaboration graph
[legend]

Public Types

using IndexType = int
 Indexing type.
 
using RealType = Real
 Type of numbers stored in this vector.
 
- Public Types inherited from TNL::Containers::StaticArray< Size, Value >
using IndexType = int
 Type being used for the array elements indexing.
 
using ValueType = Value
 Type of elements stored in this array.
 

Public Member Functions

__cuda_callable__ constexpr StaticVector ()=default
 Default constructor.
 
template<typename T1 , typename T2 , typename Operation >
constexpr StaticVector (const Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation > &expr)
 Constructor from binary vector expression.
 
template<typename T , typename Operation >
constexpr StaticVector (const Expressions::StaticUnaryExpressionTemplate< T, Operation > &expr)
 Constructor from unary expression.
 
__cuda_callable__ constexpr StaticVector (const StaticVector &)=default
 Default copy constructor.
 
template<typename VectorExpression >
constexpr StaticVectoroperator%= (const VectorExpression &expression)
 Elementwise modulo by a vector expression.
 
template<typename VectorExpression >
constexpr StaticVector< Size, Real > & operator%= (const VectorExpression &expression)
 
template<typename VectorExpression >
constexpr StaticVectoroperator*= (const VectorExpression &expression)
 Elementwise multiplication by a vector expression.
 
template<typename VectorExpression >
constexpr StaticVector< Size, Real > & operator*= (const VectorExpression &expression)
 
template<typename VectorExpression >
constexpr StaticVectoroperator+= (const VectorExpression &expression)
 Addition operator with a vector expression.
 
template<typename VectorExpression >
constexpr StaticVector< Size, Real > & operator+= (const VectorExpression &expression)
 
template<typename VectorExpression >
constexpr StaticVectoroperator-= (const VectorExpression &expression)
 Subtraction operator with a vector expression.
 
template<typename VectorExpression >
constexpr StaticVector< Size, Real > & operator-= (const VectorExpression &expression)
 
template<typename VectorExpression >
constexpr StaticVectoroperator/= (const VectorExpression &expression)
 Elementwise division by a vector expression.
 
template<typename VectorExpression >
constexpr StaticVector< Size, Real > & operator/= (const VectorExpression &expression)
 
constexpr StaticVectoroperator= (const StaticVector &)=default
 Default copy-assignment operator.
 
template<typename VectorExpression >
constexpr StaticVectoroperator= (const VectorExpression &expression)
 Assignment operator with a vector expression.
 
template<typename VectorExpression >
constexpr StaticVector< Size, Real > & operator= (const VectorExpression &expression)
 
constexpr StaticVectoroperator= (StaticVector &&) noexcept=default
 Default move-assignment operator.
 
- Public Member Functions inherited from TNL::Containers::StaticArray< Size, Value >
__cuda_callable__ constexpr StaticArray ()=default
 Default constructor.
 
__cuda_callable__ constexpr StaticArray (const StaticArray &v)
 Copy constructor.
 
template<typename OtherValue >
__cuda_callable__ constexpr StaticArray (const StaticArray< Size, OtherValue > &v)
 Templated copy constructor.
 
template<typename OtherValue >
constexpr StaticArray (const StaticArray< Size, OtherValue > &v)
 
template<typename OtherValue >
__cuda_callable__ constexpr StaticArray (const std::array< OtherValue, Size > &array)
 Constructor which initializes the array by copying elements from std::array.
 
template<typename OtherValue >
__cuda_callable__ constexpr StaticArray (const std::initializer_list< OtherValue > &elems)
 Constructor which initializes the array by copying elements from std::initializer_list, e.g. {...}.
 
__cuda_callable__ constexpr StaticArray (const Value &v)
 Constructor that sets all array components to value v.
 
template<typename _unused = void>
__cuda_callable__ constexpr StaticArray (const Value v[Size])
 Constructor from static array.
 
template<typename _unused >
constexpr StaticArray (const Value v[Size])
 
constexpr StaticArray (StaticArray &&) noexcept=default
 Move constructor.
 
__cuda_callable__ constexpr StaticArray (std::array< Value, Size > &&array)
 Constructor which initializes the array by moving elements from std::array.
 
template<typename... Values, std::enable_if_t<(Size > 1) &&sizeof...(Values)==Size, bool > = true>
__cuda_callable__ constexpr StaticArray (Values &&... values)
 Constructor which initializes the array element-by-element using the supplied values.
 
constexpr const ValuegetData () const noexcept
 Gets constant pointer to data of this static array.
 
constexpr ValuegetData () noexcept
 Gets pointer to data of this static array.
 
constexpr Value getElement (IndexType i) const noexcept
 Returns the value of the i-th element.
 
void load (File &file)
 Loads data from the file to this static array.
 
template<typename Array >
constexpr bool operator!= (const Array &array) const
 This function checks whether this static array is not equal to another array.
 
constexpr const Valueoperator() (int i) const noexcept
 Accesses specified element at the position i and returns a constant reference to its value.
 
constexpr Valueoperator() (int i) noexcept
 Accesses specified element at the position i and returns a reference to its value.
 
constexpr StaticArrayoperator= (const StaticArray &v)
 Copy-assignment operator.
 
template<typename T >
constexpr StaticArray< Size, Value > & operator= (const T &v)
 Assigns an object v of type T.
 
constexpr StaticArrayoperator= (StaticArray &&) noexcept=default
 Move-assignment operator.
 
template<typename Array >
constexpr bool operator== (const Array &array) const
 This function checks whether this static array is equal to another array.
 
constexpr const Valueoperator[] (int i) const noexcept
 Accesses specified element at the position i and returns a constant reference to its value.
 
constexpr Valueoperator[] (int i) noexcept
 Accesses specified element at the position i and returns a reference to its value.
 
void save (File &file) const
 Saves this static array into the file.
 
constexpr void setElement (IndexType i, ValueType value) noexcept
 Sets the value of the i-th element to value.
 
constexpr void setValue (const ValueType &val)
 Sets all values of this static array to val.
 
constexpr void sort ()
 Sorts the elements in this static array in ascending order.
 
std::ostreamwrite (std::ostream &str, const char *separator=" ") const
 Writes the array values into stream str with specified separator.
 
constexpr const Valuex () const noexcept
 Returns constant reference to the first coordinate.
 
constexpr Valuex () noexcept
 Returns reference to the first coordinate.
 
constexpr const Valuey () const noexcept
 Returns constant reference to the second coordinate for arrays with Size >= 2.
 
constexpr Valuey () noexcept
 Returns reference to the second coordinate for arrays with Size >= 2.
 
constexpr const Valuez () const noexcept
 Returns constant reference to the third coordinate for arrays with Size >= 3.
 
constexpr Valuez () noexcept
 Returns reference to the third coordinate for arrays with Size >= 3.
 

Additional Inherited Members

- Static Public Member Functions inherited from TNL::Containers::StaticArray< Size, Value >
static constexpr int getSize ()
 Gets size of this array.
 
- Protected Attributes inherited from TNL::Containers::StaticArray< Size, Value >
std::array< Value, Size > data
 

Detailed Description

template<int Size, typename Real = double>
class TNL::Containers::StaticVector< Size, Real >

Vector with constant size.

Parameters
SizeSize of static vector. Number of its elements.
RealType of the values in the static vector.

Constructor & Destructor Documentation

◆ StaticVector() [1/2]

template<int Size, typename Real >
template<typename T1 , typename T2 , typename Operation >
constexpr TNL::Containers::StaticVector< Size, Real >::StaticVector ( const Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation > & expr)
constexpr

Constructor from binary vector expression.

Parameters
expris binary expression.

◆ StaticVector() [2/2]

template<int Size, typename Real >
template<typename T , typename Operation >
constexpr TNL::Containers::StaticVector< Size, Real >::StaticVector ( const Expressions::StaticUnaryExpressionTemplate< T, Operation > & expr)
constexpr

Constructor from unary expression.

Parameters
expris unary expression

Member Function Documentation

◆ operator%=()

template<int Size, typename Real = double>
constexpr StaticVector & TNL::Containers::StaticVector< Size, Real >::operator%= ( const VectorExpression & expression)
constexpr

Elementwise modulo by a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression
Returns
reference to this vector

◆ operator*=()

template<int Size, typename Real = double>
constexpr StaticVector & TNL::Containers::StaticVector< Size, Real >::operator*= ( const VectorExpression & expression)
constexpr

Elementwise multiplication by a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression.
Returns
reference to this vector

◆ operator+=()

template<int Size, typename Real = double>
constexpr StaticVector & TNL::Containers::StaticVector< Size, Real >::operator+= ( const VectorExpression & expression)
constexpr

Addition operator with a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression
Returns
reference to this vector

◆ operator-=()

template<int Size, typename Real = double>
constexpr StaticVector & TNL::Containers::StaticVector< Size, Real >::operator-= ( const VectorExpression & expression)
constexpr

Subtraction operator with a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression
Returns
reference to this vector

◆ operator/=()

template<int Size, typename Real = double>
constexpr StaticVector & TNL::Containers::StaticVector< Size, Real >::operator/= ( const VectorExpression & expression)
constexpr

Elementwise division by a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression
Returns
reference to this vector

◆ operator=()

template<int Size, typename Real = double>
constexpr StaticVector & TNL::Containers::StaticVector< Size, Real >::operator= ( const VectorExpression & expression)
constexpr

Assignment operator with a vector expression.

The vector expression can be even just static vector.

Parameters
expressionis the vector expression
Returns
reference to this vector

The documentation for this class was generated from the following files: