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

Table of entity lists. More...

#include <arcane/core/ItemPairGroup.h>

Classes

class  CustomFunctorWrapper

Public Types

typedef IFunctorWithArgumentT< ItemPairGroupBuilder & > CustomFunctor
 Functor for custom connectivity calculation.

Public Member Functions

 ItemPairGroup ()
 Constructs an empty table.
 ItemPairGroup (ItemPairGroupImpl *prv)
 Constructs a group from the internal representation prv.
 ItemPairGroup (const ItemGroup &group, const ItemGroup &sub_item_group, eItemKind link_kind)
 Constructs an instance by specifying the neighborhood via entities of kind link_kind.
 ItemPairGroup (const ItemGroup &group, const ItemGroup &sub_item_group, CustomFunctor *functor)
 Constructs an instance with a specific functor.
 ItemPairGroup (const ItemPairGroup &from)
 Copy constructor.
const ItemPairGroupoperator= (const ItemPairGroup &from)
bool null () const
 true means the group is the null group
eItemKind itemKind () const
 Type of entities in the group.
eItemKind subItemKind () const
 Type of sub-entities in the group.
ItemPairGroupImplinternal () const
 Returns the group implementation.
IItemFamilyitemFamily () const
 Entity family to which this group belongs (0 for a null list).
IItemFamilysubItemFamily () const
 Entity family to which this group belongs (0 for a null list).
IMeshmesh () const
 Mesh to which this list belongs (0 for a null list).
const ItemGroupitemGroup () const
 Initial item group.
const ItemGroupsubItemGroup () const
 Final item group (after bounce).
void invalidate (bool force_recompute=false)
 Invalidates the list.
void checkValid ()
 Internal check of group validity.
ItemPairEnumerator enumerator () const

Static Protected Member Functions

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

Protected Attributes

AutoRefT< ItemPairGroupImplm_impl
 Internal representation of the group.

Detailed Description

Table of entity lists.

This class allows managing a list of entities associated with each entity of an entity group (ItemGroup). For example, for every node in a group, the set of cells connected to this node by faces.

This class has a reference semantics in the same way as the ItemGroup class.

Arcane provides a predefined set of methods to calculate the connectivities of entities connected to other entities by a specific entity type. To use these methods, you must use the following constructor: ItemPairGroup(const ItemGroup& group,const ItemGroup& sub_item_group, eItemKind link_kind). link_kind then indicates the entity type that links them. For example:

CellGroup cells1;
CellGroup cells2;
// g1 contains for each cell in \a cells1 the cells that are
// connected to it by nodes and belong to the group \a cells2
CellCellGroup g1(cells1,cells2,IK_Node);
ENUMERATE_ITEMPAIR(Cell,Cell,iitem,ad_list){
Cell cell = *iitem;
// Iterates over cells connected to 'cell'
ENUMERATE_SUB_ITEM(Cell,isubitem,iitem){
Cell sub_cell = *iitem;
...
}
}
#define ENUMERATE_ITEMPAIR(_item_type1, _item_type2, _name, _array)
Enumerator over an ItemPairGroup.
#define ENUMERATE_SUB_ITEM(_item_type, _name, _parent_item)
Enumerator over a sub-element of an ItemPairGroup.
Cell of a mesh.
Definition Item.h:1300
ItemGroupT< Cell > CellGroup
Group of cells.
Definition ItemTypes.h:184
@ IK_Node
Node mesh entity.
ItemPairGroupT< Cell, Cell > CellCellGroup
Group of cells connected to cells.
Definition ItemTypes.h:159

It is possible for the user to specify a particular way of calculating connectivities by specifying a functor of type ItemPairGroup::CustomFunctor as an argument to the constructor.

Warning
The functor passed as an argument must be allocated by the new operator and will be destroyed at the same time as the associated ItemPairGroup.

Here is a complete example that calculates the cells connected to the cells via faces:

