Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::Materials::MeshMaterialVariable Class Referenceabstract

Base class for material variables. More...

#include <arcane/materials/MeshMaterialVariable.h>

Inheritance diagram for Arcane::Materials::MeshMaterialVariable:
Collaboration diagram for Arcane::Materials::MeshMaterialVariable:

Public Member Functions

 MeshMaterialVariable (const MaterialVariableBuildInfo &v, MatVarSpace mvs)
String name () const override
 Name of the variable.
void addVariableRef (MeshMaterialVariableRef *var_ref) override
 Adds a reference to this variable.
void removeVariableRef (MeshMaterialVariableRef *var_ref) override
 Removes a reference to this variable.
MeshMaterialVariableReffirstReference () const override
IVariablematerialVariable (IMeshMaterial *mat) override
 Variable containing the specific values of the material mat.
void setKeepOnChange (bool v) override
 Indicates whether the variable value should be kept after a change in the list of materials.
bool keepOnChange () const override
 Indicates whether the variable value should be kept after a change in the list of materials.
MatVarSpace space () const override
 Variable definition space (material+environment or environment only).
Dependency Management
void update (IMeshMaterial *mat) override
 Recalculates the variable for material mat if necessary.
void setUpToDate (IMeshMaterial *mat) override
 Indicates that the variable has just been updated.
Int64 modifiedTime (IMeshMaterial *mat) override
 Time when the variable was updated.
void addDepend (IMeshMaterialVariable *var) override
 Adds var to the dependency list.
void addDepend (IMeshMaterialVariable *var, const TraceInfo &tinfo) override
 Adds var to the dependency list with trace info tinfo.
void addDepend (IVariable *var) override
 Adds var to the dependency list.
void addDepend (IVariable *var, const TraceInfo &tinfo) override
 Adds var to the dependency list with trace info tinfo.
void removeDepend (IMeshMaterialVariable *var) override
 Removes var from the dependency list.
void removeDepend (IVariable *var) override
 Removes var from the dependency list.
void setComputeFunction (IMeshMaterialVariableComputeFunction *v) override
 Sets the variable's recalculation function.
IMeshMaterialVariableComputeFunctioncomputeFunction () override
 Function used to update the variable.
void dependInfos (Array< VariableDependInfo > &infos, Array< MeshMaterialVariableDependInfo > &mat_infos) override
 Dependency information.
IMeshMaterialVariableInternal_internalApi () override
Public Member Functions inherited from Arcane::Materials::IMeshMaterialVariable
virtual IVariableglobalVariable () const =0
 Associated global variable on the mesh.
virtual void buildFromManager (bool is_continue)=0
 Builds the variable information. For internal use in Arcane.
virtual void syncReferences ()=0
 Synchronizes references.
virtual void synchronize ()=0
 Synchronizes the variable.
virtual void synchronize (MeshMaterialVariableSynchronizerList &sync_list)=0
virtual void dumpValues (std::ostream &ostr)=0
 Dumps the variable values to the stream ostr.
virtual void dumpValues (std::ostream &ostr, AllEnvCellVectorView view)=0
 Dumps the variable values for the view view to the stream ostr.
virtual void fillPartialValuesWithGlobalValues ()=0
 Fills partial values with the value of the associated global cell.
virtual void fillPartialValuesWithSuperValues (Int32 level)=0
 Fills partial values with the value of the super cell. If level equals LEVEL_MATERIAL, it copies material values with the middle one. If level equals LEVEL_ENVIRONMENT, it copies environment values with the global cell's. If level equals LEVEL_ALLENVIRONMENT, it fills all partial values with the global cell's value (this makes this method equivalent to fillGlobalValuesWithGlobalValues()).
virtual void serialize (ISerializer *sbuffer, Int32ConstArrayView ids)=0
 Serializes the variable for local ID entities ids.

Private Attributes

friend MeshMaterialVariablePrivate
friend MeshMaterialVariableSynchronizerList

Public functions reserved for Arcane to manage synchronizations

