Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::Real2x2 Class Reference

Class managing a 2x2 matrix of reals. More...

#include <arcane/utils/Real2x2.h>

Collaboration diagram for Arcane::Real2x2:

Public Member Functions

constexpr __host__ __device__ Real2x2 ()
 Constructs the zero matrix.
constexpr __host__ __device__ Real2x2 (Real2 ax, Real2 ay)
 Constructs the pair (ax,ay).
ARCANE_DEPRECATED_116 Real2x2 (Real ax, Real ay, Real bx, Real by)
 Constructs the pair ((ax,bx),(ay,by)).
 Real2x2 (const Real2x2 &f)=default
 Constructs a copy identical to f.
constexpr __host__ __device__ Real2x2 (const Real2x2POD &f)
 Constructs a copy identical to f.
constexpr __host__ __device__ Real2x2 (Real v)
 Constructs the instance with the triplet (v,v,v).
constexpr __host__ __device__ Real2x2 (ConstArrayView< Real > av)
 Constructs the pair ((av[0], av[1]), (av[2], av[3])).
Real2x2operator= (const Real2x2 &f)=default
 Copy assignment operator.
constexpr __host__ __device__ Real2x2operator= (Real v)
 Assigns the pair (v,v,v) to the instance.
constexpr __host__ __device__ Real2x2 copy () const
 Returns a copy of the pair.
constexpr __host__ __device__ Real2x2reset ()
 Resets the pair with default constructors.
constexpr __host__ __device__ Real2x2assign (Real2 ax, Real2 ay)
 Assigns the pair (ax,ay) to the instance.
constexpr __host__ __device__ Real2x2assign (Real2x2 f)
 Copies the pair f.
constexpr __host__ __device__ ArrayView< Realview ()
constexpr __host__ __device__ ConstArrayView< RealconstView () const
std::istream & assign (std::istream &i)
 Reads the matrix from the stream i The matrix is read in the form of three Real2.
std::ostream & print (std::ostream &o) const
 Writes the pair to the stream o readable by an assign().
std::ostream & printXy (std::ostream &o) const
 Writes the pair to the stream o in the form (x,y,z).
constexpr __host__ __device__ Real2x2add (Real2x2 b)
 Adds b to the pair.
constexpr __host__ __device__ Real2x2sub (Real2x2 b)
 Subtracts b from the pair.
constexpr __host__ __device__ Real2x2div (Real2x2 b)
 Multiplies each component of the pair by the corresponding component of b.
constexpr __host__ __device__ Real2x2addSame (Real2 b)
 Adds b to each component of the pair.
constexpr __host__ __device__ Real2x2subSame (Real2 b)
 Subtracts b from each component of the pair.
constexpr __host__ __device__ Real2x2mulSame (Real2 b)
 Multiplies each component of the pair by b.
constexpr __host__ __device__ Real2x2divSame (Real2 b)
 Divides each component of the pair by b.
constexpr __host__ __device__ Real2x2operator+= (Real2x2 b)
 Adds b to the pair.
constexpr __host__ __device__ Real2x2operator-= (Real2x2 b)
 Subtracts b from the pair.
constexpr __host__ __device__ void operator*= (Real b)
 Multiplies 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 corresponding component of b.
constexpr __host__ __device__ Real2x2 operator+ (Real2x2 b) const
 Creates a pair that equals this pair added to b.
constexpr __host__ __device__ Real2x2 operator- (Real2x2 b) const
 Creates a pair that equals b subtracted from this pair.
constexpr __host__ __device__ Real2x2 operator- () const
 Creates an inverse tensor of the current tensor.
constexpr __host__ __device__ bool operator== (Real2x2 b) const
 Compares component by component the current instance to b.
constexpr __host__ __device__ bool operator!= (Real2x2 b) const
 Compares two pairs. For the notion of equality, see operator==().
__host__ __device__ Real2 operator[] (Integer i) const
 Read-only access to the i-th (between 0 and 1 inclusive) row of the instance.
__host__ __device__ Real2 operator() (Integer i) const
 Read-only access to the i-th (between 0 and 1 inclusive) row of the instance.
__host__ __device__ Real operator() (Integer i, Integer j) const
 Read-only access to the i-th row and j-th column.
__host__ __device__ Real2operator[] (Integer i)
 Access to the i-th row (between 0 and 1 inclusive) of the instance.
