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

Entity vector. More...

#include <arcane/core/ItemVector.h>

Inheritance diagram for Arcane::ItemVector:
Collaboration diagram for Arcane::ItemVector:

Public Types

using ItemType = Item

Public Member Functions

 ItemVector (IItemFamily *afamily)
 Creates an empty vector associated with the family family.
 ItemVector (IItemFamily *afamily, Int32ConstArrayView local_ids)
 Creates a vector associated with the family family and containing the entities local_ids.
 ItemVector (IItemFamily *afamily, Integer asize)
 Creates a vector for size elements associated with the family family.
 ItemVector ()
 Creates a null vector. You must then call setFamily() to use it.
 operator ItemVectorView () const
 Cast operator to ItemVectorView.
void setFamily (IItemFamily *afamily)
 Sets the associated family.
void add (Int32 local_id)
 Adds an entity with local ID local_id to the end of the vector.
void add (ConstArrayView< Int32 > local_ids)
 Adds a list of entity local IDs local_ids to the end of the vector.
void addItem (ItemLocalId local_id)
 Adds an entity with local ID local_id to the end of the vector.
void addItem (Item item)
 Adds an entity to the end of the vector.
Int32 size () const
 Number of elements in the vector.
void reserve (Integer capacity)
 Reserves memory for capacity entities.
void clear ()
 Removes all entities from the vector.
ItemVectorView view () const
 View of the vector.
ArrayView< Int32viewAsArray ()
 View of the local IDs.
ConstArrayView< Int32viewAsArray () const
 Constant view of the local IDs.
void removeAt (Int32 index)
 Removes the entity at index index.
void resize (Integer new_size)
 Sets the number of elements in the array.
ItemVector clone ()
 Clones this vector.
Item operator[] (Int32 index) const
 Entity at position index of the vector.
IItemFamilyfamily () const
 Family associated with the vector.
ItemEnumerator enumerator () const
 Enumerator.

Protected Attributes

SharedArray< Int32m_local_ids
IItemFamilym_family = nullptr
ItemSharedInfom_shared_info = ItemSharedInfo::nullInstance()

Private Member Functions

void _init ()

Detailed Description

Entity vector.

The ItemVector class uses a reference semantics.

Note
This class is not thread-safe and should not be used by different threads simultaneously.
Warning
A vector must necessarily be associated with an entity family (ItemFamily*) before being used. This can be done either via calling setFamily(), or via a constructor that takes a family as an argument.

ItemVector is the generic class. It is possible to have a specialized version by entity type via ItemVectorT.

The operation of the entity vector is similar to that of the ItemGroup entity group, with the following differences:

  • the vector is local to the subdomain
  • the vector is invalidated if the associated family (IItemFamily) changes (after calling IItemFamily::endUpdate() if compaction or sorting is active)
  • the vector can contain the same entity multiple times.

A vector is useful for building a temporary list of entities. It inherits functionalities similar to the Array class and it is therefore possible, for example, to add elements one by one, either via a localId(), or via an entity.

Definition at line 59 of file ItemVector.h.

Member Typedef Documentation

◆ ItemType

using Arcane::ItemVector::ItemType = Item

Definition at line 63 of file ItemVector.h.

Constructor & Destructor Documentation

◆ ItemVector() [1/4]

Arcane::ItemVector::ItemVector ( IItemFamily * afamily)
explicit

Creates an empty vector associated with the family family.

Definition at line 37 of file ItemVector.cc.

Referenced by clone(), Arcane::ItemVectorT< Node >::ItemVectorT(), Arcane::ItemVectorT< Node >::ItemVectorT(), Arcane::ItemVectorT< Node >::ItemVectorT(), and Arcane::ItemVectorT< Node >::ItemVectorT().

Here is the caller graph for this function:

◆ ItemVector() [2/4]

Arcane::ItemVector::ItemVector ( IItemFamily * afamily,
Int32ConstArrayView local_ids )

Creates a vector associated with the family family and containing the entities local_ids.

Definition at line 48 of file ItemVector.cc.

References Arcane::MemoryUtils::copy(), and Arcane::ConstArrayView< T >::size().

Here is the call graph for this function:

◆ ItemVector() [3/4]

Arcane::ItemVector::ItemVector ( IItemFamily * afamily,
Integer asize )

Creates a vector for size elements associated with the family family.

Definition at line 61 of file ItemVector.cc.

◆ ItemVector() [4/4]

Arcane::ItemVector::ItemVector ( )

Creates a null vector. You must then call setFamily() to use it.

Definition at line 73 of file ItemVector.cc.

Member Function Documentation

◆ _init()

void Arcane::ItemVector::_init ( )
private