MeshMaterialVariablePrivate * m_p = nullptr
UniqueArray< Span< std::byte > > m_views_as_bytes
virtual Int32 dataTypeSize () const =0
void incrementReference ()
virtual void copyToBuffer (ConstArrayView< MatVarIndex > matvar_indexes, ByteArrayView bytes) const =0
virtual void copyFromBuffer (ConstArrayView< MatVarIndex > matvar_indexes, ByteConstArrayView bytes)=0
ITraceMng_traceMng () const
void _copyToBuffer (SmallSpan< const MatVarIndex > matvar_indexes, Span< std::byte > bytes, RunQueue *queue) const
void _copyFromBuffer (SmallSpan< const MatVarIndex > matvar_indexes, Span< const std::byte > bytes, RunQueue *queue)
virtual Ref< IData_internalCreateSaveDataRef (Integer nb_value)=0
virtual void _saveData (IMeshComponent *component, IData *data)=0
virtual void _restoreData (IMeshComponent *component, IData *data, Integer data_index, Int32ConstArrayView ids, bool allow_null_id)=0
virtual void _copyBetweenPartialAndGlobal (const CopyBetweenPartialAndGlobalArgs &args)=0
virtual void _initializeNewItemsWithZero (InitializeWithZeroArgs &args)=0
virtual void _syncReferences (bool update_views)=0
virtual void _resizeForIndexer (ResizeVariableIndexerArgs &args)=0
static SmallSpan< const Int32_toInt32Indexes (SmallSpan< const MatVarIndex > indexes)
 Converts a view of MatVarIndex to a view of Int32.
static void _genericCopyTo (Span< const std::byte > input, SmallSpan< const Int32 > input_indexes, Span< std::byte > output, SmallSpan< const Int32 > output_indexes, const RunQueue &queue, Int32 data_type_size)

Detailed Description

Base class for material variables.

This class contains the implementation of material variables. It is internal to Arcane. Generally, IMeshMaterialVariable should be used.

Definition at line 69 of file MeshMaterialVariable.h.

Constructor & Destructor Documentation

◆ MeshMaterialVariable()

Arcane::Materials::MeshMaterialVariable::MeshMaterialVariable ( const MaterialVariableBuildInfo & v,
MatVarSpace mvs )

Definition at line 182 of file MeshMaterialVariable.cc.

◆ ~MeshMaterialVariable()

Arcane::Materials::MeshMaterialVariable::~MeshMaterialVariable ( )
override

Definition at line 192 of file MeshMaterialVariable.cc.

Member Function Documentation

◆ _copyFromBuffer()

void Arcane::Materials::MeshMaterialVariable::_copyFromBuffer ( SmallSpan< const MatVarIndex > matvar_indexes,
Span< const std::byte > bytes,
RunQueue * queue )
protected

Definition at line 500 of file MeshMaterialVariable.cc.

◆ _copyToBuffer()

void Arcane::Materials::MeshMaterialVariable::_copyToBuffer ( SmallSpan< const MatVarIndex > matvar_indexes,
Span< std::byte > bytes,
RunQueue * queue ) const
protected

Definition at line 485 of file MeshMaterialVariable.cc.

◆ _genericCopyTo()

void Arcane::Materials::MeshMaterialVariable::_genericCopyTo ( Span< const std::byte > input,
SmallSpan< const Int32 > input_indexes,
Span< std::byte > output,
SmallSpan< const Int32 > output_indexes,
const RunQueue & queue,
Int32 data_type_size )
static

Definition at line 515 of file MeshMaterialVariable.cc.

◆ _internalApi()

IMeshMaterialVariableInternal * Arcane::Materials::MeshMaterialVariable::_internalApi ( )
overridevirtual

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 546 of file MeshMaterialVariable.cc.

◆ _toInt32Indexes()

SmallSpan< const Int32 > Arcane::Materials::MeshMaterialVariable::_toInt32Indexes ( SmallSpan< const MatVarIndex > indexes)
staticprivate

Converts a view of MatVarIndex to a view of Int32.

Assumes that a MatVarIndex contains 2 Int32.

Definition at line 474 of file MeshMaterialVariable.cc.

References Arcane::SpanImpl< T, SizeType, Extent >::data(), and Arcane::SpanImpl< T, SizeType, Extent >::size().

Here is the call graph for this function:

◆ _traceMng()

ITraceMng * Arcane::Materials::MeshMaterialVariable::_traceMng ( ) const
protected

Definition at line 451 of file MeshMaterialVariable.cc.

◆ addDepend() [1/4]

void Arcane::Materials::MeshMaterialVariable::addDepend ( IMeshMaterialVariable * var)
overridevirtual

