Class managing a 2-dimensional real vector. More...
#include <arcane/utils/Real2.h>
Public Member Functions | |
| constexpr __host__ __device__ | Real2 () |
| Constructs the zero vector. | |
| constexpr __host__ __device__ | Real2 (Real ax, Real ay) |
| Constructs the pair (ax,ay). | |
| Real2 (const Real2 &f)=default | |
| Constructs a copy identical to f. | |
| constexpr __host__ __device__ | Real2 (const Real2POD &f) |
| Constructs a copy identical to f. | |
| constexpr __host__ __device__ | Real2 (Real v) |
| Constructs the instance with the triplet (v,v,v). | |
| constexpr __host__ __device__ | Real2 (const Real3 &v) |
| Constructs the instance using the first two components of Real3. | |
| constexpr __host__ __device__ | Real2 (ConstArrayView< Real > av) |
| Constructs the pair (av[0], av[1]). | |
| Real2 & | operator= (const Real2 &f)=default |
| constexpr __host__ __device__ Real2 & | operator= (Real v) |
| Assigns the pair (v,v) to the instance. | |
| constexpr __host__ __device__ Real2 | copy () const |
| Returns a copy of the pair. | |
| constexpr __host__ __device__ Real2 & | reset () |
| Resets the pair using default constructors. | |
| constexpr __host__ __device__ Real2 & | assign (Real ax, Real ay) |
| Assigns the triplet (ax,ay,az) to the instance. | |
| constexpr __host__ __device__ Real2 & | assign (Real2 f) |
| Copies the pair f. | |
| constexpr __host__ __device__ ArrayView< Real > | view () |
| Returns a view of the two elements of the vector. | |
| constexpr __host__ __device__ ConstArrayView< Real > | constView () const |
| Returns a constant view of the two elements of the vector. | |
| __host__ __device__ Real2 | absolute () const |
| Absolute value component by component. | |
| std::istream & | assign (std::istream &i) |
| Reads a pair from stream i The pair is read in the form of three values of type #value_type. | |
| std::ostream & | print (std::ostream &o) const |
| Writes the pair to stream o readable by an assign(). | |
| std::ostream & | printXy (std::ostream &o) const |
| Writes the pair to stream o in the form (x,y). | |
| constexpr __host__ __device__ Real2 & | add (Real2 b) |
| Adds b to the pair. | |
| constexpr __host__ __device__ Real2 & | sub (Real2 b) |
| Subtracts b from the pair. | |
| constexpr __host__ __device__ Real2 & | mul (Real2 b) |
| Multiplies each component of the pair by the corresponding component of b. | |
| constexpr __host__ __device__ Real2 & | div (Real2 b) |
| Divides each component of the pair by the corresponding component of b. | |
| constexpr __host__ __device__ Real2 & | addSame (Real b) |
| Adds b to each component of the pair. | |
| constexpr __host__ __device__ Real2 & | subSame (Real b) |
| Subtracts b from each component of the pair. | |
| constexpr __host__ __device__ Real2 & | mulSame (Real b) |
| Multiplies each component of the pair by b. | |
| constexpr __host__ __device__ Real2 & | divSame (Real b) |
| Divides each component of the pair by b. | |
| constexpr __host__ __device__ Real2 & | operator+= (Real2 b) |
| Adds b to the pair. | |
| constexpr __host__ __device__ Real2 & | operator-= (Real2 b) |
| Subtracts b from the pair. | |
| constexpr __host__ __device__ Real2 & | operator*= (Real2 b) |
| Multiplies each component of the pair by the corresponding component of b. | |
| constexpr __host__ __device__ void | operator*= (Real b) |
| Multiplies each component of the pair by the real number b. | |
| constexpr __host__ __device__ Real2 & | operator/= (Real2 b) |
| Divides each component of the pair by the corresponding component of b. | |
| constexpr __host__ __device__ void | operator/= (Real b) |
| Divides each component of the pair by the real number b. | |
| constexpr __host__ __device__ Real2 | operator+ (Real2 b) const |
| Creates a pair that equals this pair added to b. | |
| constexpr __host__ __device__ Real2 | operator- (Real2 b) const |
| Creates a pair that equals b subtracted from this pair. | |
| constexpr __host__ __device__ Real2 | operator- () const |
| Creates a pair opposite to the current pair. | |
| constexpr __host__ __device__ Real2 | operator* (Real2 b) const |
| Creates a pair that equals this pair, where each component has been multiplied by the corresponding component of b. | |
| constexpr __host__ __device__ Real2 | operator/ (Real2 b) const |
| Creates a pair that equals this pair, where each component has been divided by the corresponding component of b. | |
| constexpr __host__ __device__ bool | operator== (Real2 b) const |
| Compares the current instance component by component to b. | |
| constexpr __host__ __device__ bool | operator!= (Real2 b) const |
| Compares two pairs. For the concept of equality, see operator==(). | |
| constexpr __host__ __device__ Real | squareNormL2 () const |
| Returns the squared norm of the pair $ \(x^2+y^2+z^2$\). | |
| __host__ __device__ Real | abs2 () const |
| Returns the squared norm of the pair $ \(x^2+y^2+z^2$\). | |
| __host__ __device__ Real | abs () const |
| Returns the norm of the pair $ \(\sqrt{x^2+y^2+z^2}$\). | |
| constexpr __host__ __device__ bool | isNearlyZero () const |
| Indicates if the instance is close to the zero instance. | |
| __host__ __device__ Real | normL2 () const |
| Returns the norm of the pair $ \(\sqrt{x^2+y^2+z^2}$\). | |
| Real2 & | normalize () |
| Normalizes the pair. | |
| Public Member Functions inherited from Arcane::Real2POD | |
| __host__ __device__ Real | operator[] (Integer i) const |
| __host__ __device__ Real | operator() (Integer i) const |
| __host__ __device__ Real & | operator[] (Integer i) |
| __host__ __device__ Real & | operator() (Integer i) |
| __host__ __device__ void | setComponent (Integer i, Real value) |
| Positions the i th component at value. | |
Static Public Member Functions | |
| constexpr __host__ static __device__ Real2 | null () |
Friends | |
| constexpr __host__ __device__ Real2 | operator* (Real sca, Real2 vec) |
| Multiplication by a scalar. | |
| constexpr __host__ __device__ Real2 | operator* (Real2 vec, Real sca) |
| Multiplication by a scalar. | |
| constexpr __host__ __device__ Real2 | operator/ (Real2 vec, Real sca) |
| Division by a scalar. | |
| constexpr __host__ __device__ bool | operator< (Real2 v1, Real2 v2) |
| Comparison operator. | |
| std::ostream & | operator<< (std::ostream &o, Real2 t) |
| Writes the pair t to the stream o. | |
| std::istream & | operator>> (std::istream &i, Real2 &t) |
| Reads the pair t from the stream o. | |
Additional Inherited Members | |
| Public Attributes inherited from Arcane::Real2POD | |
| Real | x |
| first component of the pair | |
| Real | y |
| second component of the pair | |
Class managing a 2-dimensional real vector.
The vector includes two components x and y which are of type Real.
|
inlineconstexpr |
Constructs the zero vector.
Definition at line 126 of file Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by absolute(), add(), addSame(), assign(), assign(), copy(), div(), divSame(), mul(), mulSame(), normalize(), operator!=(), operator*, operator*(), operator*, operator*=(), operator+(), operator+=(), operator-(), operator-(), operator-=(), operator/(), operator/, operator/=(), operator<, operator<<, operator=(), operator==(), operator>>, Real2(), Real2(), reset(), sub(), and subSame().
Constructs the pair (ax,ay).
Definition at line 133 of file Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineexplicitconstexpr |
Constructs a copy identical to f.
Definition at line 142 of file Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineexplicitconstexpr |
Constructs the instance with the triplet (v,v,v).
Definition at line 150 of file Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineexplicitconstexpr |
Constructs the instance using the first two components of Real3.
Definition at line 491 of file Real3.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineconstexpr |
Constructs the pair (av[0], av[1]).
Definition at line 160 of file Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inline |
|
inline |
Returns the squared norm of the pair $ \(x^2+y^2+z^2$\).
Definition at line 417 of file Real2.h.
References abs2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by abs2().
|
inline |
Absolute value component by component.
Definition at line 221 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Adds b to the pair.
Definition at line 236 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by operator+=().
Adds b to each component of the pair.
Definition at line 268 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Assigns the triplet (ax,ay,az) to the instance.
Definition at line 193 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by operator>>.
Copies the pair f.
Definition at line 201 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
| std::istream & Arcane::Real2::assign | ( | std::istream & | i | ) |
Reads a pair from stream i The pair is read in the form of three values of type #value_type.
Definition at line 26 of file Real2.cc.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineconstexpr |
Returns a constant view of the two elements of the vector.
Definition at line 215 of file Real2.h.
References Arcane::Real2POD::x.
|
inlineconstexpr |
Divides each component of the pair by the corresponding component of b.
Definition at line 260 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by operator/=().
Divides each component of the pair by b.
Definition at line 292 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by Arcane::math::mutableNormalize().
|
inlineconstexpr |
Multiplies each component of the pair by the corresponding component of b.
Definition at line 252 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by operator*=().
Multiplies each component of the pair by b.
Definition at line 284 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inline |
|
inline |
|
inlinestaticconstexpr |
|
inlineconstexpr |
Compares two pairs. For the concept of equality, see operator==().
| true | if the two pairs are different, |
| false | otherwise. |
Definition at line 407 of file Real2.h.
References operator==(), and Real2().
Creates a pair that equals this pair, where each component has been multiplied by the corresponding component of b.
Definition at line 338 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineconstexpr |
Multiplies each component of the pair by the real number b.
Definition at line 309 of file Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
Creates a pair that equals this pair added to b.
Definition at line 326 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineconstexpr |
Creates a pair opposite to the current pair.
Definition at line 332 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Creates a pair that equals b subtracted from this pair.
Definition at line 329 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Creates a pair that equals this pair, where each component has been divided by the corresponding component of b.
Definition at line 344 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineconstexpr |
Divides each component of the pair by the real number b.
Definition at line 319 of file Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
Assigns the pair (v,v) to the instance.
Definition at line 170 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineconstexpr |
Compares the current instance component by component to b.
| true | if this.x==b.x and this.y==b.y. |
| false | otherwise. |
Definition at line 396 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by operator!=().
| std::ostream & Arcane::Real2::print | ( | std::ostream & | o | ) | const |
Writes the pair to stream o readable by an assign().
Definition at line 36 of file Real2.cc.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
| std::ostream & Arcane::Real2::printXy | ( | std::ostream & | o | ) | const |
Writes the pair to stream o in the form (x,y).
Definition at line 46 of file Real2.cc.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by operator<<.
|
inlineconstexpr |
Resets the pair using default constructors.
Definition at line 186 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineconstexpr |
Returns the squared norm of the pair $ \(x^2+y^2+z^2$\).
Definition at line 413 of file Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
Subtracts b from the pair.
Definition at line 244 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by operator-=().
Subtracts b from each component of the pair.
Definition at line 276 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Returns a view of the two elements of the vector.
Definition at line 209 of file Real2.h.
References Arcane::Real2POD::x.
Multiplication by a scalar.
Definition at line 347 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Multiplication by a scalar.
Definition at line 353 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Division by a scalar.
Definition at line 359 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Comparison operator.
This operator allows Real2 objects to be sorted for use, for example, in std::set
Definition at line 370 of file Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
friend |
|
friend |