Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::Vector2< T > Class Template Reference

Class managing a 2-dimensional vector of type T. More...

#include <arcane/utils/Vector2.h>

Public Types

using ThatClass = Vector2<T>
using value_type = T

Public Member Functions

constexpr __host__ __device__ Vector2 ()=default
 Constructs the zero vector.
constexpr __host__ __device__ Vector2 (const T &ax, const T &ay)
 Constructs the triplet (ax,ay,az).
constexpr __host__ __device__ Vector2 (const T &v)
 Constructs the instance with the triplet (v,v,v).
constexpr Vector2 (const std::array< T, 2 > &v)
 Constructs the instance with the array v.
constexpr Vector2 (std::initializer_list< T > v)
 Constructs the instance with the list v.
constexpr Vector2operator= (std::initializer_list< T > v)
 Positions the instance with the list v.
constexpr __host__ __device__ void operator+= (const T &b)
 Adds b to the instance.
constexpr __host__ __device__ void operator+= (const ThatClass &b)
 Adds b to the instance.
constexpr __host__ __device__ void operator-= (const T &b)
 Subtracts b from the instance.
constexpr __host__ __device__ void operator-= (const ThatClass &b)
 Subtracts b from the instance.
constexpr __host__ __device__ void operator*= (const T &b)
 Multiplies each component of the instance by b.
constexpr __host__ __device__ void operator/= (const T &b)
 Divides each component of the instance by b.
constexpr __host__ __device__ ThatClass operator- () const
 Returns the opposite of the instance.

Public Attributes

x = {}
y = {}

Friends

constexpr __host__ __device__ bool operator< (const Vector2< T > &v1, const Vector2< T > &v2)
std::ostream & operator<< (std::ostream &o, const Vector2< T > &t)
 Writes t to the stream o.
constexpr __host__ __device__ bool operator== (const Vector2< T > &v1, const Vector2< T > &v2)
constexpr __host__ __device__ bool operator!= (const Vector2< T > &v1, const Vector2< T > &v2)
constexpr __host__ __device__ ThatClass operator+ (const ThatClass &a, const ThatClass &b)
 Sums component by component of a and b.
constexpr __host__ __device__ ThatClass operator+ (const ThatClass &a, const T &b)
 Returns a by adding b to each component.
constexpr __host__ __device__ ThatClass operator+ (const T &a, const ThatClass &b)
 Returns b by adding a to each component.
constexpr __host__ __device__ ThatClass operator- (const ThatClass &a, const ThatClass &b)
 Subtracts each component of a by each component of b.
constexpr __host__ __device__ ThatClass operator- (const ThatClass &a, const T &b)
 Subtracts each component of a by b.
constexpr __host__ __device__ ThatClass operator* (const T &a, const ThatClass &b)
 Multiplies each component of b by a.
constexpr __host__ __device__ ThatClass operator* (const ThatClass &a, const T &b)
 Multiplies each component of a by b.
constexpr __host__ __device__ ThatClass operator/ (const ThatClass &a, const T &b)
 Divides each component of a by b.

Detailed Description

template<typename T>
class Arcane::Vector2< T >

Class managing a 2-dimensional vector of type T.

The 2 elements of the vector can be accessed by x or y.

Definition at line 36 of file Vector2.h.

Member Typedef Documentation

◆ ThatClass

template<typename T>
using Arcane::Vector2< T >::ThatClass = Vector2<T>

Definition at line 40 of file Vector2.h.

◆ value_type

template<typename T>
using Arcane::Vector2< T >::value_type = T

Definition at line 41 of file Vector2.h.

Constructor & Destructor Documentation

◆ Vector2() [1/4]

template<typename T>
__host__ __device__ Arcane::Vector2< T >::Vector2 ( const T & ax,
const T & ay )
inlineconstexpr

Constructs the triplet (ax,ay,az).

Definition at line 55 of file Vector2.h.

◆ Vector2() [2/4]

template<typename T>
__host__ __device__ Arcane::Vector2< T >::Vector2 ( const T & v)
inlineexplicitconstexpr

Constructs the instance with the triplet (v,v,v).

Definition at line 62 of file Vector2.h.

◆ Vector2() [3/4]

template<typename T>
Arcane::Vector2< T >::Vector2 ( const std::array< T, 2 > & v)
inlineconstexpr

Constructs the instance with the array v.

