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

Operation to add or remove cells from a material. More...

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

Collaboration diagram for Arcane::Materials::MaterialModifierOperation:

Public Member Functions

bool isAdd () const
 Indicates whether the operation is to add or remove cells from the material.
IMeshMaterialmaterial () const
 The material for which cells are to be added/removed.
SmallSpan< const Int32ids () 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

IMeshMaterialm_mat = nullptr
bool m_is_add = false
UniqueArray< Int32m_ids

Detailed Description

Operation to add or remove cells from a material.

Definition at line 35 of file MaterialModifierOperation.h.

Constructor & Destructor Documentation

◆ MaterialModifierOperation() [1/2]

Arcane::Materials::MaterialModifierOperation::MaterialModifierOperation ( )

Definition at line 38 of file MaterialModifierOperation.cc.

◆ MaterialModifierOperation() [2/2]

Arcane::Materials::MaterialModifierOperation::MaterialModifierOperation ( IMeshMaterial * mat,
SmallSpan< const Int32 > ids,
bool is_add )
private

Definition at line 47 of file MaterialModifierOperation.cc.

Member Function Documentation

◆ _checkMaterialPresence()

Int32 Arcane::Materials::MaterialModifierOperation::_checkMaterialPresence ( MaterialModifierOperation * operation)
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().

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

◆ _filterValidIds()

void Arcane::Materials::MaterialModifierOperation::_filterValidIds ( MaterialModifierOperation * operation,
Int32Array & valid_ids )
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().

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

◆ createAdd()

MaterialModifierOperation * Arcane::Materials::MaterialModifierOperation::createAdd ( IMeshMaterial * mat,
SmallSpan< const Int32 > ids )
inlinestatic

Definition at line 47 of file MaterialModifierOperation.h.

◆ createRemove()

MaterialModifierOperation * Arcane::Materials::MaterialModifierOperation::createRemove ( IMeshMaterial * mat,
SmallSpan< const Int32 > ids )
inlinestatic

Definition at line 51 of file MaterialModifierOperation.h.

◆ filterIds()

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.

Here is the call graph for this function:

◆ ids()

SmallSpan< const Int32 > Arcane::Materials::MaterialModifierOperation::ids ( ) const
inline

List of localId() of cells to add/remove.

Definition at line 65 of file MaterialModifierOperation.h.

Referenced by _checkMaterialPresence(), and _filterValidIds().

Here is the caller graph for this function:

◆ isAdd()

bool Arcane::Materials::MaterialModifierOperation::isAdd ( ) const
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().

Here is the caller graph for this function:

◆ material()

IMeshMaterial * Arcane::Materials::MaterialModifierOperation::material ( ) const
inline

The material for which cells are to be added/removed.

Definition at line 62 of file MaterialModifierOperation.h.

Referenced by _checkMaterialPresence(), and _filterValidIds().

Here is the caller graph for this function:

Member Data Documentation

◆ m_ids

UniqueArray<Int32> Arcane::Materials::MaterialModifierOperation::m_ids
private

Definition at line 90 of file MaterialModifierOperation.h.

◆ m_is_add

bool Arcane::Materials::MaterialModifierOperation::m_is_add = false
private

Definition at line 89 of file MaterialModifierOperation.h.

◆ m_mat

IMeshMaterial* Arcane::Materials::MaterialModifierOperation::m_mat = nullptr
private

Definition at line 88 of file MaterialModifierOperation.h.


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