13#include "arcane/datatype/RealArrayVariant.h"
15#include "arcane/utils/Array.h"
16#include "arcane/utils/FatalErrorException.h"
17#include "arcane/utils/NumVector.h"
19#include "arcane/MathUtils.h"
32extern "C++" ARCANE_CORE_EXPORT
33void _arcaneTestRealArrayVariant()
35 UniqueArray<Real> a1_({2.4, 5.6, 3.3, 5.4});
36 ConstArrayView<Real> a1 = a1_.constView();
38 Real3 a3{ 4.0, 7.2, 3.6 };
41 RealArrayVariant variants[nb_variants] = { RealArrayVariant(a1), RealArrayVariant(a2), RealArrayVariant(a3) };
43 for (Integer v=0 ; v<nb_variants ; ++v){
44 std::cout <<
"A" << v <<
"=[ ";
45 for (Integer i=0 ; i<variants[v].size() ; ++i)
46 std::cout << variants[v][i] <<
" ";
50#if defined(ARCANE_HAS_ACCELERATOR_API)
51 NumArray<Real,MDDim1> num_data(4, { 2.4, 5.6, 3.3, 5.4 });
52 RealArrayVariant variant2{num_data};
53 NumArray<Real,MDDim1> num_data_copy(variant2);
54 if (num_data_copy.to1DSpan()!=num_data.to1DSpan())
58 RealN2 b2{ 2.0, 3.1 };
59 RealN3 b3{ 4.0, 7.2, 3.6 };
60 NumVector<Real,3> b4{ 2.0, 1.2, 4.6 };
61 RealArrayVariant b2_variant(b2);
62 RealArrayVariant b3_variant(b3);
63 NumVector<Real,2> c2(b2_variant);
64 NumVector<Real,3> c3(b3_variant);
66 std::cout <<
"Z=" << z.vx() <<
"\n";
68 for (Integer i=0 ; i<3 ; ++i)
69 std::cout <<
"V=" << i <<
" v=" << z(i) <<
"\n";
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
ARCCORE_HOST_DEVICE Real normL2() const
Retourne la norme L2 du triplet .
Real3 normalizedCrossProduct3(Real3 v1, Real3 v2)
Produit vectoriel normalisé.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.