Incremental modification of materials. More...
#include <arcane/materials/internal/IncrementalComponentModifier.h>
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. | |
| TraceAccessor & | operator= (const TraceAccessor &rhs) |
| Copy assignment operator. | |
| virtual | ~TraceAccessor () |
| Frees resources. | |
| ITraceMng * | traceMng () 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 | |
| AllEnvData * | m_all_env_data = nullptr |
| MeshMaterialMng * | m_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 |
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.
| Arcane::Materials::IncrementalComponentModifier::IncrementalComponentModifier | ( | AllEnvData * | all_env_data, |
| const RunQueue & | queue ) |
Definition at line 38 of file IncrementalComponentModifier.cc.
|
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().
| void Arcane::Materials::IncrementalComponentModifier::_addItemsToIndexer | ( | MeshMaterialVariableIndexer * | var_indexer, |
| SmallSpan< const Int32 > | local_ids ) |
Definition at line 333 of file IncrementalComponentModifier.cc.
| 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().
| 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().
| void Arcane::Materials::IncrementalComponentModifier::_applyInitializeWithZero | ( | const InitializeWithZeroArgs & | args | ) |
Definition at line 436 of file IncrementalComponentModifier_Accelerator.cc.
| 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().
|
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().
| void Arcane::Materials::IncrementalComponentModifier::_computeItemsToAdd | ( | ComponentItemListBuilder & | list_builder, |
| SmallSpan< const Int32 > | local_ids ) |
Definition at line 254 of file IncrementalComponentModifier_Accelerator.cc.
|
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().
|
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().
| void Arcane::Materials::IncrementalComponentModifier::_removeItemsInGroup | ( | ItemGroup | cells, |
| SmallSpan< const Int32 > | removed_ids ) |
Definition at line 345 of file IncrementalComponentModifier_Accelerator.cc.
| void Arcane::Materials::IncrementalComponentModifier::_resetTransformedCells | ( | SmallSpan< const Int32 > | ids | ) |
Definition at line 328 of file IncrementalComponentModifier_Accelerator.cc.
|
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().
|
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().
|
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().
| void Arcane::Materials::IncrementalComponentModifier::apply | ( | MaterialModifierOperation * | operation | ) |
Definition at line 41 of file IncrementalComponentModifier_Accelerator.cc.
| void Arcane::Materials::IncrementalComponentModifier::finalize | ( | ) |
Definition at line 81 of file IncrementalComponentModifier.cc.
| void Arcane::Materials::IncrementalComponentModifier::flagRemovedCells | ( | SmallSpan< const Int32 > | local_ids, |
| bool | value_to_set ) |
Definition at line 308 of file IncrementalComponentModifier_Accelerator.cc.
| void Arcane::Materials::IncrementalComponentModifier::initialize | ( | bool | is_debug | ) |
Definition at line 67 of file IncrementalComponentModifier.cc.
|
inline |
Definition at line 55 of file IncrementalComponentModifier.h.
|
inline |
Definition at line 56 of file IncrementalComponentModifier.h.
|
friend |
Definition at line 44 of file IncrementalComponentModifier.h.
|
private |
Definition at line 60 of file IncrementalComponentModifier.h.
|
private |
Definition at line 64 of file IncrementalComponentModifier.h.
|
private |
Definition at line 65 of file IncrementalComponentModifier.h.
|
private |
True if we force the use of a single command for resizing.
Definition at line 70 of file IncrementalComponentModifier.h.
Referenced by _resizeVariablesIndexer().
|
private |
Definition at line 66 of file IncrementalComponentModifier.h.
|
private |
Definition at line 61 of file IncrementalComponentModifier.h.
|
private |
Definition at line 63 of file IncrementalComponentModifier.h.
|
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().
|
private |
Definition at line 62 of file IncrementalComponentModifier.h.