12#ifndef ARCANE_UTILS_VECTOR3_H
13#define ARCANE_UTILS_VECTOR3_H
52 constexpr ARCCORE_HOST_DEVICE
56 constexpr ARCCORE_HOST_DEVICE
Vector3(
const T& ax,
const T& ay,
const T& az)
64 constexpr ARCCORE_HOST_DEVICE
explicit Vector3(
const T& v)
72 constexpr explicit Vector3(
const std::array<T, 3>& v)
80 constexpr Vector3(std::initializer_list<T> v)
94 friend constexpr ARCCORE_HOST_DEVICE
bool
103 return (v1.x < v2.x);
113 friend constexpr ARCCORE_HOST_DEVICE
bool
116 return v1.x == v2.x && v1.y == v2.y && v1.z == v2.z;
119 friend constexpr ARCCORE_HOST_DEVICE
bool
136 constexpr ARCCORE_HOST_DEVICE
void operator+=(
const ThatClass& b)
152 constexpr ARCCORE_HOST_DEVICE
void operator-=(
const ThatClass& b)
176 friend constexpr ARCCORE_HOST_DEVICE ThatClass
operator+(
const ThatClass& a,
const ThatClass& b)
178 return ThatClass(a.x + b.x, a.y + b.y, a.z + b.z);
182 friend constexpr ARCCORE_HOST_DEVICE ThatClass
operator+(
const ThatClass& a,
const T& b)
184 return ThatClass(a.x + b, a.y + b, a.z + b);
188 friend constexpr ARCCORE_HOST_DEVICE ThatClass
operator+(
const T& a,
const ThatClass& b)
190 return ThatClass(a + b.x, a + b.y, a + b.z);
194 friend constexpr ARCCORE_HOST_DEVICE ThatClass
operator-(
const ThatClass& a,
const ThatClass& b)
196 return ThatClass(a.x - b.x, a.y - b.y, a.z - b.z);
200 friend constexpr ARCCORE_HOST_DEVICE ThatClass
operator-(
const ThatClass& a,
const T& b)
202 return ThatClass(a.x - b, a.y - b, a.z - b);
206 constexpr ARCCORE_HOST_DEVICE ThatClass
operator-()
const {
return ThatClass(-x, -y, -z); }
210 friend constexpr ARCCORE_HOST_DEVICE ThatClass
operator*(
const T& a,
const ThatClass& b)
212 return ThatClass(b.x * a, b.y * a, b.z * a);
216 friend constexpr ARCCORE_HOST_DEVICE ThatClass
operator*(
const ThatClass& a,
const T& b)
218 return ThatClass(a.x * b, a.y * b, a.z * b);
222 friend constexpr ARCCORE_HOST_DEVICE ThatClass
operator/(
const ThatClass& a,
const T& b)
224 return ThatClass(a.x / b, a.y / b, a.z / b);
229 void _print(std::ostream& o)
const
231 o <<
'{' << x <<
',' << y <<
',' << z <<
'}';
233 constexpr void _setFromList(std::initializer_list<T> v)
236 auto ptr = v.begin();
Declarations of types used in Arcane.
Class managing a 3-dimensional vector of type T.
constexpr __host__ __device__ void operator-=(const T &b)
Subtracts b from the instance.
friend std::ostream & operator<<(std::ostream &o, const Vector3< T > &t)
Writes the triplet t to the stream o.
constexpr Vector3(std::initializer_list< T > v)
Constructs the instance with the list v.
friend constexpr __host__ __device__ ThatClass operator/(const ThatClass &a, const T &b)
Divides each component of a by b.
friend constexpr __host__ __device__ ThatClass operator*(const T &a, const ThatClass &b)
Multiplies each component of b by a.
constexpr __host__ __device__ void operator/=(const T &b)
Divides each component of the instance by b.
constexpr __host__ __device__ void operator*=(const T &b)
Multiplies each component of the instance by b.
constexpr __host__ __device__ Vector3(const T &ax, const T &ay, const T &az)
Constructs the triplet (ax,ay,az).
constexpr Vector3(const std::array< T, 3 > &v)
Constructs the instance with the array v.
friend 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
Returns the opposite of the instance.
friend constexpr __host__ __device__ ThatClass operator+(const T &a, const ThatClass &b)
Returns b by adding a to each component.
constexpr __host__ __device__ void operator-=(const ThatClass &b)
Subtracts b from the instance.
constexpr Vector3 & operator=(std::initializer_list< T > v)
Positions the instance with the list v.
friend constexpr __host__ __device__ ThatClass operator*(const ThatClass &a, const T &b)
Multiplies each component of a by b.
friend constexpr __host__ __device__ ThatClass operator+(const ThatClass &a, const T &b)
Returns a by adding b to each component.
constexpr __host__ __device__ void operator+=(const ThatClass &b)
Adds b to the instance.
constexpr __host__ __device__ void operator+=(const T &b)
Adds b to the instance.
constexpr __host__ __device__ Vector3()=default
Constructs the zero vector.
constexpr __host__ __device__ Vector3(const T &v)
Constructs the instance with the triplet (v,v,v).
friend constexpr __host__ __device__ ThatClass operator-(const ThatClass &a, const T &b)
Subtracts each component of a by b.
friend constexpr __host__ __device__ ThatClass operator+(const ThatClass &a, const ThatClass &b)
Sums component by component of a and b.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
bool operator<(const Item &item1, const Item &item2)
Compare two entities.