__host__ __device__ Real2operator() (Integer i)
 Access to the i-th row (between 0 and 1 inclusive) of the instance.
__host__ __device__ Realoperator() (Integer i, Integer j)
 Access to the i-th row and j-th column.
constexpr __host__ __device__ bool isNearlyZero () const
 Compares the matrix with the zero matrix.

Static Public Member Functions

constexpr __host__ static __device__ Real2x2 null ()
 Constructs the zero matrix.
constexpr __host__ static __device__ Real2x2 fromColumns (Real ax, Real ay, Real bx, Real by)
 Constructs the pair ((ax,bx),(ay,by)).
constexpr __host__ static __device__ Real2x2 fromLines (Real ax, Real bx, Real ay, Real by)
 Constructs the pair ((ax,bx),(ay,by)).

Public Attributes

Real2 x
 First component.
Real2 y
 Second component.

Static Private Member Functions

constexpr __host__ static __device__ bool _eq (Real a, Real b)
 Compares the values of a and b with the TypeEqualT comparator.

Friends

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

Detailed Description

Class managing a 2x2 matrix of reals.

The matrix comprises two components x and y which are of the type Real2. For example:

Real2x2 matrix;
matrix.x.y = 2.;
matrix.y.y = 3.;
Real2 x
First component.
Definition Real2x2.h:112
Real2 y
Second component.
Definition Real2x2.h:113
constexpr __host__ __device__ Real2x2()
Constructs the zero matrix.
Definition Real2x2.h:59
Real y
second component of the pair
Definition Real2.h:35

Definition at line 54 of file Real2x2.h.

Constructor & Destructor Documentation

◆ Real2x2() [1/6]

__host__ __device__ Arcane::Real2x2::Real2x2 ( )
inlineconstexpr

Constructs the zero matrix.

Definition at line 59 of file Real2x2.h.

References null(), x, and y.

Referenced by add(), addSame(), assign(), assign(), copy(), div(), divSame(), fromColumns(), fromLines(), mulSame(), null(), operator!=(), operator*, operator*, operator+(), operator+=(), operator-(), operator-(), operator-=(), operator/, operator<, operator<<, operator=(), operator=(), operator==(), operator>>, Real2x2(), reset(), sub(), and subSame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Real2x2() [2/6]

__host__ __device__ Arcane::Real2x2::Real2x2 ( Real2 ax,
Real2 ay )
inlineconstexpr

Constructs the pair (ax,ay).

Definition at line 65 of file Real2x2.h.

References x, and y.

◆ Real2x2() [3/6]

ARCANE_DEPRECATED_116 Arcane::Real2x2::Real2x2 ( Real ax,
Real ay,
Real bx,
Real by )
inline

Constructs the pair ((ax,bx),(ay,by)).

Deprecated
Use Real2x2(Real2 a,Real2 b) instead.

Definition at line 74 of file Real2x2.h.

References x, and y.

◆ Real2x2() [4/6]

__host__ __device__ Arcane::Real2x2::Real2x2 ( const Real2x2POD & f)
inlineexplicitconstexpr

Constructs a copy identical to f.

Definition at line 83 of file Real2x2.h.

References x, and y.

◆ Real2x2() [5/6]

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

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

Definition at line 89 of file Real2x2.h.

References x, and y.

◆ Real2x2() [6/6]

__host__ __device__ Arcane::Real2x2::Real2x2 ( ConstArrayView< Real > av)
inlineexplicitconstexpr

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

Definition at line 95 of file Real2x2.h.

References x, and y.

Member Function Documentation

◆ _eq()

__host__ static __device__ bool Arcane::Real2x2::_eq ( Real a,
Real b )
inlinestaticconstexprprivate

Compares the values of a and b with the TypeEqualT comparator.

Return values
trueif a and b are equal,
falseotherwise.

Definition at line 435 of file Real2x2.h.

References Arcane::TypeEqualT< T >::isEqual().

Here is the call graph for this function:

◆ add()

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

Adds b to the pair.

Definition at line 187 of file Real2x2.h.

References Real2x2(), x, and y.

Referenced by operator+=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSame()

__host__ __device__ Real2x2 & Arcane::Real2x2::addSame ( Real2 b)
inlineconstexpr

Adds b to each component of the pair.

Definition at line 214 of file Real2x2.h.

References Real2x2(), x, and y.

