Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::Real3 Class Reference

Class managing a 3-dimensional real vector. More...

#include <arcane/utils/Real3.h>

Public Member Functions

constexpr __host__ __device__ Real3 ()
 Constructs the zero vector.
constexpr __host__ __device__ Real3 (Real ax, Real ay, Real az)
 Constructs the triplet (ax,ay,az).
 Real3 (const Real3 &f)=default
 Constructs a triplet identical to f.
constexpr __host__ __device__ Real3 (const Real3POD &f)
 Constructs a triplet identical to f.
constexpr __host__ __device__ Real3 (Real v)
 Constructs the instance with the triplet (v,v,v).
constexpr __host__ __device__ Real3 (const Real2 &f)
 Constructs a triplet identical to f.
constexpr __host__ __device__ Real3 (ConstArrayView< Real > av)
 Constructs the triplet (av[0], av[1], av[2]).
Real3operator= (const Real3 &f)=default
 Copy assignment operator.
constexpr __host__ __device__ Real3operator= (Real v)
 Assigns the triplet (v,v,v) to the instance.
constexpr __host__ __device__ Real3 copy () const
 Returns a copy of the triplet.
constexpr __host__ __device__ Real3reset ()
 Resets the triplet using default constructors.
constexpr __host__ __device__ Real3assign (Real ax, Real ay, Real az)
 Assigns the triplet (ax,ay,az) to the instance.
constexpr __host__ __device__ Real3assign (Real3 f)
 Copies the triplet f.
constexpr __host__ __device__ ArrayView< Realview ()
 Returns a view of the three elements of the vector.
constexpr __host__ __device__ ConstArrayView< RealconstView () const
 Returns a constant view of the three elements of the vector.
__host__ __device__ Real3 absolute () const
 Absolute value component by component.
std::istream & assign (std::istream &i)
 Reads a triplet from the stream i The triplet is read in the form of three values of type #value_type.
std::ostream & print (std::ostream &o) const
 Writes the triplet to the stream o readable by an assign().
std::ostream & printXyz (std::ostream &o) const
 Writes the triplet to the stream o in the form (x,y,z).
constexpr __host__ __device__ Real3add (Real3 b)
 Adds b to the triplet.
constexpr __host__ __device__ Real3sub (Real3 b)
 Subtracts b from the triplet.
constexpr __host__ __device__ Real3mul (Real3 b)
 Multiplies each component of the triplet by the corresponding component of b.
constexpr __host__ __device__ Real3div (Real3 b)
 Divides each component of the triplet by the corresponding component of b.
constexpr __host__ __device__ Real3addSame (Real b)
 Adds b to each component of the triplet.
constexpr __host__ __device__ Real3subSame (Real b)
 Subtracts b from each component of the triplet.
constexpr __host__ __device__ Real3mulSame (Real b)
 Multiplies each component of the triplet by b.
constexpr __host__ __device__ Real3divSame (Real b)
 Divides each component of the triplet by b.
constexpr __host__ __device__ Real3operator+= (Real3 b)
 Adds b to the triplet.
constexpr __host__ __device__ Real3operator-= (Real3 b)
 Subtracts b from the triplet.
constexpr __host__ __device__ Real3operator*= (Real3 b)
 Multiplies each component of the triplet by the corresponding component of b.
constexpr __host__ __device__ void operator*= (Real b)
 Multiplies each component of the triplet by the real number b.
constexpr __host__ __device__ Real3operator/= (Real3 b)
 Divides each component of the triplet by the corresponding component of b.
constexpr __host__ __device__ void operator/= (Real b)
 Divides each component of the triplet by the real number b.
constexpr __host__ __device__ Real3 operator+ (Real3 b) const
 Creates a triplet that equals this triplet added to b.
constexpr __host__ __device__ Real3 operator- (Real3 b) const
 Creates a triplet that equals b subtracted from this triplet.
constexpr __host__ __device__ Real3 operator- () const
 Creates a triplet opposite to the current triplet.