Definition at line 69 of file Vector2.h.

◆ Vector2() [4/4]

template<typename T>
Arcane::Vector2< T >::Vector2 ( std::initializer_list< T > v)
inlineconstexpr

Constructs the instance with the list v.

Definition at line 76 of file Vector2.h.

Member Function Documentation

◆ operator*=()

template<typename T>
__host__ __device__ void Arcane::Vector2< T >::operator*= ( const T & b)
inlineconstexpr

Multiplies each component of the instance by b.

Definition at line 149 of file Vector2.h.

◆ operator+=() [1/2]

template<typename T>
__host__ __device__ void Arcane::Vector2< T >::operator+= ( const T & b)
inlineconstexpr

Adds b to the instance.

Definition at line 121 of file Vector2.h.

◆ operator+=() [2/2]

template<typename T>
__host__ __device__ void Arcane::Vector2< T >::operator+= ( const ThatClass & b)
inlineconstexpr

Adds b to the instance.

Definition at line 128 of file Vector2.h.

◆ operator-()

template<typename T>
__host__ __device__ ThatClass Arcane::Vector2< T >::operator- ( ) const
inlineconstexpr

Returns the opposite of the instance.

Definition at line 193 of file Vector2.h.

◆ operator-=() [1/2]

template<typename T>
__host__ __device__ void Arcane::Vector2< T >::operator-= ( const T & b)
inlineconstexpr

Subtracts b from the instance.

Definition at line 135 of file Vector2.h.

◆ operator-=() [2/2]

template<typename T>
__host__ __device__ void Arcane::Vector2< T >::operator-= ( const ThatClass & b)
inlineconstexpr

Subtracts b from the instance.

Definition at line 142 of file Vector2.h.

◆ operator/=()

template<typename T>
__host__ __device__ void Arcane::Vector2< T >::operator/= ( const T & b)
inlineconstexpr

Divides each component of the instance by b.

Definition at line 156 of file Vector2.h.

◆ operator=()

template<typename T>
Vector2 & Arcane::Vector2< T >::operator= ( std::initializer_list< T > v)
inlineconstexpr

Positions the instance with the list v.

Definition at line 82 of file Vector2.h.

◆ operator!=

template<typename T>
__host__ __device__ bool operator!= ( const Vector2< T > & v1,
const Vector2< T > & v2 )
friend

Definition at line 113 of file Vector2.h.

◆ operator* [1/2]

template<typename T>
__host__ __device__ ThatClass operator* ( const T & a,
const ThatClass & b )
friend

Multiplies each component of b by a.

Definition at line 196 of file Vector2.h.

◆ operator* [2/2]

template<typename T>
__host__ __device__ ThatClass operator* ( const ThatClass & a,
const T & b )
friend

Multiplies each component of a by b.

Definition at line 202 of file Vector2.h.

◆ operator+ [1/3]

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

Returns b by adding a to each component.

Definition at line 175 of file Vector2.h.

◆ operator+ [2/3]

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

Returns a by adding b to each component.

Definition at line 169 of file Vector2.h.

◆ operator+ [3/3]

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

Sums component by component of a and b.

Definition at line 163 of file Vector2.h.

◆ operator- [1/2]

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

Subtracts each component of a by b.

Definition at line 187 of file Vector2.h.

◆ operator- [2/2]

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

Subtracts each component of a by each component of b.

Definition at line 181 of file Vector2.h.

◆ operator/

template<typename T>
__host__ __device__ ThatClass operator/ ( const ThatClass & a,
const T & b )
friend

Divides each component of a by b.

Definition at line 208 of file Vector2.h.

◆ operator<

template<typename T>
__host__ __device__ bool operator< ( const Vector2< T > & v1,
const Vector2< T > & v2 )
friend

Definition at line 90 of file Vector2.h.

◆ operator<<

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

Writes t to the stream o.

Definition at line 100 of file Vector2.h.

◆ operator==

template<typename T>
__host__ __device__ bool operator== ( const Vector2< T > & v1,
const Vector2< T > & v2 )
friend

Definition at line 107 of file Vector2.h.

Member Data Documentation

◆ x

template<typename T>
T Arcane::Vector2< T >::x = {}

Definition at line 45 of file Vector2.h.

◆ y

template<typename T>
T Arcane::Vector2< T >::y = {}

Definition at line 46 of file Vector2.h.


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