Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::Materials::IMeshMaterialMng Class Referenceabstract

Interface for the material and environment manager of a mesh. More...

#include <arcane/core/materials/IMeshMaterialMng.h>

Classes

class  IFactory

Public Member Functions

virtual IMeshmesh ()=0
 Associated mesh.
virtual ITraceMngtraceMng ()=0
 Trace manager.
virtual MeshMaterialInforegisterMaterialInfo (const String &name)=0
 Registers the material info with name name.
virtual IMeshEnvironmentcreateEnvironment (const MeshEnvironmentBuildInfo &infos)=0
 Creates an environment with the info infos.
virtual IMeshBlockcreateBlock (const MeshBlockBuildInfo &infos)=0
 Creates a block.
virtual void addEnvironmentToBlock (IMeshBlock *block, IMeshEnvironment *env)=0
 Adds an environment to an existing block.
virtual void removeEnvironmentToBlock (IMeshBlock *block, IMeshEnvironment *env)=0
 Removes an environment from an existing block.
virtual void endCreate (bool is_continue=false)=0
 Indicates that environment creation is finished.
virtual void recreateFromDump ()=0
 Recreates the material and environment info from the dump info.
virtual void setKeepValuesAfterChange (bool v)=0
 Sets the saving of values between two modifications of the materials.
virtual bool isKeepValuesAfterChange () const =0
 Indicates if variable values are preserved between modifications.
virtual void setDataInitialisationWithZero (bool v)=0
 Indicates how to initialize new values in material and environment cells.
virtual bool isDataInitialisationWithZero () const =0
 Indicates how to initialize new values in material and environment cells.
virtual void setMeshModificationNotified (bool v)=0
 Indicates if environments and materials follow changes in the mesh topology.
virtual bool isMeshModificationNotified () const =0
 Indicates if environments and materials follow changes in the mesh topology.
virtual void setModificationFlags (int v)=0
 Sets the flags to parameterize material/environment modifications.
virtual int modificationFlags () const =0
 Flags to parameterize modifications.
virtual void setAllocateScalarEnvironmentVariableAsMaterial (bool v)=0
 Sets the option indicating whether scalar variables of environments are allocated on materials.
virtual bool isAllocateScalarEnvironmentVariableAsMaterial () const =0
 Indicates if environment scalar variables are allocated on materials.
virtual String name () const =0
 Manager name.
virtual void setDataCompressorServiceName (const String &name)=0
 Name of the service used to compress data during forceRecompute().
virtual String dataCompressorServiceName () const =0
 Virtual name of the service used to compress data.
virtual ConstArrayView< IMeshMaterial * > materials () const =0
 List of materials.
virtual MeshComponentList materialsAsComponents () const =0
 List of materials viewed as components.
virtual ConstArrayView< IMeshEnvironment * > environments () const =0
 List of environments.
virtual MeshComponentList environmentsAsComponents () const =0
 List of environments viewed as components.
virtual MeshComponentList components () const =0
 List of all components.
virtual ConstArrayView< IMeshBlock * > blocks () const =0
 List of blocks.
virtual IMeshEnvironmentfindEnvironment (const String &name, bool throw_exception=true)=0
 Returns the environment with name name.
virtual IMeshBlockfindBlock (const String &name, bool throw_exception=true)=0
 Returns the block with name name.
virtual void fillWithUsedVariables (Array< IMeshMaterialVariable * > &variables)=0
 Fills the array variables with the list of used material variables.
virtual IMeshMaterialVariablefindVariable (const String &name)=0
 Variable with name name or nullptr if none of this name exists.
virtual IMeshMaterialVariablecheckVariable (IVariable *global_var)=0
 Material variable associated with the global variable global_var (nullptr if none).
virtual void dumpInfos (std::ostream &o)=0
 Writes the material and environment info to the stream o.
virtual void dumpCellInfos (Cell cell, std::ostream &o)=0
 Writes the cell info cell to the stream o.
virtual void checkValid ()=0
 Checks the validity of internal structures.
virtual AllEnvCellVectorView view (const CellGroup &cells)=0
 View of environment cells corresponding to the group cells.
virtual AllEnvCellVectorView view (CellVectorView cells)=0
 View of environment cells corresponding to the group cells.
virtual AllEnvCellVectorView view (SmallSpan< const Int32 > cell_local_id)=0
 View of environment cells corresponding to local cell IDs cells_local_id.
virtual CellToAllEnvCellConverter cellToAllEnvCellConverter ()=0
 Creates an instance to convert from 'Cell' to 'AllEnvCell'.
