12#ifndef ARCANE_MESH_ITEMFAMILY_H
13#define ARCANE_MESH_ITEMFAMILY_H
17#include "arcane/utils/List.h"
18#include "arcane/utils/String.h"
19#include "arcane/utils/TraceAccessor.h"
21#include "arcane/core/IItemFamily.h"
22#include "arcane/core/ItemPairGroup.h"
23#include "arcane/core/ObserverPool.h"
24#include "arcane/core/IItemConnectivity.h"
25#include "arcane/core/IIncrementalItemConnectivity.h"
26#include "arcane/core/ItemSharedInfo.h"
27#include "arcane/core/ItemGroup.h"
73class ARCANE_MESH_EXPORT ItemFamily
87 : m_item_group(item_group)
88 , m_sub_item_group(sub_item_group)
89 , m_link_kind(link_kind)
90 , m_nb_layer(nb_layer)
103 bool operator<(
const AdjacencyInfo& rhs)
const
105 if (m_item_group != rhs.m_item_group)
106 return m_item_group < rhs.m_item_group;
107 if (m_sub_item_group != rhs.m_sub_item_group)
108 return m_sub_item_group < rhs.m_sub_item_group;
109 if (m_link_kind != rhs.m_link_kind)
110 return m_link_kind < rhs.m_link_kind;
111 return m_nb_layer < rhs.m_nb_layer;
114 using AdjacencyGroupMap = std::map<AdjacencyInfo, ItemPairGroup>;
117 using AdjencyGroupMap = AdjacencyGroupMap;
132 ~ItemFamily()
override;
136 void build()
override;
143 Integer nbItem()
const override;
144 Int32 maxLocalId()
const override;
149 void setParentFamily(
IItemFamily* parent)
override;
150 Integer parentFamilyDepth()
const override;
154 void checkValid()
override;
155 void checkValidConnectivity()
override;
164 void endUpdate()
override;
165 void partialEndUpdate()
override;
166 void partialEndUpdateGroup(
const ItemGroup& group)
override;
167 void partialEndUpdateVariable(
IVariable* variable)
override;
171 void itemsUniqueIdToLocalId(
ArrayView<Int64> ids,
bool do_fatal =
true)
const;
174 bool do_fatal)
const override;
177 bool do_fatal)
const override;
194 void removeItems2(
ItemDataList& item_data_list)
override;
195 void removeNeedRemoveMarkedItems()
override;
208 void notifyItemsOwnerChanged()
override;
210 ItemGroup findGroup(
const String& name,
bool create_if_needed)
override;
215 void notifyItemsUniqueIdChanged()
override;
216 void destroyGroups()
override;
220 IVariable* findVariable(
const String& name,
bool throw_exception)
override;
225 void prepareForDump()
override;
226 void readFromDump()
override;
231 void compactItems(
bool do_sort)
override;
232 void clearItems()
override;
236 ItemSharedInfo* commonItemSharedInfo() {
return m_common_item_shared_info; }
240 ARCANE_DEPRECATED_REASON(
"Y2024: This method is internal to Arcane. Use _infos() instead.")
241 const DynamicMeshKindInfos& infos() const;
245 void setHasUniqueIdMap(
bool v) override;
246 bool hasUniqueIdMap() const override;
250 void computeSynchronizeInfos() override;
251 void getCommunicatingSubDomains(
Int32Array& sub_domains) const override;
261 ARCANE_DEPRECATED_REASON(
"Y2024: use findAdjacencyItems() instead")
300 void removeItem(
Item item)
312 void _removeOne(
Item item);
313 void _detachOne(
Item item);
319 void _setHasUniqueIdMap(
bool v);
321 void _removeDetachedOne(
Item item);
326 virtual void _endAllocate();
327 virtual void _notifyEndUpdateFromMesh();
333 IMesh* m_mesh =
nullptr;
334 InternalApi* m_internal_api =
nullptr;
337 Integer m_parent_family_depth = 0;
341 std::unique_ptr<DynamicMeshKindInfos> m_infos;
346 bool m_need_prepare_dump =
true;
358 Integer m_current_variable_item_size = 0;
360 std::set<
IVariable*,
decltype(&_cmpIVariablePtr)> m_used_variables;
361 std::set<
IVariable*,
decltype(&_cmpIVariablePtr)> m_used_shmem_variables;
366 typedef std::set<IItemConnectivity*> ItemConnectivitySet;
367 ItemConnectivitySet m_source_item_connectivities;
382 void _checkNeedEndUpdate()
const;
383 void _updateSharedInfo();
387 void _endUpdate(
bool need_check_remove);
388 bool _partialEndUpdate();
389 void _updateGroup(
ItemGroup group,
bool need_check_remove);
393 void _buildConnectivitySelectors();
394 void _preAllocate(
Int32 nb_item,
bool pre_alloc_connectivity);
415 _resizeShMemVariables();
416 _resizeVariables(force_resize);
428 Variables* m_internal_variables =
nullptr;
429 Int32 m_default_sub_domain_owner = A_NULL_RANK;
433 Int32 m_sub_domain_id = A_NULL_RANK;
437 bool m_is_parallel =
false;
451 bool m_item_need_prepare_dump =
false;
455 Int64 m_nb_allocate_info = 0;
459 AdjacencyGroupMap m_adjacency_groups;
466 bool m_use_legacy_compact_item =
false;
471 bool m_do_shrink_after_allocate =
false;
475 ItemTypeMng* _itemTypeMng()
const {
return m_item_type_mng; }
478 ARCANE_DEPRECATED_REASON(
"Y2022: This method is a now a no-operation")
479 void _reserveInfosMemory(
Integer memory);
480 ARCANE_DEPRECATED_REASON(
"Y2022: This method is a now a no-operation")
481 void _resizeInfos(
Integer memory);
485 ARCANE_DEPRECATED_REASON(
"Y2022: This method always return 0")
487 void _setSharedInfosPtr(
Integer* ptr);
489 void _checkValidConnectivity();
490 void _notifyDataIndexChanged();
493 template <class
Type>
void
495 void _updateGroups(
bool check_need_remove);
497 void _checkComputeSynchronizeInfos(
Int32 changed);
499 void _invalidateComputedGroups();
500 void _compactItems(
bool do_sort);
501 void _compactOnlyItems(
bool do_sort);
502 void _applyCheckNeedUpdateOnGroups();
507 void _updateItemsSharedFlag();
514 arcaneThrowIfNull(item,
"item",
"Invalid null item");
522 arcaneThrowIfNull(source,
"source",
"Invalid null source item");
523 arcaneThrowIfNull(target,
"target",
"Invalid null target item");
525 ARCANE_UNUSED(source);
526 ARCANE_UNUSED(target);
529 void _checkValidItem(Item item) { _checkValidItem(ItemCompatibility::_itemInternal(item)); }
530 void _checkValidSourceTargetItems(Item source, Item target)
532 _checkValidItem(ItemCompatibility::_itemInternal(source));
533 _checkValidItem(ItemCompatibility::_itemInternal(target));
538 void _getConnectedItems(IIncrementalItemConnectivity* parent_connectivity, ItemVector& target_family_connected_items);
539 void _fillHasExtraParentProperty(ItemScalarProperty<bool>& child_families_has_extra_parent, ItemVectorView connected_items);
540 void _computeConnectivityInfo(ItemConnectivityInfo* ici);
541 void _updateItemViews();
542 void _resizeItemVariables(Int32 new_size,
bool force_resize);
543 void _handleOldCheckpoint();
545 void _addSourceConnectivity(IIncrementalItemSourceConnectivity* c);
546 void _addTargetConnectivity(IIncrementalItemTargetConnectivity* c);
547 void _addVariable(IVariable* var);
548 void _removeVariable(IVariable* var);
549 void _resizeVariables(
bool force_resize);
550 void _resizeShMemVariables();
551 void _shrinkConnectivityAndPrintInfos();
552 void _addOnSizeChangedObservable(VariableRef& var_ref);
Modifiable view of an array of type T.
Constant view of an array of type T.
Class managing observers associated with an event.
Interface of an operation on a data.
Interface for managing an incremental connectivity.
Interface for connectivity information by entity type.
Interface to manage connectivity.
Internal part of IItemFamily.
Interface for entity family policies.
Interface for modifying the topology of entities within a family.
Interface of an entity family.
Interface of an entity sorting function.
Management of mesh family compaction.
Interface of the parallelism manager for a subdomain.
Interface of a particle family.
Interface of the subdomain manager.
Interface of a variable synchronization service.
Information to manage the compaction of entities of a family.
View of a list to obtain information about entities.
Connectivity information, for an entity family, allowing transition between old and new connectivity ...
Internal structure of a mesh entity.
Index of an Item in a variable.
Internal shared structure of a mesh entity.
Info on a mesh entity type.
Mesh entity type manager.
Unique identifier of an entity.
View on a vector of entities.
Base class for a mesh element.
Indirection tables for mesh entities.
Reference to an instance.
Unicode character string.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
1D data vector with value semantics (STL style).
Mesh information for a given entity kind.
Information on connectivity by entity type.
Selection between historical and on-demand connectivities.
bool canAllocateBulk() const
Whether _allocateInfosBulk() can be used: nothing allocated, nothing freed.
IMesh * mesh() const override
Associated mesh.
String fullName() const override
Full family name (with the mesh's name).
ItemInternalConnectivityList m_item_connectivity_list
Accessor for connectivities via Item and ItemInternal.
IParticleFamily * toParticleFamily() override
Returns the interface of the particle family for this family.
Integer m_current_id
Family identifier.
ItemInternalConnectivityList * itemInternalConnectivityList()
Accessor for connectivities via Item and ItemInternal.
IItemFamilyTopologyModifier * _topologyModifier() override
Topology modifier interface.
ItemConnectivitySet m_target_item_connectivities
connectivite ou ItemFamily == SourceFamily
static bool _cmpIVariablePtr(const IVariable *a, const IVariable *b)
Function to compare two variable names (strcmp).
IItemConnectivityMng * m_connectivity_mng
connectivite ou ItemFamily == TargetFamily
void _allocateInfosBulk(Int64ConstArrayView uids, ItemTypeInfo *type, Int32 owner, Int32ArrayView lids)
Allocates every item of uids at once.
Properties * properties() override
Properties associated with this family.
void resizeVariables(bool force_resize) override
Resizes the variables of this family.
String name() const override
Family name.
IItemFamilyPolicyMng * policyMng() override
Interface of behaviors/policies associated with this family.
Associative array of ItemInternal.
Mesh info for a given entity type.
Temporary class to hold an ItemSharedInfo and an entity type.
ItemVariableScalarRefT< Int32 > VariableItemInt32
32-bit integer type quantity
eReduceType
Supported reduction types.
Concurrency implementation.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Array< Int64 > Int64Array
Dynamic one-dimensional array of 64-bit integers.
ArrayView< Int64 > Int64ArrayView
C equivalent of a 1D array of 64-bit integers.
Collection< ItemGroup > ItemGroupCollection
Collection of mesh item groups.
std::int64_t Int64
Signed integer type of 64 bits.
Array< Int16 > Int16Array
Dynamic one-dimensional array of 16-bit integers.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
List< ItemGroup > ItemGroupList
Array of mesh item groups.
ConstArrayView< ItemInternal * > ItemInternalList
Type of the internal list of entities.
Collection< IItemFamily * > IItemFamilyCollection
Collection of item families.
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
eItemKind
Mesh entity type.
Array< Int32 > Int32Array
Dynamic one-dimensional array of 32-bit integers.
std::int32_t Int32
Signed integer type of 32 bits.