12#ifndef ARCANE_UTILS_REAL2X2_H
13#define ARCANE_UTILS_REAL2X2_H
17#include "arcane/utils/Real2.h"
135 constexpr ARCCORE_HOST_DEVICE
Real2x2 copy()
const {
return (*
this); }
178 std::istream& assign(std::istream& i);
181 std::ostream& print(std::ostream& o)
const;
184 std::ostream& printXy(std::ostream& o)
const;
288 return (
x == b.
x) && (
y == b.
y);
308 ARCCORE_CHECK_AT(i, 2);
318 ARCCORE_CHECK_AT(i, 2);
329 ARCCORE_CHECK_AT(i, 2);
330 ARCCORE_CHECK_AT(j, 2);
340 ARCCORE_CHECK_AT(i, 2);
350 ARCCORE_CHECK_AT(i, 2);
361 ARCCORE_CHECK_AT(i, 2);
362 ARCCORE_CHECK_AT(j, 2);
383 return Real2x2(vec.
x * sca, vec.
y * sca);
389 return Real2x2(vec.
x * sca, vec.
y * sca);
395 return Real2x2(vec.
x / sca, vec.
y / sca);
409 return (v1.
x < v2.
x);
426 inline constexpr ARCCORE_HOST_DEVICE
bool isNearlyZero()
const;
435 constexpr ARCCORE_HOST_DEVICE
static bool _eq(
Real a,
Real b)
457 constexpr ARCCORE_HOST_DEVICE
bool isNearlyZero(
const Real2x2& v)
459 return math::isNearlyZero(v.
x) && math::isNearlyZero(v.
y);
469 return math::isNearlyZero(*
this);
Modifiable view of an array of type T.
Constant view of an array of type T.
Class managing a 2-dimensional real vector.
Class managing a 2x2 matrix of reals.
friend constexpr __host__ __device__ Real2x2 operator/(Real2x2 vec, Real sca)
Division by a scalar.
constexpr __host__ __device__ Real2x2 & sub(Real2x2 b)
Subtracts b from the pair.
constexpr __host__ __device__ Real2x2 operator+(Real2x2 b) const
Creates a pair that equals this pair added to b.
constexpr __host__ __device__ Real2x2 & addSame(Real2 b)
Adds b to each component of the pair.
friend constexpr __host__ __device__ Real2x2 operator*(Real sca, Real2x2 vec)
Multiplication by a scalar.
constexpr __host__ __device__ Real2x2 & div(Real2x2 b)
Multiplies each component of the pair by the corresponding component of b.
__host__ __device__ Real & operator()(Integer i, Integer j)
Access to the i-th row and j-th column.
std::ostream & printXy(std::ostream &o) const
Writes the pair to the stream o in the form (x,y,z).
ARCANE_DEPRECATED_116 Real2x2(Real ax, Real ay, Real bx, Real by)
Constructs the pair ((ax,bx),(ay,by)).
constexpr __host__ __device__ Real2x2 & operator-=(Real2x2 b)
Subtracts b from the pair.
constexpr __host__ __device__ Real2x2 & assign(Real2 ax, Real2 ay)
Assigns the pair (ax,ay) to the instance.
constexpr __host__ static __device__ Real2x2 null()
Constructs the zero matrix.
constexpr __host__ __device__ bool operator!=(Real2x2 b) const
Compares two pairs. For the notion of equality, see operator==().
constexpr __host__ static __device__ Real2x2 fromColumns(Real ax, Real ay, Real bx, Real by)
Constructs the pair ((ax,bx),(ay,by)).
constexpr __host__ __device__ void operator/=(Real b)
Divides each component of the pair by the corresponding component of b.
constexpr __host__ __device__ Real2x2(ConstArrayView< Real > av)
Constructs the pair ((av[0], av[1]), (av[2], av[3])).
__host__ __device__ Real2 & operator()(Integer i)
Access to the i-th row (between 0 and 1 inclusive) of the instance.
constexpr __host__ __device__ ArrayView< Real > view()
constexpr __host__ __device__ Real2x2(Real2 ax, Real2 ay)
Constructs the pair (ax,ay).
friend std::istream & operator>>(std::istream &i, Real2x2 &t)
Reads the pair t from the stream o.
constexpr __host__ static __device__ Real2x2 fromLines(Real ax, Real bx, Real ay, Real by)
Constructs the pair ((ax,bx),(ay,by)).
constexpr __host__ __device__ Real2x2 & assign(Real2x2 f)
Copies the pair f.
constexpr __host__ __device__ Real2x2 operator-(Real2x2 b) const
Creates a pair that equals b subtracted from this pair.
Real2x2(const Real2x2 &f)=default
Constructs a copy identical to f.
__host__ __device__ Real2 & operator[](Integer i)
Access to the i-th row (between 0 and 1 inclusive) of the instance.
constexpr __host__ __device__ ConstArrayView< Real > constView() const
constexpr __host__ __device__ bool operator==(Real2x2 b) const
Compares component by component the current instance to b.
constexpr __host__ __device__ Real2x2 & mulSame(Real2 b)
Multiplies each component of the pair by b.
Real2x2 & operator=(const Real2x2 &f)=default
Copy assignment operator.
__host__ __device__ Real operator()(Integer i, Integer j) const
Read-only access to the i-th row and j-th column.
friend constexpr __host__ __device__ bool operator<(Real2x2 v1, Real2x2 v2)
Comparison operator.
friend constexpr __host__ __device__ Real2x2 operator*(Real2x2 vec, Real sca)
Multiplication by a scalar.
__host__ __device__ Real2 operator[](Integer i) const
Read-only access to the i-th (between 0 and 1 inclusive) row of the instance.
constexpr __host__ __device__ Real2x2()
Constructs the zero matrix.
__host__ __device__ Real2 operator()(Integer i) const
Read-only access to the i-th (between 0 and 1 inclusive) row of the instance.
constexpr __host__ __device__ bool isNearlyZero() const
Compares the matrix with the zero matrix.
constexpr __host__ __device__ Real2x2 copy() const
Returns a copy of the pair.
constexpr __host__ __device__ Real2x2 & reset()
Resets the pair with default constructors.
friend std::ostream & operator<<(std::ostream &o, Real2x2 t)
Writes the pair t to the stream o.
constexpr __host__ __device__ Real2x2 & operator+=(Real2x2 b)
Adds b to the pair.
constexpr __host__ __device__ Real2x2 & divSame(Real2 b)
Divides each component of the pair by b.
constexpr __host__ __device__ Real2x2 & subSame(Real2 b)
Subtracts b from each component of the pair.
constexpr __host__ __device__ void operator*=(Real b)
Multiplies each component of the pair by the corresponding component of b.
constexpr __host__ __device__ Real2x2 & add(Real2x2 b)
Adds b to the pair.
constexpr __host__ __device__ Real2x2 & operator=(Real v)
Assigns the pair (v,v,v) to the instance.
constexpr __host__ __device__ Real2x2(Real v)
Constructs the instance with the triplet (v,v,v).
constexpr __host__ __device__ Real2x2(const Real2x2POD &f)
Constructs a copy identical to f.
constexpr __host__ __device__ Real2x2 operator-() const
Creates an inverse tensor of the current tensor.
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 Real2x2.