Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::Materials::IncrementalComponentModifier Class Reference

Incremental modification of materials. More...

#include <arcane/materials/internal/IncrementalComponentModifier.h>

Inheritance diagram for Arcane::Materials::IncrementalComponentModifier:
Collaboration diagram for Arcane::Materials::IncrementalComponentModifier:

Public Member Functions

 IncrementalComponentModifier (AllEnvData *all_env_data, const RunQueue &queue)
void initialize (bool is_debug)
void apply (MaterialModifierOperation *operation)
void finalize ()
void setDoCopyBetweenPartialAndPure (bool v)
void setDoInitNewItems (bool v)
void flagRemovedCells (SmallSpan< const Int32 > local_ids, bool value_to_set)
Int32 _computeCellsToTransformForEnvironments (SmallSpan< const Int32 > ids)
 Calculates the cells to transform when modifying the cells of an environment.
void _resetTransformedCells (SmallSpan< const Int32 > ids)
void _addItemsToIndexer (MeshMaterialVariableIndexer *var_indexer, SmallSpan< const Int32 > local_ids)
void _removeItemsInGroup (ItemGroup cells, SmallSpan< const Int32 > removed_ids)
void _applyCopyBetweenPartialsAndGlobals (const CopyBetweenPartialAndGlobalArgs &args, RunQueue &queue)
 Performs the copy between partial and global values.
void _applyCopyVariableViews (RunQueue &queue)
 Performs the copy of views for variables.
void _applyInitializeWithZero (const InitializeWithZeroArgs &args)
void _computeItemsToAdd (ComponentItemListBuilder &list_builder, SmallSpan< const Int32 > local_ids)
Public Member Functions inherited from Arcane::TraceAccessor
 TraceAccessor (ITraceMng *m)
 Constructs an accessor via the trace manager m.
 TraceAccessor (const TraceAccessor &rhs)
 Copy constructor.
TraceAccessoroperator= (const TraceAccessor &rhs)
 Copy assignment operator.
virtual ~TraceAccessor ()
 Frees resources.
ITraceMngtraceMng () const
 Trace manager.
TraceMessage info () const
 Flow for an information message.
TraceMessage pinfo () const
 Flow for a parallel information message.
TraceMessage info (char category) const
 Flow for an information message of a given category.
TraceMessage pinfo (char category) const
 Flow for a parallel information message of a given category.
TraceMessage info (bool v) const
 Flow for an information message.
TraceMessage warning () const
 Flow for a warning message.
TraceMessage pwarning () const
TraceMessage error () const
 Flow for an error message.
TraceMessage perror () const
TraceMessage log () const
 Flow for a log message.
TraceMessage plog () const
 Flow for a log message.
TraceMessage logdate () const
 Flow for a log message preceded by the date.
TraceMessage fatal () const
 Flow for a fatal error message.
TraceMessage pfatal () const
 Flow for a parallel fatal error message.
TraceMessageDbg debug (Trace::eDebugLevel=Trace::Medium) const
 Flow for a debug message.
Trace::eDebugLevel configDbgLevel () const
 Debug level of the configuration file.
TraceMessage info (Int32 verbose_level) const
 Flow for an information message of a given level.
TraceMessage linfo () const
 Flow for an information message with the local information level of this instance.
TraceMessage linfo (Int32 relative_level) const
 Flow for an information message with the local information level of this instance.
void fatalMessage (const StandaloneTraceMessage &o) const

Private Member Functions

void _switchCellsForEnvironments (const IMeshEnvironment *modified_env, SmallSpan< const Int32 > ids)
 Transforms entities for environments.
void _switchCellsForMaterials (const MeshMaterial *modified_mat, SmallSpan< const Int32 > ids)
 Transforms entities for an environment.
Int32 _computeCellsToTransformForMaterial (const MeshMaterial *mat, SmallSpan< const Int32 > ids)
 Calculates the cells to transform for material \at mat.
void _removeItemsFromEnvironment (MeshEnvironment *env, MeshMaterial *mat, SmallSpan< const Int32 > local_ids, bool update_env_indexer)
 Removes cells of a material from the environment.
void _addItemsToEnvironment (MeshEnvironment *env, MeshMaterial *mat, SmallSpan< const Int32 > local_ids, bool update_env_indexer)
 Adds the cells of an environment material.
void _copyBetweenPartialsAndGlobals (const CopyBetweenPartialAndGlobalArgs &args)
 Copies between partial and global values.
void _resizeVariablesIndexer (Int32 var_index)
 Resizes the variable index var_index.

Private Attributes