Here is the call graph for this function:

◆ assign() [1/3]

__host__ __device__ Real2x2 & Arcane::Real2x2::assign ( Real2 ax,
Real2 ay )
inlineconstexpr

Assigns the pair (ax,ay) to the instance.

Definition at line 145 of file Real2x2.h.

References Real2x2(), x, and y.

Referenced by operator>>.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assign() [2/3]

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

Copies the pair f.

Definition at line 153 of file Real2x2.h.

References Real2x2(), x, and y.

Here is the call graph for this function:

◆ assign() [3/3]

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

Reads the matrix from the stream i The matrix is read in the form of three Real2.

Definition at line 27 of file Real2x2.cc.

References x, and y.

◆ constView()

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

Returns a constant view of the four elements of the matrix. [x.x, x.y, y.x, y.y]

Definition at line 169 of file Real2x2.h.

References x.

◆ copy()

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

Returns a copy of the pair.

Definition at line 135 of file Real2x2.h.

References Real2x2().

Here is the call graph for this function:

◆ div()

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

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

Divides each component of the pair by the corresponding component of b

Definition at line 206 of file Real2x2.h.

References Real2x2(), x, and y.

Here is the call graph for this function:

◆ divSame()

__host__ __device__ Real2x2 & Arcane::Real2x2::divSame ( Real2 b)
inlineconstexpr

Divides each component of the pair by b.

Definition at line 238 of file Real2x2.h.

References Real2x2(), x, and y.

Here is the call graph for this function:

◆ fromColumns()

__host__ static __device__ Real2x2 Arcane::Real2x2::fromColumns ( Real ax,
Real ay,
Real bx,
Real by )
inlinestaticconstexpr

Constructs the pair ((ax,bx),(ay,by)).

Definition at line 121 of file Real2x2.h.

References Real2x2().

Here is the call graph for this function:

◆ fromLines()

__host__ static __device__ Real2x2 Arcane::Real2x2::fromLines ( Real ax,
Real bx,
Real ay,
Real by )
inlinestaticconstexpr

Constructs the pair ((ax,bx),(ay,by)).

Definition at line 127 of file Real2x2.h.

References Real2x2().

Here is the call graph for this function:

◆ isNearlyZero()

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

Compares the matrix with the zero matrix.

The matrix is zero if and only if each of its components is less than a given epsilon. The epsilon value used is that of float_info<value_type>::nearlyEpsilon():

\[A=0 \Leftrightarrow |A.x|<\epsilon,|A.y|<\epsilon\]

Return values
trueif the matrix is equal to the zero matrix,
falseotherwise.

Definition at line 466 of file Real2x2.h.

◆ mulSame()

__host__ __device__ Real2x2 & Arcane::Real2x2::mulSame ( Real2 b)
inlineconstexpr

Multiplies each component of the pair by b.

Definition at line 230 of file Real2x2.h.

References Real2x2(), x, and y.

Here is the call graph for this function:

◆ null()

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

Constructs the zero matrix.

Definition at line 118 of file Real2x2.h.

References Real2x2().

Referenced by Arcane::DataTypeTraitsT< Real2x2 >::defaultValue(), Real2x2(), reset(), and Arcane::Real2x2Proxy::reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

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

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

Return values
trueif the two pairs are different,
falseotherwise.

Definition at line 297 of file Real2x2.h.

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

Here is the call graph for this function:

◆ operator()() [1/4]

__host__ __device__ Real2 & Arcane::Real2x2::operator() ( Integer i)
inline

Access to the i-th row (between 0 and 1 inclusive) of the instance.

Parameters
irow number to return

Definition at line 348 of file Real2x2.h.

References x.

◆ operator()() [2/4]

__host__ __device__ Real2 Arcane::Real2x2::operator() ( Integer i) const
inline

Read-only access to the i-th (between 0 and 1 inclusive) row of the instance.

Parameters
irow number to return

Definition at line 316 of file Real2x2.h.

References x.

◆ operator()() [3/4]

__host__ __device__ Real & Arcane::Real2x2::operator() ( Integer i,
Integer j )
inline

Access to the i-th row and j-th column.

Parameters
irow number to return
jcolumn number to return

Definition at line 359 of file Real2x2.h.

References x.

◆ operator()() [4/4]

__host__ __device__ Real Arcane::Real2x2::operator() ( Integer i,
Integer j ) const
inline

