12#ifndef ARCANE_UTILS_REAL3X3_H
13#define ARCANE_UTILS_REAL3X3_H
17#include "arcane/utils/Real3.h"
112 :
x(av[0], av[1], av[2])
113 ,
y(av[3], av[4], av[5])
114 ,
z(av[6], av[7], av[8])
159 constexpr ARCCORE_HOST_DEVICE
Real3x3 copy()
const {
return (*
this); }
204 std::istream& assign(std::istream& i);
207 std::ostream& print(std::ostream& o)
const;
210 std::ostream& printXyz(std::ostream& o)
const;
287 return x == b.
x &&
y == b.
y &&
z == b.
z;
307 ARCCORE_CHECK_AT(i, 3);
317 ARCCORE_CHECK_AT(i, 3);
328 ARCCORE_CHECK_AT(i, 3);
329 ARCCORE_CHECK_AT(j, 3);
339 ARCCORE_CHECK_AT(i, 3);
349 ARCCORE_CHECK_AT(i, 3);
360 ARCCORE_CHECK_AT(i, 3);
361 ARCCORE_CHECK_AT(j, 3);
368 return (
x.x * (
y.y *
z.z -
y.z *
z.y) +
x.y * (
y.z *
z.x -
y.x *
z.z) +
x.z * (
y.x *
z.y -
y.y *
z.x));
386 return Real3x3(vec.
x * sca, vec.
y * sca, vec.
z * sca);
392 return Real3x3(vec.
x * sca, vec.
y * sca, vec.
z * sca);
398 return Real3x3(vec.
x / sca, vec.
y / sca, vec.
z / sca);
415 return (v1.
x < v2.
x);
421 inline constexpr ARCCORE_HOST_DEVICE
bool isNearlyZero()
const;
430 constexpr ARCCORE_HOST_DEVICE
static bool _eq(
Real a,
Real b)
452 inline constexpr ARCCORE_HOST_DEVICE
bool isNearlyZero(
const Real3x3& v)
454 return isNearlyZero(v.
x) && isNearlyZero(v.
y) && isNearlyZero(v.
z);
461inline constexpr ARCCORE_HOST_DEVICE
bool Real3x3::
464 return math::isNearlyZero(*
this);
Modifiable view of an array of type T.
Constant view of an array of type T.
Class managing a 3-dimensional real vector.
Class managing a 3x3 real matrix.
constexpr __host__ __device__ Real3x3 operator-(Real3x3 b) const
Creates a triplet that equals b subtracted from this triplet.
constexpr __host__ static __device__ Real3x3 null()
Constructs the null tensor.
Real3x3(const Real3x3 &f)=default
Constructs a triplet identical to f.
friend constexpr __host__ __device__ Real3x3 operator*(Real sca, Real3x3 vec)
Multiplication by a scalar.
constexpr __host__ __device__ Real3x3 & add(Real3x3 b)
Adds b to the triplet.
constexpr __host__ static __device__ Real3x3 identity()
Constructs the identity matrix.
constexpr __host__ __device__ Real3x3 & subSame(Real3 b)
Subtracts b from each component of the triplet.
std::ostream & printXyz(std::ostream &o) const
Writes the triplet to the stream o in the form (x,y,z).
constexpr __host__ __device__ Real3x3 & assign(Real3 ax, Real3 ay, Real3 az)
Assigns the rows (ax,ay,az) to the instance.
Real3 z
first element of the triplet
constexpr __host__ __device__ bool operator==(Real3x3 b) const
Compares the current instance component by component to b.
friend constexpr __host__ __device__ bool operator<(Real3x3 v1, Real3x3 v2)
Comparison operator.
constexpr __host__ __device__ Real3x3 & sub(Real3x3 b)
Subtracts b from the triplet.
constexpr __host__ static __device__ Real3x3 fromLines(Real ax, Real bx, Real cx, Real ay, Real by, Real cy, Real az, Real bz, Real cz)
Constructs the matrix ((ax,bx,cx),(ay,by,cy),(az,bz,cz)).
constexpr __host__ __device__ Real3x3 & operator=(Real v)
Assigns the triplet (v,v,v) to the instance.
constexpr __host__ __device__ Real3x3 & reset()
Resets the coefficients of the matrix to zero.
Real3 y
first element of the triplet
constexpr __host__ __device__ Real3x3 & assign(Real3x3 f)
Copies matrix f.
constexpr __host__ __device__ Real determinant() const
Determinant of the matrix.
__host__ __device__ Real3 operator()(Integer i) const
Read-only access to the i-th (between 0 and 2 inclusive) row of the instance.
constexpr __host__ static __device__ Real3x3 fromColumns(Real ax, Real ay, Real az, Real bx, Real by, Real bz, Real cx, Real cy, Real cz)
Constructs the matrix ((ax,bx,cx),(ay,by,cy),(az,bz,cz)).
constexpr __host__ __device__ Real3x3()
Constructs the matrix with all coefficients zero.
constexpr __host__ __device__ Real3x3(ConstArrayView< Real > av)
Constructs the triplet ((av[0], av[1], av[2]), (av[3], av[4], av[5]), (av[6], av[7],...
__host__ __device__ Real3 operator[](Integer i) const
Read-only access to the i-th (between 0 and 2 inclusive) row of the instance.
constexpr __host__ __device__ Real3x3 & addSame(Real3 b)
Adds b to each component of the triplet.
Real3x3 & operator=(const Real3x3 &f)=default
Copy assignment operator.
constexpr __host__ __device__ ArrayView< Real > view()
constexpr __host__ __device__ ConstArrayView< Real > constView() const
constexpr __host__ __device__ Real3x3(const Real3x3POD &f)
Constructs a triplet identical to f.
constexpr __host__ __device__ bool operator!=(Real3x3 b) const
Compares two triplets. For the notion of equality, see operator==().
Real3 x
first element of the triplet
constexpr __host__ __device__ Real3x3(Real v)
Constructs the instance with the triplet (v,v,v).
friend std::ostream & operator<<(std::ostream &o, Real3x3 t)
Writes the triplet t to the stream o.
__host__ __device__ Real3 & operator[](Integer i)
Access to the i-th row (between 0 and 2 inclusive) of the instance.
constexpr __host__ static __device__ Real3x3 zero()
Constructs the zero matrix.
__host__ __device__ Real operator()(Integer i, Integer j) const
Read-only access to the i-th row and j-th column.
friend std::istream & operator>>(std::istream &i, Real3x3 &t)
Reads the triplet t from the stream o.
constexpr __host__ __device__ Real3x3(Real3 ax, Real3 ay, Real3 az)
Constructs the matrix with rows (ax,ay,az).
constexpr __host__ __device__ Real3x3 & operator+=(Real3x3 b)
Adds b to the triplet.
constexpr __host__ __device__ void operator/=(Real b)
Divides each component of the matrix by the real b.
constexpr __host__ __device__ Real3x3 copy() const
Returns a copy of the matrix.
constexpr __host__ __device__ Real3x3 operator-() const
Creates a tensor opposite to the current tensor.
constexpr __host__ __device__ Real3x3 operator+(Real3x3 b) const
Creates a triplet that equals this triplet added to b.
ARCANE_DEPRECATED_116 Real3x3(Real ax, Real ay, Real az, Real bx, Real by, Real bz, Real cx, Real cy, Real cz)
Constructs the tensor ((ax,bx,cx),(ay,by,cy),(az,bz,cz)).
constexpr __host__ __device__ void operator*=(Real b)
Multiplies each component of the matrix by the real b.
__host__ __device__ Real & operator()(Integer i, Integer j)
Access to the i-th row and j-th column.
constexpr __host__ __device__ Real3x3 & operator-=(Real3x3 b)
Subtracts b from the triplet.
friend constexpr __host__ __device__ Real3x3 operator/(Real3x3 vec, Real sca)
Division by a scalar.
friend constexpr __host__ __device__ Real3x3 operator*(Real3x3 vec, Real sca)
Multiplication by a scalar.
__host__ __device__ Real3 & operator()(Integer i)
Access to the i-th row (between 0 and 2 inclusive) of the instance.
constexpr __host__ static __device__ bool isEqual(const T &a, const T &b)
Compares a to b.
Namespace for mathematical functions.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
double Real
Type representing a real number.
POD structure for a Real3x3.