Operation to add or remove cells from a material. More...
#include <arcane/materials/internal/MaterialModifierOperation.h>
Public Member Functions | |
| bool | isAdd () const |
| Indicates whether the operation is to add or remove cells from the material. | |
| IMeshMaterial * | material () const |
| The material for which cells are to be added/removed. | |
| SmallSpan< const Int32 > | ids () const |
| List of localId() of cells to add/remove. | |
| void | filterIds () |
| Filters the cell IDs. | |
Static Public Member Functions | |
| static MaterialModifierOperation * | createAdd (IMeshMaterial *mat, SmallSpan< const Int32 > ids) |
| static MaterialModifierOperation * | createRemove (IMeshMaterial *mat, SmallSpan< const Int32 > ids) |
Private Member Functions | |
| MaterialModifierOperation (IMeshMaterial *mat, SmallSpan< const Int32 > ids, bool is_add) | |
Static Private Member Functions | |
| static void | _filterValidIds (MaterialModifierOperation *operation, Int32Array &valid_ids) |
| Filters the array of cells ids so that it is valid. | |
| static Int32 | _checkMaterialPresence (MaterialModifierOperation *operation) |
| Checks if the cells ids are already in the material mat. | |
Private Attributes | |
| IMeshMaterial * | m_mat = nullptr |
| bool | m_is_add = false |
| UniqueArray< Int32 > | m_ids |
Operation to add or remove cells from a material.
Definition at line 35 of file MaterialModifierOperation.h.
| Arcane::Materials::MaterialModifierOperation::MaterialModifierOperation | ( | ) |
Definition at line 38 of file MaterialModifierOperation.cc.
|
private |
Definition at line 47 of file MaterialModifierOperation.cc.
|
staticprivate |
Checks if the cells ids are already in the material mat.
If operation==eOperation::Add, checks that the cells of ids are not already in the material and if operation==eOperation::Remove, checks that the cells of ids are in the material.
Also checks that an element is present only once in the list ids.
Returns the number of errors.
Definition at line 71 of file MaterialModifierOperation.cc.
References Arcane::Materials::IMeshComponent::_internalApi(), Arcane::Materials::IMeshComponent::cells(), ids(), Arcane::ITraceMng::info(), isAdd(), Arcane::ItemGroup::itemFamily(), material(), Arcane::IItemFamily::maxLocalId(), Arcane::Materials::IMeshComponent::name(), Arcane::Materials::IMeshComponent::traceMng(), and Arcane::Materials::IMeshComponentInternal::variableIndexer().
Referenced by filterIds().
|
staticprivate |
Filters the array of cells ids so that it is valid.
This method allows filtering the values of ids so that only valid values remain so that they can be added (if do_add is true) or removed (if do_add is false) from the material mat.
The valid values are stored in valid_ids.
Definition at line 135 of file MaterialModifierOperation.cc.
References Arcane::Materials::IMeshComponent::_internalApi(), Arcane::Array< T >::add(), Arcane::Materials::IMeshComponent::cells(), Arcane::Array< T >::clear(), ids(), Arcane::ITraceMng::info(), isAdd(), Arcane::ItemGroup::itemFamily(), material(), Arcane::IItemFamily::maxLocalId(), Arcane::Array< T >::reserve(), Arcane::AbstractArray< T >::size(), Arcane::Materials::IMeshComponent::traceMng(), and Arcane::Materials::IMeshComponentInternal::variableIndexer().
Referenced by filterIds().
|
inlinestatic |
Definition at line 47 of file MaterialModifierOperation.h.
|
inlinestatic |
Definition at line 51 of file MaterialModifierOperation.h.
| void Arcane::Materials::MaterialModifierOperation::filterIds | ( | ) |
Filters the cell IDs.
If isAdd() is true, filters the IDs to remove those that are already in the material. If isAdd() is false, filters the IDs to remove those that are not in the material.
These operations are costly because all present entities must be traversed. Therefore, this method should generally only be used in verification mode.
Definition at line 187 of file MaterialModifierOperation.cc.
References _checkMaterialPresence(), _filterValidIds(), and ARCANE_FATAL.
List of localId() of cells to add/remove.
Definition at line 65 of file MaterialModifierOperation.h.
Referenced by _checkMaterialPresence(), and _filterValidIds().
|
inline |
Indicates whether the operation is to add or remove cells from the material.
Definition at line 59 of file MaterialModifierOperation.h.
Referenced by _checkMaterialPresence(), _filterValidIds(), and Arcane::Materials::ConstituentModifierWorkInfo::setCurrentOperation().
|
inline |
The material for which cells are to be added/removed.
Definition at line 62 of file MaterialModifierOperation.h.
Referenced by _checkMaterialPresence(), and _filterValidIds().
|
private |
Definition at line 90 of file MaterialModifierOperation.h.
|
private |
Definition at line 89 of file MaterialModifierOperation.h.
|
private |
Definition at line 88 of file MaterialModifierOperation.h.