14#include "arcane/mesh/IncrementalItemConnectivity.h"
16#include "arcane/utils/StringBuilder.h"
17#include "arcane/utils/ArgumentException.h"
18#include "arcane/utils/PlatformUtils.h"
20#include "arcane/core/IMesh.h"
21#include "arcane/core/IItemFamily.h"
22#include "arcane/core/ConnectivityItemVector.h"
24#include "arcane/core/ObserverPool.h"
25#include "arcane/core/Properties.h"
26#include "arcane/core/IndexedItemConnectivityView.h"
27#include "arcane/core/internal/IDataInternal.h"
28#include "arcane/core/internal/IItemFamilyInternal.h"
29#include "arcane/core/internal/IIncrementalItemConnectivityInternal.h"
31#include "arcane/mesh/IndexedItemConnectivityAccessor.h"
42IndexedItemConnectivityAccessor::
43IndexedItemConnectivityAccessor(IndexedItemConnectivityViewBase view, IItemFamily* target_item_family)
44: IndexedItemConnectivityViewBase(view)
45, m_item_shared_info(target_item_family->_internalApi()->commonItemSharedInfo())
51IndexedItemConnectivityAccessor::
52IndexedItemConnectivityAccessor(IIncrementalItemConnectivity* connectivity)
53: m_item_shared_info(connectivity->targetFamily()->_internalApi()->commonItemSharedInfo())
55 auto* ptr =
dynamic_cast<mesh::IncrementalItemConnectivityBase*
>(connectivity);
57 IndexedItemConnectivityViewBase::set(ptr->connectivityView());
63AbstractIncrementalItemConnectivity::
64AbstractIncrementalItemConnectivity(IItemFamily* source_family,
65 IItemFamily* target_family,
66 const String& connectivity_name)
67: TraceAccessor(source_family->traceMng())
68, m_source_family(source_family)
69, m_target_family(target_family)
70, m_name(connectivity_name)
72 m_families.add(m_source_family);
73 m_families.add(m_target_family);
76 source_family->_internalApi()->addSourceConnectivity(
this);
77 target_family->_internalApi()->addTargetConnectivity(
this);
104class IncrementalItemConnectivityContainer
108 IncrementalItemConnectivityContainer(
IMesh*
mesh,
const String& var_name)
109 : m_var_name(var_name)
113 , m_connectivity_nb_item_array(m_connectivity_nb_item_variable._internalTrueData()->_internalDeprecatedValue())
114 , m_connectivity_index_array(m_connectivity_index_variable._internalTrueData()->_internalDeprecatedValue())
115 , m_connectivity_list_array(m_connectivity_list_variable._internalTrueData()->_internalDeprecatedValue())
120 String tag_name =
"ArcaneConnectivity";
121 m_connectivity_nb_item_variable.addTag(tag_name,
"1");
122 m_connectivity_index_variable.addTag(tag_name,
"1");
123 m_connectivity_list_variable.addTag(tag_name,
"1");
149 Integer size()
const {
return m_connectivity_nb_item_array.size(); }
151 bool isAllocated()
const {
return size() > 0; }
153 void _checkResize(
Int32 lid)
156 Integer size = m_connectivity_nb_item_array.
size();
158 if (wanted_size < size)
161 if (wanted_size < capacity) {
165 Integer reserve_size = 1000;
166 while (lid > reserve_size) {
169 m_connectivity_nb_item_array.
reserve(reserve_size);
170 m_connectivity_index_array.
reserve(reserve_size);
172 m_connectivity_nb_item_array.
resize(wanted_size);
173 m_connectivity_index_array.
resize(wanted_size);
176 void reserveForItems(Int32 capacity)
178 m_connectivity_nb_item_array.
reserve(capacity);
179 m_connectivity_index_array.
reserve(capacity);
193 explicit InternalApi(IncrementalItemConnectivityBase* v)
199 void shrinkMemory()
override {
return m_internal_api->_shrinkMemory(); }
202 m_internal_api->_addMemoryInfos(mem_info);
207 IncrementalItemConnectivityBase* m_internal_api =
nullptr;
213IncrementalItemConnectivityBase::
217, m_internal_api(std::make_unique<InternalApi>(this))
221 var_name += source_family->
name();
222 var_name += target_family->
name();
229 m_p->m_observers.addObserver(
this, &ThatClass::_notifyConnectivityNbItemChangedFromObservable,
230 m_p->m_connectivity_nb_item_variable.variable()->readObservable());
232 m_p->m_observers.addObserver(
this, &ThatClass::_notifyConnectivityIndexChanged,
233 m_p->m_connectivity_index_variable.variable()->readObservable());
235 m_p->m_observers.addObserver(
this, &ThatClass::_notifyConnectivityListChanged,
236 m_p->m_connectivity_list_variable.variable()->readObservable());
241 _notifyConnectivityListChanged();
242 _notifyConnectivityIndexChanged();
249IncrementalItemConnectivityBase::
250~IncrementalItemConnectivityBase()
264 m_p->reserveForItems(n);
265 _notifyConnectivityIndexChanged();
266 _notifyConnectivityNbItemChanged();
268 if (pre_alloc_connectivity) {
270 if (pre_alloc_size > 0) {
271 m_p->m_connectivity_list_array.reserve(n * pre_alloc_size);
272 _notifyConnectivityListChanged();
280void IncrementalItemConnectivityBase::
281_notifyConnectivityListChanged()
283 m_connectivity_list = m_p->m_connectivity_list_array.
view();
284 if (m_item_connectivity_list)
291void IncrementalItemConnectivityBase::
292_notifyConnectivityIndexChanged()
294 m_connectivity_index = m_p->m_connectivity_index_array.
view();
295 if (m_item_connectivity_list)
302void IncrementalItemConnectivityBase::
303_notifyConnectivityNbItemChanged()
305 m_connectivity_nb_item = m_p->m_connectivity_nb_item_array.
view();
306 if (m_item_connectivity_list)
313void IncrementalItemConnectivityBase::
314_setMaxNbConnectedItemsInConnectivityList()
316 if (m_item_connectivity_list)
317 m_item_connectivity_list->_setMaxNbConnectedItem(m_item_connectivity_index, m_p->m_max_nb_item);
329 _notifyConnectivityNbItemChanged();
330 _computeMaxNbConnectedItem();
336void IncrementalItemConnectivityBase::
337_setNewMaxNbConnectedItems(
Int32 new_max)
341 _setMaxNbConnectedItemsInConnectivityList();
348void IncrementalItemConnectivityBase::
349_computeMaxNbConnectedItem()
353 Int32 max_nb_item = 0;
354 for (Int32 x : m_connectivity_nb_item)
357 _setNewMaxNbConnectedItems(max_nb_item);
366 return m_p->m_max_nb_item;
381 info(4) <<
"setItemConnectivityList name=" <<
name() <<
" ilist=" << ilist <<
" index=" << index;
382 m_item_connectivity_list = ilist;
383 m_item_connectivity_index = index;
384 _notifyConnectivityListChanged();
385 _notifyConnectivityIndexChanged();
386 _notifyConnectivityNbItemChanged();
387 _setMaxNbConnectedItemsInConnectivityList();
396 if (m_p->isAllocated()) {
397 m_p->m_connectivity_nb_item_variable.variable()->compact(new_to_old_ids);
398 m_p->m_connectivity_index_variable.variable()->compact(new_to_old_ids);
399 _notifyConnectivityNbItemChanged();
400 _notifyConnectivityIndexChanged();
412 for (
Integer i = 0; i < n; ++i)
413 if (ids[i] != NULL_ITEM_LOCAL_ID)
414 ids[i] = old_to_new_ids[ids[i]];
423 return con_items.
resizeAndCopy(_connectedItemsLocalId(item));
430connectivityContainerView()
const
432 return { m_connectivity_list, m_connectivity_index, m_connectivity_nb_item };
438IndexedItemConnectivityViewBase IncrementalItemConnectivityBase::
439connectivityView()
const
441 return { connectivityContainerView(), _sourceFamily()->
itemKind(), _targetFamily()->
itemKind() };
447IndexedItemConnectivityAccessor IncrementalItemConnectivityBase::
448connectivityAccessor()
const
450 return IndexedItemConnectivityAccessor(connectivityView(), _targetFamily());
459 return m_internal_api.get();
465void IncrementalItemConnectivityBase::
468 info() <<
"Infos index=" << m_connectivity_index;
469 info() <<
"Infos nb_item=" << m_connectivity_nb_item;
470 info() <<
"Infos list=" << m_connectivity_list;
479IncrementalItemConnectivity::
482: IncrementalItemConnectivityBase(source_family, target_family, aname)
486, m_pre_allocated_size(0)
489 info(4) <<
"PreallocSize1 var=" << m_p->m_var_name <<
" v=" << m_pre_allocated_size;
498IncrementalItemConnectivity::
499~IncrementalItemConnectivity()
501 info(4) <<
" connectivity name=" <<
name()
502 <<
" prealloc_size=" << m_pre_allocated_size
503 <<
" nb_add=" << m_nb_add
504 <<
" nb_remove=" << m_nb_remove
505 <<
" nb_memcopy=" << m_nb_memcopy;
511inline Integer IncrementalItemConnectivity::
512_increaseConnectivityList(
Int32 new_lid)
514 Integer pos_in_list = m_connectivity_list.size();
515 m_p->m_connectivity_list_array.add(new_lid);
516 _notifyConnectivityListChanged();
523inline Integer IncrementalItemConnectivity::
524_increaseConnectivityList(
Int32 new_lid,
Integer nb_value)
526 Integer pos_in_list = m_connectivity_list.size();
527 m_p->m_connectivity_list_array.addRange(new_lid, nb_value);
528 _notifyConnectivityListChanged();
535void IncrementalItemConnectivity::
536_resetConnectivityList()
538 m_p->m_connectivity_list_array.clear();
539 _notifyConnectivityListChanged();
546void IncrementalItemConnectivity::
549 Integer added_range = (m_pre_allocated_size > 0) ? m_pre_allocated_size : 1;
551 Integer pos_in_index = m_connectivity_index[lid];
552 Integer new_pos_in_list = _increaseConnectivityList(NULL_ITEM_LOCAL_ID, size + added_range);
553 ArrayView<Int32> current_list(size, &(m_connectivity_list[pos_in_index]));
554 ArrayView<Int32> new_list(size + 1, &(m_connectivity_list[new_pos_in_list]));
555 new_list.copy(current_list);
558 new_list[size] = target_lid;
559 m_connectivity_index[lid] = new_pos_in_list;
569 const Int32 lid = source_item.localId();
570 const Int32 target_lid = target_item.localId();
571 Integer size = m_connectivity_nb_item[lid];
581 if (m_pre_allocated_size != 0) {
585 Integer new_pos_in_list = _increaseConnectivityList(NULL_ITEM_LOCAL_ID, m_pre_allocated_size);
586 m_connectivity_index[lid] = new_pos_in_list;
587 m_connectivity_list[new_pos_in_list] = target_lid;
590 if (size < m_pre_allocated_size || (size % m_pre_allocated_size) != 0) {
591 Integer index = m_connectivity_index[lid];
592 m_connectivity_list[index + size] = target_lid;
595 _increaseIndexList(lid, size, target_lid);
601 Integer new_pos_in_list = _increaseConnectivityList(target_lid);
602 m_connectivity_index[lid] = new_pos_in_list;
605 _increaseIndexList(lid, size, target_lid);
608 ++(m_connectivity_nb_item[lid]);
609 _setNewMaxNbConnectedItems(m_connectivity_nb_item[lid]);
615Integer IncrementalItemConnectivity::
616_computeAllocSize(
Integer nb_item)
618 if (m_pre_allocated_size != 0) {
620 Integer alloc_size = nb_item / m_pre_allocated_size;
622 return m_pre_allocated_size;
623 if ((nb_item % m_pre_allocated_size) == 0)
625 return m_pre_allocated_size * (alloc_size + 1);
633void IncrementalItemConnectivity::
634addConnectedItems(ItemLocalId source_item,
Integer nb_item)
636 const Int32 lid = source_item.localId();
637 Integer size = m_connectivity_nb_item[lid];
639 ARCANE_FATAL(
"source_item already have connected items");
640 Integer alloc_size = _computeAllocSize(nb_item);
641 Integer new_pos_in_list = _increaseConnectivityList(NULL_ITEM_LOCAL_ID, alloc_size);
642 m_connectivity_index[lid] = new_pos_in_list;
643 m_connectivity_nb_item[lid] += nb_item;
644 _setNewMaxNbConnectedItems(m_connectivity_nb_item[lid]);
654 addConnectedItems(source_item, target_local_ids.
size());
664 Int32 lid = source_item.localId();
665 m_connectivity_nb_item[lid] = 0;
675 Int32 lid = source_item.localId();
676 Int32 target_lid = target_item.localId();
677 Integer size = m_connectivity_nb_item[lid];
678 Int32* items = &(m_connectivity_list[m_connectivity_index[lid]]);
680 --(m_connectivity_nb_item[lid]);
689 Int32 lid = source_item.localId();
690 Int32 target_lid = target_item.localId();
691 ARCANE_CHECK_AT(index, m_connectivity_nb_item[lid]);
692 m_connectivity_list[m_connectivity_index[lid] + index] = target_lid;
701 Int32 lid = source_item.localId();
704 ARCANE_CHECK_AT(n - 1, m_connectivity_nb_item[lid]);
705 const Int32 pos = m_connectivity_index[lid];
706 for (
Integer i = 0; i < n; ++i)
707 m_connectivity_list[pos + i] = target_local_ids[i];
717 bool has_connection =
false;
718 auto connected_items = _connectedItemsLocalId(source_item);
719 if (std::find(connected_items.begin(), connected_items.end(), target_local_id) != connected_items.end())
720 has_connection =
true;
721 return has_connection;
730 Int32 lid = item.localId();
731 m_p->_checkResize(lid);
732 _notifyConnectivityIndexChanged();
733 _notifyConnectivityNbItemChanged();
735 m_connectivity_nb_item[lid] = 0;
736 m_connectivity_index[lid] = 0;
742void IncrementalItemConnectivity::
749 Int32 max_lid = local_ids[0];
750 for (
Int32 lid : local_ids)
753 m_p->_checkResize(max_lid);
754 _notifyConnectivityIndexChanged();
755 _notifyConnectivityNbItemChanged();
757 for (
Int32 lid : local_ids) {
758 m_connectivity_nb_item[lid] = 0;
759 m_connectivity_index[lid] = 0;
769 m_pre_allocated_size = _sourceFamily()->properties()->getIntegerWithDefault(
name() +
"PreallocSize", 0);
770 info(4) <<
"PreallocSize2 var=" << m_p->m_var_name <<
" v=" << m_pre_allocated_size;
781 if (m_pre_allocated_size < 0)
783 String::format(
"Invalid prealloc_size v={0}",
791 if (m_connectivity_nb_item.size() != 0)
794 m_pre_allocated_size = prealloc_size;
795 _sourceFamily()->properties()->setInteger(
name() +
"PreallocSize", prealloc_size);
800 _resetConnectivityList();
809 Int64 mem1 = m_p->m_connectivity_list_array.capacity();
810 Int64 mem2 = m_p->m_connectivity_index_array.capacity();
811 Int64 mem3 = m_p->m_connectivity_nb_item_array.capacity();
812 Int64 allocated_size = mem1 + mem2 + mem3;
813 allocated_size *=
sizeof(
Int32);
815 out <<
" connectiviy name=" <<
name()
816 <<
" prealloc_size=" << m_pre_allocated_size
817 <<
" nb_add=" << m_nb_add
818 <<
" nb_remove=" << m_nb_remove
819 <<
" nb_memcopy=" << m_nb_memcopy
820 <<
" list_size=" << m_connectivity_list.size()
821 <<
" list_capacity=" << mem1
822 <<
" index_size=" << m_connectivity_index.size()
823 <<
" index_capacity=" << mem2
824 <<
" nb_item_size=" << m_connectivity_nb_item.size()
825 <<
" nb_item_capacity=" << mem3
826 <<
" allocated_size=" << allocated_size;
832void IncrementalItemConnectivityBase::
835 m_p->m_connectivity_list_array.
shrink();
836 m_p->m_connectivity_index_array.
shrink();
837 m_p->m_connectivity_nb_item_array.
shrink();
838 _notifyConnectivityIndexChanged();
839 _notifyConnectivityNbItemChanged();
840 _notifyConnectivityListChanged();
846void IncrementalItemConnectivityBase::
849 Int64 s1 = m_p->m_connectivity_list_array.
size();
850 Int64 s2 = m_p->m_connectivity_index_array.
size();
851 Int64 s3 = m_p->m_connectivity_nb_item_array.
size();
863void IncrementalItemConnectivity::
870 if (m_connectivity_list.
size() == 0) {
871 if (m_pre_allocated_size > 0) {
872 _increaseConnectivityList(NULL_ITEM_LOCAL_ID, m_pre_allocated_size);
875 _increaseConnectivityList(NULL_ITEM_LOCAL_ID);
895 info(4) <<
"Begin Compacting IncrementalItemConnectivity name=" <<
name()
896 <<
" new_size=" << m_connectivity_list.size()
897 <<
" prealloc_size=" << m_pre_allocated_size;
903 Integer nb_item = m_connectivity_nb_item.size();
904 m_p->m_connectivity_list_array.clear();
905 _notifyConnectivityListChanged();
907 Integer new_pos_in_list = m_p->m_connectivity_list_array.size();
908 Int32 pre_allocated_size = m_pre_allocated_size;
909 for (
Integer i = 0; i < nb_item; ++i) {
911 Int32 nb = m_connectivity_nb_item[lid];
913 m_connectivity_index[lid] = 0;
916 Int32 index = m_connectivity_index[lid];
918 Integer alloc_size = _computeAllocSize(nb);
919 m_connectivity_index[lid] = new_pos_in_list;
920 new_pos_in_list += alloc_size;
923 if (pre_allocated_size != 0) {
924 Int32 pos_modulo = new_pos_in_list % pre_allocated_size;
926 ARCANE_FATAL(
"Bad position i={0} pos={1} pre_alloc_size={2} modulo={3}",
927 i, new_pos_in_list, pre_allocated_size, pos_modulo);
929 m_p->m_connectivity_list_array.addRange(con_list);
931 if (alloc_size != nb)
932 m_p->m_connectivity_list_array.addRange(NULL_ITEM_LOCAL_ID, alloc_size - nb);
933 if (m_pre_allocated_size == 0 && nb == 0)
934 m_connectivity_index[lid] = 0;
936 _notifyConnectivityListChanged();
937 _computeMaxNbConnectedItem();
938 info(4) <<
"Compacting IncrementalItemConnectivity name=" <<
name()
939 <<
" nb_item=" << nb_item <<
" old_size=" << old_size
940 <<
" new_size=" << m_connectivity_list.size()
941 <<
" prealloc_size=" << m_pre_allocated_size;
953OneItemIncrementalItemConnectivity::
958 info(4) <<
"Using fixed OneItem connectivity for name=" <<
name();
964OneItemIncrementalItemConnectivity::
965~OneItemIncrementalItemConnectivity()
975 Int32 lid = source_item.localId();
976 Integer size = m_connectivity_nb_item[lid];
978 ARCANE_FATAL(
"source_item already have connected items");
979 Int32 target_lid = target_item.localId();
980 m_connectivity_list[lid] = target_lid;
981 m_connectivity_nb_item[lid] = 1;
982 _setNewMaxNbConnectedItems(1);
991 Int32 lid = source_item.localId();
992 m_connectivity_nb_item[lid] = 0;
1001 Int32 lid = source_item.localId();
1002 Int32 target_local_id = target_item.localId();
1003 Integer size = m_connectivity_nb_item[lid];
1006 Int32 target_lid = m_connectivity_list[lid];
1007 if (target_lid != target_local_id)
1008 ARCANE_FATAL(
"source_item is not connected to item with wanted_lid={0} current_lid={1}",
1009 target_local_id, target_lid);
1010 m_connectivity_nb_item[lid] = 0;
1011 m_connectivity_list[lid] = NULL_ITEM_LOCAL_ID;
1022 Int32 lid = source_item.localId();
1023 Int32 target_lid = target_item.localId();
1024 m_connectivity_list[lid] = target_lid;
1033 Int32 lid = source_item.localId();
1038 ARCANE_FATAL(
"Invalid size for target_list. value={0} (expected 1)", n);
1039 m_connectivity_list[lid] = target_local_ids[0];
1049 if (m_connectivity_list[source_item.localId()] == target_local_id.localId())
1058void OneItemIncrementalItemConnectivity::
1059_checkResizeConnectivityList()
1063 Integer wanted_size = m_connectivity_nb_item.size();
1065 if (list_size == wanted_size)
1068 if (wanted_size >= capacity) {
1069 m_p->m_connectivity_list_array.
reserve(m_p->m_connectivity_nb_item_array.
capacity());
1071 m_p->m_connectivity_list_array.
resize(wanted_size);
1072 _notifyConnectivityListChanged();
1081 Int32 lid = item.localId();
1082 m_p->_checkResize(lid);
1083 _notifyConnectivityIndexChanged();
1084 _notifyConnectivityNbItemChanged();
1085 _checkResizeConnectivityList();
1087 m_connectivity_nb_item[lid] = 0;
1088 m_connectivity_index[lid] = lid;
1089 m_connectivity_list[lid] = NULL_ITEM_LOCAL_ID;
1105 m_p->m_connectivity_nb_item_variable.variable()->compact(new_to_old_ids);
1106 _notifyConnectivityNbItemChanged();
1111 m_p->m_connectivity_list_variable.variable()->compact(new_to_old_ids);
1112 _notifyConnectivityListChanged();
1116 m_p->m_connectivity_index_array.resize(m_connectivity_nb_item.size());
1117 _notifyConnectivityIndexChanged();
1134 size_t allocated_size = m_p->m_connectivity_list_array.capacity() + m_p->m_connectivity_index_array.capacity() + m_p->m_connectivity_nb_item_array.capacity();
1135 allocated_size *=
sizeof(
Int32);
1137 out <<
" connectiviy name=" <<
name()
1138 <<
" list_size=" << m_connectivity_list.size()
1139 <<
" index_size=" << m_connectivity_index.size()
1140 <<
" nb_item_size=" << m_connectivity_nb_item.size()
1141 <<
" allocated_size=" << allocated_size;
1147void OneItemIncrementalItemConnectivity::
1148compactConnectivityList()
1150 _computeMaxNbConnectedItem();
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Utility functions for the mesh.
void removeItemAndKeepOrder(Int32ArrayView items, Int32 local_id)
Removes an entity while preserving order.
Integer capacity() const
Capacity (number of allocated elements) of the vector.
Integer size() const
Number of elements in the vector.
Exception when an argument is invalid.
constexpr Integer size() const noexcept
Returns the size of the array.
void shrink()
Reallocates to free unused memory.
void resize(Int64 s)
Changes the number of elements in the array to s.
const T * data() const
Access to the root of the array without any protection.
void reserve(Int64 new_capacity)
Reserves memory for new_capacity elements.
ArrayView< T > view() const
Mutable view of this array.
ItemVectorView resizeAndCopy(Int32ConstArrayView ids)
Positions the connectivity list with the entities specified by ids.
Constant view of an array of type T.
constexpr Integer size() const noexcept
Number of elements in the array.
Internal Arcane API for IIncrementalItemConnectivity.
virtual Integer preAllocatedSize() const =0
Number of entities pre-allocated for the connectivity of each entity.
Interface of an entity family.
virtual String name() const =0
Family name.
virtual eItemKind itemKind() const =0
Entity kind.
virtual IMesh * mesh() const =0
Associated mesh.
virtual Properties * properties()=0
Properties associated with this family.
@ PPrivate
Indicates that the variable is private.
Views of containers holding connectivity. This class allows the containers used to be opaque outside ...
Memory usage information for connectivities.
Int64 m_total_capacity
Total number of Int32 allocated (corresponds to the sum of capacity()).
Int64 m_total_size
Total number of Int32 used (corresponds to the sum of size()).
Connectivity information, for an entity family, allowing transition between old and new connectivity ...
void _setConnectivityNbItem(Int32 item_kind, ConstArrayView< Int32 > v)
Positions the array containing the number of connected entities.
void _setConnectivityList(Int32 item_kind, ArrayView< Int32 > v)
Positions the array containing the connectivity list.
void _setConnectivityIndex(Int32 item_kind, ConstArrayView< Int32 > v)
Positions the connectivity index array.
Index of an Item in a variable.
View on a vector of entities.
Integer getIntegerWithDefault(const String &name, Integer default_value) const
Value of the property named name.
Reference to an instance.
Unicode character string constructor.
Unicode character string.
TraceMessage info() const
Flow for an information message.
1D data vector with value semantics (STL style).
Parameters necessary for building a variable.
Array< DataType > ContainerType
Abstract class for managing connectivities.
String name() const final
Name of the connectivity.
void addMemoryInfos(ItemConnectivityMemoryInfo &mem_info) override
Adds the instance's memory information to mem_info.
void shrinkMemory() override
Minimally reduces memory usage for connectivities.
Base class for incremental item->item[] connectivities.
void notifySourceFamilyLocalIdChanged(Int32ConstArrayView new_to_old_ids) override
Notifies the connectivity that the source family has been compacted.
void _notifyConnectivityNbItemChangedFromObservable()
Int32 maxNbConnectedItem() const override
Maximum number of entities connected to a source entity.
void setItemConnectivityList(ItemInternalConnectivityList *ilist, Int32 index)
Indicates that this connectivity is associated with one of the connectivities of ItemInternal.
void reserveMemoryForNbSourceItems(Int32 n, bool pre_alloc_connectivity) override
Reserves memory for n source entities.
ItemVectorView _connectedItems(ItemLocalId item, ConnectivityItemVector &con_items) const final
Fills con_items with the entities connected to item.
IIncrementalItemConnectivityInternal * _internalApi() override
Internal Arcane API.
void notifyTargetFamilyLocalIdChanged(Int32ConstArrayView old_to_new_ids) override
Notifies the connectivity that the target family has been compacted.
Int32 m_max_nb_item
Maximum number of connected items.
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 compactConnectivityList()
Compresses the connectivity list.
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.
void dumpStats(std::ostream &out) const override
Dumps statistics on usage and memory used to the stream out.
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 setPreAllocatedSize(Integer value) final
Sets the number of entities to pre-allocate for the connectivity of each entity.
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.
void notifySourceItemAdded(ItemLocalId item) override
Notifies the connectivity that an entity has been added to the source family.
void removeConnectedItems(ItemLocalId source_item) override
Removes all entities connected to source_item.
void dumpStats(std::ostream &out) const override
Dumps statistics on usage and memory used to the stream out.
T max(const T &a, const T &b, const T &c)
Returns the maximum of three elements.
VariableRefArrayT< Int32 > VariableArrayInt32
Array variable of 32-bit integer type.
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.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.