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;
195 Integer m_item_connectivity_index = -1;
196 std::unique_ptr<InternalApi> m_internal_api;
200 void _lazyNotifySourceItemAdded(
Int32 lid);
211 void _notifyConnectivityListChanged();
212 void _notifyConnectivityIndexChanged();
213 void _notifyConnectivityNbItemChanged();
214 void _notifyConnectivityNbItemChangedFromObservable();
215 void _computeMaxNbConnectedItem();
216 void _setNewMaxNbConnectedItems(
Int32 new_max);
217 void _setMaxNbConnectedItemsInConnectivityList();
221 void _shrinkMemory();
230class ARCANE_MESH_EXPORT IncrementalItemConnectivity
231:
public IncrementalItemConnectivityBase
242 ~IncrementalItemConnectivity()
override;
290 void setPreAllocatedSize(
Integer value)
final;
292 void dumpStats(std::ostream& out)
const override;
294 void compactConnectivityList();
299 Int64 m_nb_remove = 0;
300 Int64 m_nb_memcopy = 0;
301 Integer m_pre_allocated_size = 0;
306 inline Integer _increaseConnectivityList(
Int32 new_lid);
309 void _checkAddNullItem();
310 void _resetConnectivityList();
326class ARCANE_MESH_EXPORT OneItemIncrementalItemConnectivity
327:
public IncrementalItemConnectivityBase
334 ~OneItemIncrementalItemConnectivity()
override;
352 void dumpStats(std::ostream& out)
const override;
354 void compactConnectivityList();
358 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.
bool m_is_lazy
True while this connectivity has never had a connected item.
void _checkMaterialize()
Leaves the lazy state if this connectivity is still in it.
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.
void _publishLazyViews(Int32 nb_source)
Points both per-source views at the shared zero buffer, so a reader of nbConnectedItem() gets 0 for e...
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 _trimLazyViews()
Moves the lazy views to one zero buffer of the size of the mesh.
void _materialize()
Leaves the lazy state: allocates the two per-source arrays for real.
void notifyTargetFamilyLocalIdChanged(Int32ConstArrayView old_to_new_ids) override
Notifies the connectivity that the target family has been compacted.
void resizeBulkConnectivity(Int32 nb_source, Int64 list_size, Int32ArrayView &nb_items, Int32ArrayView &indexes, Int32ArrayView &list)
Sizes the storage for a bulk fill and hands out the arrays to write.
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 endBulkConnectivity()
Closes a fill started by resizeBulkConnectivity().
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().
void setBulkConnectivity(Int32ConstArrayView nb_items, Int32ConstArrayView indexes, Int32ConstArrayView list)
Replaces the whole connectivity with one the caller already knows.
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.