14#include "arcane/datatype/RealArray2Variant.h"
16#include "arcane/utils/FatalErrorException.h"
17#include "arcane/utils/NumMatrix.h"
19#include "arcane/MathUtils.h"
32extern "C++" ARCANE_CORE_EXPORT
void
33_arcaneTestRealArray2Variant()
36 Real data[4] = {2.4, 5.6,3.3, 4.4};
37 ConstArray2View<Real> a(data, 2, 2);
38 Real2x2 a22{ Real2{ -1.0, -2.5 }, Real2{ -2.0, 3.7 } };
39 Real3x3 a33{ Real3{ -2.1, 3.9, 1.5 }, Real3{ 9.2, 3.4, 2.1 }, Real3{ 7.1, 4.5, 3.2 } };
42 RealArray2Variant variants[nb_variants] = { RealArray2Variant(a), RealArray2Variant(a22), RealArray2Variant(a33) };
44 for (Integer v=0 ; v<nb_variants ; ++v) {
45 std::cout <<
"A" << v <<
"=[ ";
46 for (Integer i=0 ; i<variants[v].dim1Size() ; ++i) {
48 for (Integer j=0 ; j<variants[v].dim2Size() ; ++j)
49 std::cout << variants[v][i][j] <<
" ";
55#if defined(ARCANE_HAS_ACCELERATOR_API)
56 NumArray<Real,MDDim2> num_data(3, 2, {1.4, 2.3, 4.5, 5.7, 2.9 , 6.5 });
57 RealArray2Variant variant2{num_data};
58 NumArray<Real,MDDim2> num_data_copy(variant2);
59 Span<const Real> variant2_span(variant2.data(),variant2.dim1Size()*variant2.dim2Size());
60 std::cout <<
"NUM_DATA =" << num_data.to1DSpan() <<
"\n";
61 std::cout <<
"NUM_DATA_COPY=" << num_data_copy.to1DSpan() <<
"\n";
62 if (num_data_copy.to1DSpan()!=num_data.to1DSpan())
68 NumMatrix<Real,3> m33(Real3x3( Real3{ 1.1, 2.9, 3.5 }, Real3{ 2.2, 4.4, 6.1 }, Real3{ -1.1, 2.5, 1.2 } ));
69 RealArray2Variant n22_variant(n22);
70 RealArray2Variant n33_variant(n33);
71 RealN2x2 c22(n22_variant);
72 RealN3x3 c33(n33_variant);
75 std::cout <<
"Z=" << z.vx().vx() <<
"\n";
77 for (Integer i=0 ; i<3 ; ++i)
78 for (Integer j=0 ; j<3 ; ++j)
79 std::cout <<
"V1=" << i <<
" " << j <<
" v=" << m33(i,j) <<
"\n";
80 for (Integer i=0 ; i<3 ; ++i){
82 for (Integer j=0 ; j<3 ; ++j)
83 std::cout <<
"V2=" << i <<
" " << j <<
" v=" << lc(j) <<
"\n";
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
__host__ __device__ Real matrixDeterminant(Real3x3 m)
Calcul du déterminant d'une matrice 3x3.
Real3x3 matrix3x3Prod(Real3x3 m1, Real3x3 m2)
Multiplication de 2 matrices 3x3.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
double Real
Type représentant un réel.
Int32 Integer
Type représentant un entier.