42 static const Integer MAX_DIM1_SIZE = 3;
43 static const Integer MAX_DIM2_SIZE = 3;
51 _setValue(v.
data(), v.dim1Size(), v.dim2Size());
55 _setValue(
reinterpret_cast<Real*
>(&r), 2, 2);
59 _setValue(
reinterpret_cast<Real*
>(&r), 3, 3);
62#if defined(ARCANE_HAS_ACCELERATOR_API)
63 template<
typename LayoutType>
67 template<
typename LayoutType>
72 template<
typename LayoutType>
82 _setValue(v.
data(), v.dim1Size(), v.dim2Size());
87 _setValue(
reinterpret_cast<Real*
>(&r), 2, 2);
92 _setValue(
reinterpret_cast<Real*
>(&r), 3, 3);
96 Real* operator[](Integer index)
98 ARCANE_ASSERT(index < m_nb_dim1, (
"Index out of range"));
99 return m_value[index];
101 const Real* operator [](Integer index)
const
103 ARCANE_ASSERT(index < m_nb_dim1, (
"Index out of range"));
104 return m_value[index];
107 Real& operator()(Int32 i,Int32 j)
109 ARCANE_ASSERT(i < m_nb_dim1, (
"Index i out of range"));
110 ARCANE_ASSERT(j < m_nb_dim2, (
"Index j out of range"));
111 return m_value[i][j];
113 Real operator()(Int32 i,Int32 j)
const
115 ARCANE_ASSERT(i < m_nb_dim1, (
"Index i out of range"));
116 ARCANE_ASSERT(j < m_nb_dim2, (
"Index j out of range"));
117 return m_value[i][j];
120 Int32 dim1Size()
const {
return m_nb_dim1; }
121 Int32 dim2Size()
const {
return m_nb_dim2; }
122 Real* data() {
return reinterpret_cast<Real*
>(&m_value[0]); }
123 const Real* data()
const {
return reinterpret_cast<const Real*
>(m_value); }
130 return Real2x2::fromLines(m_value[0][0], m_value[0][1], m_value[1][0], m_value[1][1]);
135 m_value[1][0], m_value[1][1], m_value[1][2],
136 m_value[2][0], m_value[2][1], m_value[2][2]);
138#if defined(ARCANE_HAS_ACCELERATOR_API)
139 template<
typename LayoutType>
143 for( Integer i=0, m=m_nb_dim1; i<m; ++i )
144 for( Integer j=0, n=m_nb_dim2; j<n; ++j )
145 v(i,j) = m_value[i][j];
152 Real m_value[MAX_DIM1_SIZE][MAX_DIM2_SIZE];
158 void _setValue(
const Real* v, Integer nb_dim1, Integer nb_dim2)
161 ARCANE_ASSERT(nb_dim1 <= MAX_DIM1_SIZE, (
"Dim1 size too large"));
163 ARCANE_ASSERT(nb_dim2 <= MAX_DIM2_SIZE, (
"Dim2 size too large"));
164 for (Integer i = 0 ; i < nb_dim1; ++i)
165 for (Integer j = 0 ; j < nb_dim2; ++j)
166 m_value[i][j] = v[i * nb_dim2 + j];
constexpr __host__ static __device__ Real2x2 fromLines(Real ax, Real bx, Real ay, Real by)
Construit le couple ((ax,bx),(ay,by)).
constexpr __host__ static __device__ Real3x3 fromLines(Real ax, Real bx, Real cx, Real ay, Real by, Real cy, Real az, Real bz, Real cz)
Construit la matrice ((ax,bx,cx),(ay,by,cy),(az,bz,cz)).