14#include "arcane/utils/NotImplementedException.h"
15#include "arcane/utils/TraceInfo.h"
16#include "arcane/utils/NumericTypes.h"
18#include "arcane/core/MeshVariableScalarRef.h"
19#include "arcane/core/VariableBuildInfo.h"
20#include "arcane/core/ArcaneException.h"
22#include "arcane/core/materials/IMeshMaterialMng.h"
23#include "arcane/core/materials/IMeshMaterial.h"
24#include "arcane/core/materials/MaterialVariableBuildInfo.h"
36MeshMaterialVariableRef::
37MeshMaterialVariableRef()
38: m_material_variable(nullptr)
39, m_previous_reference(nullptr)
40, m_next_reference(nullptr)
41, m_global_variable(nullptr)
42, m_is_registered(false)
49MeshMaterialVariableRef::
50~MeshMaterialVariableRef()
59void MeshMaterialVariableRef::
64 m_is_registered =
false;
70void MeshMaterialVariableRef::
75 m_is_registered =
true;
81void MeshMaterialVariableRef::
84 m_material_variable = mat_variable;
93MeshMaterialVariableRef* MeshMaterialVariableRef::
102MeshMaterialVariableRef* MeshMaterialVariableRef::
111void MeshMaterialVariableRef::
112setPreviousReference(MeshMaterialVariableRef* v)
120void MeshMaterialVariableRef::
121setNextReference(MeshMaterialVariableRef* v)
129void MeshMaterialVariableRef::
138void MeshMaterialVariableRef::
148void MeshMaterialVariableRef::
158String MeshMaterialVariableRef::
161 return m_global_variable->name();
163void MeshMaterialVariableRef::
166 m_global_variable->setUpToDate();
168bool MeshMaterialVariableRef::
171 return m_global_variable->isUsed();
173void MeshMaterialVariableRef::
176 m_global_variable->update();
179void MeshMaterialVariableRef::
180addDependCurrentTime(
const VariableRef& var)
182 m_global_variable->addDepend(var.variable(),IVariable::DPT_CurrentTime);
184void MeshMaterialVariableRef::
185addDependCurrentTime(
const VariableRef& var,
const TraceInfo& tinfo)
187 m_global_variable->addDepend(var.variable(),IVariable::DPT_CurrentTime,tinfo);
190void MeshMaterialVariableRef::
191addDependCurrentTime(
const MeshMaterialVariableRef& var)
193 m_global_variable->addDepend(var.m_global_variable,IVariable::DPT_CurrentTime);
196void MeshMaterialVariableRef::
197addDependPreviousTime(
const MeshMaterialVariableRef& var)
199 m_global_variable->addDepend(var.m_global_variable,IVariable::DPT_PreviousTime);
202void MeshMaterialVariableRef::
203removeDepend(
const MeshMaterialVariableRef& var)
205 m_global_variable->removeDepend(var.m_global_variable);
211void MeshMaterialVariableRef::
217void MeshMaterialVariableRef::
220 m_material_variable->update(mat);
223void MeshMaterialVariableRef::
229void MeshMaterialVariableRef::
232 m_material_variable->addDepend(var.
variable(),tinfo);
235void MeshMaterialVariableRef::
241void MeshMaterialVariableRef::
275: m_private_part(rhs.m_private_part)
281 m_private_part->incrementReference();
292template<
typename DataType>
void
298 _internalInit(m_private_part->toMeshMaterialVariable());
305template<
typename DataType>
void
307refersTo(
const CellMaterialVariableScalarRef<DataType>& rhs)
309 if (rhs.m_private_part==m_private_part)
313 m_private_part = rhs.m_private_part;
314 m_container_value = {};
320 m_private_part->incrementReference();
327template<
typename DataType>
void
337template<
typename DataType> DataType
346 return this->operator[](imatcell);
355template<
typename DataType> DataType
363 return this->operator[](ienvcell);
382template<
typename DataType>
void
386 m_private_part->fillFromArray(mat,values);
403template<
typename DataType>
void
407 m_private_part->fillFromArray(mat,values,indexes);
424template<
typename DataType>
void
428 m_private_part->fillToArray(mat,values);
445template<
typename DataType>
void
449 m_private_part->fillToArray(mat,values,indexes);
459template<
typename DataType>
void
474template<
typename DataType>
void
487template<
typename DataType>
void
489fill(
const DataType& value)
500template<
typename DataType>
void
504 m_private_part->fillPartialValues(value);
517 GlobalVariableRefType* rt = m_private_part->globalVariableReference();
530 GlobalVariableRefType* rt = m_private_part->globalVariableReference();
539template<
typename DataType>
void
544 m_container_value = m_private_part->_internalFullValuesView();
545 m_value = m_container_value.data();
548 m_container_value = {};
584: m_private_part(rhs.m_private_part)
590 m_private_part->incrementReference();
599template<
typename DataType>
void
605 _internalInit(m_private_part->toMeshMaterialVariable());
613template<
typename DataType>
void
615refersTo(
const CellMaterialVariableArrayRef<DataType>& rhs)
617 if (rhs.m_private_part==m_private_part)
622 m_private_part = rhs.m_private_part;
624 m_container_value = {};
629 m_private_part->incrementReference();
637template<
typename DataType>
void
651 GlobalVariableRefType* rt = m_private_part->globalVariableReference();
664 GlobalVariableRefType* rt = m_private_part->globalVariableReference();
673template<
typename DataType>
void
677 m_private_part->resize(dim2_size);
683template<
typename DataType>
void
688 m_container_value = m_private_part->_internalFullValuesView();
689 m_value = m_container_value.data();
692 m_container_value = {};
703#define ARCANE_INSTANTIATE_MAT(type) \
704 template class ARCANE_TEMPLATE_EXPORT CellMaterialVariableScalarRef<type>;\
705 template class ARCANE_TEMPLATE_EXPORT CellMaterialVariableArrayRef<type>
707ARCANE_INSTANTIATE_MAT(
Byte);
708ARCANE_INSTANTIATE_MAT(
Int8);
709ARCANE_INSTANTIATE_MAT(
Int16);
710ARCANE_INSTANTIATE_MAT(
Int32);
711ARCANE_INSTANTIATE_MAT(
Int64);
712ARCANE_INSTANTIATE_MAT(BFloat16);
713ARCANE_INSTANTIATE_MAT(
Float16);
714ARCANE_INSTANTIATE_MAT(
Float32);
715ARCANE_INSTANTIATE_MAT(
Real);
716ARCANE_INSTANTIATE_MAT(Real2);
717ARCANE_INSTANTIATE_MAT(Real3);
718ARCANE_INSTANTIATE_MAT(Real2x2);
719ARCANE_INSTANTIATE_MAT(Real3x3);
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Vue modifiable d'un tableau d'un type T.
Tableau d'items de types quelconques.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
ArrayView< T > view() const
Vue mutable sur ce tableau.
Vue constante d'un tableau de type T.
Exception lorsqu'une erreur interne survient.
Integer size() const
Nombre d'éléments du groupe.
Maille arcane avec info matériaux et milieux.
Variable tableau sur les mailles d'un matériau du maillage. Pour l'instant, cette classe n'est instan...
CellMaterialVariableArrayRef()=delete
Constructeur vide (interdit)
GlobalVariableRefType & globalVariable()
Variable globale associée à cette variable matériau.
virtual void refersTo(const ThatClass &rhs)
Positionne la référence de l'instance à la variable rhs.
void updateFromInternal() override
void resize(Integer dim2_size)
Redimensionne le nombre d'éléments du tableau.
Variable scalaire sur les mailles d'un matériau du maillage. Pour l'instant, cette classe n'est insta...
DataType matValue(AllEnvCell c, Int32 mat_id) const
Valeur de la variable pour le matériau d'index mat_id de la maille ou 0 si absent de la maille.
DataType envValue(AllEnvCell c, Int32 env_id) const
Valeur de la variable pour le milieu d'index env_id de la maille ou 0 si absent de la maille.
void fill(const DataType &value)
Remplit les valeurs partielles et globales de la variable avec la valeur value.
void fillPartialValues(const DataType &value)
Remplit les valeurs partielles de la variable avec la valeur value.
void fillFromArray(IMeshMaterial *mat, ConstArrayView< DataType > values)
Remplit les valeurs de la variable pour un matériau.
GlobalVariableRefType & globalVariable()
Variable globale associée à cette variable matériau.
virtual void refersTo(const ThatClass &rhs)
Positionne la référence de l'instance à la variable rhs.
void updateFromInternal() override
CellMaterialVariableScalarRef()=delete
Constructeur vide (interdit)
void fillToArray(IMeshMaterial *mat, ArrayView< DataType > values)
Remplit un tableau à partir des valeurs de la variable pour un matériau.
Maille arcane d'un milieu.
__host__ __device__ Int32 environmentId() const
Identifiant du milieu.
virtual CellGroup cells() const =0
Groupe des mailles de ce matériau.
Interface d'une variable matériau d'un maillage.
virtual IVariable * globalVariable() const =0
Variable globale sur le maillage associée.
Interface d'un matériau d'un maillage.
Représente un matériau d'une maille multi-matériau.
__host__ __device__ Int32 materialId() const
Identifiant du matériau.
Classe de base des références aux variables matériaux.
IMeshMaterialVariable * materialVariable() const
Variable matériau associée.
IMeshMaterialVariable * m_material_variable
Variable associée.
void unregisterVariable()
Supprime l'enregistrement de la variable (interne)
MeshMaterialVariableRef * m_next_reference
Référence suivante sur m_variable.
MeshMaterialVariableRef * m_previous_reference
Référence précédente sur m_variable.
Synchronisation d'une liste de variables matériaux.
Variable tableau sur un type d'entité du maillage.
Variable scalaire sur un type d'entité du maillage.
Chaîne de caractères unicode.
Paramètres nécessaires à la construction d'une variable.
Référence à une variable.
IVariable * variable() const
Variable associée.
Active toujours les traces dans les parties Arcane concernant les matériaux.
MatVarSpace
Espace de définition d'une variable matériau.
@ MaterialAndEnvironment
Variable ayant des valeurs sur les milieux et matériaux.
std::int8_t Int8
Type entier signé sur 8 bits.
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
@ Float16
Donnée de type Float16.
std::int16_t Int16
Type entier signé sur 16 bits.
double Real
Type représentant un réel.
unsigned char Byte
Type d'un octet.
float Float32
Type flottant IEEE-753 simple précision.
std::int32_t Int32
Type entier signé sur 32 bits.