auto f = [](ItemPairGroupBuilder& builder)
{
const ItemPairGroup& pair_group = builder.group();
const ItemGroup& items = pair_group.itemGroup();
const ItemGroup& sub_items = pair_group.subItemGroup();
// Marks all entities that are not allowed to belong to
// the connectivity list because they are not in \a sub_items;
std::set<Int32> allowed_ids;
ENUMERATE_CELL(iitem,sub_items) {
allowed_ids.insert(iitem.itemLocalId());
}
Int32Array local_ids;
local_ids.reserve(8);
// List of entities already processed for the current cell
std::set<Int32> already_in_list;
ENUMERATE_CELL(icell,items){
Cell cell = *icell;
local_ids.clear();
Int32 current_local_id = icell.itemLocalId();
already_in_list.clear();
// To avoid adding itself to its own connectivity list
already_in_list.insert(current_local_id);
for( FaceEnumerator iface(cell.faces()); iface.hasNext(); ++iface ){
Face face = *iface;
for( CellEnumerator isubcell(face.cells()); isubcell.hasNext(); ++isubcell ){
const Int32 sub_local_id = isubcell.itemLocalId();
// Checks if we are in the list of allowed cells and if we
// have not yet been processed.
if (allowed_ids.find(sub_local_id)==allowed_ids.end())
continue;
if (already_in_list.find(sub_local_id)!=already_in_list.end())
continue;
// This cell must be added. We mark it so as not to
// iterate over it and we add it to the list.
already_in_list.insert(sub_local_id);
local_ids.add(sub_local_id);
}
}
builder.addNextItem(local_ids);
}
};
// Creates a group that calculates connectivities over all cells.
ItemPairGroupT<Cell,Cell> ad_list(allCells(),allCells(),functor::makePointer(f));
#define ENUMERATE_CELL(name, group)
Generic enumerator for a cell group.
void clear()
Removes the elements from the array.
void add(ConstReferenceType val)
Adds element val to the end of the array.
void reserve(Int64 new_capacity)
Reserves memory for new_capacity elements.
FaceConnectedListViewType faces() const
List of faces of the cell.
Definition Item.h:1403
Face of a cell.
Definition Item.h:1032
CellConnectedListViewType cells() const
List of cells of the face.
Definition Item.h:1135
Mesh entity group.
Definition ItemGroup.h:51
Construction of the entity lists for the ItemPairGroup.
const ItemGroup & itemGroup() const
Initial item group.
ItemPairGroup()
Constructs an empty table.
const ItemGroup & subItemGroup() const
Final item group (after bounce).
ItemEnumeratorT< Face > FaceEnumerator
Enumerators over faces.
Definition ItemTypes.h:266
ItemEnumeratorT< Cell > CellEnumerator
Enumerators over cells.
Definition ItemTypes.h:272
Array< Int32 > Int32Array
Dynamic one-dimensional array of 32-bit integers.
Definition UtilsTypes.h:127
std::int32_t Int32
Signed integer type of 32 bits.

Definition at line 38 of file ItemPairGroup.h.

Member Typedef Documentation

◆ CustomFunctor

Functor for custom connectivity calculation.

Definition at line 45 of file ItemPairGroup.h.

Constructor & Destructor Documentation

◆ ItemPairGroup() [1/5]

Arcane::ItemPairGroup::ItemPairGroup ( )

Constructs an empty table.

Definition at line 206 of file ItemPairGroup.cc.

References m_impl.

Referenced by Arcane::ItemPairGroup::CustomFunctorWrapper::executeFunctor(), ItemPairGroup(), and ItemPairGroup().

◆ ItemPairGroup() [2/5]

Arcane::ItemPairGroup::ItemPairGroup ( ItemPairGroupImpl * prv)
explicit

Constructs a group from the internal representation prv.

Definition at line 197 of file ItemPairGroup.cc.

References m_impl.

◆ ItemPairGroup() [3/5]