Adds var to the dependency list.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 388 of file MeshMaterialVariable.cc.

◆ addDepend() [2/4]

void Arcane::Materials::MeshMaterialVariable::addDepend ( IMeshMaterialVariable * var,
const TraceInfo & tinfo )
overridevirtual

Adds var to the dependency list with trace info tinfo.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 394 of file MeshMaterialVariable.cc.

◆ addDepend() [3/4]

void Arcane::Materials::MeshMaterialVariable::addDepend ( IVariable * var)
overridevirtual

Adds var to the dependency list.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 407 of file MeshMaterialVariable.cc.

◆ addDepend() [4/4]

void Arcane::Materials::MeshMaterialVariable::addDepend ( IVariable * var,
const TraceInfo & tinfo )
overridevirtual

Adds var to the dependency list with trace info tinfo.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 413 of file MeshMaterialVariable.cc.

◆ addVariableRef()

void Arcane::Materials::MeshMaterialVariable::addVariableRef ( MeshMaterialVariableRef * var_ref)
overridevirtual

Adds a reference to this variable.

Precondition: var_ref must not already reference a variable.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 216 of file MeshMaterialVariable.cc.

References Arcane::Materials::MeshMaterialVariableRef::previousReference(), Arcane::Materials::MeshMaterialVariableRef::setNextReference(), and Arcane::Materials::MeshMaterialVariableRef::setPreviousReference().

Here is the call graph for this function:

◆ computeFunction()

IMeshMaterialVariableComputeFunction * Arcane::Materials::MeshMaterialVariable::computeFunction ( )
overridevirtual

Function used to update the variable.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 432 of file MeshMaterialVariable.cc.

◆ dependInfos()

void Arcane::Materials::MeshMaterialVariable::dependInfos ( Array< VariableDependInfo > & infos,
Array< MeshMaterialVariableDependInfo > & mat_infos )
overridevirtual

Dependency information.

Fills the array infos with dependency information on global variables and the array mat_infos with those on material variables.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 438 of file MeshMaterialVariable.cc.

References Arcane::Array< T >::add().

Here is the call graph for this function:

◆ firstReference()

MeshMaterialVariableRef * Arcane::Materials::MeshMaterialVariable::firstReference ( ) const
overridevirtual

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 281 of file MeshMaterialVariable.cc.

◆ incrementReference()

void Arcane::Materials::MeshMaterialVariable::incrementReference ( )

Increments the reference counter.

Definition at line 201 of file MeshMaterialVariable.cc.

◆ keepOnChange()

bool Arcane::Materials::MeshMaterialVariable::keepOnChange ( ) const
overridevirtual

Indicates whether the variable value should be kept after a change in the list of materials.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 318 of file MeshMaterialVariable.cc.

◆ materialVariable()

IVariable * Arcane::Materials::MeshMaterialVariable::materialVariable ( IMeshMaterial * mat)
overridevirtual

Variable containing the specific values of the material mat.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 299 of file MeshMaterialVariable.cc.

References Arcane::Materials::IMeshComponent::_internalApi(), and Arcane::Materials::IMeshComponentInternal::variableIndexer().

Here is the call graph for this function:

◆ modifiedTime()

Int64 Arcane::Materials::MeshMaterialVariable::modifiedTime ( IMeshMaterial * mat)
overridevirtual

Time when the variable was updated.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 381 of file MeshMaterialVariable.cc.

References Arcane::Materials::IMeshComponent::id().

Here is the call graph for this function:

◆ name()

String Arcane::Materials::MeshMaterialVariable::name ( ) const
overridevirtual

Name of the variable.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 290 of file MeshMaterialVariable.cc.

Referenced by Arcane::Materials::MeshMaterialVariableSynchronizerList::add(), Arcane::Materials::ItemMaterialVariableBase< Traits >::buildFromManager(), Arcane::Materials::ItemMaterialVariableScalar< DataType >::dumpValues(), Arcane::Materials::ItemMaterialVariableScalar< DataType >::dumpValues(), and update().

Here is the caller graph for this function:

◆ removeDepend() [1/2]

void Arcane::Materials::MeshMaterialVariable::removeDepend ( IMeshMaterialVariable * var)
overridevirtual

Removes var from the dependency list.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 400 of file MeshMaterialVariable.cc.