constexpr __host__ __device__ Real3 operator* (Real3 b) const
 Creates a triplet that equals this triplet whose each component has been multiplied by the corresponding component of b.
constexpr __host__ __device__ Real3 operator/ (Real3 b) const
 Creates a triplet that equals this triplet whose each component has been divided by the corresponding component of b.
constexpr __host__ __device__ bool operator== (Real3 b) const
 Compares the current instance component by component to b.
constexpr __host__ __device__ bool operator!= (Real3 b) const
 Compares two triplets. For the notion of equality, see operator==().
constexpr __host__ __device__ Real squareNormL2 () const
 Returns the square of the L2 norm of the triplet $ \(x^2+y^2+z^2$\).
__host__ __device__ Real normL2 () const
 Returns the L2 norm of the triplet $ \(\sqrt{x^2+y^2+z^2}\).
constexpr __host__ __device__ Real abs2 () const
 Returns the square of the norm of the triplet $ \(x^2+y^2+z^2\).
__host__ __device__ Real abs () const
 Returns the norm of the triplet $ \(\sqrt{x^2+y^2+z^2}\).
constexpr __host__ __device__ bool isNearlyZero () const
Real3normalize ()
Public Member Functions inherited from Arcane::Real3POD
__host__ __device__ Real operator[] (Integer i) const
__host__ __device__ Real operator() (Integer i) const
__host__ __device__ Realoperator[] (Integer i)
__host__ __device__ Realoperator() (Integer i)
__host__ __device__ void setComponent (Integer i, Real value)
 Sets the i-th component to value.

Static Public Member Functions

constexpr __host__ static __device__ Real3 null ()
constexpr __host__ static __device__ Real3 zero ()

Friends

constexpr __host__ __device__ Real3 operator* (Real sca, Real3 vec)
 Multiplication by a scalar.
constexpr __host__ __device__ Real3 operator* (Real3 vec, Real sca)
 Multiplication by a scalar.
constexpr __host__ __device__ Real3 operator/ (Real3 vec, Real sca)
 Division by a scalar.
constexpr __host__ __device__ bool operator< (Real3 v1, Real3 v2)
 Comparison operator.
std::ostream & operator<< (std::ostream &o, Real3 t)
 Writes the triplet t to the stream o.
std::istream & operator>> (std::istream &i, Real3 &t)
 Reads the triplet t from the stream o.

(Note that these are not member symbols.)

template<typename Type>
std::istream & operator>> (std::istream &i, BuiltInProxy< Type > &t)
 Reads the triplet t from the stream o.
std::ostream & operator<< (std::ostream &o, Real3Proxy t)
 Writes the triplet t to the stream o.
std::istream & operator>> (std::istream &i, Real3Proxy &t)
 Reads the triplet t from the stream o.
std::ostream & operator<< (std::ostream &o, Real3x3Proxy t)
 Writes the triplet t to the stream o.
std::istream & operator>> (std::istream &i, Real3x3Proxy &t)
 Reads the triplet t from the stream o.

Additional Inherited Members

Public Attributes inherited from Arcane::Real3POD
Real x
 first component of the triplet
Real y
 second component of the triplet
Real z
 third component of the triplet

Detailed Description

Class managing a 3-dimensional real vector.

Le vector includes three components x, y, and z, which are of type Real.

Real3 value (1.0,2.3,4.5); // Created a triplet (x=1.0, y=2.3, z=4.5)
cout << value.x; // Prints component x
value.y += 3.2; // Adds 3.2 to component \b y
constexpr __host__ __device__ Real3()
Constructs the zero vector.
Definition Real3.h:136

or equivalently

Real3 value (1.0,2.3,4.5); // Created a triplet (x=1.0, y=2.3, z=4.5)
cout << value[0]; // Prints component x
value[1] += 3.2; // Adds 3.2 to component \b y

Definition at line 130 of file Real3.h.

Constructor & Destructor Documentation

◆ Real3() [1/6]

◆ Real3() [2/6]

__host__ __device__ Arcane::Real3::Real3 ( Real ax,
Real ay,
Real az )
inlineconstexpr