Arcane::ItemPairGroup::ItemPairGroup ( const ItemGroup & group,
const ItemGroup & sub_item_group,
eItemKind link_kind )

Constructs an instance by specifying the neighborhood via entities of kind link_kind.

Definition at line 169 of file ItemPairGroup.cc.

References Arcane::IItemFamily::findAdjacencyItems(), internal(), Arcane::ItemGroup::itemFamily(), ItemPairGroup(), and m_impl.

◆ ItemPairGroup() [4/5]

Arcane::ItemPairGroup::ItemPairGroup ( const ItemGroup & group,
const ItemGroup & sub_item_group,
CustomFunctor * functor )

Constructs an instance with a specific functor.

Definition at line 182 of file ItemPairGroup.cc.

References ARCANE_CHECK_POINTER, and m_impl.

◆ ItemPairGroup() [5/5]

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

Copy constructor.

Definition at line 64 of file ItemPairGroup.h.

References ItemPairGroup(), and m_impl.

Member Function Documentation

◆ _check()

ItemPairGroupImpl * Arcane::ItemPairGroup::_check ( ItemPairGroupImpl * impl,
eItemKind ik,
eItemKind aik )
inlinestaticprotected

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

Definition at line 133 of file ItemPairGroup.h.

◆ checkValid()

void Arcane::ItemPairGroup::checkValid ( )
inline

Internal check of group validity.

Definition at line 119 of file ItemPairGroup.h.

References m_impl.

◆ enumerator()

ItemPairEnumerator Arcane::ItemPairGroup::enumerator ( ) const

Definition at line 215 of file ItemPairGroup.cc.

◆ internal()

ItemPairGroupImpl * Arcane::ItemPairGroup::internal ( ) const
inline

Returns the group implementation.

Warning
This method returns a pointer to the group's internal representation and should not be used outside of Arcane.

Definition at line 92 of file ItemPairGroup.h.

References m_impl.

Referenced by ItemPairGroup(), Arcane::operator!=(), and Arcane::operator==().

◆ invalidate()

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

Invalidates the list.

Definition at line 113 of file ItemPairGroup.h.

References m_impl.

◆ itemFamily()

IItemFamily * Arcane::ItemPairGroup::itemFamily ( ) const
inline

Entity family to which this group belongs (0 for a null list).

Definition at line 95 of file ItemPairGroup.h.

References m_impl.

◆ itemGroup()

const ItemGroup & Arcane::ItemPairGroup::itemGroup ( ) const
inline

Initial item group.

Definition at line 104 of file ItemPairGroup.h.

References m_impl.

◆ itemKind()

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

Type of entities in the group.

Definition at line 80 of file ItemPairGroup.h.

References m_impl.

◆ mesh()

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

Mesh to which this list belongs (0 for a null list).

Definition at line 101 of file ItemPairGroup.h.

References m_impl.

◆ null()

bool Arcane::ItemPairGroup::null ( ) const
inline

true means the group is the null group

Definition at line 78 of file ItemPairGroup.h.

References m_impl.

◆ operator=()

const ItemPairGroup & Arcane::ItemPairGroup::operator= ( const ItemPairGroup & from)
inline

Definition at line 68 of file ItemPairGroup.h.

◆ subItemFamily()

IItemFamily * Arcane::ItemPairGroup::subItemFamily ( ) const
inline

Entity family to which this group belongs (0 for a null list).

Definition at line 98 of file ItemPairGroup.h.

References m_impl.

◆ subItemGroup()

const ItemGroup & Arcane::ItemPairGroup::subItemGroup ( ) const
inline

Final item group (after bounce).

Definition at line 107 of file ItemPairGroup.h.

References m_impl.

◆ subItemKind()

eItemKind Arcane::ItemPairGroup::subItemKind ( ) const
inline

Type of sub-entities in the group.

Definition at line 82 of file ItemPairGroup.h.

References m_impl.

Member Data Documentation

◆ m_impl


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