Arcane  4.2.1.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::NumVector< T, Size > Class Template Reference

Small fixed-size vector of Size numerical data points. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/base/arccore/base/NumVector.h>

Collaboration diagram for Arcane::NumVector< T, Size >:

Classes

struct  InitTag

Public Types

using ThatClass = NumVector<T, Size>
using DataType = T

Public Member Functions

 NumVector ()=default
 Constructs the zero vector.
constexpr __host__ __device__ NumVector (T ax, T ay)
 Constructs with the pair (ax,ay).
constexpr __host__ __device__ NumVector (T ax, T ay, T az)
 Constructs with the triplet (ax,ay,az).
constexpr __host__ __device__ NumVector (T a1, T a2, T a3, T a4)
 Constructs with the quadruplet (a1,a2,a3,a4).
constexpr __host__ __device__ NumVector (T a1, T a2, T a3, T a4, T a5)
 Constructs with the quintuplet (a1,a2,a3,a4,a5).
constexpr __host__ __device__ NumVector (T a1, T a2, T a3, T a4, T a5, T a6)
 Constructs with the sextuplet (a1,a2,a3,a4,a5,a6).
template<bool = true>
constexpr __host__ __device__ NumVector (const T(&v)[Size])
 Constructs the instance with the value v for each component.
constexpr __host__ __device__ NumVector (std::array< T, Size > v)
 Constructs the instance with the value v for each component.
constexpr __host__ __device__ NumVector (T v)
 Constructs the instance with the value v for each component.
constexpr __host__ __device__ NumVector (const DataType *v, InitTag)
 Constructs the instance with the value v for each component.
constexpr __host__ __device__ NumVector (Real2 v)
constexpr __host__ __device__ NumVector (Real3 v)
constexpr __host__ __device__ NumVectoroperator= (const DataType &value)
 Assigns value to all components of the vector.
constexpr __host__ __device__ NumVectoroperator= (const Real2 &v)
constexpr __host__ __device__ NumVectoroperator= (const Real3 &v)
constexpr operator Real2 () const
constexpr operator Real3 () const
__host__ __device__ NumVector absolute () const
 Absolute value component by component.
constexpr __host__ __device__ void fill (const T &v)
 Fill the vector with the value v.
constexpr __host__ __device__ NumVector operator- () const
 Creates a triplet opposite to the current triplet.
constexpr __host__ __device__ T & operator() (Int32 i)
constexpr __host__ __device__ T operator() (Int32 i) const
constexpr __host__ __device__ T & operator[] (Int32 i)
constexpr __host__ __device__ DataType operator[] (Int32 i) const
constexpr __host__ __device__ DataType & vx ()
 Value of the first component.
constexpr __host__ __device__ DataType vx () const
 Value of the first component.
constexpr __host__ __device__ DataType & vy ()
 Value of the second component.
constexpr __host__ __device__ DataType vy () const
 Value of the second component.
constexpr __host__ __device__ DataType & vz ()
 Value of the third component.
constexpr __host__ __device__ DataType vz () const
 Value of the third component.

Static Public Member Functions

static constexpr bool isRealType ()
constexpr __host__ static __device__ NumVector zero ()

Private Member Functions

template<typename Stream>
void print (Stream &o) const

Static Private Member Functions

constexpr __host__ static __device__ bool _eq (T a, T b)
 Compares the values of a and b using the TypeEqualT comparator.

Private Attributes

m_values [Size]
 Vector values.

Friends

constexpr __host__ __device__ NumVectoroperator+= (NumVector &a, T b)
 Adds b to each component of a.
constexpr __host__ __device__ NumVectoroperator+= (NumVector &a, const NumVector &b)
 Adds b to a.
constexpr __host__ __device__ NumVectoroperator-= (NumVector &a, T b)
 Subtracts b from each component of a.
constexpr __host__ __device__ NumVectoroperator-= (NumVector &a, const NumVector &b)
 Subtracts b from each component of a.
constexpr __host__ __device__ NumVectoroperator*= (NumVector &a, T b)
 Multiplies each component of a by b.
constexpr __host__ __device__ NumVectoroperator/= (NumVector &a, T b)
 Divides each component of a by b.
constexpr __host__ __device__ NumVector operator+ (const NumVector &a, const NumVector &b)
 Creates a triplet that equals this triplet added to b.
