Class managing a 2-dimensional real vector. More...
#include <arccore/base/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.
Definition at line 121 of file arccore/src/base/arccore/base/Real2.h.
|
inlineconstexpr |
Constructs the zero vector.
Definition at line 127 of file arccore/src/base/arccore/base/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(), reset(), sub(), and subSame().
Constructs the pair (ax,ay).
Definition at line 134 of file arccore/src/base/arccore/base/Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineexplicitconstexpr |
Constructs a copy identical to f.
Definition at line 143 of file arccore/src/base/arccore/base/Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineexplicitconstexpr |
Constructs the instance with the triplet (v,v,v).
Definition at line 151 of file arccore/src/base/arccore/base/Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inlineexplicitconstexpr |
Constructs the instance using the first two components of Real3.
Definition at line 487 of file arccore/src/base/arccore/base/Real3.h.
References Arcane::Real2POD::x, Arcane::Real3POD::x, Arcane::Real2POD::y, and Arcane::Real3POD::y.
|
inlineconstexpr |
Constructs the pair (av[0], av[1]).
Definition at line 161 of file arccore/src/base/arccore/base/Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inline |
Returns the norm of the pair $ \(\sqrt{x^2+y^2+z^2}$\).
Definition at line 105 of file MathReal2.h.
|
inline |
Returns the squared norm of the pair $ \(x^2+y^2+z^2$\).
Definition at line 421 of file arccore/src/base/arccore/base/Real2.h.
References abs2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by abs2().
|
inline |
Absolute value component by component.
Definition at line 222 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Adds b to the pair.
Definition at line 240 of file arccore/src/base/arccore/base/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 272 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Assigns the triplet (ax,ay,az) to the instance.
Definition at line 194 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by operator>>.
Copies the pair f.
Definition at line 202 of file arccore/src/base/arccore/base/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 27 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 216 of file arccore/src/base/arccore/base/Real2.h.
References Arcane::Real2POD::x.
|
inlineconstexpr |
Returns a copy of the pair.
Definition at line 184 of file arccore/src/base/arccore/base/Real2.h.
References Real2().
Divides each component of the pair by the corresponding component of b.
Definition at line 264 of file arccore/src/base/arccore/base/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 296 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Referenced by Arcane::math::mutableNormalize().
|
inlineconstexpr |
Indicates if the instance is close to the zero instance.
| true | if math::isNearlyZero() is true for every component. |
| false | otherwise. |
Definition at line 87 of file MathReal2.h.
Multiplies each component of the pair by the corresponding component of b.
Definition at line 256 of file arccore/src/base/arccore/base/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 288 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
inline |
Normalizes the pair.
If the pair is non-zero, divides each component by the norm of the pair (abs()), such that after calling this method, abs() equals 1. If the pair is zero, does nothing.
Definition at line 99 of file MathReal2.h.
References Arcane::math::mutableNormalize(), and Real2().
|
inline |
Returns the norm of the pair $ \(\sqrt{x^2+y^2+z^2}$\).
Definition at line 93 of file MathReal2.h.
|
inlinestaticconstexpr |
Definition at line 179 of file arccore/src/base/arccore/base/Real2.h.
|
inlineconstexpr |
Compares two pairs. For the concept of equality, see operator==().
| true | if the two pairs are different, |
| false | otherwise. |
Definition at line 411 of file arccore/src/base/arccore/base/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 342 of file arccore/src/base/arccore/base/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 313 of file arccore/src/base/arccore/base/Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
Multiplies each component of the pair by the corresponding component of b.
Definition at line 310 of file arccore/src/base/arccore/base/Real2.h.
Creates a pair that equals this pair added to b.
Definition at line 330 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Adds b to the pair.
Definition at line 304 of file arccore/src/base/arccore/base/Real2.h.
|
inlineconstexpr |
Creates a pair opposite to the current pair.
Definition at line 336 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Creates a pair that equals b subtracted from this pair.
Definition at line 333 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Subtracts b from the pair.
Definition at line 307 of file arccore/src/base/arccore/base/Real2.h.
Creates a pair that equals this pair, where each component has been divided by the corresponding component of b.
Definition at line 348 of file arccore/src/base/arccore/base/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 323 of file arccore/src/base/arccore/base/Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
Divides each component of the pair by the corresponding component of b.
Definition at line 320 of file arccore/src/base/arccore/base/Real2.h.
Assigns the pair (v,v) to the instance.
Definition at line 171 of file arccore/src/base/arccore/base/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 400 of file arccore/src/base/arccore/base/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 37 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 47 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 187 of file arccore/src/base/arccore/base/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 417 of file arccore/src/base/arccore/base/Real2.h.
References Arcane::Real2POD::x, and Arcane::Real2POD::y.
Subtracts b from the pair.
Definition at line 248 of file arccore/src/base/arccore/base/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 280 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Returns a view of the two elements of the vector.
Definition at line 210 of file arccore/src/base/arccore/base/Real2.h.
References Arcane::Real2POD::x.
Multiplication by a scalar.
Definition at line 351 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Multiplication by a scalar.
Definition at line 357 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
Division by a scalar.
Definition at line 363 of file arccore/src/base/arccore/base/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 374 of file arccore/src/base/arccore/base/Real2.h.
References Real2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.
|
friend |
Writes the pair t to the stream o.
Definition at line 383 of file arccore/src/base/arccore/base/Real2.h.
|
friend |
Reads the pair t from the stream o.
Definition at line 389 of file arccore/src/base/arccore/base/Real2.h.