AllEnvDatam_all_env_data = nullptr
MeshMaterialMngm_material_mng = nullptr
ConstituentModifierWorkInfo m_work_info
RunQueue m_queue
bool m_do_copy_between_partial_and_pure = true
bool m_do_init_new_items = true
bool m_is_debug = false
Int32 m_use_generic_copy_between_pure_and_partial = 0
 1 or 2 if we use a generic version for copies between pure and partial
bool m_force_multiple_command_for_resize = false
 True if we force the use of a single command for resizing.

Friends

class MeshMaterialModifierImpl

Additional Inherited Members

Protected Member Functions inherited from Arcane::TraceAccessor
void _setLocalVerboseLevel (Int32 v)
Int32 _localVerboseLevel () const

Detailed Description

Incremental modification of materials.

You must call initialize() to initialize the instance, then call apply() for each operation.

Definition at line 41 of file IncrementalComponentModifier.h.

Constructor & Destructor Documentation

◆ IncrementalComponentModifier()

Arcane::Materials::IncrementalComponentModifier::IncrementalComponentModifier ( AllEnvData * all_env_data,
const RunQueue & queue )

Definition at line 38 of file IncrementalComponentModifier.cc.

Member Function Documentation

◆ _addItemsToEnvironment()

void Arcane::Materials::IncrementalComponentModifier::_addItemsToEnvironment ( MeshEnvironment * env,
MeshMaterial * mat,
SmallSpan< const Int32 > local_ids,
bool update_env_indexer )
private

Adds the cells of an environment material.

Adds the cells given by local_ids to the environment material mat of the environment. The material indexer is updated, and if update_env_indexer is true, the environment's indexer is also updated (meaning the environment appears in the cells local_ids).

Definition at line 301 of file IncrementalComponentModifier.cc.

References Arcane::Materials::ConstituentConnectivityList::fillCellsIsPartial(), Arcane::TraceAccessor::info(), Arcane::Materials::MeshMaterial::name(), and Arcane::SpanImpl< T, SizeType, Extent >::size().

Here is the call graph for this function:

◆ _addItemsToIndexer()

void Arcane::Materials::IncrementalComponentModifier::_addItemsToIndexer ( MeshMaterialVariableIndexer * var_indexer,
SmallSpan< const Int32 > local_ids )

Definition at line 333 of file IncrementalComponentModifier.cc.

◆ _applyCopyBetweenPartialsAndGlobals()

void Arcane::Materials::IncrementalComponentModifier::_applyCopyBetweenPartialsAndGlobals ( const CopyBetweenPartialAndGlobalArgs & args,
RunQueue & queue )

Performs the copy between partial and global values.

This method allows the copy to be done using a single RunCommand.

Definition at line 390 of file IncrementalComponentModifier_Accelerator.cc.

References ARCANE_CHECK_POINTER, ARCANE_FATAL, Arcane::SpanImpl< T, SizeType, Extent >::data(), Arcane::Materials::VariableIndexerCommonArgs::m_copy_data, Arcane::Accelerator::makeCommand(), RUNCOMMAND_LOOP2, and Arcane::SpanImpl< T, SizeType, Extent >::size().

Referenced by _copyBetweenPartialsAndGlobals().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _applyCopyVariableViews()

void Arcane::Materials::IncrementalComponentModifier::_applyCopyVariableViews ( RunQueue & queue)

Performs the copy of views for variables.

This method allows the copies between the CPU and accelerator views of the variables to be done in a single RunCommand

Definition at line 478 of file IncrementalComponentModifier_Accelerator.cc.

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

Referenced by _resizeVariablesIndexer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _applyInitializeWithZero()

void Arcane::Materials::IncrementalComponentModifier::_applyInitializeWithZero ( const InitializeWithZeroArgs & args)

Definition at line 436 of file IncrementalComponentModifier_Accelerator.cc.

◆ _computeCellsToTransformForEnvironments()

Int32 Arcane::Materials::IncrementalComponentModifier::_computeCellsToTransformForEnvironments ( SmallSpan< const Int32 > ids)

Calculates the cells to transform when modifying the cells of an environment.

Definition at line 220 of file IncrementalComponentModifier_Accelerator.cc.

References Arcane::Accelerator::makeCommand(), RUNCOMMAND_LOOP1, and Arcane::SpanImpl< T, SizeType, Extent >::size().

Referenced by _switchCellsForEnvironments().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _computeCellsToTransformForMaterial()

Int32 Arcane::Materials::IncrementalComponentModifier::_computeCellsToTransformForMaterial ( const MeshMaterial * mat,
SmallSpan< const Int32 > ids )
private