Read-only access to the i-th row and j-th column.

Parameters
irow number to return
jcolumn number to return

Definition at line 327 of file Real2x2.h.

References x.

◆ operator*=()

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

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

Multiplies each component of the matrix by the real b

Definition at line 255 of file Real2x2.h.

References x, and y.

◆ operator+()

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

Creates a pair that equals this pair added to b.

Definition at line 272 of file Real2x2.h.

References Real2x2(), x, and y.

Here is the call graph for this function:

◆ operator+=()

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

Adds b to the pair.

Definition at line 246 of file Real2x2.h.

References add(), and Real2x2().

Here is the call graph for this function:

◆ operator-() [1/2]

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

Creates an inverse tensor of the current tensor.

Definition at line 278 of file Real2x2.h.

References Real2x2(), x, and y.

Here is the call graph for this function:

◆ operator-() [2/2]

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

Creates a pair that equals b subtracted from this pair.

Definition at line 275 of file Real2x2.h.

References Real2x2(), x, and y.

Here is the call graph for this function:

◆ operator-=()

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

Subtracts b from the pair.

Definition at line 249 of file Real2x2.h.

References Real2x2(), and sub().

Here is the call graph for this function:

◆ operator/=()

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

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

Divides each component of the matrix by the real b

Definition at line 265 of file Real2x2.h.

References x, and y.

◆ operator=()

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

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

Definition at line 104 of file Real2x2.h.

References Real2x2(), x, and y.

Here is the call graph for this function:

◆ operator==()

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

Compares component by component the current instance to b.

Return values
trueif this.x==b.x and this.y==b.y.
falseotherwise.

Definition at line 286 of file Real2x2.h.

References Real2x2(), x, and y.

Referenced by operator!=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator[]() [1/2]

__host__ __device__ Real2 & Arcane::Real2x2::operator[] ( Integer i)
inline

Access to the i-th row (between 0 and 1 inclusive) of the instance.

Parameters
irow number to return

Definition at line 338 of file Real2x2.h.

References x.

◆ operator[]() [2/2]

__host__ __device__ Real2 Arcane::Real2x2::operator[] ( Integer i) const
inline

Read-only access to the i-th (between 0 and 1 inclusive) row of the instance.

Parameters
irow number to return

Definition at line 306 of file Real2x2.h.

References x.

◆ print()

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

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

Definition at line 37 of file Real2x2.cc.

References x, and y.

◆ printXy()

std::ostream & Arcane::Real2x2::printXy ( std::ostream & o) const

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

Definition at line 47 of file Real2x2.cc.

References x, and y.

Referenced by operator<<.

Here is the caller graph for this function:

◆ reset()

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

Resets the pair with default constructors.

Definition at line 138 of file Real2x2.h.

References null(), and Real2x2().

Here is the call graph for this function:

◆ sub()

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

Subtracts b from the pair.

Definition at line 195 of file Real2x2.h.

References Real2x2(), x, and y.

Referenced by operator-=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ subSame()

__host__ __device__ Real2x2 & Arcane::Real2x2::subSame ( Real2 b)
inlineconstexpr

Subtracts b from each component of the pair.

Definition at line 222 of file Real2x2.h.

References Real2x2(), x, and y.

Here is the call graph for this function:

◆ view()

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

Returns a view of the four elements of the matrix. [x.x, x.y, y.x, y.y]

Definition at line 162 of file Real2x2.h.

References x.

◆ operator* [1/2]

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

Multiplication by a scalar.

Definition at line 381 of file Real2x2.h.

References Real2x2(), x, and y.

◆ operator* [2/2]

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

Multiplication by a scalar.

Definition at line 387 of file Real2x2.h.

References Real2x2(), x, and y.

◆ operator/

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

Division by a scalar.

Definition at line 393 of file Real2x2.h.

References Real2x2(), x, and y.

◆ operator<

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

Comparison operator.

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

Definition at line 404 of file Real2x2.h.

References Real2x2(), x, and y.

◆ operator<<

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

Writes the pair t to the stream o.

Definition at line 369 of file Real2x2.h.

References printXy(), and Real2x2().

◆ operator>>

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

Reads the pair t from the stream o.

Definition at line 375 of file Real2x2.h.

References assign(), and Real2x2().

Member Data Documentation

◆ x

◆ y


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