◆ removeDepend() [2/2]

void Arcane::Materials::MeshMaterialVariable::removeDepend ( IVariable * var)
overridevirtual

Removes var from the dependency list.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 419 of file MeshMaterialVariable.cc.

◆ removeVariableRef()

void Arcane::Materials::MeshMaterialVariable::removeVariableRef ( MeshMaterialVariableRef * var_ref)
overridevirtual

Removes a reference to this variable.

Precondition: var_ref must reference this variable (a call to addVariableRef() must have been made on this variable).

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 237 of file MeshMaterialVariable.cc.

References ARCANE_FATAL, Arcane::Materials::MeshMaterialVariableRef::nextReference(), Arcane::Materials::MeshMaterialVariableRef::previousReference(), Arcane::Materials::MeshMaterialVariableRef::setNextReference(), and Arcane::Materials::MeshMaterialVariableRef::setPreviousReference().

Here is the call graph for this function:

◆ setComputeFunction()

void Arcane::Materials::MeshMaterialVariable::setComputeFunction ( IMeshMaterialVariableComputeFunction * v)
overridevirtual

Sets the variable's recalculation function.

If a recalculation function already existed, it is destroyed and replaced by this one.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 426 of file MeshMaterialVariable.cc.

◆ setKeepOnChange()

void Arcane::Materials::MeshMaterialVariable::setKeepOnChange ( bool v)
overridevirtual

Indicates whether the variable value should be kept after a change in the list of materials.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 309 of file MeshMaterialVariable.cc.

◆ setUpToDate()

void Arcane::Materials::MeshMaterialVariable::setUpToDate ( IMeshMaterial * mat)
overridevirtual

Indicates that the variable has just been updated.

For correct dependency management, this property must be called every time a variable has been updated.

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 374 of file MeshMaterialVariable.cc.

References Arcane::Materials::IMeshComponent::id(), and Arcane::IVariable::incrementModifiedTime().

Here is the call graph for this function:

◆ space()

MatVarSpace Arcane::Materials::MeshMaterialVariable::space ( ) const
overridevirtual

Variable definition space (material+environment or environment only).

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 460 of file MeshMaterialVariable.cc.

Referenced by Arcane::Materials::MeshMaterialVariableSynchronizerList::add(), Arcane::Materials::ItemMaterialVariableArray< DataType >::serialize(), and Arcane::Materials::ItemMaterialVariableScalar< DataType >::serialize().

Here is the caller graph for this function:

◆ update()

void Arcane::Materials::MeshMaterialVariable::update ( IMeshMaterial * mat)
overridevirtual

Recalculates the variable for material mat if necessary.

Through the dependency mechanism, this operation is called recursively on all variables that the instance depends on. The recalculation function computeFunction() is then called if it turns out that one of the variables it depends on has been modified more recently.

Precondition: computeFunction() != 0

Implements Arcane::Materials::IMeshMaterialVariable.

Definition at line 327 of file MeshMaterialVariable.cc.

References ARCANE_FATAL, Arcane::Materials::IMeshMaterialVariableComputeFunction::execute(), Arcane::Materials::IMeshComponent::id(), Arcane::IVariable::modifiedTime(), Arcane::Materials::IMeshMaterialVariable::modifiedTime(), name(), Arcane::IVariable::update(), Arcane::Materials::MeshMaterialVariableDependInfo::variable(), and Arcane::VariableDependInfo::variable().

Here is the call graph for this function:

Member Data Documentation

◆ m_p

MeshMaterialVariablePrivate* Arcane::Materials::MeshMaterialVariable::m_p = nullptr
protected

Definition at line 143 of file MeshMaterialVariable.h.

◆ m_views_as_bytes

UniqueArray<Span<std::byte> > Arcane::Materials::MeshMaterialVariable::m_views_as_bytes
protected

Definition at line 144 of file MeshMaterialVariable.h.

◆ MeshMaterialVariablePrivate

friend Arcane::Materials::MeshMaterialVariable::MeshMaterialVariablePrivate
private

Definition at line 72 of file MeshMaterialVariable.h.

◆ MeshMaterialVariableSynchronizerList

friend Arcane::Materials::MeshMaterialVariable::MeshMaterialVariableSynchronizerList
private

Definition at line 74 of file MeshMaterialVariable.h.


The documentation for this class was generated from the following files: