Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::ItemGroup Class Reference

Mesh entity group. More...

#include <arcane/core/ItemGroup.h>

Public Types

typedef ItemEnumerator const_iter
 Iteration range type (to be removed).

Public Member Functions

 ItemGroup ()
 Constructs a null group.
 ItemGroup (ItemGroupImpl *prv)
 Constructs a group from the internal representation prv.
 ItemGroup (const ItemGroup &from)
 Constructs a reference to the group from.
ItemGroupoperator= (const ItemGroup &from)=default
 Assigns a reference to the group from to this instance.
bool null () const
 true means the group is the null group
const Stringname () const
 Group name.
const StringfullName () const
 Group name.
Integer size () const
 Number of elements in the group.
bool empty () const
 Tests if the group is empty.
eItemKind itemKind () const
 Group kind. This is the kind of its elements.
ItemGroupImplinternal () const
IItemFamilyitemFamily () const
 Entity family to which this group belongs (0 for the null group).
IMeshmesh () const
 Mesh to which this group belongs (0 for the null group).
ItemGroup own () const
 Group equivalent to this one but containing only the local elements of the subdomain.
ItemGroup ghost () const
bool isOwn () const
 Returns whether the group contains only elements belonging to the subdomain.
void setOwn (bool v)
 Sets whether the group property is local or not.
ItemGroup interface () const
NodeGroup nodeGroup () const
 Group of nodes of the elements of this group.
EdgeGroup edgeGroup () const
 Group of edges of the elements of this group.
FaceGroup faceGroup () const
 Group of faces of the elements of this group.
CellGroup cellGroup () const
 Group of cells of the elements of this group.
FaceGroup innerFaceGroup () const
 Group of internal faces of the elements of this group.
FaceGroup outerFaceGroup () const
 Group of external faces of the elements of this group.
CellGroup activeCellGroup () const
 AMR.
CellGroup ownActiveCellGroup () const
 Group of own active cells of the elements of this group.
CellGroup levelCellGroup (const Integer &level) const
 Group of level l cells of the elements of this group.
CellGroup ownLevelCellGroup (const Integer &level) const
 Group of own level l cells of the elements of this group.
FaceGroup activeFaceGroup () const
 Group of active faces.
FaceGroup ownActiveFaceGroup () const
 Group of active faces belonging to the domain of the elements of this group.
FaceGroup innerActiveFaceGroup () const
 Group of internal faces of the elements of this group.
FaceGroup outerActiveFaceGroup () const
 Group of active external faces of the elements of this group.
ItemGroup createSubGroup (const String &suffix, IItemFamily *family, ItemGroupComputeFunctor *functor) const
 Creates a computed subgroup.
ItemGroup findSubGroup (const String &suffix) const
 Access to a subgroup.
bool isLocalToSubDomain () const
 True if the group is local to the subdomain.
void setLocalToSubDomain (bool v)
 Sets the boolean indicating if the group is local to the subdomain.
void invalidate (bool force_recompute=false)
 Invalidates the group.
void addItems (Int32ConstArrayView items_local_id, bool check_if_present=true)
 Adds entities.
void removeItems (Int32ConstArrayView items_local_id, bool check_if_present=true)
 Removes entities.
void setItems (Int32ConstArrayView items_local_id)
 Sets the entities of the group.
void setItems (Int32ConstArrayView items_local_id, bool do_sort)
 Sets the entities of the group.
void checkValid ()
 Internal check of group validity.
void clear ()
 Clears the entities of the group.
void applyOperation (IItemOperationByBasicType *operation) const
 Applies the operation operation to the entities of the group.
ItemVectorView view () const
 View of the group entities.
bool isAllItems () const
 Indicates if the group is that of all entities.
Int64 timestamp () const
void incrementTimestamp () const
 Increments the last modification time of the group.
SharedPtrT< GroupIndexTablelocalIdToIndex () const
 Table of local ids to a position for all entities in the group.
IVariableSynchronizersynchronizer () const
 Group synchronizer.
bool isAutoComputed () const
 True if it is an automatically computed group.
bool hasSynchronizer () const
 Indicates if the group has an active synchronizer.
bool checkIsSorted () const
 Checks and returns whether the group is sorted by increasing uniqueId().
ItemVectorView _paddedView () const
 View of the group entities with padding for vectorization.
ItemVectorView _unpaddedView () const
 View of the group entities without padding for vectorization.
ItemGroupImplInternal * _internalApi () const
 Internal Arcane API.
ItemEnumerator enumerator () const
 Enumerator over the group entities.

Protected Member Functions

ItemVectorView _view (bool do_padding) const

Static Protected Member Functions

static ItemGroupImpl_check (ItemGroupImpl *impl, eItemKind ik)
 Returns the group impl if it is of kind kt, the null group otherwise.

Protected Attributes

AutoRefT< ItemGroupImplm_impl
 Internal representation of the group.

Friends

template<typename T>
class SimdItemEnumeratorContainerTraits

Detailed Description

Mesh entity group.

An entity group contains a set of entities of a given family. A group is created via the corresponding family using IItemFamily::createGroup(), IItemFamily::findGroup().

A mesh entity group is a list of entities of the same family (IItemFamily).

An entity can only appear once in a group.

An instance of this class holds a reference to any mesh entity group. From this reference, it is possible to know the type (itemKind(), the name (name()), and the number of elements (size()) of the group and to iterate generically over the elements that compose it. To iterate over derived elements (cells, nodes, ...), it must first be converted into a reference to a specific group (NodeGroup, FaceGroup, EdgeGroup, or CellGroup). For example:

ItemGroup group = subDomain()->defaultMesh()->findGroup("Surface");
FaceGroup surface(surface);
if (surface.null())
// Not a surface.
if (surface.empty())
// Surface exists but is empty
ItemGroup()
Constructs a null group.
Definition ItemGroup.cc:140
ItemGroupT< Face > FaceGroup
Group of faces.
Definition ItemTypes.h:179

It is possible to sort a group so that its elements are always classified in ascending order of the elements' uniqueId(), in order to ensure that sequential and parallel codes produce the same result.

There is a special group, called the null group, which allows representing an unreferenced group, meaning one that does not exist. This group is the only one for which null() returns true. The null group has the following properties:

This class uses a reference counter and is therefore used by reference. For example:

ItemGroup a = subDomain()->defaultMesh()->findGroup("Toto");
ItemGroup b = a; // b and a refer to the same group.
if (a.null())
// Group not found...
;
bool null() const
true means the group is the null group
Definition ItemGroup.h:75

To iterate over the entities of a group, an enumerator must be used, via the ENUMERATE_* macros, for example ENUMERATE_CELL for a cell group:

ENUMERATE_CELL(icell,g){
m_mass[icell] = m_volume[icell] * m_density[icell];
}
#define ENUMERATE_CELL(name, group)
Generic enumerator for a cell group.
ItemGroupT< Cell > CellGroup
Group of cells.
Definition ItemTypes.h:184

It is possible to add (addItems()) or remove entities from a group (removeItems()).

Groups that have no parents are persistent and can be recovered during a restart. The elements of these groups are automatically updated when the associated family is modified. For example, if an element of a family is deleted and belonged to a group, it is automatically deleted from that group. Similarly, groups are updated during a mesh repartitioning. However, there is a small restriction with the current implementation regarding this usage. To avoid updating the group with every family change, the group is marked as needing to be updated (via invalidate()) upon every change but is only actually recalculated when it is used. It is therefore theoretically possible that multiple additions and deletions between two uses of the group render its elements inconsistent (TODO: link to detailed explanation). To avoid this problem, it is possible to force the recalculation of the group by calling invalidate() with true as an argument.

Derived groups (which have a parent), such as own() or cellGroup(), are invalidated and emptied of their elements when the associated family is modified.

If a group is used as support for partial variables, then the entities belonging to the group must be consistent across subdomains. That is, if an entity x is present in several subdomains (whether as a local or ghost entity), it must be in this group for all subdomains or in none of the groups. For example, if the cell with uniqueId() 238 is present in subdomains 1, 4, and 8, and for subdomain 4 it is in the cell group 'TOTO', then it must also be in this cell group 'TOTO' for subdomains 1 and 8.

Definition at line 50 of file ItemGroup.h.

Member Typedef Documentation

◆ const_iter

Iteration range type (to be removed).

Definition at line 70 of file ItemGroup.h.

Constructor & Destructor Documentation

◆ ItemGroup() [1/3]

◆ ItemGroup() [2/3]

Arcane::ItemGroup::ItemGroup ( ItemGroupImpl * prv)

Constructs a group from the internal representation prv.

Definition at line 122 of file ItemGroup.cc.

References m_impl.

◆ ItemGroup() [3/3]

Arcane::ItemGroup::ItemGroup ( const ItemGroup & from)
inline

Constructs a reference to the group from.

Definition at line 62 of file ItemGroup.h.

References ItemGroup(), and m_impl.

Member Function Documentation

◆ _check()

ItemGroupImpl * Arcane::ItemGroup::_check ( ItemGroupImpl * impl,
eItemKind ik )
inlinestaticprotected

Returns the group impl if it is of kind kt, the null group otherwise.

Definition at line 365 of file ItemGroup.h.

References Arcane::ItemGroupImpl::itemKind().

◆ _internalApi()

ItemGroupImplInternal * Arcane::ItemGroup::_internalApi ( ) const

Internal Arcane API.

Definition at line 642 of file ItemGroup.cc.

References m_impl.

◆ _paddedView()

ItemVectorView Arcane::ItemGroup::_paddedView ( ) const

View of the group entities with padding for vectorization.

Definition at line 588 of file ItemGroup.cc.

Referenced by Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForeach(), Arcane::Parallel::Foreach(), and Arcane::Parallel::Foreach().

◆ _unpaddedView()

ItemVectorView Arcane::ItemGroup::_unpaddedView ( ) const

View of the group entities without padding for vectorization.

The returned view MUST NOT be used in vectorization macros such as ENUMERATE_SIMD_CELL().

Definition at line 597 of file ItemGroup.cc.

◆ _view()

ItemVectorView Arcane::ItemGroup::_view ( bool do_padding) const
protected

Definition at line 563 of file ItemGroup.cc.

◆ activeCellGroup()

CellGroup Arcane::ItemGroup::activeCellGroup ( ) const

AMR.

AMR Group of active cells of the elements of this group

Definition at line 296 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ activeFaceGroup()

FaceGroup Arcane::ItemGroup::activeFaceGroup ( ) const

Group of active faces.

This group only exists for a cell group (itemKind()==IK_Cell).

Definition at line 343 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ addItems()

void Arcane::ItemGroup::addItems ( Int32ConstArrayView items_local_id,
bool check_if_present = true )

Adds entities.

Adds the local ID entities items_local_id.

The parameter check_if_present indicates whether to check if the entities to be added are already present in the group; if so, they will not be added. If the caller is certain that the entities to be added are not currently in the group, they can set the parameter check_if_present to false, which speeds up the addition.

Definition at line 438 of file ItemGroup.cc.

References isAllItems(), m_impl, and null().

◆ applyOperation()

void Arcane::ItemGroup::applyOperation ( IItemOperationByBasicType * operation) const

Applies the operation operation to the entities of the group.

Definition at line 527 of file ItemGroup.cc.

References m_impl, and null().

Referenced by Arcane::geometric::BarycentricGeomShapeComputer::computeAll().

◆ cellGroup()

CellGroup Arcane::ItemGroup::cellGroup ( ) const

Group of cells of the elements of this group.

Definition at line 257 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ checkIsSorted()

bool Arcane::ItemGroup::checkIsSorted ( ) const

Checks and returns whether the group is sorted by increasing uniqueId().

Definition at line 651 of file ItemGroup.cc.

References m_impl.

◆ checkValid()

void Arcane::ItemGroup::checkValid ( )

Internal check of group validity.

Definition at line 518 of file ItemGroup.cc.

References m_impl.

◆ clear()

void Arcane::ItemGroup::clear ( )

Clears the entities of the group.

Definition at line 420 of file ItemGroup.cc.

References m_impl.

Referenced by ItemGroupBuilder< T >::buildGroup().

◆ createSubGroup()

ItemGroup Arcane::ItemGroup::createSubGroup ( const String & suffix,
IItemFamily * family,
ItemGroupComputeFunctor * functor ) const

Creates a computed subgroup.

The memory management of the functor is then delegated to the group

Definition at line 397 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ edgeGroup()

EdgeGroup Arcane::ItemGroup::edgeGroup ( ) const

Group of edges of the elements of this group.

Definition at line 233 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ empty()

bool Arcane::ItemGroup::empty ( ) const
inline

Tests if the group is empty.

A group is empty if it is null (null() returns true) or if it has no elements (size() returns 0).

Return values
trueif the group is empty,
falseotherwise.

Definition at line 107 of file ItemGroup.h.

References m_impl.

◆ enumerator()

ItemEnumerator Arcane::ItemGroup::enumerator ( ) const

Enumerator over the group entities.

Definition at line 539 of file ItemGroup.cc.

References m_impl, and null().

◆ faceGroup()

FaceGroup Arcane::ItemGroup::faceGroup ( ) const

Group of faces of the elements of this group.

Definition at line 245 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ findSubGroup()

ItemGroup Arcane::ItemGroup::findSubGroup ( const String & suffix) const

Access to a subgroup.

Definition at line 409 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ fullName()

const String & Arcane::ItemGroup::fullName ( ) const
inline

Group name.

Definition at line 87 of file ItemGroup.h.

References m_impl.

◆ ghost()

ItemGroup Arcane::ItemGroup::ghost ( ) const

Definition at line 194 of file ItemGroup.cc.

◆ hasSynchronizer()

bool Arcane::ItemGroup::hasSynchronizer ( ) const

Indicates if the group has an active synchronizer.

Definition at line 633 of file ItemGroup.cc.

References m_impl.

◆ incrementTimestamp()

void Arcane::ItemGroup::incrementTimestamp ( ) const

Increments the last modification time of the group.

Normally this time is incremented automatically. However, it is possible to do it manually in case of external modification of the group information.

Definition at line 661 of file ItemGroup.cc.

References m_impl.

◆ innerActiveFaceGroup()

FaceGroup Arcane::ItemGroup::innerActiveFaceGroup ( ) const

Group of internal faces of the elements of this group.

This group only exists for a cell group (itemKind()==IK_Cell). A face is internal if it is connected to two active cells of this group.

Definition at line 370 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ innerFaceGroup()

FaceGroup Arcane::ItemGroup::innerFaceGroup ( ) const

Group of internal faces of the elements of this group.

This group only exists for a cell group (itemKind()==IK_Cell). A face is internal if it is connected to two cells of this group.

Definition at line 269 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ interface()

ItemGroup Arcane::ItemGroup::interface ( ) const

Definition at line 208 of file ItemGroup.cc.

◆ internal()

ItemGroupImpl * Arcane::ItemGroup::internal ( ) const
inline

Definition at line 125 of file ItemGroup.h.

◆ invalidate()

void Arcane::ItemGroup::invalidate ( bool force_recompute = false)
inline

Invalidates the group.

For a dynamically computed group (such as the group of elements belonging to the subdomain), this means it must be recalculated.

If force_recompute is false, the group is just invalidated and will be recalculated the first time it is accessed. Otherwise, it is immediately recalculated.

Definition at line 257 of file ItemGroup.h.

References m_impl.

◆ isAllItems()

◆ isAutoComputed()

bool Arcane::ItemGroup::isAutoComputed ( ) const

True if it is an automatically computed group.

Definition at line 624 of file ItemGroup.cc.

References m_impl.

◆ isLocalToSubDomain()

bool Arcane::ItemGroup::isLocalToSubDomain ( ) const
inline

True if the group is local to the subdomain.

Definition at line 230 of file ItemGroup.h.

References m_impl.

Referenced by Arcane::MeshUtils::writeMeshConnectivity().

◆ isOwn()

bool Arcane::ItemGroup::isOwn ( ) const

Returns whether the group contains only elements belonging to the subdomain.

Definition at line 148 of file ItemGroup.cc.

References m_impl, and null().

Referenced by own().

◆ itemFamily()

◆ itemKind()

eItemKind Arcane::ItemGroup::itemKind ( ) const
inline

Group kind. This is the kind of its elements.

Definition at line 114 of file ItemGroup.h.

References m_impl.

Referenced by Arcane::VariableArrayT< T >::initialize(), and Arcane::Hdf5VariableInfoBase::writeGroup().

◆ levelCellGroup()

CellGroup Arcane::ItemGroup::levelCellGroup ( const Integer & level) const

Group of level l cells of the elements of this group.

Definition at line 320 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ localIdToIndex()

SharedPtrT< GroupIndexTable > Arcane::ItemGroup::localIdToIndex ( ) const
inline

◆ mesh()

IMesh * Arcane::ItemGroup::mesh ( ) const
inline

Mesh to which this group belongs (0 for the null group).

Definition at line 131 of file ItemGroup.h.

References m_impl.

Referenced by Arcane::Hdf5VariableInfoBase::writeGroup().

◆ name()

◆ nodeGroup()

NodeGroup Arcane::ItemGroup::nodeGroup ( ) const

Group of nodes of the elements of this group.

Definition at line 221 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ null()

◆ outerActiveFaceGroup()

FaceGroup Arcane::ItemGroup::outerActiveFaceGroup ( ) const

Group of active external faces of the elements of this group.

This group only exists for a cell group (itemKind()==IK_Cell). A face is external if it is connected to only one cell of this group and is active.

Definition at line 382 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ outerFaceGroup()

FaceGroup Arcane::ItemGroup::outerFaceGroup ( ) const

Group of external faces of the elements of this group.

This group only exists for a cell group (itemKind()==IK_Cell). A face is external if it is connected to only one cell of this group.

Definition at line 281 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ own()

ItemGroup Arcane::ItemGroup::own ( ) const

Group equivalent to this one but containing only the local elements of the subdomain.

If this group is already a group containing only the local elements of the subdomain, it is returned itself:

group.own()==group; // For a local group
group.own().own()==group.own(); // Invariant

Definition at line 181 of file ItemGroup.cc.

References isOwn(), ItemGroup(), m_impl, and null().

Referenced by Arcane::MeshUtils::checkUniqueIdsHashCollective(), Arcane::Hdf5VariableInfoBase::writeGroup(), and Arcane::Hdf5ItemVariableInfo< VariableType, DataType >::writeVariable().

◆ ownActiveCellGroup()

CellGroup Arcane::ItemGroup::ownActiveCellGroup ( ) const

Group of own active cells of the elements of this group.

Definition at line 308 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ ownActiveFaceGroup()

FaceGroup Arcane::ItemGroup::ownActiveFaceGroup ( ) const

Group of active faces belonging to the domain of the elements of this group.

This group only exists for a cell group (itemKind()==IK_Cell).

Definition at line 355 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ ownLevelCellGroup()

CellGroup Arcane::ItemGroup::ownLevelCellGroup ( const Integer & level) const

Group of own level l cells of the elements of this group.

Definition at line 332 of file ItemGroup.cc.

References ItemGroup(), m_impl, and null().

◆ removeItems()

void Arcane::ItemGroup::removeItems ( Int32ConstArrayView items_local_id,
bool check_if_present = true )

Removes entities.

Removes the local ID entities items_local_id.

The parameter check_if_present indicates whether to check if the entities to be removed are already present in the group; if so, they will not be removed. If the caller is certain that the entities to be removed are in the group, they can set the parameter check_if_present to false, which speeds up the removal.

Definition at line 461 of file ItemGroup.cc.

References isAllItems(), m_impl, and null().

◆ setItems() [1/2]

void Arcane::ItemGroup::setItems ( Int32ConstArrayView items_local_id)

Sets the entities of the group.

Positions the group entities.

Positions the entities whose local IDs are given by items_local_id. The caller guarantees that each entity is present only once in this array

Definition at line 483 of file ItemGroup.cc.

References m_impl, and null().

Referenced by ItemGroupBuilder< T >::buildGroup().

◆ setItems() [2/2]

void Arcane::ItemGroup::setItems ( Int32ConstArrayView items_local_id,
bool do_sort )

Sets the entities of the group.

Positions the group entities.

If do_sort is true, the entities are sorted by increasing uniqueId.

Positions the entities whose local IDs are given by items_local_id. The caller guarantees that each entity is present only once in this array If do_sort is true, the entities are sorted by increasing uniqueId before being added to the group.

Definition at line 504 of file ItemGroup.cc.

References m_impl, and null().

◆ setLocalToSubDomain()

void Arcane::ItemGroup::setLocalToSubDomain ( bool v)
inline

Sets the boolean indicating if the group is local to the subdomain.

By default upon creation, a group is common to all subdomains, meaning that each subdomain must possess an instance of this group, even if that instance is empty.

A group local to the subdomain is not transferred during a rebalancing.

Definition at line 243 of file ItemGroup.h.

References m_impl.

◆ setOwn()

void Arcane::ItemGroup::setOwn ( bool v)

Sets whether the group property is local or not.

Definition at line 160 of file ItemGroup.cc.

References m_impl, and null().

◆ size()

◆ synchronizer()

IVariableSynchronizer * Arcane::ItemGroup::synchronizer ( ) const

Group synchronizer.

Definition at line 615 of file ItemGroup.cc.

References m_impl.

◆ timestamp()

Int64 Arcane::ItemGroup::timestamp ( ) const
inline

Returns the last modification time of the group.

This time is automatically incremented after each modification. It is possible to increment it manually via the call to incrementTimestamp().

Definition at line 297 of file ItemGroup.h.

References m_impl.

◆ view()

◆ SimdItemEnumeratorContainerTraits

template<typename T>
friend class SimdItemEnumeratorContainerTraits
friend

Definition at line 353 of file ItemGroup.h.

Member Data Documentation

◆ m_impl


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