virtual void forceRecompute ()=0
 Forces the recalculation of material information.
virtual MutexvariableLock ()=0
 Lock used for multi-threading.
virtual bool synchronizeMaterialsInCells ()=0
 Synchronizes material cells.
virtual void checkMaterialsInCells (Integer max_print=10)=0
 Checks that material cells are consistent between subdomains.
virtual void visitVariables (IFunctorWithArgumentT< IMeshMaterialVariable * > *functor)=0
 Applies the functor functor to all material variables.
virtual Int64 timestamp () const =0
 Counter for the number of modifications of the material list and environments.
virtual void setSynchronizeVariableVersion (Integer version)=0
 Sets the version of the implementation for synchronizing material variables.
virtual Integer synchronizeVariableVersion () const =0
 Version of the implementation for synchronizing material variables.
virtual bool isInMeshMaterialExchange () const =0
 True if a mesh exchange with material management is underway.
virtual IMeshMaterialVariableFactoryMngvariableFactoryMng () const =0
 Interface of the variable factory.
virtual void enableCellToAllEnvCellForRunCommand (bool is_enable, bool force_create=false)=0
 Activates or deactivates the construction and update of the table of "connectivity" CellLocalId -> AllEnvCell for RUNCOMMAND.
virtual bool isCellToAllEnvCellForRunCommand () const =0
virtual void setUseMaterialValueWhenRemovingPartialValue (bool v)=0
 Indicates whether the material or environment value is used when transforming a cell from a partial cell to a pure cell.
virtual bool isUseMaterialValueWhenRemovingPartialValue () const =0
virtual IMeshMaterialMngInternal * _internalApi () const =0
 Internal API for Arcane.
virtual IMeshMaterialVariableSynchronizer_allCellsMatEnvSynchronizer ()=0
virtual IMeshMaterialVariableSynchronizer_allCellsEnvOnlySynchronizer ()=0

Static Public Member Functions

static IMeshMaterialMnggetReference (const MeshHandleOrMesh &mesh_handle, bool create=true)
 Retrieves or creates the reference associated with mesh.
static Ref< IMeshMaterialMnggetTrueReference (const MeshHandle &mesh_handle, bool create=true)
 Retrieves or creates the reference associated with mesh.

Friends

class MeshMaterialMngFactory

Detailed Description

Interface for the material and environment manager of a mesh.

This interface manages the different components (IMeshComponent) multi-materials of a mesh, as well as their associated variables. These components can be either materials (IMeshMaterial), or environments (IMeshEnvironment). It is possible to retrieve the list of materials via materials() and the list of environments via environments(). It is also possible to retrieve one of these two lists in the form

The current implementation only manages materials and environments on the cells.

Once this instance is created, via getReference(), the first thing to do is register the list of materials via registerMaterialInfo(). It is then possible to create each environment by indicating the list of materials that compose it via createEnvironment(). Once this is finished, you must call endCreate() to finish initialization. The list of materials and environments cannot be modified except during initialization. It must not change afterward.

Any modification of the cell list of an environment or a material must be done via an instance of MeshMaterialModifier.

Definition at line 57 of file core/materials/IMeshMaterialMng.h.

Member Function Documentation

◆ addEnvironmentToBlock()

virtual void Arcane::Materials::IMeshMaterialMng::addEnvironmentToBlock ( IMeshBlock * block,
IMeshEnvironment * env )
pure virtual

Adds an environment to an existing block.

Adds the environment env to the block block.

The modification of a block can only take place during initialization, (i.e., before calling endCreate()).

Warning
This method does not modify the block->cells() group, and it is up to the caller to add the environment's cells to the group if necessary.

◆ checkMaterialsInCells()

virtual void Arcane::Materials::IMeshMaterialMng::checkMaterialsInCells ( Integer max_print = 10)
pure virtual

Checks that material cells are consistent between subdomains.

This method allows checking that all ghost cells of our subdomain have the same list of materials as the associated owned cells.

In case of an error, the list of inconsistent cells is displayed and a FatalErrorException is raised.

max_print indicates the maximum number of errors to display in case of an error. If it is negative, all cells are displayed.

◆ components()

virtual MeshComponentList Arcane::Materials::IMeshMaterialMng::components ( ) const
pure virtual

List of all components.

This list is the concatenation of environmentsAsComponents() and materialsAsComponents(). It is only valid once endCreate() has been called.

◆ createBlock()

virtual IMeshBlock * Arcane::Materials::IMeshMaterialMng::createBlock ( const MeshBlockBuildInfo & infos)
pure virtual

Creates a block.

Creates a block with the info infos.