Calculates the cells to transform for material \at mat.

Definition at line 240 of file IncrementalComponentModifier.cc.

References Arcane::Materials::ConstituentConnectivityList::fillCellsToTransform().

Referenced by _switchCellsForMaterials().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _computeItemsToAdd()

void Arcane::Materials::IncrementalComponentModifier::_computeItemsToAdd ( ComponentItemListBuilder & list_builder,
SmallSpan< const Int32 > local_ids )

Definition at line 254 of file IncrementalComponentModifier_Accelerator.cc.

◆ _copyBetweenPartialsAndGlobals()

void Arcane::Materials::IncrementalComponentModifier::_copyBetweenPartialsAndGlobals ( const CopyBetweenPartialAndGlobalArgs & args)
private

Copies between partial and global values.

If pure_to_partial is true, then we copy the global values to the partial values; otherwise, we do the reverse. (of material deletion)

Definition at line 473 of file IncrementalComponentModifier.cc.

References _applyCopyBetweenPartialsAndGlobals(), _resizeVariablesIndexer(), Arcane::Accelerator::RunQueuePool::barrier(), Arcane::Array< T >::clear(), Arcane::Array< T >::data(), Arccore::SpanImpl< T, SizeType, Extent >::empty(), Arcane::Materials::VariableIndexerCommonArgs::m_copy_data, m_use_generic_copy_between_pure_and_partial, Arcane::Array< T >::reserve(), Arcane::AbstractArray< T >::size(), and Arcane::Materials::MeshMaterialMng::visitVariables().

Referenced by _switchCellsForEnvironments(), and _switchCellsForMaterials().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _removeItemsFromEnvironment()

void Arcane::Materials::IncrementalComponentModifier::_removeItemsFromEnvironment ( MeshEnvironment * env,
MeshMaterial * mat,
SmallSpan< const Int32 > local_ids,
bool update_env_indexer )
private

Removes cells of a material from the environment.

Removes the cells provided by local_ids from material mat in the environment. The material indexer is updated, and if update_env_indexer is true, the environment indexer is also updated (which means the environment disappears from the cells local_ids).

TODO: optimize this by not iterating over all cells materials of the environment (removed_local_ids_filter must be removed). If we know the index of each cell in the MatVarIndex from the indexer, we can directly access it.

Definition at line 268 of file IncrementalComponentModifier.cc.

References Arcane::TraceAccessor::info(), Arcane::Materials::MeshMaterial::name(), and Arcane::SpanImpl< T, SizeType, Extent >::size().

Here is the call graph for this function:

◆ _removeItemsInGroup()

void Arcane::Materials::IncrementalComponentModifier::_removeItemsInGroup ( ItemGroup cells,
SmallSpan< const Int32 > removed_ids )

Definition at line 345 of file IncrementalComponentModifier_Accelerator.cc.

◆ _resetTransformedCells()

void Arcane::Materials::IncrementalComponentModifier::_resetTransformedCells ( SmallSpan< const Int32 > ids)

Definition at line 328 of file IncrementalComponentModifier_Accelerator.cc.

◆ _resizeVariablesIndexer()

void Arcane::Materials::IncrementalComponentModifier::_resizeVariablesIndexer ( Int32 var_index)
private

Resizes the variable index var_index.

Definition at line 410 of file IncrementalComponentModifier.cc.

References _applyCopyVariableViews(), Arcane::Array< T >::clear(), Arcane::Array< T >::data(), Arcane::Materials::VariableIndexerCommonArgs::m_copy_data, m_force_multiple_command_for_resize, m_use_generic_copy_between_pure_and_partial, Arcane::Array< T >::reserve(), Arcane::AbstractArray< T >::size(), and Arcane::Materials::MeshMaterialMng::visitVariables().

Referenced by _copyBetweenPartialsAndGlobals().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _switchCellsForEnvironments()

void Arcane::Materials::IncrementalComponentModifier::_switchCellsForEnvironments ( const IMeshEnvironment * modified_env,
SmallSpan< const Int32 > ids )
private

Transforms entities for environments.

Iterates over environments, except the modified environment modified_env, and for each one converts pure cells to partial cells or vice versa. After conversion, the values corresponding to the modified cells are updated for each variable.

If is_add is true, it transforms from pure to partial (in the case of material addition); otherwise, it transforms from partial to pure (in the case of material removal)

Definition at line 170 of file IncrementalComponentModifier.cc.