Definition at line 82 of file ItemVector.cc.

◆ add() [1/2]

void Arcane::ItemVector::add ( ConstArrayView< Int32 > local_ids)
inline

Adds a list of entity local IDs local_ids to the end of the vector.

Definition at line 97 of file ItemVector.h.

◆ add() [2/2]

void Arcane::ItemVector::add ( Int32 local_id)
inline

Adds an entity with local ID local_id to the end of the vector.

Definition at line 94 of file ItemVector.h.

◆ addItem() [1/2]

void Arcane::ItemVector::addItem ( Item item)
inline

Adds an entity to the end of the vector.

Definition at line 103 of file ItemVector.h.

References Arcane::Item::localId().

Here is the call graph for this function:

◆ addItem() [2/2]

void Arcane::ItemVector::addItem ( ItemLocalId local_id)
inline

Adds an entity with local ID local_id to the end of the vector.

Definition at line 100 of file ItemVector.h.

◆ clear()

void Arcane::ItemVector::clear ( )
inline

Removes all entities from the vector.

Definition at line 112 of file ItemVector.h.

◆ clone()

ItemVector Arcane::ItemVector::clone ( )
inline

Clones this vector.

Definition at line 135 of file ItemVector.h.

References ItemVector().

Here is the call graph for this function:

◆ enumerator()

ItemEnumerator Arcane::ItemVector::enumerator ( ) const
inline

Enumerator.

Definition at line 144 of file ItemVector.h.

◆ family()

IItemFamily * Arcane::ItemVector::family ( ) const
inline

Family associated with the vector.

Definition at line 141 of file ItemVector.h.

◆ operator ItemVectorView()

Arcane::ItemVector::operator ItemVectorView ( ) const
inline

Cast operator to ItemVectorView.

Definition at line 82 of file ItemVector.h.

References view().

Here is the call graph for this function:

◆ operator[]()

Item Arcane::ItemVector::operator[] ( Int32 index) const
inline

Entity at position index of the vector.

Definition at line 138 of file ItemVector.h.

◆ removeAt()

void Arcane::ItemVector::removeAt ( Int32 index)
inline

Removes the entity at index index.

Definition at line 124 of file ItemVector.h.

◆ reserve()

void Arcane::ItemVector::reserve ( Integer capacity)
inline

Reserves memory for capacity entities.

Definition at line 109 of file ItemVector.h.

◆ resize()

void Arcane::ItemVector::resize ( Integer new_size)
inline

Sets the number of elements in the array.

If the new size is greater than the old size, the added elements are undefined.

Definition at line 132 of file ItemVector.h.

Referenced by Arcane::ConnectivityItemVector::resizeAndCopy(), and Arcane::ConnectivityItemVector::setItem().

Here is the caller graph for this function:

◆ setFamily()

void Arcane::ItemVector::setFamily ( IItemFamily * afamily)

Sets the associated family.

The vector is cleared of its elements

Definition at line 96 of file ItemVector.cc.

◆ size()

Int32 Arcane::ItemVector::size ( ) const
inline

Number of elements in the vector.

Definition at line 106 of file ItemVector.h.

Referenced by Arcane::mesh::ItemsExchangeInfo2::prepareToSend(), and Arcane::mesh::ItemFamilyVariableSerializer::serialize().

Here is the caller graph for this function:

◆ view()

ItemVectorView Arcane::ItemVector::view ( ) const
inline

View of the vector.

Definition at line 115 of file ItemVector.h.

Referenced by operator ItemVectorView(), and Arcane::mesh::ItemsExchangeInfo2::removeSentItems().

Here is the caller graph for this function:

◆ viewAsArray() [1/2]

ArrayView< Int32 > Arcane::ItemVector::viewAsArray ( )
inline

View of the local IDs.

Definition at line 118 of file ItemVector.h.

Referenced by Arcane::ConnectivityItemVector::resizeAndCopy(), and Arcane::ConnectivityItemVector::setItem().

Here is the caller graph for this function:

◆ viewAsArray() [2/2]

ConstArrayView< Int32 > Arcane::ItemVector::viewAsArray ( ) const
inline

Constant view of the local IDs.

Definition at line 121 of file ItemVector.h.

Member Data Documentation

◆ m_family

IItemFamily* Arcane::ItemVector::m_family = nullptr
protected

Definition at line 149 of file ItemVector.h.

◆ m_local_ids

SharedArray<Int32> Arcane::ItemVector::m_local_ids
protected

Definition at line 148 of file ItemVector.h.

◆ m_shared_info

ItemSharedInfo* Arcane::ItemVector::m_shared_info = ItemSharedInfo::nullInstance()
protected

Definition at line 150 of file ItemVector.h.


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