12#ifndef ARCANE_MESH_INCREMENTALITEMCONNECTIVITY_H
13#define ARCANE_MESH_INCREMENTALITEMCONNECTIVITY_H
19#include "arcane/utils/TraceAccessor.h"
21#include "arcane/core/IItemFamily.h"
22#include "arcane/core/ItemVector.h"
23#include "arcane/core/VariableTypes.h"
24#include "arcane/core/IIncrementalItemConnectivity.h"
26#include "arcane/mesh/MeshGlobal.h"
53class ARCANE_MESH_EXPORT AbstractIncrementalItemConnectivity
62 AbstractIncrementalItemConnectivity(
IItemFamily* source_family,
64 const String& connectivity_name);
82 IItemFamily* _sourceFamily()
const {
return m_source_family; }
83 IItemFamily* _targetFamily()
const {
return m_target_family; }
87 IItemFamily* m_source_family;
88 IItemFamily* m_target_family;
89 SharedArray<IItemFamily*> m_families;
98class ARCANE_MESH_EXPORT IncrementalItemConnectivityBase
99:
public AbstractIncrementalItemConnectivity
105 template <
class SourceFamily,
class TargetFamily,
class LegacyType,
class CustomType>
106 friend class NewWithLegacyConnectivity;
112 ~IncrementalItemConnectivityBase()
override;
117 IncrementalItemConnectivityBase(
const IncrementalItemConnectivityBase&) =
delete;
118 IncrementalItemConnectivityBase(IncrementalItemConnectivityBase&&) =
delete;
119 IncrementalItemConnectivityBase& operator=(
const IncrementalItemConnectivityBase&) =
delete;
120 IncrementalItemConnectivityBase& operator=(IncrementalItemConnectivityBase&&) =
delete;
128 return m_connectivity_nb_item[lid];
132 return m_connectivity_list[m_connectivity_index[lid] + index];
139 Int32 maxNbConnectedItem()
const override;
141 void reserveMemoryForNbSourceItems(
Int32 n,
bool pre_alloc_connectivity)
override;
148 Int32 nb = m_connectivity_nb_item[lid];
149 Int32 index = m_connectivity_index[lid];
150 return { nb, &m_connectivity_list[index] };
154 Int32ArrayView _connectedItemsLocalId(ItemLocalId lid)
156 Int32 nb = m_connectivity_nb_item[lid];
157 Int32 index = m_connectivity_index[lid];
158 return { nb, &m_connectivity_list[index] };
163 Int32ArrayView connectivityIndex() {
return m_connectivity_index; }
166 void setItemConnectivityList(ItemInternalConnectivityList* ilist, Int32 index);
179 bool m_is_empty =
true;
185 Integer m_item_connectivity_index = -1;
186 std::unique_ptr<InternalApi> m_internal_api;
190 void _notifyConnectivityListChanged();
191 void _notifyConnectivityIndexChanged();
192 void _notifyConnectivityNbItemChanged();
193 void _notifyConnectivityNbItemChangedFromObservable();
194 void _computeMaxNbConnectedItem();
195 void _setNewMaxNbConnectedItems(
Int32 new_max);
196 void _setMaxNbConnectedItemsInConnectivityList();
200 void _shrinkMemory();
209class ARCANE_MESH_EXPORT IncrementalItemConnectivity
210:
public IncrementalItemConnectivityBase
221 ~IncrementalItemConnectivity()
override;
243 void setPreAllocatedSize(
Integer value)
final;
245 void dumpStats(std::ostream& out)
const override;
247 void compactConnectivityList();
252 Int64 m_nb_remove = 0;
253 Int64 m_nb_memcopy = 0;
254 Integer m_pre_allocated_size = 0;
259 inline Integer _increaseConnectivityList(
Int32 new_lid);
262 void _checkAddNullItem();
263 void _resetConnectivityList();
279class ARCANE_MESH_EXPORT OneItemIncrementalItemConnectivity
280:
public IncrementalItemConnectivityBase
287 ~OneItemIncrementalItemConnectivity()
override;
305 void dumpStats(std::ostream& out)
const override;
307 void compactConnectivityList();
311 inline void _checkResizeConnectivityList();
#define ARCCORE_DEFINE_REFERENCE_COUNTED_INCLASS_METHODS()
Macro to define methods managing counters of references.
Manages the retrieval of connectivity information.
Constant view of an array of type T.
Internal Arcane API for IIncrementalItemConnectivity.
Interface for managing an incremental connectivity.
Interface of an entity family.
Base class for a view on unstructured connectivity.
Views of containers holding connectivity. This class allows the containers used to be opaque outside ...
Memory usage information for connectivities.
Connectivity information, for an entity family, allowing transition between old and new connectivity ...
Index of an Item in a variable.
View on a vector of entities.
Reference to an instance.
Thread-safe implementation of a reference counter.
Unicode character string.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
String name() const final
Name of the connectivity.
ConstArrayView< IItemFamily * > families() const override
List of families (sourceFamily() + targetFamily()).
IItemFamily * sourceFamily() const override
Source family.
IItemFamily * targetFamily() const override
Target family.
void notifySourceFamilyLocalIdChanged(Int32ConstArrayView new_to_old_ids) override
Notifies the connectivity that the source family has been compacted.
void _initializeStorage(ConnectivityItemVector *civ) override
Implements the initialization of civ for this connectivity.
Int32 connectedItemLocalId(ItemLocalId lid, Integer index) const final
localId() of the index-th entity connected to the source entity with local ID lid
Integer nbConnectedItem(ItemLocalId lid) const final
Number of entities connected to the source entity with local ID lid.
void notifyTargetFamilyLocalIdChanged(Int32ConstArrayView old_to_new_ids) override
Notifies the connectivity that the target family has been compacted.
bool hasConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) const override
Tests the existence of a connectivity between source_item and the entity with localId() target_local_...
void setConnectedItems(ItemLocalId source_item, Int32ConstArrayView target_local_ids) override
Allocates and positions entities connected to source_item.
void removeConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) override
Removes the entity with localId() target_local_id from the connectivity of source_item.
void notifySourceItemAdded(ItemLocalId item) override
Notifies the connectivity that an entity has been added to the source family.
void addConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) override
Adds the entity with localId() target_local_id to the connectivity of source_item.
void removeConnectedItems(ItemLocalId source_item) override
Removes all entities connected to source_item.
void notifyReadFromDump() override
Notifies the connectivity that a read has been performed from a dump.
friend class IndexedIncrementalItemConnectivityMng
For access to _internalNotifySourceItemsAdded().
Integer preAllocatedSize() const final
Number of entities pre-allocated for the connectivity of each entity.
void replaceConnectedItems(ItemLocalId source_item, Int32ConstArrayView target_local_ids) override
Replaces the entities of source_item with the entities with localId() target_local_ids.
void replaceConnectedItem(ItemLocalId source_item, Integer index, ItemLocalId target_local_id) override
Replaces the entity at index index of source_item with the entity with localId() target_local_id.
void removeConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) override
Removes the entity with localId() target_local_id from the connectivity of source_item.
void replaceConnectedItems(ItemLocalId source_item, Int32ConstArrayView target_local_ids) override
Replaces the entities of source_item with the entities with localId() target_local_ids.
void addConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) override
Adds the entity with localId() target_local_id to the connectivity of source_item.
void notifyReadFromDump() override
Notifies the connectivity that a read has been performed from a dump.
bool hasConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) const override
Tests the existence of a connectivity between source_item and the entity with localId() target_local_...
void notifySourceFamilyLocalIdChanged(Int32ConstArrayView new_to_old_ids) override
Notifies the connectivity that the source family has been compacted.
void replaceConnectedItem(ItemLocalId source_item, Integer index, ItemLocalId target_local_id) override
Replaces the entity at index index of source_item with the entity with localId() target_local_id.
Integer preAllocatedSize() const final
Number of entities pre-allocated for the connectivity of each entity.
void notifySourceItemAdded(ItemLocalId item) override
Notifies the connectivity that an entity has been added to the source family.
void setPreAllocatedSize(Int32 value) final
Sets the number of entities to pre-allocate for the connectivity of each entity.
void removeConnectedItems(ItemLocalId source_item) override
Removes all entities connected to source_item.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
std::int32_t Int32
Signed integer type of 32 bits.