References _computeCellsToTransformForEnvironments(), _copyBetweenPartialsAndGlobals(), Arcane::TraceAccessor::info(), Arcane::Materials::MeshMaterialVariableIndexer::name(), Arcane::SpanImpl< T, SizeType, Extent >::size(), and Arcane::Materials::MeshMaterialVariableIndexer::transformCells().

Here is the call graph for this function:

◆ _switchCellsForMaterials()

void Arcane::Materials::IncrementalComponentModifier::_switchCellsForMaterials ( const MeshMaterial * modified_mat,
SmallSpan< const Int32 > ids )
private

Transforms entities for an environment.

Iterates over the environment env and converts pure cells to partial cells or vice versa. After conversion, the values corresponding to the modified cells are updated for each variable.

If is_add is true, it transforms from pure to partial (material addition); otherwise, it transforms from partial to pure (material removal)

Definition at line 101 of file IncrementalComponentModifier.cc.

References _computeCellsToTransformForMaterial(), _copyBetweenPartialsAndGlobals(), Arcane::TraceAccessor::info(), Arcane::Materials::MeshMaterialVariableIndexer::name(), and Arcane::Materials::MeshMaterialVariableIndexer::transformCells().

Here is the call graph for this function:

◆ apply()

void Arcane::Materials::IncrementalComponentModifier::apply ( MaterialModifierOperation * operation)

Definition at line 41 of file IncrementalComponentModifier_Accelerator.cc.

◆ finalize()

void Arcane::Materials::IncrementalComponentModifier::finalize ( )

Definition at line 81 of file IncrementalComponentModifier.cc.

◆ flagRemovedCells()

void Arcane::Materials::IncrementalComponentModifier::flagRemovedCells ( SmallSpan< const Int32 > local_ids,
bool value_to_set )

Definition at line 308 of file IncrementalComponentModifier_Accelerator.cc.

◆ initialize()

void Arcane::Materials::IncrementalComponentModifier::initialize ( bool is_debug)

Definition at line 67 of file IncrementalComponentModifier.cc.

◆ setDoCopyBetweenPartialAndPure()

void Arcane::Materials::IncrementalComponentModifier::setDoCopyBetweenPartialAndPure ( bool v)
inline

Definition at line 55 of file IncrementalComponentModifier.h.

◆ setDoInitNewItems()

void Arcane::Materials::IncrementalComponentModifier::setDoInitNewItems ( bool v)
inline

Definition at line 56 of file IncrementalComponentModifier.h.

◆ MeshMaterialModifierImpl

friend class MeshMaterialModifierImpl
friend

Definition at line 44 of file IncrementalComponentModifier.h.

Member Data Documentation

◆ m_all_env_data

AllEnvData* Arcane::Materials::IncrementalComponentModifier::m_all_env_data = nullptr
private

Definition at line 60 of file IncrementalComponentModifier.h.

◆ m_do_copy_between_partial_and_pure

bool Arcane::Materials::IncrementalComponentModifier::m_do_copy_between_partial_and_pure = true
private

Definition at line 64 of file IncrementalComponentModifier.h.

◆ m_do_init_new_items

bool Arcane::Materials::IncrementalComponentModifier::m_do_init_new_items = true
private

Definition at line 65 of file IncrementalComponentModifier.h.

◆ m_force_multiple_command_for_resize

bool Arcane::Materials::IncrementalComponentModifier::m_force_multiple_command_for_resize = false
private

True if we force the use of a single command for resizing.

Definition at line 70 of file IncrementalComponentModifier.h.

Referenced by _resizeVariablesIndexer().

◆ m_is_debug

bool Arcane::Materials::IncrementalComponentModifier::m_is_debug = false
private

Definition at line 66 of file IncrementalComponentModifier.h.

◆ m_material_mng

MeshMaterialMng* Arcane::Materials::IncrementalComponentModifier::m_material_mng = nullptr
private

Definition at line 61 of file IncrementalComponentModifier.h.

◆ m_queue

RunQueue Arcane::Materials::IncrementalComponentModifier::m_queue
private

Definition at line 63 of file IncrementalComponentModifier.h.

◆ m_use_generic_copy_between_pure_and_partial

Int32 Arcane::Materials::IncrementalComponentModifier::m_use_generic_copy_between_pure_and_partial = 0
private

1 or 2 if we use a generic version for copies between pure and partial

Definition at line 68 of file IncrementalComponentModifier.h.

Referenced by _copyBetweenPartialsAndGlobals(), and _resizeVariablesIndexer().

◆ m_work_info

ConstituentModifierWorkInfo Arcane::Materials::IncrementalComponentModifier::m_work_info
private

Definition at line 62 of file IncrementalComponentModifier.h.


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