The creation of a block can only take place during initialization, (i.e., before calling endCreate()), but after the creation of environments.

◆ createEnvironment()

virtual IMeshEnvironment * Arcane::Materials::IMeshMaterialMng::createEnvironment ( const MeshEnvironmentBuildInfo & infos)
pure virtual

Creates an environment with the info infos.

The creation of an environment can only take place during initialization. The materials constituting the environment must have previously been registered via registerMaterialInfo(). A material can belong to several environments.

◆ enableCellToAllEnvCellForRunCommand()

virtual void Arcane::Materials::IMeshMaterialMng::enableCellToAllEnvCellForRunCommand ( bool is_enable,
bool force_create = false )
pure virtual

Activates or deactivates the construction and update of the table of "connectivity" CellLocalId -> AllEnvCell for RUNCOMMAND.

It can also be activated by the environment variable ARCANE_ALLENVCELL_FOR_RUNCOMMAND. Optionally, the table can be forced to be created, which can be useful during a late call of this method compared to ForceRecompute()

◆ endCreate()

virtual void Arcane::Materials::IMeshMaterialMng::endCreate ( bool is_continue = false)
pure virtual

Indicates that environment creation is finished.

The instance is not usable until this method has been called.

If is_continue is true, it rebuilds for each material and environment the list of their cells from the recovery information.

◆ fillWithUsedVariables()

virtual void Arcane::Materials::IMeshMaterialMng::fillWithUsedVariables ( Array< IMeshMaterialVariable * > & variables)
pure virtual

Fills the array variables with the list of used material variables.

The array variables is cleared before the call.

◆ findBlock()

virtual IMeshBlock * Arcane::Materials::IMeshMaterialMng::findBlock ( const String & name,
bool throw_exception = true )
pure virtual

Returns the block with name name.

If no block with this name exists, returns null if throw_exception is false and throws an exception if throw_exception is true.

References name().

◆ findEnvironment()

virtual IMeshEnvironment * Arcane::Materials::IMeshMaterialMng::findEnvironment ( const String & name,
bool throw_exception = true )
pure virtual

Returns the environment with name name.

If no environment with this name exists, returns null if throw_exception is false and throws an exception if throw_exception is true.

References name().

◆ forceRecompute()

virtual void Arcane::Materials::IMeshMaterialMng::forceRecompute ( )
pure virtual

Forces the recalculation of material information.

This method allows forcing the recalculation of information on cells mixed, for example, following a mesh change. This is a temporary method that will eventually be removed. Mixed values are invalidated after calling this method.

◆ getReference()

IMeshMaterialMng * Arcane::Materials::IMeshMaterialMng::getReference ( const MeshHandleOrMesh & mesh_handle,
bool create = true )
static

Retrieves or creates the reference associated with mesh.

If no material manager is associated with mesh, it will be created when this method is called if create is true. If create is false, no manager is associated with the mesh, a null pointer is returned. The returned instance remains valid as long as the mesh mesh exists.

Definition at line 65 of file IMeshMaterialMng.cc.

References getTrueReference(), and Arcane::MeshHandleOrMesh::handle().

Referenced by Arcane::Materials::MeshMaterialVariableCommonStaticImpl< TrueType >::getReference(), and Arcane::Materials::MeshMaterialVariableBuildTraits< TrueType >::getVariableReference().

◆ getTrueReference()

Ref< IMeshMaterialMng > Arcane::Materials::IMeshMaterialMng::getTrueReference ( const MeshHandle & mesh_handle,
bool create = true )
static

Retrieves or creates the reference associated with mesh.

If no material manager is associated with mesh, it will be created when this method is called if create is true. If create is false, no manager is associated with the mesh, a null pointer is returned. The returned instance remains valid as long as the mesh mesh exists.

Definition at line 48 of file IMeshMaterialMng.cc.

References ARCANE_FATAL, and Arcane::MeshHandle::isNull().

Referenced by getReference().

◆ recreateFromDump()

virtual void Arcane::Materials::IMeshMaterialMng::recreateFromDump ( )
pure virtual

Recreates the material and environment info from the dump info.

This method replaces endCreate() and can only be used during recovery and during initialization.

◆ registerMaterialInfo()

virtual MeshMaterialInfo * Arcane::Materials::IMeshMaterialMng::registerMaterialInfo ( const String & name)
pure virtual

Registers the material info with name name.

This operation only registers the information of a material. This information is then used when creating the environment via createEnvironment().

References name().

◆ removeEnvironmentToBlock()

