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);
405 _resizeShMemVariables();
406 _resizeVariables(force_resize);
418 Variables* m_internal_variables =
nullptr;
419 Int32 m_default_sub_domain_owner = A_NULL_RANK;
423 Int32 m_sub_domain_id = A_NULL_RANK;
427 bool m_is_parallel =
false;
441 bool m_item_need_prepare_dump =
false;
445 Int64 m_nb_allocate_info = 0;
449 AdjacencyGroupMap m_adjacency_groups;
456 bool m_use_legacy_compact_item =
false;
461 bool m_do_shrink_after_allocate =
false;
465 ItemTypeMng* _itemTypeMng()
const {
return m_item_type_mng; }
468 ARCANE_DEPRECATED_REASON(
"Y2022: This method is a now a no-operation")
469 void _reserveInfosMemory(
Integer memory);
470 ARCANE_DEPRECATED_REASON(
"Y2022: This method is a now a no-operation")
471 void _resizeInfos(
Integer memory);
475 ARCANE_DEPRECATED_REASON(
"Y2022: This method always return 0")
477 void _setSharedInfosPtr(
Integer* ptr);
479 void _checkValidConnectivity();
480 void _notifyDataIndexChanged();
483 template <class
Type>
void
485 void _updateGroups(
bool check_need_remove);
487 void _checkComputeSynchronizeInfos(
Int32 changed);
489 void _invalidateComputedGroups();
490 void _compactItems(
bool do_sort);
491 void _compactOnlyItems(
bool do_sort);
492 void _applyCheckNeedUpdateOnGroups();
497 void _updateItemsSharedFlag();
504 arcaneThrowIfNull(item,
"item",
"Invalid null item");
512 arcaneThrowIfNull(source,
"source",
"Invalid null source item");
513 arcaneThrowIfNull(target,
"target",
"Invalid null target item");
515 ARCANE_UNUSED(source);
516 ARCANE_UNUSED(target);
519 void _checkValidItem(Item item) { _checkValidItem(ItemCompatibility::_itemInternal(item)); }
520 void _checkValidSourceTargetItems(Item source, Item target)
522 _checkValidItem(ItemCompatibility::_itemInternal(source));
523 _checkValidItem(ItemCompatibility::_itemInternal(target));
528 void _getConnectedItems(IIncrementalItemConnectivity* parent_connectivity, ItemVector& target_family_connected_items);
529 void _fillHasExtraParentProperty(ItemScalarProperty<bool>& child_families_has_extra_parent, ItemVectorView connected_items);
530 void _computeConnectivityInfo(ItemConnectivityInfo* ici);
531 void _updateItemViews();
532 void _resizeItemVariables(Int32 new_size,
bool force_resize);
533 void _handleOldCheckpoint();
535 void _addSourceConnectivity(IIncrementalItemSourceConnectivity* c);
536 void _addTargetConnectivity(IIncrementalItemTargetConnectivity* c);
537 void _addVariable(IVariable* var);
538 void _removeVariable(IVariable* var);
539 void _resizeVariables(
bool force_resize);
540 void _resizeShMemVariables();
541 void _shrinkConnectivityAndPrintInfos();
542 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.
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
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.