12#ifndef ARCANE_MATERIALS_MESHMATERIALVARIABLEREF_H
13#define ARCANE_MATERIALS_MESHMATERIALVARIABLEREF_H
22#include "arcane/utils/NotImplementedException.h"
23#include "arcane/utils/Array2View.h"
25#include "arcane/Item.h"
26#include "arcane/VariableRef.h"
28#include "arcane/core/materials/IMeshMaterialVariable.h"
30#include "arcane/core/materials/MeshMaterialVariableComputeFunction.h"
31#include "arcane/core/materials/IScalarMeshMaterialVariable.h"
32#include "arcane/core/materials/IArrayMeshMaterialVariable.h"
46class ARCANE_CORE_EXPORT MeshMaterialVariableRef
54 : m_vref(vp->firstReference())
59 m_vref = m_vref->nextReference();
61 MeshMaterialVariableRef* operator*()
const
72 MeshMaterialVariableRef* m_vref =
nullptr;
77 MeshMaterialVariableRef();
78 virtual ~MeshMaterialVariableRef();
94 void setPreviousReference(MeshMaterialVariableRef* v);
102 void setNextReference(MeshMaterialVariableRef* v);
110 virtual void updateFromInternal() =0;
135 m_material_variable->fillPartialValuesWithSuperValues(level);
152 template<
typename ClassType>
void
153 setComputeFunction(ClassType* instance,
void (ClassType::*func)())
165 template<
typename ClassType>
void
166 setMaterialComputeFunction(ClassType* instance,
void (ClassType::*func)(
IMeshMaterial*))
172 void _internalInit(IMeshMaterialVariable* mat_variable);
173 bool _isRegistered()
const {
return m_is_registered; }
178 IMeshMaterialVariable* m_material_variable;
181 MeshMaterialVariableRef* m_previous_reference;
184 MeshMaterialVariableRef* m_next_reference;
187 IVariable* m_global_variable;
189 bool m_is_registered;
192 void _checkValid()
const
195 if (!m_material_variable)
199 void _throwInvalid()
const;
209template<
typename DataType_>
210class CellMaterialVariableScalarRef
211:
public MeshMaterialVariableRef
215 using DataType = DataType_;
217 using ItemType =
Cell;
219 using ThatClass = CellMaterialVariableScalarRef<DataType>;
231 ARCANE_CORE_EXPORT ThatClass&
operator=(
const ThatClass& rhs) =
delete;
238 ARCANE_CORE_EXPORT
virtual void refersTo(
const ThatClass& rhs);
243 ARCANE_CORE_EXPORT
void updateFromInternal()
override;
261 return this->operator[](mc.
localId());
267 return this->operator[](mc.
localId());
273 return this->operator[](mc._varIndex());
279 return this->operator[](mc._varIndex());
285 return m_value[0][c.localId()];
291 return m_value[0][c.localId()];
297 return m_value[0][mvi.valueIndex()];
303 return m_value[0][mvi.valueIndex()];
326 ARCANE_CORE_EXPORT
void fill(
const DataType& value);
338 PrivatePartType* m_private_part =
nullptr;
345 void _setContainerView();
357 void* _internalValueAsPointerOfPointer() {
return reinterpret_cast<void*
>(&m_value); }
368template<
typename DataType_>
369class CellMaterialVariableArrayRef
370:
public MeshMaterialVariableRef
374 using DataType = DataType_;
376 using ItemType =
Cell;
378 using ThatClass = CellMaterialVariableArrayRef<DataType>;
390 ARCANE_CORE_EXPORT ThatClass&
operator=(
const ThatClass& rhs) =
delete;
397 ARCANE_CORE_EXPORT
virtual void refersTo(
const ThatClass& rhs);
402 ARCANE_CORE_EXPORT
void updateFromInternal()
override;
437 return this->operator[](mc.
localId());
443 return this->operator[](mc.
localId());
449 return m_value[0][c.localId()];
455 return m_value[0][c.localId()];
461 return m_value[0][mvi.valueIndex()];
467 return m_value[0][mvi.valueIndex()];
472 PrivatePartType* m_private_part =
nullptr;
479 void _setContainerView();
Vue modifiable pour un tableau 2D.
Vue modifiable d'un tableau d'un type T.
Classe de base des vecteurs 1D de données.
Vue constante d'un tableau de type T.
Maille arcane avec info matériaux et milieux.
Enumérateur sur les constituants d'une maille.
Variable tableau sur les mailles d'un matériau du maillage. Pour l'instant, cette classe n'est instan...
ArrayView< DataType > operator[](CellLocalId c)
Valeur globale de la variable pour la maille c.
ConstArrayView< DataType > operator[](ComponentItemLocalId mc) const
Valeur partielle de la variable pour la maille matériau mc.
CellMaterialVariableArrayRef()=delete
Constructeur vide (interdit)
ArrayView< DataType > operator[](PureMatVarIndex mvi)
Valeur de la variable pour la maille matériau mvi.
ThatClass & operator=(const ThatClass &rhs)=delete
Opérateur de recopie (interdit)
ConstArrayView< DataType > operator[](CellLocalId c) const
Valeur globale de la variable pour la maille c.
CellMaterialVariableArrayRef(const MaterialVariableBuildInfo &vb)
Construit une référence à la variable spécifiée dans vb.
const GlobalVariableRefType & globalVariable() const
Variable globale associée à cette variable matériau.
GlobalVariableRefType & globalVariable()
Variable globale associée à cette variable matériau.
ArrayView< DataType > operator[](ComponentItemLocalId mc)
Valeur partielle de la variable pour la maille matériau mc.
virtual void refersTo(const ThatClass &rhs)
Positionne la référence de l'instance à la variable rhs.
void resize(Integer dim2_size)
Redimensionne le nombre d'éléments du tableau.
ConstArrayView< DataType > operator[](PureMatVarIndex mvi) const
Valeur de la variable pour la maille matériau mvi.
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 & operator[](ComponentItemLocalId mc)
Valeur partielle de la variable pour la maille matériau mc.
void fillToArray(IMeshMaterial *mat, Array< DataType > &values, Int32ConstArrayView indexes)
Remplit un tableau à partir des valeurs de la variable pour un matériau.
DataType operator[](PureMatVarIndex mvi) const
Valeur de la variable pour la maille matériau mvi.
const GlobalVariableRefType & globalVariable() const
Variable globale associée à cette variable matériau.
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.
DataType operator[](ComponentItemLocalId mc) const
Valeur partielle de la variable pour la maille matériau mc.
void fillFromArray(IMeshMaterial *mat, ConstArrayView< DataType > values, Int32ConstArrayView indexes)
Remplit les valeurs de la variable pour un matériau.
DataType & operator[](CellComponentCellEnumerator mc)
Valeur partielle de la variable pour l'itérateur mc.
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 fillToArray(IMeshMaterial *mat, ArrayView< DataType > values, Int32ConstArrayView indexes)
Remplit un tableau à partir des valeurs de la variable pour un matériau.
void fillToArray(IMeshMaterial *mat, Array< DataType > &values)
Remplit un tableau à partir des valeurs de la variable pour un matériau.
CellMaterialVariableScalarRef(const MaterialVariableBuildInfo &vb)
Construit une référence à la variable spécifiée dans vb.
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.
DataType operator[](CellComponentCellEnumerator mc) const
Valeur partielle de la variable pour l'itérateur mc.
DataType operator[](CellLocalId c) const
Valeur globale de la variable pour la maille c.
DataType & operator[](CellLocalId c)
Valeur globale de la variable pour la maille c.
virtual void refersTo(const ThatClass &rhs)
Positionne la référence de l'instance à la variable rhs.
CellMaterialVariableScalarRef()=delete
Constructeur vide (interdit)
ThatClass & operator=(const ThatClass &rhs)=delete
Opérateur de recopie (interdit)
void fillToArray(IMeshMaterial *mat, ArrayView< DataType > values)
Remplit un tableau à partir des valeurs de la variable pour un matériau.
DataType & operator[](PureMatVarIndex mvi)
Valeur de la variable pour la maille matériau mvi.
constexpr __host__ __device__ MatVarIndex localId() const
Index générique pour accéder aux valeurs d'une variable.
Interface d'une variable matériau d'un maillage.
Interface d'un matériau d'un maillage.
Représente un index sur les variables matériaux et milieux.
constexpr __host__ __device__ Int32 arrayIndex() const
Retourne l'indice du tableau de valeur dans la liste des variables.
constexpr __host__ __device__ Int32 valueIndex() const
Retourne l'indice dans le tableau de valeur.
Interface de la classe fonctor de recalcul d'une variable.
Classe de base des références aux variables matériaux.
MeshMaterialVariableRef * nextReference()
Référence suivante (ou null) sur variable()
IMeshMaterialVariable * materialVariable() const
Variable matériau associée.
MatVarSpace space() const
Espace de définition de la variable (matériau+milieu ou milieu uniquement)
MeshMaterialVariableRef * previousReference()
Référence précédente (ou null) sur variable()
void unregisterVariable()
Supprime l'enregistrement de la variable (interne)
void fillPartialValuesWithSuperValues(Int32 level)
Remplit les valeurs partielles avec la valeur de la maille du dessus. Si level vaut LEVEL_MATERIAL,...
void registerVariable()
Enregistre la variable (interne)
Synchronisation d'une liste de variables matériaux.
Index d'un Item matériaux pure dans une variable.
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.
Interface de la classe fonctor de recalcul d'une variable.
Référence à une variable.
Active toujours les traces dans les parties Arcane concernant les matériaux.
CellMaterialVariableArrayRef< Int32 > MaterialVariableCellArrayInt32
Variable matériau de type tableau de Int32
CellMaterialVariableScalarRef< Real2x2 > MaterialVariableCellReal2x2
Variable matériau de type Real2x2
MaterialVariableCellArrayInt32 MaterialVariableCellArrayInteger
Variable matériau de type tableau de Integer
MaterialVariableCellInt32 MaterialVariableCellInteger
Variable matériau de type Integer
CellMaterialVariableArrayRef< Real3 > MaterialVariableCellArrayReal3
Variable matériau de type tableau de Real3
CellMaterialVariableArrayRef< Int16 > MaterialVariableCellArrayInt16
Variable matériau de type tableau de Int16
CellMaterialVariableScalarRef< Int16 > MaterialVariableCellInt16
Variable matériau de type Int16
CellMaterialVariableScalarRef< Real2 > MaterialVariableCellReal2
Variable matériau de type Real2
CellMaterialVariableScalarRef< Real3x3 > MaterialVariableCellReal3x3
Variable matériau de type Real3x3
CellMaterialVariableArrayRef< Byte > MaterialVariableCellArrayByte
Variable matériau de type tableau de Byte
CellMaterialVariableArrayRef< Real2x2 > MaterialVariableCellArrayReal2x2
Variable matériau de type tableau de Real2x2
CellMaterialVariableScalarRef< Byte > MaterialVariableCellByte
Variable matériau de type Byte
CellMaterialVariableScalarRef< Int64 > MaterialVariableCellInt64
Variable matériau de type Int64
CellMaterialVariableArrayRef< Real2 > MaterialVariableCellArrayReal2
Variable matériau de type tableau de Real2
CellMaterialVariableScalarRef< Real3 > MaterialVariableCellReal3
Variable matériau de type Real3
CellMaterialVariableArrayRef< Int64 > MaterialVariableCellArrayInt64
Variable matériau de type tableau de Int64
CellMaterialVariableScalarRef< Real > MaterialVariableCellReal
Variable matériau de type Real
MatVarSpace
Espace de définition d'une variable matériau.
CellMaterialVariableScalarRef< Int32 > MaterialVariableCellInt32
Variable matériau de type Int32
CellMaterialVariableArrayRef< Real > MaterialVariableCellArrayReal
Variable matériau de type tableau de Real
CellMaterialVariableArrayRef< Real3x3 > MaterialVariableCellArrayReal3x3
Variable matériau de type tableau de Real3x3
Int32 Integer
Type représentant un entier.
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
std::int32_t Int32
Type entier signé sur 32 bits.