Constructs the triplet (ax,ay,az).

Definition at line 145 of file Real3.h.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ Real3() [3/6]

__host__ __device__ Arcane::Real3::Real3 ( const Real3POD & f)
inlineexplicitconstexpr

Constructs a triplet identical to f.

Definition at line 157 of file Real3.h.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ Real3() [4/6]

__host__ __device__ Arcane::Real3::Real3 ( Real v)
inlineexplicitconstexpr

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

Definition at line 166 of file Real3.h.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ Real3() [5/6]

__host__ __device__ Arcane::Real3::Real3 ( const Real2 & f)
inlineexplicitconstexpr

Constructs a triplet identical to f.

Definition at line 173 of file Real3.h.

References Arcane::Real2POD::x, Arcane::Real3POD::x, Arcane::Real2POD::y, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ Real3() [6/6]

__host__ __device__ Arcane::Real3::Real3 ( ConstArrayView< Real > av)
inlineconstexpr

Constructs the triplet (av[0], av[1], av[2]).

Definition at line 182 of file Real3.h.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

Member Function Documentation

◆ abs()

__host__ __device__ Real Arcane::Real3::abs ( ) const
inline

Returns the norm of the triplet $ \(\sqrt{x^2+y^2+z^2}\).

Definition at line 590 of file Real3.h.

Referenced by MicroHydroModule::computeGeometricValues().

◆ abs2()

__host__ __device__ Real Arcane::Real3::abs2 ( ) const
inlineconstexpr

Returns the square of the norm of the triplet $ \(x^2+y^2+z^2\).

Definition at line 463 of file Real3.h.