virtual void Arcane::Materials::IMeshMaterialMng::removeEnvironmentToBlock ( IMeshBlock * block,
IMeshEnvironment * env )
pure virtual

Removes an environment from an existing block.

Removes the environment env from the block block.

The modification of a block can only take place during initialization, (i.e., before calling endCreate()).

Warning
This method does not modify the block->cells() group, and it is up to the caller to add the environment's cells to the group if necessary.

◆ setAllocateScalarEnvironmentVariableAsMaterial()

virtual void Arcane::Materials::IMeshMaterialMng::setAllocateScalarEnvironmentVariableAsMaterial ( bool v)
pure virtual

Sets the option indicating whether scalar variables of environments are allocated on materials.

If active, then environment scalar variables are still allocated on materials. This allows declaring the same variable both as a material variable and an environment variable (e.g., MaterialVariableCellReal and EnvironmentVariableCellReal).

By default, this option is not active.

This method must be enabled before calling endCreate() to be taken into account.

◆ setDataCompressorServiceName()

virtual void Arcane::Materials::IMeshMaterialMng::setDataCompressorServiceName ( const String & name)
pure virtual

Name of the service used to compress data during forceRecompute().

If null (the default), no compression is performed.

References name().

◆ setDataInitialisationWithZero()

virtual void Arcane::Materials::IMeshMaterialMng::setDataInitialisationWithZero ( bool v)
pure virtual

Indicates how to initialize new values in material and environment cells.

If true, the new values are initialized to zero or the null vector following the data type. If false, initialization is done with the global value.

◆ setKeepValuesAfterChange()

virtual void Arcane::Materials::IMeshMaterialMng::setKeepValuesAfterChange ( bool v)
pure virtual

Sets the saving of values between two modifications of the materials.

If active, the values of partial variables are preserved between two modifications of the material list.

◆ setMeshModificationNotified()

virtual void Arcane::Materials::IMeshMaterialMng::setMeshModificationNotified ( bool v)
pure virtual

Indicates if environments and materials follow changes in the mesh topology.

This method must be called before any material creation.

If v is false, environments and materials are not notified of changes in the mesh topology. In this case, all associated data is invalidated.

◆ setModificationFlags()

virtual void Arcane::Materials::IMeshMaterialMng::setModificationFlags ( int v)
pure virtual

Sets the flags to parameterize material/environment modifications.

The possible flags are a combination of eModificationFlags.

For example:

IMeshMaterialMng* mm = ...;
Interface for the material and environment manager of a mesh.
virtual void setModificationFlags(int v)=0
Sets the flags to parameterize material/environment modifications.
@ GenericOptimize
Activates generic optimizations.
@ OptimizeMultiAddRemove
Activates optimizations for multiple additions/removals.

This method must be enabled before calling endCreate() to be taken into account.

◆ setUseMaterialValueWhenRemovingPartialValue()

virtual void Arcane::Materials::IMeshMaterialMng::setUseMaterialValueWhenRemovingPartialValue ( bool v)
pure virtual

Indicates whether the material or environment value is used when transforming a cell from a partial cell to a pure cell.

When transitioning from a partial cell to a pure cell, the partial value must be copied into the global value. By default, the behavior is not the same depending on whether optimizations are active or not (

See also
modificationFlags()). Without optimization, the material value is used. If the optimization eModificationFlags::GenericOptimize is active, the environment value is used.

If this property is true, it allows using the material value in all cases.

◆ synchronizeMaterialsInCells()

virtual bool Arcane::Materials::IMeshMaterialMng::synchronizeMaterialsInCells ( )
pure virtual

Synchronizes material cells.

This method allows synchronizing between subdomains the cells of each material. It is collective

During this call, the subdomain owning N cells sends to the subdomains that possess these N cells as ghost cells the list of materials it possesses. These latter subdomains update this list by adding or removing the necessary materials.

After this call, it is guaranteed that the ghost cells of a subdomain have the same list of materials and environments as the cells of the subdomain that owns these cells. It is possible, in particular, to synchronize variables via MeshMaterialVariableRef::synchronize().

Returns true if the materials of this subdomain have been modified following the synchronization, false otherwise.

◆ timestamp()

virtual Int64 Arcane::Materials::IMeshMaterialMng::timestamp ( ) const
pure virtual

Counter for the number of modifications of the material list and environments.

This counter increases every time materials are added or removed. The increment is not necessarily constant.

Note
Currently, this counter is not saved during a protection and will therefore be 0 during recovery.

◆ MeshMaterialMngFactory

friend class MeshMaterialMngFactory
friend

Definition at line 59 of file core/materials/IMeshMaterialMng.h.


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