constexpr __host__ __device__ NumVector operator- (const NumVector &a, const NumVector &b)
 Creates a triplet that equals b subtracted from this triplet.
constexpr __host__ __device__ NumVector operator* (T a, const NumVector &vec)
 Multiplication by a scalar.
constexpr __host__ __device__ NumVector operator* (const NumVector &vec, T b)
 Multiplication by a scalar.
constexpr __host__ __device__ NumVector operator/ (const NumVector &vec, T b)
 Division by a scalar.
constexpr __host__ __device__ bool operator== (const NumVector &a, const NumVector &b)
 Compares the current instance component by component to b.
std::ostream & operator<< (std::ostream &o, const NumVector &t)
constexpr __host__ __device__ bool operator!= (const NumVector &a, const NumVector &b)
 Compares two vectors For the notion of equality, see operator==().

Detailed Description

template<typename T, int Size>
class Arcane::NumVector< T, Size >

Small fixed-size vector of Size numerical data points.

It is possible to access each component of the vector using 'operator[]' or 'operator()' or via the methods vx(), vy(), vz() if the dimension is sufficient (for example, vz() is only accessible if Size>=3.

Definition at line 36 of file arccore/src/base/arccore/base/NumVector.h.

Member Typedef Documentation

◆ DataType

template<typename T, int Size>
using Arcane::NumVector< T, Size >::DataType = T

Definition at line 43 of file arccore/src/base/arccore/base/NumVector.h.

◆ ThatClass

template<typename T, int Size>
using Arcane::NumVector< T, Size >::ThatClass = NumVector<T, Size>

Definition at line 42 of file arccore/src/base/arccore/base/NumVector.h.

Constructor & Destructor Documentation

◆ NumVector() [1/11]

template<typename T, int Size>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( T ax,
T ay )
inlineconstexpr

Constructs with the pair (ax,ay).

Definition at line 54 of file arccore/src/base/arccore/base/NumVector.h.

◆ NumVector() [2/11]

template<typename T, int Size>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( T ax,
T ay,
T az )
inlineconstexpr

Constructs with the triplet (ax,ay,az).

Definition at line 62 of file arccore/src/base/arccore/base/NumVector.h.

◆ NumVector() [3/11]

template<typename T, int Size>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( T a1,
T a2,
T a3,
T a4 )
inlineconstexpr

Constructs with the quadruplet (a1,a2,a3,a4).

Definition at line 71 of file arccore/src/base/arccore/base/NumVector.h.

◆ NumVector() [4/11]

template<typename T, int Size>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( T a1,
T a2,
T a3,
T a4,
T a5 )
inlineconstexpr

Constructs with the quintuplet (a1,a2,a3,a4,a5).

Definition at line 81 of file arccore/src/base/arccore/base/NumVector.h.

◆ NumVector() [5/11]

template<typename T, int Size>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( T a1,
T a2,
T a3,
T a4,
T a5,
T a6 )
inlineconstexpr

Constructs with the sextuplet (a1,a2,a3,a4,a5,a6).

Definition at line 91 of file arccore/src/base/arccore/base/NumVector.h.

◆ NumVector() [6/11]

template<typename T, int Size>
template<bool = true>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( const T(&) v[Size])
inlineexplicitconstexpr

Constructs the instance with the value v for each component.

Definition at line 103 of file arccore/src/base/arccore/base/NumVector.h.

◆ NumVector() [7/11]

template<typename T, int Size>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( std::array< T, Size > v)
inlineexplicitconstexpr

Constructs the instance with the value v for each component.

Definition at line 110 of file arccore/src/base/arccore/base/NumVector.h.

◆ NumVector() [8/11]

template<typename T, int Size>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( T v)
inlineexplicitconstexpr

Constructs the instance with the value v for each component.

Definition at line 117 of file arccore/src/base/arccore/base/NumVector.h.

◆ NumVector() [9/11]

template<typename T, int Size>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( const DataType * v,
InitTag  )
inlineconstexpr

Constructs the instance with the value v for each component.

Definition at line 124 of file arccore/src/base/arccore/base/NumVector.h.

◆ NumVector() [10/11]

template<typename T, int Size>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( Real2 v)
inlineexplicitconstexpr

Definition at line 130 of file arccore/src/base/arccore/base/NumVector.h.

◆ NumVector() [11/11]

template<typename T, int Size>
__host__ __device__ Arcane::NumVector< T, Size >::NumVector ( Real3 v)
inlineexplicitconstexpr

Definition at line 134 of file arccore/src/base/arccore/base/NumVector.h.

Member Function Documentation

◆ _eq()

template<typename T, int Size>
__host__ static __device__ bool Arcane::NumVector< T, Size >::_eq ( T a,
T b )
inlinestaticconstexprprivate

Compares the values of a and b using the TypeEqualT comparator.

Return values
trueif a and b are equal,
falseotherwise.

Definition at line 392 of file arccore/src/base/arccore/base/NumVector.h.

Referenced by Arcane::NumVector< DataType, Size >::operator==.

Here is the caller graph for this function:

◆ absolute()

template<typename T, int Size>
__host__ __device__ NumVector Arcane::NumVector< T, Size >::absolute ( ) const
inline

Absolute value component by component.

Definition at line 177 of file arccore/src/base/arccore/base/NumVector.h.

◆ fill()

template<typename T, int Size>
__host__ __device__ void Arcane::NumVector< T, Size >::fill ( const T & v)
inlineconstexpr

Fill the vector with the value v.

Definition at line 186 of file arccore/src/base/arccore/base/NumVector.h.

◆ isRealType()

template<typename T, int Size>
constexpr bool Arcane::NumVector< T, Size >::isRealType ( )
inlinestaticconstexpr

Definition at line 44 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator Real2()

template<typename T, int Size>
Arcane::NumVector< T, Size >::operator Real2 ( ) const
inlineconstexpr

Definition at line 160 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator Real3()

template<typename T, int Size>
Arcane::NumVector< T, Size >::operator Real3 ( ) const
inlineconstexpr

Definition at line 165 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator()() [1/2]

template<typename T, int Size>
__host__ __device__ T & Arcane::NumVector< T, Size >::operator() ( Int32 i)
inlineconstexpr

Definition at line 324 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator()() [2/2]

template<typename T, int Size>
__host__ __device__ T Arcane::NumVector< T, Size >::operator() ( Int32 i) const
inlineconstexpr

Definition at line 329 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator-()

template<typename T, int Size>
__host__ __device__ NumVector Arcane::NumVector< T, Size >::operator- ( ) const
inlineconstexpr

Creates a triplet opposite to the current triplet.

Definition at line 260 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator=() [1/3]

template<typename T, int Size>
__host__ __device__ NumVector & Arcane::NumVector< T, Size >::operator= ( const DataType & value)
inlineconstexpr

Assigns value to all components of the vector.

Definition at line 139 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator=() [2/3]

template<typename T, int Size>
__host__ __device__ NumVector & Arcane::NumVector< T, Size >::operator= ( const Real2 & v)
inlineconstexpr

Definition at line 146 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator=() [3/3]

template<typename T, int Size>
__host__ __device__ NumVector & Arcane::NumVector< T, Size >::operator= ( const Real3 & v)
inlineconstexpr

Definition at line 153 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator[]() [1/2]

template<typename T, int Size>
__host__ __device__ T & Arcane::NumVector< T, Size >::operator[] ( Int32 i)
inlineconstexpr

Definition at line 334 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator[]() [2/2]

template<typename T, int Size>
__host__ __device__ DataType Arcane::NumVector< T, Size >::operator[] ( Int32 i) const
inlineconstexpr

Definition at line 339 of file arccore/src/base/arccore/base/NumVector.h.

◆ print()

template<typename T, int Size>
template<typename Stream>
void Arcane::NumVector< T, Size >::print ( Stream & o) const
inlineprivate

Definition at line 397 of file arccore/src/base/arccore/base/NumVector.h.

◆ vx() [1/2]

template<typename T, int Size>
__host__ __device__ DataType & Arcane::NumVector< T, Size >::vx ( )
inlineconstexpr

Value of the first component.

Definition at line 346 of file arccore/src/base/arccore/base/NumVector.h.

◆ vx() [2/2]

template<typename T, int Size>
__host__ __device__ DataType Arcane::NumVector< T, Size >::vx ( ) const
inlineconstexpr

Value of the first component.

Definition at line 351 of file arccore/src/base/arccore/base/NumVector.h.

◆ vy() [1/2]

template<typename T, int Size>
__host__ __device__ DataType & Arcane::NumVector< T, Size >::vy ( )
inlineconstexpr

Value of the second component.

Definition at line 357 of file arccore/src/base/arccore/base/NumVector.h.

◆ vy() [2/2]

template<typename T, int Size>
__host__ __device__ DataType Arcane::NumVector< T, Size >::vy ( ) const
inlineconstexpr

Value of the second component.

Definition at line 362 of file arccore/src/base/arccore/base/NumVector.h.

◆ vz() [1/2]

template<typename T, int Size>
__host__ __device__ DataType & Arcane::NumVector< T, Size >::vz ( )
inlineconstexpr

Value of the third component.

Definition at line 368 of file arccore/src/base/arccore/base/NumVector.h.

◆ vz() [2/2]

template<typename T, int Size>
__host__ __device__ DataType Arcane::NumVector< T, Size >::vz ( ) const
inlineconstexpr

Value of the third component.

Definition at line 373 of file arccore/src/base/arccore/base/NumVector.h.

◆ zero()

template<typename T, int Size>
__host__ static __device__ NumVector Arcane::NumVector< T, Size >::zero ( )
inlinestaticconstexpr

Definition at line 172 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator!=

template<typename T, int Size>
__host__ __device__ bool operator!= ( const NumVector< T, Size > & a,
const NumVector< T, Size > & b )
friend

Compares two vectors For the notion of equality, see operator==().

Definition at line 319 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator* [1/2]

template<typename T, int Size>
__host__ __device__ NumVector operator* ( const NumVector< T, Size > & vec,
T b )
friend

Multiplication by a scalar.

Definition at line 278 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator* [2/2]

template<typename T, int Size>
__host__ __device__ NumVector operator* ( T a,
const NumVector< T, Size > & vec )
friend

Multiplication by a scalar.

Definition at line 269 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator*=

template<typename T, int Size>
__host__ __device__ NumVector & operator*= ( NumVector< T, Size > & a,
T b )
friend

Multiplies each component of a by b.

Definition at line 226 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator+

template<typename T, int Size>
__host__ __device__ NumVector operator+ ( const NumVector< T, Size > & a,
const NumVector< T, Size > & b )
friend

Creates a triplet that equals this triplet added to b.

Definition at line 242 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator+= [1/2]

template<typename T, int Size>
__host__ __device__ NumVector & operator+= ( NumVector< T, Size > & a,
const NumVector< T, Size > & b )
friend

Adds b to a.

Definition at line 202 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator+= [2/2]

template<typename T, int Size>
__host__ __device__ NumVector & operator+= ( NumVector< T, Size > & a,
T b )
friend

Adds b to each component of a.

Definition at line 194 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator-

template<typename T, int Size>
__host__ __device__ NumVector operator- ( const NumVector< T, Size > & a,
const NumVector< T, Size > & b )
friend

Creates a triplet that equals b subtracted from this triplet.

Definition at line 251 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator-= [1/2]

template<typename T, int Size>
__host__ __device__ NumVector & operator-= ( NumVector< T, Size > & a,
const NumVector< T, Size > & b )
friend

Subtracts b from each component of a.

Definition at line 218 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator-= [2/2]

template<typename T, int Size>
__host__ __device__ NumVector & operator-= ( NumVector< T, Size > & a,
T b )
friend

Subtracts b from each component of a.

Definition at line 210 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator/

template<typename T, int Size>
__host__ __device__ NumVector operator/ ( const NumVector< T, Size > & vec,
T b )
friend

Division by a scalar.

Definition at line 287 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator/=

template<typename T, int Size>
__host__ __device__ NumVector & operator/= ( NumVector< T, Size > & a,
T b )
friend

Divides each component of a by b.

Definition at line 234 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator<<

template<typename T, int Size>
std::ostream & operator<< ( std::ostream & o,
const NumVector< T, Size > & t )
friend

Definition at line 309 of file arccore/src/base/arccore/base/NumVector.h.

◆ operator==

template<typename T, int Size>
__host__ __device__ bool operator== ( const NumVector< T, Size > & a,
const NumVector< T, Size > & b )
friend

Compares the current instance component by component to b.

Return values
trueif this.x==b.x and this.y==b.y and this.z==b.z.
falseotherwise.

Definition at line 301 of file arccore/src/base/arccore/base/NumVector.h.

Member Data Documentation

◆ m_values


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