References abs2(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

Referenced by abs2().

◆ absolute()

__host__ __device__ Real3 Arcane::Real3::absolute ( ) const
inline

Absolute value component by component.

Definition at line 248 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ add()

__host__ __device__ Real3 & Arcane::Real3::add ( Real3 b)
inlineconstexpr

Adds b to the triplet.

Definition at line 263 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

Referenced by operator+=().

◆ addSame()

__host__ __device__ Real3 & Arcane::Real3::addSame ( Real b)
inlineconstexpr

Adds b to each component of the triplet.

Definition at line 299 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ assign() [1/3]

__host__ __device__ Real3 & Arcane::Real3::assign ( Real ax,
Real ay,
Real az )
inlineconstexpr

Assigns the triplet (ax,ay,az) to the instance.

Definition at line 218 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

Referenced by operator>>.

◆ assign() [2/3]

__host__ __device__ Real3 & Arcane::Real3::assign ( Real3 f)
inlineconstexpr

Copies the triplet f.

Definition at line 227 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ assign() [3/3]

std::istream & Arcane::Real3::assign ( std::istream & i)

Reads a triplet from the stream i The triplet is read in the form of three values of type #value_type.

Definition at line 28 of file Real3.cc.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ constView()

__host__ __device__ ConstArrayView< Real > Arcane::Real3::constView ( ) const
inlineconstexpr

Returns a constant view of the three elements of the vector.

Definition at line 242 of file Real3.h.

References Arcane::Real3POD::x.

◆ copy()

__host__ __device__ Real3 Arcane::Real3::copy ( ) const
inlineconstexpr

Returns a copy of the triplet.

Definition at line 208 of file Real3.h.

References Real3().

◆ div()

__host__ __device__ Real3 & Arcane::Real3::div ( Real3 b)
inlineconstexpr

Divides each component of the triplet by the corresponding component of b.

Definition at line 290 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

Referenced by operator/=().

◆ divSame()

__host__ __device__ Real3 & Arcane::Real3::divSame ( Real b)
inlineconstexpr

Divides each component of the triplet by b.

Definition at line 326 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

Referenced by Arcane::math::mutableNormalize().

◆ isNearlyZero()

__host__ __device__ bool Arcane::Real3::isNearlyZero ( ) const
inlineconstexpr

Definition at line 566 of file Real3.h.

◆ mul()

__host__ __device__ Real3 & Arcane::Real3::mul ( Real3 b)
inlineconstexpr

Multiplies each component of the triplet by the corresponding component of b.

Definition at line 281 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

Referenced by operator*=().

◆ mulSame()

__host__ __device__ Real3 & Arcane::Real3::mulSame ( Real b)
inlineconstexpr

Multiplies each component of the triplet by b.

Definition at line 317 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ normalize()

Real3 & Arcane::Real3::normalize ( )
inline

Definition at line 560 of file Real3.h.

◆ normL2()

__host__ __device__ Real Arcane::Real3::normL2 ( ) const
inline

Returns the L2 norm of the triplet $ \(\sqrt{x^2+y^2+z^2}\).

Definition at line 584 of file Real3.h.

Referenced by Arcane::math::axisSymmetric(), and Arcane::math::planarSymmetric().

◆ null()

__host__ static __device__ Real3 Arcane::Real3::null ( )
inlinestaticconstexpr

Definition at line 202 of file Real3.h.

◆ operator!=()

__host__ __device__ bool Arcane::Real3::operator!= ( Real3 b) const
inlineconstexpr

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

Return values
trueif the two triplets are different,
falseotherwise.

Definition at line 449 of file Real3.h.

References operator==(), and Real3().

◆ operator*()

__host__ __device__ Real3 Arcane::Real3::operator* ( Real3 b) const
inlineconstexpr

Creates a triplet that equals this triplet whose each component has been multiplied by the corresponding component of b.

Definition at line 375 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator*=() [1/2]

__host__ __device__ void Arcane::Real3::operator*= ( Real b)
inlineconstexpr

Multiplies each component of the triplet by the real number b.

Definition at line 344 of file Real3.h.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator*=() [2/2]

__host__ __device__ Real3 & Arcane::Real3::operator*= ( Real3 b)
inlineconstexpr

Multiplies each component of the triplet by the corresponding component of b.

Definition at line 341 of file Real3.h.

References mul(), and Real3().

◆ operator+()

__host__ __device__ Real3 Arcane::Real3::operator+ ( Real3 b) const
inlineconstexpr

Creates a triplet that equals this triplet added to b.

Definition at line 363 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator+=()

__host__ __device__ Real3 & Arcane::Real3::operator+= ( Real3 b)
inlineconstexpr

Adds b to the triplet.

Definition at line 335 of file Real3.h.

References add(), and Real3().

◆ operator-() [1/2]

__host__ __device__ Real3 Arcane::Real3::operator- ( ) const
inlineconstexpr

Creates a triplet opposite to the current triplet.

Definition at line 369 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator-() [2/2]

__host__ __device__ Real3 Arcane::Real3::operator- ( Real3 b) const
inlineconstexpr

Creates a triplet that equals b subtracted from this triplet.

Definition at line 366 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator-=()

__host__ __device__ Real3 & Arcane::Real3::operator-= ( Real3 b)
inlineconstexpr

Subtracts b from the triplet.

Definition at line 338 of file Real3.h.

References Real3(), and sub().

◆ operator/()

__host__ __device__ Real3 Arcane::Real3::operator/ ( Real3 b) const
inlineconstexpr

Creates a triplet that equals this triplet whose each component has been divided by the corresponding component of b.

Definition at line 381 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator/=() [1/2]

__host__ __device__ void Arcane::Real3::operator/= ( Real b)
inlineconstexpr

Divides each component of the triplet by the real number b.

Definition at line 355 of file Real3.h.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator/=() [2/2]

__host__ __device__ Real3 & Arcane::Real3::operator/= ( Real3 b)
inlineconstexpr

Divides each component of the triplet by the corresponding component of b.

Definition at line 352 of file Real3.h.

References div(), and Real3().

◆ operator=()

__host__ __device__ Real3 & Arcane::Real3::operator= ( Real v)
inlineconstexpr

Assigns the triplet (v,v,v) to the instance.

Definition at line 194 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator==()

__host__ __device__ bool Arcane::Real3::operator== ( Real3 b) const
inlineconstexpr

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 438 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

Referenced by operator!=().

◆ print()

std::ostream & Arcane::Real3::print ( std::ostream & o) const

Writes the triplet to the stream o readable by an assign().

Definition at line 38 of file Real3.cc.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ printXyz()

std::ostream & Arcane::Real3::printXyz ( std::ostream & o) const

Writes the triplet to the stream o in the form (x,y,z).

Definition at line 48 of file Real3.cc.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

Referenced by operator<<.

◆ reset()

__host__ __device__ Real3 & Arcane::Real3::reset ( )
inlineconstexpr

Resets the triplet using default constructors.

Definition at line 211 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ squareNormL2()

__host__ __device__ Real Arcane::Real3::squareNormL2 ( ) const
inlineconstexpr

◆ sub()

__host__ __device__ Real3 & Arcane::Real3::sub ( Real3 b)
inlineconstexpr

Subtracts b from the triplet.

Definition at line 272 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

Referenced by operator-=().

◆ subSame()

__host__ __device__ Real3 & Arcane::Real3::subSame ( Real b)
inlineconstexpr

Subtracts b from each component of the triplet.

Definition at line 308 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ view()

__host__ __device__ ArrayView< Real > Arcane::Real3::view ( )
inlineconstexpr

Returns a view of the three elements of the vector.

Definition at line 236 of file Real3.h.

References Arcane::Real3POD::x.

◆ zero()

__host__ static __device__ Real3 Arcane::Real3::zero ( )
inlinestaticconstexpr

Definition at line 203 of file Real3.h.

◆ operator* [1/2]

__host__ __device__ Real3 operator* ( Real sca,
Real3 vec )
friend

Multiplication by a scalar.

Definition at line 384 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator* [2/2]

__host__ __device__ Real3 operator* ( Real3 vec,
Real sca )
friend

Multiplication by a scalar.

Definition at line 390 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator/

__host__ __device__ Real3 operator/ ( Real3 vec,
Real sca )
friend

Division by a scalar.

Definition at line 396 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator<

__host__ __device__ bool operator< ( Real3 v1,
Real3 v2 )
friend

Comparison operator.

This operator allows sorting Real3 for example in std::set

Definition at line 409 of file Real3.h.

References Real3(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ operator<< [1/3]

std::ostream & operator<< ( std::ostream & o,
Real3 t )
friend

Writes the triplet t to the stream o.

Definition at line 421 of file Real3.h.

References printXyz(), and Real3().

◆ operator<<() [2/3]

std::ostream & operator<< ( std::ostream & o,
Real3Proxy t )
related

Writes the triplet t to the stream o.

Definition at line 432 of file Real3Proxy.h.

References Arcane::Real3Proxy::printXyz().

◆ operator<<() [3/3]

std::ostream & operator<< ( std::ostream & o,
Real3x3Proxy t )
related

Writes the triplet t to the stream o.

Definition at line 272 of file Real3x3Proxy.h.

References Arcane::Real3x3Proxy::printXyz().

◆ operator>>() [1/4]

template<typename Type>
std::istream & operator>> ( std::istream & i,
BuiltInProxy< Type > & t )
related

Reads the triplet t from the stream o.

Definition at line 166 of file BuiltInProxy.h.

◆ operator>> [2/4]

std::istream & operator>> ( std::istream & i,
Real3 & t )
friend

Reads the triplet t from the stream o.

Definition at line 427 of file Real3.h.

References assign(), and Real3().

◆ operator>>() [3/4]

std::istream & operator>> ( std::istream & i,
Real3Proxy & t )
related

Reads the triplet t from the stream o.

Definition at line 443 of file Real3Proxy.h.

References Arcane::Real3Proxy::assign().

◆ operator>>() [4/4]

std::istream & operator>> ( std::istream & i,
Real3x3Proxy & t )
related

Reads the triplet t from the stream o.

Definition at line 283 of file Real3x3Proxy.h.

References Arcane::Real3x3Proxy::assign().


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