Arcane  4.2.3.0
Developer documentation
Loading...
Searching...
No Matches
ItemFamily.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ItemFamily.cc (C) 2000-2026 */
9/* */
10/* Mesh info for a given type of entity. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/FatalErrorException.h"
15#include "arcane/utils/ITraceMng.h"
16#include "arcane/utils/StringBuilder.h"
17#include "arcane/utils/ScopedPtr.h"
18#include "arcane/utils/NotImplementedException.h"
19#include "arcane/utils/NotSupportedException.h"
20#include "arcane/utils/ArgumentException.h"
21#include "arcane/utils/CheckedConvert.h"
22#include "arcane/utils/PlatformUtils.h"
23#include "arcane/utils/OStringStream.h"
24#include "arcane/utils/ValueConvert.h"
25#include "arcane/utils/CStringUtils.h"
26
27#include "arcane/core/IParallelMng.h"
28#include "arcane/core/ISubDomain.h"
29#include "arcane/core/VariableTypes.h"
30#include "arcane/core/IVariableMng.h"
31#include "arcane/core/IVariable.h"
32#include "arcane/core/IMesh.h"
33#include "arcane/core/IMeshSubMeshTransition.h"
34#include "arcane/core/IApplication.h"
35#include "arcane/core/IDataFactoryMng.h"
36#include "arcane/core/ItemInfoListView.h"
37#include "arcane/core/ItemPairGroup.h"
38#include "arcane/core/ItemPairGroupImpl.h"
39#include "arcane/core/IMeshUtilities.h"
40#include "arcane/core/IVariableSynchronizer.h"
41#include "arcane/core/ItemInternalSortFunction.h"
42#include "arcane/core/Properties.h"
43#include "arcane/core/ItemFamilyCompactInfos.h"
44#include "arcane/core/IMeshMng.h"
45#include "arcane/core/IMeshCompacter.h"
46#include "arcane/core/IMeshCompactMng.h"
47#include "arcane/core/MeshPartInfo.h"
48#include "arcane/core/ParallelMngUtils.h"
49#include "arcane/core/internal/IDataInternal.h"
50#include "arcane/core/internal/IItemFamilyInternal.h"
51#include "arcane/core/internal/IIncrementalItemConnectivityInternal.h"
52#include "arcane/core/datatype/IDataOperation.h"
53
54#include "arcane/mesh/ItemFamily.h"
55#include "arcane/mesh/ItemSharedInfoList.h"
56#include "arcane/mesh/ItemConnectivityInfo.h"
57#include "arcane/mesh/ItemConnectivitySelector.h"
58#include "arcane/mesh/AbstractItemFamilyTopologyModifier.h"
59#include "arcane/mesh/DynamicMeshKindInfos.h"
60#include "arcane/mesh/internal/UniqueIdKeySortFunction.h"
61
62#include "arcane/core/parallel/GhostItemsVariableParallelOperation.h"
63#include "arcane/core/parallel/IStat.h"
64
65#include "arcane/core/IIncrementalItemConnectivity.h"
66#include "arcane/core/IItemConnectivityMng.h"
67#include "arcane/core/IItemFamilyPolicyMng.h"
68
69#include "arcane/core/ItemPrinter.h"
70#include "arcane/core/ConnectivityItemVector.h"
71#include "arcane/core/IndexedItemConnectivityView.h"
72
73#include "arcane/mesh/ItemProperty.h"
74#include "arcane/mesh/ItemData.h"
75#include "arcane/mesh/ConnectivityNewWithDependenciesTypes.h"
76
77#include <array>
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
82namespace Arcane::mesh
83{
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
87
88namespace
89{
90
91 template <typename DataType> void
92 _offsetArrayByOne(Array<DataType>* array)
93 {
94 Array<DataType>& v = *array;
95 MeshUtils::checkResizeArray(v, v.size() + 1, false);
96 Int32 n = v.size();
97 for (Int32 i = (n - 1); i >= 1; --i)
98 v[i] = v[i - 1];
99 }
100
101} // namespace
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
107: public IItemFamilyInternal
108{
109 public:
110
111 explicit InternalApi(ItemFamily* family)
112 : m_family(family)
113 {}
114
115 public:
116
118 {
119 return m_family->_unstructuredItemInternalConnectivityList();
120 }
122 {
123 return m_family->_topologyModifier();
124 }
126 {
127 return m_family->commonItemSharedInfo();
128 }
129 void addSourceConnectivity(IIncrementalItemSourceConnectivity* connectivity) override
130 {
131 m_family->_addSourceConnectivity(connectivity);
132 }
133 void addTargetConnectivity(IIncrementalItemTargetConnectivity* connectivity) override
134 {
135 m_family->_addTargetConnectivity(connectivity);
136 }
137 void endAllocate() override
138 {
139 return m_family->_endAllocate();
140 }
142 {
143 return m_family->_notifyEndUpdateFromMesh();
144 }
145 void addVariable(IVariable* var) override
146 {
147 return m_family->_addVariable(var);
148 }
149 void removeVariable(IVariable* var) override
150 {
151 return m_family->_removeVariable(var);
152 }
153 void resizeVariables(bool force_resize) override
154 {
155 m_family->_resizeShMemVariables();
156 m_family->_resizeVariables(force_resize);
157 }
158
159 private:
160
161 ItemFamily* m_family = nullptr;
162};
163
164/*---------------------------------------------------------------------------*/
165/*---------------------------------------------------------------------------*/
166
168{
169 public:
170
171 Variables(IMesh* mesh,
172 const String& family_name,
173 eItemKind item_kind,
174 const String& shared_data_name,
175 const String& unique_ids_name,
176 const String& items_owner_name,
177 const String& items_flags_name,
178 const String& items_type_id_name,
179 const String& items_nb_parent_name,
180 const String& groups_name,
181 const String& current_id_name,
182 const String& new_owner_name,
183 const String& parent_mesh_name,
184 const String& parent_family_name,
185 const String& parent_family_depth_name,
186 const String& child_meshes_name,
187 const String& child_families_name)
194 , m_groups_name(VariableBuildInfo(mesh, groups_name))
195 , m_current_id(VariableBuildInfo(mesh, current_id_name))
197 , m_parent_mesh_name(VariableBuildInfo(mesh, parent_mesh_name, IVariable::PPrivate))
198 , m_parent_family_name(VariableBuildInfo(mesh, parent_family_name, IVariable::PPrivate))
199 , m_parent_family_depth(VariableBuildInfo(mesh, parent_family_depth_name, IVariable::PPrivate))
200 , m_child_meshes_name(VariableBuildInfo(mesh, child_meshes_name, IVariable::PPrivate))
201 , m_child_families_name(VariableBuildInfo(mesh, child_families_name, IVariable::PPrivate))
202 {}
203
204 public:
205
206 void setUsed()
207 {
208 m_items_new_owner.setUsed(true);
209 }
210
211 public:
212
214 // TODO: use Int16 when the number of ItemSharedInfo is limited to Int16
232 VariableArrayString m_groups_name;
233 VariableScalarInteger m_current_id;
245 VariableScalarString m_parent_mesh_name;
246 VariableScalarString m_parent_family_name;
247 VariableScalarInteger m_parent_family_depth;
248 VariableArrayString m_child_meshes_name;
249 VariableArrayString m_child_families_name;
250};
251
252/*---------------------------------------------------------------------------*/
253/*---------------------------------------------------------------------------*/
254
256_cmpIVariablePtr(const IVariable* a, const IVariable* b)
257{
258 return CStringUtils::isLess(a->name().localstr(), b->name().localstr());
259}
260
261/*---------------------------------------------------------------------------*/
262/*---------------------------------------------------------------------------*/
263
264/*---------------------------------------------------------------------------*/
265/*---------------------------------------------------------------------------*/
266
267ItemFamily::
268ItemFamily(IMesh* mesh, eItemKind ik, const String& name)
269: TraceAccessor(mesh->traceMng())
270, m_name(name)
271, m_mesh(mesh)
272, m_internal_api(new InternalApi(this))
273, m_sub_domain(mesh->subDomain())
274, m_infos(std::make_unique<DynamicMeshKindInfos>(mesh, ik, name))
275, m_item_internal_list(mesh->meshItemInternalList())
276, m_common_item_shared_info(new ItemSharedInfo(this, m_item_internal_list, &m_item_connectivity_list))
277, m_item_shared_infos(new ItemSharedInfoList(this, m_common_item_shared_info))
278, m_used_variables(&_cmpIVariablePtr)
279, m_used_shmem_variables(&_cmpIVariablePtr)
280, m_properties(new Properties(*mesh->properties(), name))
281, m_sub_domain_id(mesh->meshPartInfo().partRank())
282{
283 m_item_connectivity_list.m_items = mesh->meshItemInternalList();
284 m_infos->setItemFamily(this);
285 m_connectivity_selector_list_by_item_kind.resize(ItemInternalConnectivityList::MAX_ITEM_KIND);
286}
287
288/*---------------------------------------------------------------------------*/
289/*---------------------------------------------------------------------------*/
290
291ItemFamily::
292~ItemFamily()
293{
294 delete m_topology_modifier;
295 delete m_policy_mng;
296 delete m_properties;
297 delete m_local_connectivity_info;
298 delete m_global_connectivity_info;
299 delete m_item_sort_function;
300 delete m_internal_variables;
301 delete m_item_shared_infos;
302
303 for (ItemConnectivitySelector* ics : m_connectivity_selector_list)
304 delete ics;
305
306 delete m_common_item_shared_info;
307 delete m_internal_api;
308}
309
310/*---------------------------------------------------------------------------*/
311/*---------------------------------------------------------------------------*/
312
313String ItemFamily::
314_variableName(const String& base_name) const
315{
316 return m_name + base_name;
317}
318
319/*---------------------------------------------------------------------------*/
320/*---------------------------------------------------------------------------*/
321
322void ItemFamily::
323build()
324{
325 m_item_type_mng = m_mesh->itemTypeMng();
326
327 // Create the topology modifier if it hasn't been done by
328 // the derived class.
329 if (!m_topology_modifier)
330 m_topology_modifier = new AbstractItemFamilyTopologyModifier(this);
331
332 m_full_name = m_mesh->name() + "_" + m_name;
333
334 m_local_connectivity_info = new ItemConnectivityInfo();
335 m_global_connectivity_info = new ItemConnectivityInfo();
336
337 IParallelMng* pm = m_mesh->parallelMng();
338 if (!pm->isParallel()) {
339 m_default_sub_domain_owner = 0;
340 m_is_parallel = false;
341 }
342 else
343 m_is_parallel = true;
344
345 // First initialize the infos because this creates the entity groups
346 // and it is essential before creating variables on them.
347 m_infos->build();
348
349 // Constructs the instance that will contain the variables
350 // NOTE: if we change the names here, we must also change them in MeshStats.cc
351 // otherwise the statistics will not be reliable.
352 {
353 String var_unique_ids_name(_variableName("FamilyUniqueIds"));
354 String var_owner_name(_variableName("FamilyOwner"));
355 String var_flags_name(_variableName("FamilyFlags"));
356 String var_typeid_name(_variableName("FamilyItemTypeId"));
357 String var_nb_parent_name(_variableName("FamilyItemNbParent"));
358 String var_count_name(_variableName("FamilyItemsShared"));
359 String var_groups_name(_variableName("FamilyGroupsName"));
360 String var_current_id_name(_variableName("FamilyCurrentId"));
361 String var_new_owner_name(_variableName("FamilyNewOwnerName"));
362 String var_parent_mesh_name(_variableName("ParentMeshName"));
363 String var_parent_family_name(_variableName("ParentFamilyName"));
364 String var_parent_family_depth_name(_variableName("ParentFamilyDepthName"));
365 String var_child_meshes_name(_variableName("ChildMeshesName"));
366 String var_child_families_name(_variableName("ChildFamiliesName"));
367 m_internal_variables = new Variables(m_mesh, name(), itemKind(), var_count_name,
368 var_unique_ids_name, var_owner_name,
369 var_flags_name, var_typeid_name, var_nb_parent_name, var_groups_name,
370 var_current_id_name, var_new_owner_name,
371 var_parent_mesh_name, var_parent_family_name,
372 var_parent_family_depth_name,
373 var_child_meshes_name,
374 var_child_families_name);
375 // These arrays should not be used to access entities because there is an offset
376 // of 1 to manage the null entity. You must use the associated view
377 // which is in m_common_item_shared_info.
378 m_items_unique_id = &m_internal_variables->m_items_unique_id._internalTrueData()->_internalDeprecatedValue();
379 m_items_owner = &m_internal_variables->m_items_owner._internalTrueData()->_internalDeprecatedValue();
380 m_items_flags = &m_internal_variables->m_items_flags._internalTrueData()->_internalDeprecatedValue();
381 m_items_type_id = &m_internal_variables->m_items_type_id._internalTrueData()->_internalDeprecatedValue();
382 m_items_nb_parent = &m_internal_variables->m_items_nb_parent._internalTrueData()->_internalDeprecatedValue();
383
384 // Add notification for view update after an external change
385 _addOnSizeChangedObservable(m_internal_variables->m_items_unique_id);
386 _addOnSizeChangedObservable(m_internal_variables->m_items_owner);
387 _addOnSizeChangedObservable(m_internal_variables->m_items_flags);
388 _addOnSizeChangedObservable(m_internal_variables->m_items_type_id);
389 _addOnSizeChangedObservable(m_internal_variables->m_items_nb_parent);
390
391 _updateItemViews();
392 }
393
394 m_variable_synchronizer = ParallelMngUtils::createSynchronizerRef(pm, this);
395
396 m_item_sort_function = _defaultItemSortFunction();
397
398 {
399 String s = platform::getEnvironmentVariable("ARCANE_USE_LEGACY_COMPACT_ITEMS");
400 if (s == "TRUE" || s == "1") {
401 info() << "WARNING: Using legacy 'compactItem()' without compactReference()'";
402 m_use_legacy_compact_item = true;
403 }
404 }
405 {
406 if (auto v = Convert::Type<Int32>::tryParseFromEnvironment("ARCANE_ITEMFAMILY_SHRINK_AFTER_ALLOCATE", true))
407 m_do_shrink_after_allocate = (v.value() != 0);
408 }
409}
410
411/*---------------------------------------------------------------------------*/
412/*---------------------------------------------------------------------------*/
413
416{
417 return m_infos->findOne(uid);
418}
419ItemInternalMap& ItemFamily::
420itemsMap()
421{
422 return m_infos->itemsMap();
423}
424const DynamicMeshKindInfos& ItemFamily::
425infos() const
426{
427 return *m_infos;
428}
429
430const DynamicMeshKindInfos& ItemFamily::
431_infos() const
432{
433 return *m_infos;
434}
435
436void ItemFamily::
437_removeOne(Item item)
438{
439 // TODO: check in check mode with the new connectivities that the deleted entity
440 // does not have connected objects.
441 m_infos->removeOne(ItemCompatibility::_itemInternal(item));
442}
443void ItemFamily::
444_detachOne(Item item)
445{
446 m_infos->detachOne(ItemCompatibility::_itemInternal(item));
447}
448ItemInternalList ItemFamily::
449_itemsInternal()
450{
451 return m_infos->itemsInternal();
452}
453ItemInternal* ItemFamily::
454_itemInternal(Int32 local_id)
455{
456 return m_infos->itemInternal(local_id);
457}
458ItemInternal* ItemFamily::
459_allocOne(Int64 unique_id)
460{
461 return m_infos->allocOne(unique_id);
462}
463ItemInternal* ItemFamily::
464_allocOne(Int64 unique_id, bool& need_alloc)
465{
466 return m_infos->allocOne(unique_id, need_alloc);
467}
468ItemInternal* ItemFamily::
469_findOrAllocOne(Int64 uid, bool& is_alloc)
470{
471 return m_infos->findOrAllocOne(uid, is_alloc);
472}
473void ItemFamily::
474_setHasUniqueIdMap(bool v)
475{
476 m_infos->setHasUniqueIdMap(v);
477}
478void ItemFamily::
479_removeMany(Int32ConstArrayView local_ids)
480{
481 m_infos->removeMany(local_ids);
482}
483void ItemFamily::
484_removeDetachedOne(Item item)
485{
486 m_infos->removeDetachedOne(ItemCompatibility::_itemInternal(item));
487}
489itemKind() const
490{
491 return m_infos->kind();
492}
493
494/*---------------------------------------------------------------------------*/
495/*---------------------------------------------------------------------------*/
496
498nbItem() const
499{
500 return m_infos->nbItem();
501}
502
503/*---------------------------------------------------------------------------*/
504/*---------------------------------------------------------------------------*/
505
507maxLocalId() const
508{
509 return m_infos->maxUsedLocalId();
510}
511
512/*---------------------------------------------------------------------------*/
513/*---------------------------------------------------------------------------*/
514
517{
518 return m_infos->itemsInternal();
519}
520
521/*---------------------------------------------------------------------------*/
522/*---------------------------------------------------------------------------*/
523
526{
527 return ItemInfoListView(m_common_item_shared_info);
528}
529
530/*---------------------------------------------------------------------------*/
531/*---------------------------------------------------------------------------*/
532
534parentFamily() const
535{
536 return m_parent_family;
537}
538
539/*---------------------------------------------------------------------------*/
540/*---------------------------------------------------------------------------*/
541
544{
545 m_parent_family = parent;
546 if (parent == this) // Self-referencing
547 m_parent_family_depth = 1;
548 else if (!parent) // No parent
549 m_parent_family_depth = 0;
550 else { // Cross-referencing
551 m_parent_family_depth = parent->parentFamilyDepth() + 1;
552 m_parent_family->addChildFamily(this);
553 }
554 ARCANE_ASSERT((m_parent_family_depth < 2), ("Not test if more than one depth level"));
555}
556
557/*---------------------------------------------------------------------------*/
558/*---------------------------------------------------------------------------*/
559
561parentFamilyDepth() const
562{
563 return m_parent_family_depth;
564}
565
566/*---------------------------------------------------------------------------*/
567/*---------------------------------------------------------------------------*/
568
571{
572 ItemFamily* true_family = ARCANE_CHECK_POINTER(dynamic_cast<ItemFamily*>(family));
573 m_child_families.add(true_family);
574}
575
576/*---------------------------------------------------------------------------*/
577/*---------------------------------------------------------------------------*/
578
581{
583 for (Integer i = 0; i < m_child_families.size(); ++i) {
584 collection.add(m_child_families[i]);
585 }
586 return collection;
587}
588
589/*---------------------------------------------------------------------------*/
590/*---------------------------------------------------------------------------*/
591
594{
595 return m_internal_variables->m_items_new_owner;
596}
597
598/*---------------------------------------------------------------------------*/
599/*---------------------------------------------------------------------------*/
600
603{
604 _checkValid();
605 m_item_shared_infos->checkValid();
606}
607
608/*---------------------------------------------------------------------------*/
609/*---------------------------------------------------------------------------*/
610
613{
614 _checkValidConnectivity();
615}
616
617/*---------------------------------------------------------------------------*/
618/*---------------------------------------------------------------------------*/
626{
627 // Recalculate local and global connectivity info for all sub-domains
628 _computeConnectivityInfo(m_local_connectivity_info);
629 _computeConnectivityInfo(m_global_connectivity_info);
630 m_global_connectivity_info->reduce(parallelMng());
631
632 for (ItemConnectivitySelector* cs : m_connectivity_selector_list)
633 cs->customConnectivity()->_internalApi()->notifyEndUpdateFromMesh();
634}
635
636/*---------------------------------------------------------------------------*/
637/*---------------------------------------------------------------------------*/
638
640endUpdate()
641{
642 _endUpdate(true);
643 // TODO: test connectivity but it crashes some test cases
644 // (dof, amr2 and mesh_modification). To see if this is normal.
645 //if (arcaneIsCheck())
646 //checkValidConnectivity();
647}
648
649/*---------------------------------------------------------------------------*/
650/*---------------------------------------------------------------------------*/
651
652void ItemFamily::
653_endAllocate()
654{
655 // The variable is not "used" by default because the family is not ready yet.
656 // On sub-families, it is enough to filter setUsed at the time of endAllocate
657 if (!m_parent_family) {
658 m_internal_variables->setUsed();
659 }
660 if (m_do_shrink_after_allocate)
661 _shrinkConnectivityAndPrintInfos();
662}
663
664/*---------------------------------------------------------------------------*/
665/*---------------------------------------------------------------------------*/
666
667void ItemFamily::
668_shrinkConnectivityAndPrintInfos()
669{
670 {
671 ItemConnectivityMemoryInfo mem_info;
672 for (ItemConnectivitySelector* cs : m_connectivity_selector_list) {
673 IIncrementalItemConnectivity* c = cs->customConnectivity();
674 c->_internalApi()->addMemoryInfos(mem_info);
675 }
676 const Int64 total_capacity = mem_info.m_total_capacity;
677 const Int64 total_size = mem_info.m_total_size;
678 Int64 ratio = 100 * (total_capacity - total_size);
679 ratio /= (total_size + 1); // Add 1 to avoid division by zero
680 const Int64 sizeof_int32 = sizeof(Int32);
681 const Int64 mega_byte = 1024 * 1024;
682 Int64 capacity_mega_byte = (mem_info.m_total_capacity * sizeof_int32) / mega_byte;
683 info() << "MemoryUsed for family name=" << name() << " size=" << mem_info.m_total_size
684 << " capacity=" << mem_info.m_total_capacity
685 << " capacity (MegaByte)=" << capacity_mega_byte
686 << " ratio=" << ratio;
687 }
688 OStringStream ostr;
689 std::ostream& o = ostr();
690 o << "Mem=" << platform::getMemoryUsed();
691 for (ItemConnectivitySelector* cs : m_connectivity_selector_list) {
692 IIncrementalItemConnectivity* c = cs->customConnectivity();
693 c->dumpStats(o);
694 o << "\n";
695 c->_internalApi()->shrinkMemory();
696 c->dumpStats(o);
697 o << "\n";
698 }
699 o << "Mem=" << platform::getMemoryUsed();
700 info() << ostr.str();
701}
702
703/*---------------------------------------------------------------------------*/
704/*---------------------------------------------------------------------------*/
705
706bool ItemFamily::
707_partialEndUpdate()
708{
709 bool need_end_update = m_infos->changed();
710 info(4) << "ItemFamily::endUpdate() " << fullName() << " need_end_update?=" << need_end_update;
711 if (!need_end_update) {
712 // Even if no entity is added or removed, if m_need_prepare_dump
713 // is true, it means something has changed in the family. In this
714 // case, it is preferable to increment the current_id. Otherwise, if we call
715 // readFromDump() (for example, following a rollback), the data will not be
716 // restored if current_id has not changed in the meantime.
717 if (m_need_prepare_dump) {
718 _computeConnectivityInfo(m_local_connectivity_info);
719 ++m_current_id;
720 }
721 return true;
722 }
723 m_item_need_prepare_dump = true;
724 _computeConnectivityInfo(m_local_connectivity_info);
725 ++m_current_id;
726
727 // Update "external" connectivities
729 m_connectivity_mng->setModifiedItems(this, m_infos->addedItems(), m_infos->removedItems());
730 //
731 m_infos->finalizeMeshChanged();
732
733 return false;
734}
735
736/*---------------------------------------------------------------------------*/
737/*---------------------------------------------------------------------------*/
738
739void ItemFamily::
740_endUpdate(bool need_check_remove)
741{
742 _resizeShMemVariables();
743 if (_partialEndUpdate())
744 return;
745
746 _resizeVariables(false);
747 info(4) << "ItemFamily:endUpdate(): " << fullName()
748 << " hashmapsize=" << itemsMap().nbBucket()
749 << " nb_group=" << m_item_groups.count();
750
751 _updateGroups(need_check_remove);
752}
753
754/*---------------------------------------------------------------------------*/
755/*---------------------------------------------------------------------------*/
756
759{
760 _partialEndUpdate();
761}
762
763/*---------------------------------------------------------------------------*/
764/*---------------------------------------------------------------------------*/
765
768{
769 _updateGroup(group, true);
770}
771
772/*---------------------------------------------------------------------------*/
773/*---------------------------------------------------------------------------*/
774
775void ItemFamily::
776_updateGroup(ItemGroup group, bool need_check_remove)
777{
778 // No need to recalculate the group of global entities
779 if (group == m_infos->allItems())
780 return;
781
782 if (group.internal()->hasComputeFunctor())
783 group.invalidate();
784 if (need_check_remove) {
785 debug(Trace::High) << "Reset SuppressedItems: " << group.name();
787 }
788 if (arcaneIsCheck())
789 group.checkValid();
790}
791
792/*---------------------------------------------------------------------------*/
793/*---------------------------------------------------------------------------*/
794
795void ItemFamily::
796_updateGroups(bool need_check_remove)
797{
798 for (ItemGroupList::Enumerator i(m_item_groups); ++i;) {
799 ItemGroup group = *i;
800 _updateGroup(group, need_check_remove);
801 }
802}
803
804/*---------------------------------------------------------------------------*/
805/*---------------------------------------------------------------------------*/
806
809{
810 _updateVariable(variable);
811}
812
813/*---------------------------------------------------------------------------*/
814/*---------------------------------------------------------------------------*/
815
816void ItemFamily::
817_updateVariable(IVariable* var)
818{
819 var->resizeFromGroup();
820}
821
822/*---------------------------------------------------------------------------*/
823/*---------------------------------------------------------------------------*/
824
825void ItemFamily::
826_resizeVariables(bool force_resize)
827{
828 debug(Trace::High) << "ItemFamily::resizeVariables: name=" << fullName()
829 << " varsize=" << maxLocalId()
830 << " nb_item=" << nbItem()
831 << " currentsize=" << m_current_variable_item_size;
832 if (force_resize || (maxLocalId() != m_current_variable_item_size)) {
833 info(4) << "ItemFamily::resizeVariables: name=" << fullName()
834 << " varsize=" << maxLocalId()
835 << " nb_item=" << nbItem()
836 << " currentsize=" << m_current_variable_item_size
837 << " group_nb_item=" << allItems().size()
838 << " nb_var=" << m_used_variables.size();
839
840 m_current_variable_item_size = maxLocalId();
841
842 for (IVariable* var : m_used_variables) {
843 _updateVariable(var);
844 }
845 }
846}
847
848/*---------------------------------------------------------------------------*/
849/*---------------------------------------------------------------------------*/
850
851void ItemFamily::
852_resizeShMemVariables()
853{
854 for (IVariable* var : m_used_shmem_variables) {
855 _updateVariable(var);
856 }
857}
858
859/*---------------------------------------------------------------------------*/
860/*---------------------------------------------------------------------------*/
861
862void ItemFamily::
863itemsUniqueIdToLocalId(ArrayView<Int64> ids, bool do_fatal) const
864{
865 m_infos->itemsUniqueIdToLocalId(ids, do_fatal);
866}
867
868/*---------------------------------------------------------------------------*/
869/*---------------------------------------------------------------------------*/
870
871void ItemFamily::
872itemsUniqueIdToLocalId(Int32ArrayView local_ids,
873 Int64ConstArrayView unique_ids,
874 bool do_fatal) const
875{
876 m_infos->itemsUniqueIdToLocalId(local_ids, unique_ids, do_fatal);
877}
878
879/*---------------------------------------------------------------------------*/
880/*---------------------------------------------------------------------------*/
881
882void ItemFamily::
883itemsUniqueIdToLocalId(Int32ArrayView local_ids,
885 bool do_fatal) const
886{
887 m_infos->itemsUniqueIdToLocalId(local_ids, unique_ids, do_fatal);
888}
889
890/*---------------------------------------------------------------------------*/
891/*---------------------------------------------------------------------------*/
892
894subDomain() const
895{
896 return m_sub_domain;
897}
898
899/*---------------------------------------------------------------------------*/
900/*---------------------------------------------------------------------------*/
901
903traceMng() const
904{
906}
907
908/*---------------------------------------------------------------------------*/
909/*---------------------------------------------------------------------------*/
910
912mesh() const
913{
914 return m_mesh;
915}
916
917/*---------------------------------------------------------------------------*/
918/*---------------------------------------------------------------------------*/
919
921parallelMng() const
922{
923 return m_mesh->parallelMng();
924}
925
926/*---------------------------------------------------------------------------*/
927/*---------------------------------------------------------------------------*/
928
930allItems() const
931{
932 _checkNeedEndUpdate();
933 return m_infos->allItems();
934}
935
936/*---------------------------------------------------------------------------*/
937/*---------------------------------------------------------------------------*/
938
940createGroup(const String& name, Int32ConstArrayView elements, bool do_override)
941{
942 debug(Trace::High) << "ItemFamily:createGroup(name,Int32ConstArrayView): " << m_name << ":"
943 << " group_name=" << name
944 << " count=" << elements.size()
945 << " override=" << do_override;
946
947 _checkNeedEndUpdate();
948
949 {
950 ItemGroup group;
951 if (do_override) {
952 group = findGroup(name);
953 if (group.null())
954 group = createGroup(name);
955 }
956 else {
957 group = createGroup(name);
958 }
959 group.setItems(elements);
960 return group;
961 }
962}
963
964/*---------------------------------------------------------------------------*/
965/*---------------------------------------------------------------------------*/
966
968createGroup(const String& name)
969{
970 //#warning SDP CHANGE
971 // SDP: checkpointing/recovery problem ...
972 {
974 if (!g.null()) {
975 fatal() << "Attempting to create an already existing group '" << name << "'";
976 }
977 }
978 debug() << "ItemFamily:createGroup(name): " << m_name << ":"
979 << " name=" << name;
980 ItemGroup group(new ItemGroupImpl(this, name));
981 _processNewGroup(group);
982 return group;
983}
984
985/*---------------------------------------------------------------------------*/
986/*---------------------------------------------------------------------------*/
987
989createGroup(const String& name, const ItemGroup& parent, bool do_override)
990{
991 ItemGroup group = findGroup(name);
992 if (!group.null()) {
993 if (do_override) {
994 if (group.internal()->parentGroup() != parent)
995 fatal() << "Group already existing but with a different parent";
996 if (group == parent)
997 fatal() << "A group can not be its own parent name=" << name;
998 return group;
999 }
1000 fatal() << "Attempting to create an already existing group '" << name << "'";
1001 }
1002 if (parent.null())
1003 fatal() << "Attempting to create a group '" << name << "' with no parent.";
1004 debug() << "ItemFamily:createGroup(name,parent): " << m_name << ":"
1005 << " name=" << name
1006 << " parent=" << parent.name();
1007 group = ItemGroup(new ItemGroupImpl(this, parent.internal(), name));
1008 _processNewGroup(group);
1009 return group;
1010}
1011
1012/*---------------------------------------------------------------------------*/
1013/*---------------------------------------------------------------------------*/
1014
1017{
1018 _invalidateComputedGroups();
1019 ItemGroupList current_groups(m_item_groups.clone());
1020 m_item_groups.clear();
1021 for (ItemGroupList::Enumerator i(current_groups); ++i;) {
1022 ItemGroup group(*i);
1023 if (group.isAllItems())
1024 m_item_groups.add(group);
1025 else
1026 group.internal()->destroy();
1027 }
1028 allItems().internal()->destroy();
1029}
1030
1031/*---------------------------------------------------------------------------*/
1032/*---------------------------------------------------------------------------*/
1033
1036{
1037 debug() << "ItemFamily::notifyItemsOwnerChanged()";
1038 for (ItemGroup group : m_item_groups) {
1039 if (m_is_parallel && group.internal()->hasComputeFunctor())
1040 group.invalidate();
1041 }
1042
1043 // Propagate changes to child families
1044 for (Integer i = 0; i < m_child_families.size(); ++i) {
1045 IItemFamily* family = m_child_families[i];
1046 ItemInternalArrayView items(family->itemsInternal());
1047 for (Integer z = 0, zs = items.size(); z < zs; ++z) {
1048 impl::MutableItemBase item(items[z]);
1049 if (item.isSuppressed())
1050 continue;
1051 Item parent_item = item.parentBase(0);
1052 ARCANE_ASSERT((parent_item.uniqueId() == item.uniqueId()), ("Inconsistent parent uid"));
1053 item.setOwner(parent_item.owner(), m_sub_domain_id);
1054 }
1055 family->notifyItemsOwnerChanged();
1056 }
1057}
1058
1059/*---------------------------------------------------------------------------*/
1060/*---------------------------------------------------------------------------*/
1061
1062void ItemFamily::
1063_processNewGroup(ItemGroup group)
1064{
1065 // Checks that the group has the correct type
1066 if (group.itemKind() != itemKind()) {
1067 ARCANE_FATAL("Incoherent family name={0} wanted={1} current={2}",
1068 fullName(), itemKind(), group.itemKind());
1069 }
1070 m_item_groups.add(group);
1071 m_need_prepare_dump = true;
1072 // In sequential mode, all groups are owned groups
1073 // TODO: look into removing the test with 'm_is_parallel' but
1074 // if we do that it crashes some tests with aleph_kappa.
1075 if (!m_is_parallel && m_mesh->meshPartInfo().nbPart() == 1)
1076 group.setOwn(true);
1077}
1078
1079/*---------------------------------------------------------------------------*/
1080/*---------------------------------------------------------------------------*/
1081
1083groups() const
1084{
1085 return m_item_groups;
1086}
1087
1088/*---------------------------------------------------------------------------*/
1089/*---------------------------------------------------------------------------*/
1090
1092findGroup(const String& name) const
1093{
1094 for (const ItemGroup& group : m_item_groups) {
1095 if (group.name() == name)
1096 return group;
1097 }
1098 return ItemGroup();
1099}
1100
1101/*---------------------------------------------------------------------------*/
1102/*---------------------------------------------------------------------------*/
1103
1105findGroup(const String& name, bool create_if_needed)
1106{
1107 ItemGroup group = findGroup(name);
1108 if (group.null()) {
1109 if (create_if_needed)
1110 group = createGroup(name);
1111 }
1112 return group;
1113}
1114
1115/*---------------------------------------------------------------------------*/
1116/*---------------------------------------------------------------------------*/
1117
1120{
1121 itemsMap().notifyUniqueIdsChanged();
1122}
1123
1124/*---------------------------------------------------------------------------*/
1125/*---------------------------------------------------------------------------*/
1126
1127void ItemFamily::
1128_checkNeedEndUpdate() const
1129{
1130 if (m_infos->changed())
1131 ARCANE_FATAL("missing call to endUpdate() after modification");
1132}
1133
1134/*---------------------------------------------------------------------------*/
1135/*---------------------------------------------------------------------------*/
1136
1139{
1140 info(4) << "ItemFamily::prepareForDump(): " << fullName()
1141 << " need=" << m_need_prepare_dump
1142 << " item-need=" << m_item_need_prepare_dump
1143 << " m_item_shared_infos->hasChanged()=" << m_item_shared_infos->hasChanged()
1144 << " nb_item=" << m_infos->nbItem();
1145
1146 {
1147 auto* p = m_properties;
1148 p->setInt32("dump-version", 0x0307);
1149 p->setInt32("nb-item", m_infos->nbItem());
1150 p->setInt32("current-change-id", m_current_id);
1151 }
1152
1153 // TODO: add verification flag if necessary
1154 if (m_item_need_prepare_dump || m_item_shared_infos->hasChanged()) {
1155 info(4) << "Prepare for dump:2: name=" << m_name << " nb_alloc=" << m_nb_allocate_info
1156 << " uid_size=" << m_items_unique_id->size() << " cap=" << m_items_unique_id->capacity()
1157 << " byte=" << m_items_unique_id->capacity() * sizeof(Int64);
1158
1159 // TODO: ability to specify whether or not to compact.
1160 _compactOnlyItems(false);
1161
1162 // Assumes compression
1163 m_infos->prepareForDump();
1164 m_item_shared_infos->prepareForDump();
1165 m_need_prepare_dump = true;
1166 }
1167 m_item_need_prepare_dump = false;
1168 if (m_need_prepare_dump) {
1169 Integer nb_item = m_infos->nbItem();
1170 // TODO: look into whether it would be better to do this in finishCompactItem()
1171 _resizeItemVariables(nb_item, true);
1172 m_internal_variables->m_current_id = m_current_id;
1173 info(4) << " SET FAMILY ID name=" << name() << " id= " << m_current_id
1174 << " saveid=" << m_internal_variables->m_current_id();
1175 ItemInternalList items(m_infos->itemsInternal());
1176 m_internal_variables->m_items_shared_data_index.resize(nb_item);
1177 IntegerArrayView items_shared_data_index(m_internal_variables->m_items_shared_data_index);
1178 info(4) << "ItemFamily::prepareForDump(): " << m_name
1179 << " count=" << nb_item << " currentid=" << m_current_id;
1180 // Normally items[i]->localId()==i for all entities because we performed a compaction.
1181 if (arcaneIsCheck()) {
1182 for (Integer i = 0; i < nb_item; ++i) {
1183 ItemInternal* item = items[i];
1184 if (item->localId() != i)
1185 ARCANE_FATAL("Incoherence between index ({0}) and localId() ({1})", i, item->localId());
1186 }
1187 }
1188 for (Integer i = 0; i < nb_item; ++i) {
1189 ItemInternal* item = items[i];
1190 ItemSharedInfoWithType* isi = m_item_shared_infos->findSharedInfo(item->typeInfo());
1191 items_shared_data_index[i] = isi->index();
1192#if 0
1193#ifdef ARCANE_DEBUG
1194 //if (itemKind()==IK_Particle){
1195 info() << "Item: SHARED_INDEX = " << items_shared_data_index[i]
1196 << " uid = " << item->uniqueId()
1197 << " lid = " << item->localId()
1198 << " dataindex = " << item->dataIndex()
1199 << " flags = " << item->flags();
1200 //}
1201#endif
1202#endif
1203 }
1204
1205 // Family linking data
1206 {
1207 if (m_parent_family) {
1208 m_internal_variables->m_parent_family_name = m_parent_family->name();
1209 m_internal_variables->m_parent_mesh_name = m_parent_family->mesh()->name();
1210 }
1211 m_internal_variables->m_parent_family_depth = m_parent_family_depth;
1212 const Integer child_count = m_child_families.size();
1213 m_internal_variables->m_child_meshes_name.resize(child_count);
1214 m_internal_variables->m_child_families_name.resize(child_count);
1215 for (Integer i = 0; i < child_count; ++i) {
1216 m_internal_variables->m_child_meshes_name[i] = m_child_families[i]->mesh()->name();
1217 m_internal_variables->m_child_families_name[i] = m_child_families[i]->name();
1218 }
1219 }
1220
1221 {
1222 // Determines the number of groups and entities to save.
1223 // We do not save dynamically generated groups
1224 Integer nb_group_to_save = 0;
1225 for (ItemGroupList::Enumerator i(m_item_groups); ++i;) {
1226 const ItemGroup& group = *i;
1227 if (group.internal()->hasComputeFunctor() || group.isLocalToSubDomain())
1228 continue;
1229 debug(Trace::High) << "Save group info name=" << group.name();
1230 ++nb_group_to_save;
1231 }
1232 m_internal_variables->m_groups_name.resize(nb_group_to_save);
1233 {
1234 Integer current_group_index = 0;
1235 for (ItemGroupList::Enumerator i(m_item_groups); ++i;) {
1236 const ItemGroup& group = *i;
1237 if (group.internal()->hasComputeFunctor() || group.isLocalToSubDomain())
1238 continue;
1239 m_internal_variables->m_groups_name[current_group_index] = group.name();
1240 ++current_group_index;
1241 }
1242 }
1243 }
1244 }
1245 // Ensures that the groups are up to date, to ensure that
1246 // the save will be correct.
1247 // NOTE: Should this be done here?
1248 // NOTE: better to use an observer on the group variable?
1249 _applyCheckNeedUpdateOnGroups();
1250
1251 m_need_prepare_dump = false;
1252}
1253
1254/*---------------------------------------------------------------------------*/
1255/*---------------------------------------------------------------------------*/
1256
1259{
1260 // TODO: GG: use a flag to indicate that synchronization info needs to be rebuilt
1261 // but not do it directly in this method.
1262
1263 Int32 nb_item = 0;
1264 Int32 dump_version = 0;
1265 // Indicates if we use the variable containing the entity type for
1266 // to build the ItemInternal. This is only possible with protections
1267 // performed since version 3.7 of Arcane. Before that, we must use
1268 // the m_items_shared_data_index variable.
1269 bool use_type_variable = false;
1270 {
1271 Int32 x = 0;
1272 auto* p = m_properties;
1273 if (p->get("dump-version", x))
1274 dump_version = x;
1275 if (dump_version >= 0x0307) {
1276 use_type_variable = true;
1277 nb_item = p->getInt32("nb-item");
1278 Int32 cid = p->getInt32("current-change-id");
1279 Int32 expected_cid = m_internal_variables->m_current_id();
1280 if (cid != expected_cid)
1281 ARCANE_FATAL("Bad value for current id mesh={0} id={1} expected={2}",
1282 fullName(), cid, expected_cid);
1283 }
1284 }
1285
1286 const bool allow_old_version = true;
1287 if (!allow_old_version)
1288 if (dump_version < 0x0307)
1289 ARCANE_FATAL("Your checkpoint is from a version of Arcane which is too old (mininum version is 3.7)");
1290
1291 // The part number can change during recovery. Therefore, we must
1292 // update it. Similarly, if we transition from a sequential mesh to a
1293 // multi-part mesh during recovery, we must remove isOwn() from the group of all entities.
1294 const MeshPartInfo& part_info = m_mesh->meshPartInfo();
1295 m_sub_domain_id = part_info.partRank();
1296 if (m_infos->allItems().isOwn() && part_info.nbPart() > 1)
1297 m_infos->allItems().setOwn(false);
1298
1299 // NOTE: the current implementation assumes that the dataIndex() of
1300 // entities are consecutive and increasing with the localId() of the entities
1301 // (i.e., the entity with localId() of 0 also has a dataIndex() of 0,
1302 // the one with localId() of 1, the next dataIndex() ...)
1303 // This condition is true if compactReferences() has been called.
1304 // When this is no longer the case (gap in numbering), we will need to
1305 // add a data_index variable to the entities.
1306 IntegerArrayView items_shared_data_index(m_internal_variables->m_items_shared_data_index);
1307 if (!use_type_variable)
1308 nb_item = items_shared_data_index.size();
1309
1310 info(4) << "ItemFamily::readFromDump(): " << fullName()
1311 << " count=" << nb_item
1312 << " currentid=" << m_current_id
1313 << " saveid=" << m_internal_variables->m_current_id()
1314 << " use_type_variable?=" << use_type_variable
1315 << " dump_version=" << dump_version;
1316
1317 if (!use_type_variable) {
1318 // With older protections, there is no variable for the entity type.
1319 // We must allocate it here because we use it when calling ItemInternal::setSharedInfo().
1320 if (nb_item > 0)
1321 MeshUtils::checkResizeArray(*m_items_type_id, nb_item + 1, false);
1322 // There is also no offset of 1 for flags, owner and uniqueId.
1323 // We do this offset here.
1324 _handleOldCheckpoint();
1325 }
1326 _updateItemViews();
1327
1328 if (m_internal_variables->m_current_id() == m_current_id) {
1329 debug() << "Family unchanged. Nothing to do.";
1330 //GG: we still need to recalculate the synchronization info because this family
1331 // on other sub-domains might have changed and in this case this
1332 // function will be called. Similarly, the list of groups might have changed
1333 // and their value also for the calculated groups so we must invalidate them
1335 _readGroups();
1336 _invalidateComputedGroups();
1337 return;
1338 }
1339
1340 m_current_id = m_internal_variables->m_current_id();
1341 // IMPORTANT: reset to zero to force resizing of variables
1342 // upon the next addition of entities.
1343 m_current_variable_item_size = 0;
1344
1345 // Family linking data
1346 {
1347 IMeshMng* mesh_mng = m_mesh->meshMng();
1348 if (!m_internal_variables->m_parent_mesh_name().null()) {
1349 IMesh* parent_mesh = mesh_mng->findMeshHandle(m_internal_variables->m_parent_mesh_name()).mesh();
1350 m_parent_family = parent_mesh->findItemFamily(m_internal_variables->m_parent_family_name(), true); // true=> fatal if not found
1351 }
1352 m_parent_family_depth = m_internal_variables->m_parent_family_depth();
1353 ARCANE_ASSERT((m_internal_variables->m_child_meshes_name.size() == m_internal_variables->m_child_families_name.size()),
1354 ("Incompatible child mesh/family sizes"));
1355 Integer child_count = m_internal_variables->m_child_families_name.size();
1356 for (Integer i = 0; i < child_count; ++i) {
1357 IMesh* child_mesh = mesh_mng->findMeshHandle(m_internal_variables->m_child_meshes_name[i]).mesh();
1358 IItemFamily* child_family = child_mesh->findItemFamily(m_internal_variables->m_child_families_name[i], true); // true=> fatal if not found
1359 m_child_families.add(dynamic_cast<ItemFamily*>(child_family));
1360 }
1361 }
1362
1363 m_item_shared_infos->readFromDump();
1364 m_infos->readFromDump();
1365
1366 // When reading from dump, the entities are compacted, so the max value of localId()
1367 // is equal to the number of entities.
1368
1369 if (use_type_variable) {
1370 ItemTypeMng* type_mng = mesh()->itemTypeMng();
1371 for (Integer i = 0; i < nb_item; ++i) {
1372 ;
1373 ItemTypeId type_id{ m_common_item_shared_info->m_type_ids[i] };
1374 ItemSharedInfoWithType* isi = _findSharedInfo(type_mng->typeFromId(type_id));
1375 Int64 uid = m_items_unique_id_view[i];
1376 ItemInternal* item = m_infos->allocOne(uid);
1377 item->_setSharedInfo(isi->sharedInfo(), type_id);
1378 }
1379 }
1380 else {
1381 // Method used for protections from versions 3.6 and earlier of Arcane.
1382 auto item_shared_infos = m_item_shared_infos->itemSharedInfos();
1383 for (Integer i = 0; i < nb_item; ++i) {
1384 Integer shared_data_index = items_shared_data_index[i];
1385 ItemSharedInfoWithType* isi = item_shared_infos[shared_data_index];
1386 Int64 uid = m_items_unique_id_view[i];
1387 ItemInternal* item = m_infos->allocOne(uid);
1388 item->_setSharedInfo(isi->sharedInfo(), isi->itemTypeId());
1389 }
1390 }
1391
1392 // Clear the entities from the total group because they will be updated
1393 // when calling _endUpdate()
1394 m_infos->allItems().clear();
1395
1396 // Notifies the source connectivities that we just read from dump.
1397 for (auto& c : m_source_incremental_item_connectivities)
1398 c->notifyReadFromDump();
1399
1400 // Recreation of groups if necessary
1401 _readGroups();
1402
1403 // Invalidates the recalculated groups
1404 _invalidateComputedGroups();
1405
1406 _endUpdate(false);
1407
1409}
1410
1411/*---------------------------------------------------------------------------*/
1412/*---------------------------------------------------------------------------*/
1413
1414void ItemFamily::
1415_applyCheckNeedUpdateOnGroups()
1416{
1417 for (ItemGroupList::Enumerator i(m_item_groups); ++i;) {
1418 ItemGroup group = *i;
1419 // No need to recalculate the group of global entities
1420 if (group == m_infos->allItems())
1421 continue;
1422 group.internal()->checkNeedUpdate();
1423 }
1424}
1425
1426/*---------------------------------------------------------------------------*/
1427/*---------------------------------------------------------------------------*/
1428
1429void ItemFamily::
1430_invalidateComputedGroups()
1431{
1432 // If the group has a parent, it does not have an associated variable and
1433 // furthermore, it may contain invalid values following a rollback.
1434 // In this case, we clear it and invalidate it.
1435 for (ItemGroupList::Enumerator i(m_item_groups); ++i;) {
1436 ItemGroup group = *i;
1437 if (!group.internal()->parentGroup().null()) {
1438 group.clear();
1439 group.invalidate();
1440 }
1441 }
1442}
1443
1444/*---------------------------------------------------------------------------*/
1445/*---------------------------------------------------------------------------*/
1451{
1452 // Recréation des groupes si nécessaire
1453 VariableArrayString& groups_var = m_internal_variables->m_groups_name;
1454 debug() << "ItemFamily::readFromDump(): number of group: " << groups_var.size();
1455 for (Integer i = 0, is = groups_var.size(); i < is; ++i) {
1456 String name(groups_var[i]);
1457 debug() << "Readign group again: " << name;
1458 ItemGroup group = findGroup(name);
1459 if (group.null())
1461 }
1462 // Notifie les groupes qu'ils ont été mis à jour de manière
1463 // externe. Cela peut être nécessaire pour recalculer automatiquement
1464 // certaines informations (comme le padding pour la vectorisation)
1465 for (ItemGroup& group : m_item_groups) {
1466 group.incrementTimestamp();
1467 }
1468}
1469
1470/*---------------------------------------------------------------------------*/
1471/*---------------------------------------------------------------------------*/
1480{
1481 Int32 global_changed = parallelMng()->reduce(Parallel::ReduceMax, changed);
1482 if (global_changed != 0)
1484}
1485
1486/*---------------------------------------------------------------------------*/
1487/*---------------------------------------------------------------------------*/
1496_compactOnlyItems(bool do_sort)
1497{
1498 _compactItems(do_sort);
1499
1500 // It is necessary to update the groups.
1501 // TODO verify if this needs to be done all the time
1502 m_need_prepare_dump = true;
1503
1504 // Indicates that a compactReference() will also be required
1505 // during the dump.
1506 // NOTE: specifying this will also force a recompacting during prepareForDump()
1507 // and this compaction is unnecessary in this case.
1508 // TODO: look into how to indicate to prepareForDump() that we only want to
1509 // perform a compactReference().
1510 m_item_need_prepare_dump = true;
1511}
1512
1513/*---------------------------------------------------------------------------*/
1514/*---------------------------------------------------------------------------*/
1519compactItems(bool do_sort)
1520{
1521 _compactOnlyItems(do_sort);
1522
1523 if (!m_use_legacy_compact_item) {
1524 // It is necessary to update the groups
1525 // after a compactReferences().
1526 _applyCheckNeedUpdateOnGroups();
1527 }
1528}
1529
1530/*---------------------------------------------------------------------------*/
1531/*---------------------------------------------------------------------------*/
1536_compactItems(bool do_sort)
1537{
1538 IMeshCompactMng* compact_mng = mesh()->_compactMng();
1539 IMeshCompacter* compacter = compact_mng->beginCompact(this);
1540
1541 try {
1542 compacter->setSorted(do_sort);
1543 compacter->doAllActions();
1544 }
1545 catch (...) {
1546 compact_mng->endCompact();
1547 throw;
1548 }
1549 compact_mng->endCompact();
1550}
1551
1552/*---------------------------------------------------------------------------*/
1553/*---------------------------------------------------------------------------*/
1554
1555void ItemFamily::
1556beginCompactItems(ItemFamilyCompactInfos& compact_infos)
1557{
1558 m_infos->beginCompactItems(compact_infos);
1559
1560 if (arcaneIsCheck())
1561 m_infos->checkValid();
1562
1563 Int32ConstArrayView new_to_old_ids = compact_infos.newToOldLocalIds();
1564 Int32ConstArrayView old_to_new_ids = compact_infos.oldToNewLocalIds();
1565
1566 for (auto& c : m_source_incremental_item_connectivities)
1567 c->notifySourceFamilyLocalIdChanged(new_to_old_ids);
1568
1569 for (auto& c : m_target_incremental_item_connectivities)
1570 c->notifyTargetFamilyLocalIdChanged(old_to_new_ids);
1571
1572 for (IItemConnectivity* c : m_source_item_connectivities)
1573 c->notifySourceFamilyLocalIdChanged(new_to_old_ids);
1574
1576 c->notifyTargetFamilyLocalIdChanged(old_to_new_ids);
1577
1579 m_connectivity_mng->notifyLocalIdChanged(this, old_to_new_ids, nbItem());
1580
1581 // Compacting internal variables associated with the entities
1582 {
1583 if (m_parent_family_depth > 0)
1584 m_internal_variables->m_items_nb_parent.variable()->compact(new_to_old_ids);
1585
1586 _updateItemViews();
1587 }
1588}
1589
1590/*---------------------------------------------------------------------------*/
1591/*---------------------------------------------------------------------------*/
1592
1593void ItemFamily::
1594finishCompactItems(ItemFamilyCompactInfos& compact_infos)
1595{
1596 if (arcaneIsCheck())
1597 m_infos->checkValid();
1598
1599 m_infos->finishCompactItems(compact_infos);
1600
1601 for (ItemConnectivitySelector* ics : m_connectivity_selector_list)
1602 ics->compactConnectivities();
1603}
1604
1605/*---------------------------------------------------------------------------*/
1606/*---------------------------------------------------------------------------*/
1616{
1617 ARCANE_ASSERT(source.size() == destination.size(),
1618 ("Can't copy. Source and destination have different size !"));
1619
1620 if (source.size() != 0) {
1621 for (IVariable* var : m_used_variables) {
1622 // (HP) : as seen with Gilles and Stéphane, we do not apply a filter at this level
1623 // // if the variable is temporary or no restore, we do not copy it
1624 // if (!(var->property() & (IVariable::PTemporary | IVariable::PNoRestore))) {
1625 //if (var->itemFamily()==this) {
1626 var->copyItemsValues(source, destination);
1627 }
1628 for (IVariable* var : m_used_shmem_variables) {
1629 var->copyItemsValues(source, destination);
1630 }
1631 }
1632}
1633
1634/*---------------------------------------------------------------------------*/
1635/*---------------------------------------------------------------------------*/
1647 Int32ConstArrayView second_source,
1648 Int32ConstArrayView destination)
1649{
1650 ARCANE_ASSERT(first_source.size() == destination.size(),
1651 ("Can't copy. : first_source and destination have different size !"));
1652 ARCANE_ASSERT(second_source.size() == destination.size(),
1653 ("Can't copy : second_source and destination have different size !"));
1654
1655 if (first_source.size() != 0) {
1656 for (IVariable* var : m_used_variables) {
1658 var->copyItemsMeanValues(first_source, second_source, destination);
1659 }
1660 }
1661 for (IVariable* var : m_used_shmem_variables) {
1663 var->copyItemsMeanValues(first_source, second_source, destination);
1664 }
1665 }
1666 }
1667}
1668
1669/*---------------------------------------------------------------------------*/
1670/*---------------------------------------------------------------------------*/
1679{
1680 Int32ConstArrayView new_to_old_ids = compact_infos.newToOldLocalIds();
1681 Int32ConstArrayView old_to_new_ids = compact_infos.oldToNewLocalIds();
1682
1683 for (IVariable* var : m_used_variables) {
1684 debug(Trace::High) << "Compact variable " << var->fullName();
1685 var->compact(new_to_old_ids);
1686 }
1687 for (IVariable* var : m_used_shmem_variables) {
1688 debug(Trace::High) << "Compact shmem variable " << var->fullName();
1689 var->compact(new_to_old_ids);
1690 }
1691
1692 m_variable_synchronizer->changeLocalIds(old_to_new_ids);
1693
1694 for (ItemGroupList::Enumerator i(m_item_groups); ++i;) {
1695 ItemGroup group = *i;
1696 debug(Trace::High) << "Change group Ids: " << group.name();
1697 group.internal()->changeIds(old_to_new_ids);
1698 if (group.hasSynchronizer())
1699 group.synchronizer()->changeLocalIds(old_to_new_ids);
1700 }
1701
1702 for (Integer i = 0; i < m_child_families.size(); ++i)
1703 m_child_families[i]->_compactFromParentFamily(compact_infos);
1704
1705 info(4) << "End compact family=" << fullName()
1706 << " max_local_id=" << maxLocalId()
1707 << " nb_item=" << nbItem();
1708
1709 // After compaction, variables will be allocated with the number
1710 // of elements being the number of entities (this is in DynamicMeshKindInfos::finishCompactItems()
1711 // where maxLocalId() becomes equal to nbItem()).
1712 m_current_variable_item_size = nbItem();
1713}
1714
1715/*---------------------------------------------------------------------------*/
1716/*---------------------------------------------------------------------------*/
1723#ifdef NEED_MERGE
1724void ItemFamily::
1725compactConnectivities()
1726{
1727 Int32ConstArrayView new_to_old_ids = m_infos.newToOldLocalIds();
1728 Int32ConstArrayView old_to_new_ids = m_infos.oldToNewLocalIds();
1729 for (IItemConnectivity* c : m_source_connectivities)
1730 c->notifySourceFamilyLocalIdChanged(new_to_old_ids);
1731
1732 for (IItemConnectivity* c : m_target_connectivities)
1733 c->notifyTargetFamilyLocalIdChanged(old_to_new_ids);
1734
1736 m_connectivity_mng->notifyLocalIdChanged(this, old_to_new_ids, nbItem());
1737}
1738#endif
1739
1740/*---------------------------------------------------------------------------*/
1741/*---------------------------------------------------------------------------*/
1742
1745{
1746 debug() << "Compacting child family " << fullName();
1747 if (m_parent_family_depth > 1)
1748 throw NotImplementedException(A_FUNCINFO, "Too deep parent family: not yet implemented");
1749 Int32ConstArrayView old_to_new_lids(compact_infos.oldToNewLocalIds());
1750 ARCANE_ASSERT((nbItem() == 0 || !old_to_new_lids.empty()), ("Empty oldToNewLocalIds"));
1751 debug() << "\tfrom parent family " << m_parent_family->name();
1752 if (this == m_parent_family)
1753 return; // already self compacted
1754 ItemInternalArrayView items(itemsInternal());
1755 for (Integer z = 0, zs = items.size(); z < zs; ++z) {
1756 ItemInternal* item = items[z];
1757 Int32 old_parent_lid = item->parentId(0); // depth==1 only !!
1758 item->setParent(0, old_to_new_lids[old_parent_lid]);
1759 }
1760 // If depth>1, it would be better to propagate the compaction by modifying the
1761 // oldToNewLocalIds of the current sub-mesh families and calling
1762 // DynamicMesh::_compactItems in cascade (starting from this sub-mesh)
1763}
1764
1765/*---------------------------------------------------------------------------*/
1766/*---------------------------------------------------------------------------*/
1767
1769internalRemoveItems(Int32ConstArrayView local_ids, bool keep_ghost)
1770{
1771 ARCANE_UNUSED(local_ids);
1772 ARCANE_UNUSED(keep_ghost);
1773 ARCANE_THROW(NotSupportedException, "this kind of family doesn't support this operation");
1774}
1775
1776/*---------------------------------------------------------------------------*/
1777/*---------------------------------------------------------------------------*/
1778
1779void ItemFamily::
1780_checkValid()
1781{
1782 // Checks that the part number is the same as the mesh's part number
1783 {
1784 Int32 part_rank = m_mesh->meshPartInfo().partRank();
1785 if (m_sub_domain_id != part_rank)
1786 ARCANE_FATAL("Family {0} Bad value for partRank ({1}) expected={2}",
1787 fullName(), m_sub_domain_id, part_rank);
1788 }
1789}
1790
1791/*---------------------------------------------------------------------------*/
1792/*---------------------------------------------------------------------------*/
1793
1794void ItemFamily::
1795_reserveInfosMemory(Integer memory)
1796{
1797 ARCANE_UNUSED(memory);
1798}
1799
1800/*---------------------------------------------------------------------------*/
1801/*---------------------------------------------------------------------------*/
1802
1803void ItemFamily::
1804_resizeInfos(Integer new_size)
1805{
1806 ARCANE_UNUSED(new_size);
1807}
1808
1809/*---------------------------------------------------------------------------*/
1810/*---------------------------------------------------------------------------*/
1811
1812Integer ItemFamily::
1813_allocMany(Integer memory)
1814{
1815 ARCANE_UNUSED(memory);
1816 return 0;
1817}
1818
1819/*---------------------------------------------------------------------------*/
1820/*---------------------------------------------------------------------------*/
1821
1822ItemSharedInfoWithType* ItemFamily::
1823_findSharedInfo(ItemTypeInfo* type)
1824{
1825 return m_item_shared_infos->findSharedInfo(type);
1826}
1827
1828/*---------------------------------------------------------------------------*/
1829/*---------------------------------------------------------------------------*/
1830
1831void ItemFamily::
1832_updateSharedInfo()
1833{
1834 //TODO: Check if this is still useful
1835 m_need_prepare_dump = true;
1836}
1837
1838/*---------------------------------------------------------------------------*/
1839/*---------------------------------------------------------------------------*/
1840
1841void ItemFamily::
1842_allocateInfos(ItemInternal* item, Int64 uid, ItemTypeInfo* type)
1843{
1844 ItemSharedInfoWithType* isi = _findSharedInfo(type);
1845 _allocateInfos(item, uid, isi);
1846}
1847
1848/*---------------------------------------------------------------------------*/
1849/*---------------------------------------------------------------------------*/
1850
1851void ItemFamily::
1852_resizeItemVariables(Int32 new_size, bool force_resize)
1853{
1854 bool is_resize = MeshUtils::checkResizeArray(*m_items_unique_id, new_size + 1, force_resize);
1855 is_resize |= MeshUtils::checkResizeArray(*m_items_owner, new_size + 1, force_resize);
1856 is_resize |= MeshUtils::checkResizeArray(*m_items_flags, new_size + 1, force_resize);
1857 is_resize |= MeshUtils::checkResizeArray(*m_items_type_id, new_size + 1, force_resize);
1858 if (m_parent_family_depth > 0)
1859 is_resize |= MeshUtils::checkResizeArray(*m_items_nb_parent, new_size, force_resize);
1860 if (is_resize)
1861 _updateItemViews();
1862
1863 // Positions the values for the null entity.
1864 // NOTE: check if this should be done at initialization.
1865 (*m_items_unique_id)[0] = NULL_ITEM_UNIQUE_ID;
1866 (*m_items_flags)[0] = 0;
1867 (*m_items_owner)[0] = A_NULL_RANK;
1868 (*m_items_type_id)[0] = IT_NullType;
1869}
1870
1871/*---------------------------------------------------------------------------*/
1872/*---------------------------------------------------------------------------*/
1873
1874void ItemFamily::
1875_allocateInfos(ItemInternal* item, Int64 uid, ItemSharedInfoWithType* isi)
1876{
1877 // TODO: do simultaneously with the realloc of the uniqueId() variable
1878 // the realloc of the m_source_incremental_item_connectivities.
1879 Int32 local_id = item->localId();
1880 _resizeItemVariables(local_id + 1, false);
1881
1882 // TODO: check if still useful because ItemInternal::reinitialize() must do it
1883 //(*m_items_unique_id)[local_id] = uid;
1884
1885 ItemTypeId iti = isi->itemTypeId();
1886 item->_setSharedInfo(isi->sharedInfo(), iti);
1887
1888 item->reinitialize(uid, m_default_sub_domain_owner, m_sub_domain_id);
1889 ++m_nb_allocate_info;
1890 // Notify the incremental connectivities that we added an item to the source
1891 for (auto& c : m_source_incremental_item_connectivities)
1892 c->notifySourceItemAdded(ItemLocalId(local_id));
1893}
1894
1895/*---------------------------------------------------------------------------*/
1896/*---------------------------------------------------------------------------*/
1897
1900canAllocateBulk() const
1901{
1902 return m_infos->nbItem() == 0 && m_infos->hasNoItemInternal();
1903}
1904
1905/*---------------------------------------------------------------------------*/
1906/*---------------------------------------------------------------------------*/
1907
1918 Int32 owner, Int32ArrayView lids)
1919{
1920 const Int32 nb = uids.size();
1921 if (nb == 0)
1922 return;
1923
1924 m_infos->allocMany(uids, lids);
1925 const Int32 max_local_id = lids[nb - 1];
1926 _resizeItemVariables(max_local_id + 1, false);
1927
1928 ItemSharedInfoWithType* isi = _findSharedInfo(type);
1929 ItemSharedInfo* shared_info = isi->sharedInfo();
1930 ItemTypeId iti = isi->itemTypeId();
1931 for (Int32 i = 0; i < nb; ++i) {
1932 ItemInternal* item = m_infos->itemInternal(lids[i]);
1933 item->_setSharedInfo(shared_info, iti);
1934 item->reinitialize(uids[i], owner, m_sub_domain_id);
1935 }
1936 m_nb_allocate_info += nb;
1937
1938 for (auto& c : m_source_incremental_item_connectivities)
1939 c->_internalNotifySourceItemsAdded(lids);
1940}
1941
1942/*---------------------------------------------------------------------------*/
1943/*---------------------------------------------------------------------------*/
1944
1945void ItemFamily::
1946_preAllocate(Int32 nb_item, bool pre_alloc_connectivity)
1947{
1948 if (nb_item > 1000)
1949 m_infos->itemsMap().resize(nb_item, true);
1950 _resizeItemVariables(nb_item, false);
1951 for (auto& c : m_source_incremental_item_connectivities)
1952 c->reserveMemoryForNbSourceItems(nb_item, pre_alloc_connectivity);
1953}
1954
1955/*---------------------------------------------------------------------------*/
1956/*---------------------------------------------------------------------------*/
1957
1958void ItemFamily::
1959_notifyDataIndexChanged()
1960{
1961 _updateItemViews();
1962}
1963
1964/*---------------------------------------------------------------------------*/
1965/*---------------------------------------------------------------------------*/
1966
1968getCommunicatingSubDomains(Int32Array& sub_domains) const
1969{
1970 Int32ConstArrayView ranks = m_variable_synchronizer->communicatingRanks();
1971 Integer s = ranks.size();
1972 sub_domains.resize(s);
1973 sub_domains.copy(ranks);
1974}
1975
1976/*---------------------------------------------------------------------------*/
1977/*---------------------------------------------------------------------------*/
1978
1981{
1982 // Only calculate synchronization info if we are in parallel
1983 // and the number of parts equals the number of ranks of the parallelMng(),
1984 // which is not the case during recovery after a change in the number of
1985 // sub-domains.
1986 if (m_is_parallel && m_mesh->meshPartInfo().nbPart() == parallelMng()->commSize()) {
1987 m_variable_synchronizer->compute();
1989 }
1990}
1991
1992/*---------------------------------------------------------------------------*/
1993/*---------------------------------------------------------------------------*/
1994// TODO move this method outside of ItemFamily
1997{
1998 if (!v)
1999 return;
2000 if (v->itemFamily() != this && v->itemGroup().itemFamily() != this)
2001 throw ArgumentException(A_FUNCINFO, "Variable not in this family");
2003 op.setItemFamily(this);
2004 op.addVariable(v);
2005 op.applyOperation(operation);
2006}
2007
2008/*---------------------------------------------------------------------------*/
2009/*---------------------------------------------------------------------------*/
2010// TODO move this method outside of ItemFamily
2013{
2015 operation = v->dataFactoryMng()->createDataOperation(reduction);
2016 reduceFromGhostItems(v, operation.get());
2017}
2018
2019/*---------------------------------------------------------------------------*/
2020/*---------------------------------------------------------------------------*/
2021
2022Int64ArrayView* ItemFamily::
2023uniqueIds()
2024{
2025 return &m_items_unique_id_view;
2026}
2027
2028/*---------------------------------------------------------------------------*/
2029/*---------------------------------------------------------------------------*/
2030
2032findVariable(const String& var_name, bool throw_exception)
2033{
2035 StringBuilder vname = mesh()->name();
2036 vname += "_";
2037 vname += name();
2038 vname += "_";
2039 vname += var_name;
2040 IVariable* var = vm->findVariableFullyQualified(vname.toString());
2041 if (!var && throw_exception) {
2042 ARCANE_FATAL("No variable named '{0}' in family '{1}'", var_name, name());
2043 }
2044 return var;
2045}
2046
2047/*---------------------------------------------------------------------------*/
2048/*---------------------------------------------------------------------------*/
2049
2051clearItems()
2052{
2053 m_infos->clear();
2054
2055 endUpdate();
2056}
2057
2058/*---------------------------------------------------------------------------*/
2059/*---------------------------------------------------------------------------*/
2060
2063{
2064 Integer nb_item = unique_ids.size();
2065 Int64UniqueArray all_unique_ids;
2066 IParallelMng* pm = m_mesh->parallelMng();
2067 pm->allGatherVariable(unique_ids, all_unique_ids);
2068 HashTableMapT<Int64, Integer> items_map(nb_item * 2, true);
2069 info() << "ItemFamily::checkUniqueIds name=" << name() << " n=" << nb_item
2070 << " total=" << all_unique_ids.size();
2071 for (Integer i = 0; i < nb_item; ++i)
2072 items_map.add(unique_ids[i], 0);
2073 for (Integer i = 0, is = all_unique_ids.size(); i < is; ++i) {
2074 HashTableMapT<Int64, Integer>::Data* data = items_map.lookup(all_unique_ids[i]);
2075 if (data)
2076 ++data->value();
2077 }
2078 for (Integer i = 0; i < nb_item; ++i) {
2079 Integer nb_ref = items_map[unique_ids[i]];
2080 if (nb_ref != 1) {
2081 fatal() << "Duplicate unique_id=" << unique_ids[i];
2082 }
2083 }
2084}
2085
2086/*---------------------------------------------------------------------------*/
2087/*---------------------------------------------------------------------------*/
2088
2090findAdjencyItems(const ItemGroup& group, const ItemGroup& sub_group,
2091 eItemKind link_kind, Integer layer)
2092{
2093 return findAdjacencyItems(group, sub_group, link_kind, layer);
2094}
2095
2097findAdjacencyItems(const ItemGroup& group, const ItemGroup& sub_group,
2098 eItemKind link_kind, Integer layer)
2099{
2100 AdjacencyInfo at(group, sub_group, link_kind, layer);
2101 auto i = m_adjacency_groups.find(at);
2102
2103 if (i == m_adjacency_groups.end()) {
2104 debug() << "** BUILD ADJENCY_ITEMS : " << group.name() << " x "
2105 << sub_group.name() << " link=" << link_kind << " nblayer=" << layer;
2106 ItemPairGroup v(new ItemPairGroupImpl(group, sub_group));
2107 mesh()->utilities()->computeAdjacency(v, link_kind, layer);
2108 m_adjacency_groups.insert(std::make_pair(at, v));
2109 return v;
2110 }
2111 debug() << "** FOUND KNOWN ADJENCY_ITEMS! : " << group.name() << " x "
2112 << sub_group.name() << " link=" << link_kind << " nblayer=" << layer;
2113 return i->second;
2114}
2115
2116/*---------------------------------------------------------------------------*/
2117/*---------------------------------------------------------------------------*/
2118
2121{
2122 return m_local_connectivity_info;
2123}
2124
2125/*---------------------------------------------------------------------------*/
2126/*---------------------------------------------------------------------------*/
2127
2130{
2131 return m_global_connectivity_info;
2132}
2133
2134/*---------------------------------------------------------------------------*/
2135/*---------------------------------------------------------------------------*/
2136
2138setHasUniqueIdMap(bool v)
2139{
2140 ARCANE_UNUSED(v);
2141 throw NotSupportedException(A_FUNCINFO, "this kind of family doesn't support this function");
2142}
2143
2144/*---------------------------------------------------------------------------*/
2145/*---------------------------------------------------------------------------*/
2146
2148hasUniqueIdMap() const
2149{
2150 return true;
2151}
2152
2153/*---------------------------------------------------------------------------*/
2154/*---------------------------------------------------------------------------*/
2155
2157view(Int32ConstArrayView local_ids)
2158{
2159 return ItemVectorView(itemInfoListView(), local_ids);
2160}
2161
2162/*---------------------------------------------------------------------------*/
2163/*---------------------------------------------------------------------------*/
2164
2166view()
2167{
2168 return allItems().view();
2169}
2170
2171/*---------------------------------------------------------------------------*/
2172/*---------------------------------------------------------------------------*/
2173
2174void ItemFamily::
2175_addVariable(IVariable* var)
2176{
2177 //info() << "Add var=" << var->fullName() << " to family=" << name();
2178 if (var->itemFamily() != this)
2179 ARCANE_FATAL("Can not add a variable to a different family");
2180
2181 if (var->property() & IVariable::PInShMem)
2182 m_used_shmem_variables.insert(var);
2183 else
2184 m_used_variables.insert(var);
2185}
2186
2187/*---------------------------------------------------------------------------*/
2188/*---------------------------------------------------------------------------*/
2189
2190void ItemFamily::
2191_removeVariable(IVariable* var)
2192{
2193 //info() << "Remove var=" << var->fullName() << " to family=" << name();
2194 if (var->property() & IVariable::PInShMem)
2195 m_used_shmem_variables.erase(var);
2196 else
2197 m_used_variables.erase(var);
2198}
2199
2200/*---------------------------------------------------------------------------*/
2201/*---------------------------------------------------------------------------*/
2202
2205{
2206 for (IVariable* var : m_used_variables) {
2207 collection.add(var);
2208 }
2209 for (IVariable* var : m_used_shmem_variables) {
2210 collection.add(var);
2211 }
2212}
2213
2214/*---------------------------------------------------------------------------*/
2215/*---------------------------------------------------------------------------*/
2216
2219{
2220 return m_variable_synchronizer.get();
2221}
2222
2223/*---------------------------------------------------------------------------*/
2224/*---------------------------------------------------------------------------*/
2225
2228{
2229 if (m_item_sort_function == sort_function)
2230 return;
2231 delete m_item_sort_function;
2232 m_item_sort_function = sort_function;
2233 if (!m_item_sort_function)
2234 m_item_sort_function = _defaultItemSortFunction();
2235}
2236
2237/*---------------------------------------------------------------------------*/
2238/*---------------------------------------------------------------------------*/
2239
2241itemSortFunction() const
2242{
2243 return m_item_sort_function;
2244}
2245
2246/*---------------------------------------------------------------------------*/
2247/*---------------------------------------------------------------------------*/
2248
2251{
2252 m_variable_synchronizer->synchronize(variables);
2253}
2254
2255/*---------------------------------------------------------------------------*/
2256/*---------------------------------------------------------------------------*/
2257
2260{
2261 m_variable_synchronizer->synchronize(variables, local_ids);
2262}
2263
2264/*---------------------------------------------------------------------------*/
2265/*---------------------------------------------------------------------------*/
2266
2269{
2270 ARCANE_UNUSED(unique_ids);
2271 ARCANE_UNUSED(items);
2272 ARCANE_UNUSED(owners);
2273 ARCANE_THROW(NotImplementedException, "this kind of family doesn't support this operation yet. Only DoF at present.");
2274}
2275
2276/*---------------------------------------------------------------------------*/
2277/*---------------------------------------------------------------------------*/
2278
2280removeItems2(ItemDataList& item_data_list)
2281{
2282 if (!m_mesh->itemFamilyNetwork())
2283 ARCANE_FATAL("Family name='{0}': IMesh::itemFamilyNetwork() is null", name());
2284
2285 ItemData& item_data = item_data_list[itemKind()];
2286 // 1-Prepare : Get child connectivities and families
2287 SharedArray<IIncrementalItemConnectivity*> child_connectivities = m_mesh->itemFamilyNetwork()->getChildDependencies(this); // TODO : change return type ? (List to Array ?)
2288 UniqueArray<IItemFamily*> child_families;
2289 UniqueArray<IIncrementalItemConnectivity*> child_families_to_current_family;
2290 UniqueArray<ItemScalarProperty<bool>> child_families_has_extra_parent_properties; // To indicate wheter child items have other parents.
2291 Integer index = 0;
2292 for (auto child_connectivity : child_connectivities) {
2293 child_families.add(child_connectivity->targetFamily());
2294 child_families_to_current_family.add(m_mesh->itemFamilyNetwork()->getConnectivity(child_families.back(), this, connectivityName(child_families.back(), this)));
2295 if (child_families_to_current_family.back() == nullptr)
2296 fatal() << "removeItems2 needs reverse connectivity. Missing Connectivity " << connectivityName(child_families.back(), this);
2297 child_families_has_extra_parent_properties.add(ItemScalarProperty<bool>());
2298 child_families_has_extra_parent_properties.back().resize(child_families.back(), false);
2299 for (auto parent_connectivity : m_mesh->itemFamilyNetwork()->getParentDependencies(child_families.back())) { // exclure parent actuel
2300 if (parent_connectivity == child_connectivity)
2301 continue;
2302 ItemVector connected_items;
2303 _getConnectedItems(parent_connectivity, connected_items);
2304 _fillHasExtraParentProperty(child_families_has_extra_parent_properties[index], connected_items);
2305 }
2306 index++;
2307 }
2308 // 2-Propagates item removal to child families
2309 Int64ArrayView removed_item_lids = item_data.itemInfos().view(); // Todo change ItemData to store removed item lids in Int32
2310 for (auto removed_item_lid_int64 : removed_item_lids) {
2311 Int32 removed_item_lid = CheckedConvert::toInt32(removed_item_lid_int64);
2312 index = 0;
2313 for (auto child_connectivity : child_connectivities) {
2314 ConnectivityItemVector child_con_accessor(child_connectivity);
2315 ENUMERATE_ITEM (connected_item, child_con_accessor.connectedItems(ItemLocalId(removed_item_lid))) {
2316 if (!this->itemsInternal()[removed_item_lid]->isDetached()) { // test necessary when doing removeDetached (the relations are already deleted).
2317 child_families_to_current_family[index]->removeConnectedItem(ItemLocalId(connected_item), ItemLocalId(removed_item_lid));
2318 }
2319 // Check if connected item is to remove
2320 if (!child_families_has_extra_parent_properties[index][connected_item] && child_families_to_current_family[index]->nbConnectedItem(ItemLocalId(connected_item)) == 0) {
2321 item_data_list[child_connectivity->targetFamily()->itemKind()].itemInfos().add((Int64)connected_item.localId());
2322 }
2323 }
2324 index++;
2325 }
2326 }
2327 // => merge this loop with previous one ?
2328 // 3-1 Remove relations for child relations
2329 for (auto removed_item_lid_int64 : removed_item_lids) {
2330 Int32 removed_item_lid = CheckedConvert::toInt32(removed_item_lid_int64);
2331 for (auto child_relation : m_mesh->itemFamilyNetwork()->getChildRelations(this)) {
2332 ConnectivityItemVector connectivity_accessor(child_relation);
2333 ENUMERATE_ITEM (connected_item, connectivity_accessor.connectedItems(ItemLocalId(removed_item_lid))) {
2334 child_relation->removeConnectedItem(ItemLocalId(removed_item_lid), ItemLocalId(connected_item));
2335 }
2336 }
2337 }
2338 // 3-2 Remove relations for parent relations
2339 ItemScalarProperty<bool> is_removed_item;
2340 is_removed_item.resize(this, false);
2341 for (auto removed_item_lid_int64 : removed_item_lids) {
2342 Int32 removed_item_lid = CheckedConvert::toInt32(removed_item_lid_int64);
2343 is_removed_item[*(this->itemsInternal()[removed_item_lid])] = true;
2344 }
2345 for (auto parent_relation : m_mesh->itemFamilyNetwork()->getParentRelations(this)) {
2346 for (auto source_item : parent_relation->sourceFamily()->itemsInternal()) {
2347 if (source_item->isSuppressed())
2348 continue;
2349 ConnectivityItemVector connectivity_accessor(parent_relation);
2350 ENUMERATE_ITEM (connected_item, connectivity_accessor.connectedItems(ItemLocalId(source_item))) {
2351 if (is_removed_item[connected_item])
2352 parent_relation->removeConnectedItem(ItemLocalId(source_item), connected_item);
2353 }
2354 }
2355 }
2356 // 4-Remove items. Child items will be removed by an automatic call of removeItems2 on their family...
2357 for (auto removed_item_lid_int64 : removed_item_lids) {
2358 Int32 removed_item_lid = CheckedConvert::toInt32(removed_item_lid_int64);
2359 ItemInternal* removed_item = m_infos->itemInternal(removed_item_lid);
2360 if (removed_item->isDetached()) {
2361 m_infos->removeDetachedOne(removed_item);
2362 }
2363 else {
2364 m_infos->removeOne(removed_item);
2365 }
2366 }
2367 this->endUpdate(); // endUpdate is needed since we then go deeper in the dependency graph and will need to enumerate this changed family.
2368}
2369
2370/*---------------------------------------------------------------------------*/
2371/*---------------------------------------------------------------------------*/
2372
2373void ItemFamily::
2374_getConnectedItems(IIncrementalItemConnectivity* parent_connectivity, ItemVector& target_family_connected_items)
2375{
2376 ConnectivityItemVector connectivity_accessor(parent_connectivity);
2377 for (auto source_item : parent_connectivity->sourceFamily()->itemsInternal()) {
2378 if (source_item->isSuppressed())
2379 continue;
2380 target_family_connected_items.add(connectivity_accessor.connectedItems(ItemLocalId(source_item)).localIds());
2381 }
2382}
2383
2384/*---------------------------------------------------------------------------*/
2385/*---------------------------------------------------------------------------*/
2386
2387void ItemFamily::
2388_fillHasExtraParentProperty(ItemScalarProperty<bool>& child_families_has_extra_parent, ItemVectorView connected_items)
2389{
2390 ENUMERATE_ITEM (connected_item, connected_items) {
2391 child_families_has_extra_parent[connected_item] = true;
2392 }
2393}
2394
2395/*---------------------------------------------------------------------------*/
2396/*---------------------------------------------------------------------------*/
2397
2398void ItemFamily::
2399_detachCells2(Int32ConstArrayView local_ids)
2400{
2401 //- Only cells are detached, i.e., no parent dependencies are to be found
2402 ARCANE_ASSERT((m_mesh->itemFamilyNetwork()->getParentDependencies(this).empty()), ("Only cells are detached, no parent dependencies are to be found."))
2403 // Remove all parent and child relations. Keep child dependencies => used when removing detached cells. No parent dependencies
2404 // 1 Remove relations for child relations
2405 for (auto removed_item_lid : local_ids) {
2406 for (auto child_relation : m_mesh->itemFamilyNetwork()->getChildRelations(this)) {
2407 ConnectivityItemVector connectivity_accessor(child_relation);
2408 ENUMERATE_ITEM (connected_item, connectivity_accessor.connectedItems(ItemLocalId(removed_item_lid))) {
2409 child_relation->removeConnectedItem(ItemLocalId(removed_item_lid), ItemLocalId(connected_item));
2410 }
2411 }
2412 }
2413 // 2 Remove relations for parent relations
2414 ItemScalarProperty<bool> is_detached_item;
2415 is_detached_item.resize(this, false);
2416 for (auto detached_item_lid : local_ids) {
2417 is_detached_item[*(this->itemsInternal()[detached_item_lid])] = true;
2418 }
2419 for (auto parent_relation : m_mesh->itemFamilyNetwork()->getParentRelations(this)) {
2420 for (auto source_item : parent_relation->sourceFamily()->itemsInternal()) {
2421 if (source_item->isSuppressed())
2422 continue;
2423 ConnectivityItemVector connectivity_accessor(parent_relation);
2424 ENUMERATE_ITEM (connected_item, connectivity_accessor.connectedItems(ItemLocalId(source_item))) {
2425 if (is_detached_item[connected_item]) {
2426 parent_relation->removeConnectedItem(ItemLocalId(source_item), connected_item);
2427 }
2428 }
2429 }
2430 }
2431 // 4-Detach items.
2432 for (auto detached_item_lid : local_ids) {
2433 m_infos->detachOne(m_infos->itemInternal(detached_item_lid)); // when family/mesh endUpdate is done? needed?
2434 }
2435}
2436
2437/*---------------------------------------------------------------------------*/
2438/*---------------------------------------------------------------------------*/
2439
2440void ItemFamily::
2441removeNeedRemoveMarkedItems()
2442{
2443 ItemInternalMap& item_map = itemsMap();
2444 if (item_map.count() == 0)
2445 return;
2446
2447 if (!m_mesh->itemFamilyNetwork())
2448 ARCANE_FATAL("Family name='{0}': IMesh::itemFamilyNetwork() is null", name());
2449 if (!IItemFamilyNetwork::plug_serializer)
2450 ARCANE_FATAL("family name='{0}': removeNeedMarkedItems() cannot be called if ItemFamilyNetwork is unplugged.", name());
2451
2452 UniqueArray<ItemInternal*> items_to_remove;
2453 UniqueArray<Int32> items_to_remove_lids;
2454 items_to_remove.reserve(1000);
2455 items_to_remove_lids.reserve(1000);
2456
2457 item_map.eachItem([&](impl::ItemBase item) {
2458 Integer f = item.flags();
2459 if (f & ItemFlags::II_NeedRemove) {
2460 f &= ~ItemFlags::II_NeedRemove & ItemFlags::II_Suppressed;
2461 item.toMutable().setFlags(f);
2462 items_to_remove.add(item._itemInternal());
2463 items_to_remove_lids.add(item.localId());
2464 }
2465 });
2466 info() << "Number of " << itemKind() << " of family " << name() << " to remove: " << items_to_remove.size();
2467 if (items_to_remove.size() == 0)
2468 return;
2469
2470 // Update connectivities => remove all con pointing on the removed items
2471 // TODO the nearly same procedure is done in _detachCells2: mutualize in a method (watch out the connectivities used are parentConnectivities or parentRelations...)
2472 ItemScalarProperty<bool> is_removed_item;
2473 is_removed_item.resize(this, false);
2474 for (auto removed_item : items_to_remove) {
2475 is_removed_item[*removed_item] = true;
2476 }
2477 //for (auto parent_connectivity : m_mesh->itemFamilyNetwork()->getParentConnectivities(this)) {
2478 for (auto parent_connectivity : m_mesh->itemFamilyNetwork()->getParentRelations(this)) {
2479 for (auto source_item : parent_connectivity->sourceFamily()->itemsInternal()) {
2480 if (source_item->isSuppressed())
2481 continue;
2482 ConnectivityItemVector connectivity_accessor(parent_connectivity);
2483 ENUMERATE_ITEM (connected_item, connectivity_accessor.connectedItems(ItemLocalId(source_item))) {
2484 if (is_removed_item[connected_item]) {
2485 parent_connectivity->removeConnectedItem(ItemLocalId(source_item), connected_item);
2486 }
2487 }
2488 }
2489 }
2490 // Remove items
2491 m_infos->removeMany(items_to_remove_lids);
2492}
2493
2494/*---------------------------------------------------------------------------*/
2495/*---------------------------------------------------------------------------*/
2496
2498{
2499 public:
2500
2501 bool operator()(const ItemInternal* item1, const ItemInternal* item2) const
2502 {
2503 // Destroyed entities must be placed at the end of the list.
2504 //cout << "Compare: " << item1->uniqueId() << " " << item2->uniqueId() << '\n';
2505 bool s1 = item1->isSuppressed();
2506 bool s2 = item2->isSuppressed();
2507 if (s1 && !s2)
2508 return false;
2509 if (!s1 && s2)
2510 return true;
2511 return item1->uniqueId() < item2->uniqueId();
2512 }
2513};
2514
2515/*---------------------------------------------------------------------------*/
2516/*---------------------------------------------------------------------------*/
2517
2518IItemInternalSortFunction* ItemFamily::
2519_defaultItemSortFunction()
2520{
2521 auto comparison_sort = std::make_unique<ItemInternalSortFunction<CompareUniqueIdWithSuppression>>("ArcaneUniqueId");
2522 auto use_legacy = Convert::Type<Int32>::tryParseFromEnvironment("ARCANE_USE_LEGACY_ITEM_SORT", true);
2523 if (use_legacy && use_legacy.value() != 0)
2524 return comparison_sort.release();
2525 return std::make_unique<UniqueIdKeySortFunction>("ArcaneUniqueId", std::move(comparison_sort)).release();
2526}
2527
2528/*---------------------------------------------------------------------------*/
2529/*---------------------------------------------------------------------------*/
2530
2531void ItemFamily::
2532setPolicyMng(IItemFamilyPolicyMng* policy_mng)
2533{
2534 if (m_policy_mng == policy_mng)
2535 return;
2536 if (m_policy_mng)
2537 ARCANE_FATAL("PolicyMng already set");
2538 m_policy_mng = policy_mng;
2539}
2540
2541/*---------------------------------------------------------------------------*/
2542/*---------------------------------------------------------------------------*/
2543
2544void ItemFamily::
2545addSourceConnectivity(IItemConnectivity* connectivity)
2546{
2547 m_source_item_connectivities.insert(connectivity);
2548}
2549
2550/*---------------------------------------------------------------------------*/
2551/*---------------------------------------------------------------------------*/
2552
2553void ItemFamily::
2554addTargetConnectivity(IItemConnectivity* connectivity)
2555{
2556 m_target_item_connectivities.insert(connectivity);
2557}
2558
2559/*---------------------------------------------------------------------------*/
2560/*---------------------------------------------------------------------------*/
2561
2562void ItemFamily::
2563removeSourceConnectivity(IItemConnectivity* connectivity)
2564{
2565 m_source_item_connectivities.erase(m_source_item_connectivities.find(connectivity));
2566}
2567
2568/*---------------------------------------------------------------------------*/
2569/*---------------------------------------------------------------------------*/
2570
2571void ItemFamily::
2572removeTargetConnectivity(IItemConnectivity* connectivity)
2573{
2574 m_target_item_connectivities.erase(m_target_item_connectivities.find(connectivity));
2575}
2576
2577/*---------------------------------------------------------------------------*/
2578/*---------------------------------------------------------------------------*/
2579
2580void ItemFamily::
2581setConnectivityMng(IItemConnectivityMng* connectivity_mng)
2582{
2583 ARCANE_ASSERT((m_connectivity_mng == NULL || m_connectivity_mng == connectivity_mng),
2584 ("Connectivity Manager must be unique"))
2585 m_connectivity_mng = connectivity_mng;
2586}
2587
2588/*---------------------------------------------------------------------------*/
2589/*---------------------------------------------------------------------------*/
2590
2593{
2594 return m_infos->itemListChangedEvent();
2595}
2596
2597/*---------------------------------------------------------------------------*/
2598/*---------------------------------------------------------------------------*/
2599
2600void ItemFamily::
2601experimentalChangeUniqueId(ItemLocalId local_id, ItemUniqueId unique_id)
2602{
2603 ItemInternal* iitem = _itemInternal(local_id);
2604 Int64 old_uid = iitem->uniqueId();
2605 if (old_uid == unique_id)
2606 return;
2607 //MutableItemBase item_base(local_id,m_common_item_shared_info);
2608 iitem->setUniqueId(unique_id);
2609
2610 if (m_infos->hasUniqueIdMap()) {
2611 ItemInternalMap& item_map = itemsMap();
2612 item_map.remove(old_uid);
2613 item_map.add(unique_id, iitem);
2614 }
2615}
2616
2617/*---------------------------------------------------------------------------*/
2618/*---------------------------------------------------------------------------*/
2619
2620void ItemFamily::
2621_addSourceConnectivity(IIncrementalItemSourceConnectivity* c)
2622{
2623 m_source_incremental_item_connectivities.add(c->toSourceReference());
2624}
2625
2626/*---------------------------------------------------------------------------*/
2627/*---------------------------------------------------------------------------*/
2628
2629void ItemFamily::
2630_addTargetConnectivity(IIncrementalItemTargetConnectivity* c)
2631{
2632 m_target_incremental_item_connectivities.add(c->toTargetReference());
2633}
2634
2635/*---------------------------------------------------------------------------*/
2636/*---------------------------------------------------------------------------*/
2637
2638void ItemFamily::
2639_checkValidConnectivity()
2640{
2641 {
2642 // Checks that there are no null entities.
2643 ENUMERATE_ITEM (i, allItems()) {
2644 Item item = *i;
2645 if (item.null())
2646 ARCANE_FATAL("family={0}: local item lid={1} is null", fullName(), item);
2647 }
2648 }
2649 {
2650 // Checks the consistency of the internal part
2651 ENUMERATE_ITEM (i, allItems()) {
2652 Item item = *i;
2653 Item i1 = item;
2654 Item i2 = m_common_item_shared_info->m_items_internal[item.localId()];
2655 if (i1 != i2)
2656 ARCANE_FATAL("family={0}: incoherent item internal lid={1} i1={2} i2={3}",
2657 fullName(), item.localId(), ItemPrinter(i1), ItemPrinter(i2));
2658 }
2659 }
2660 constexpr Int32 MAX_KIND = ItemInternalConnectivityList::MAX_ITEM_KIND;
2661 std::array<Int32, MAX_KIND> computed_max;
2662 computed_max.fill(0);
2663
2664 for (Integer i = 0; i < MAX_KIND; ++i) {
2665 eItemKind target_kind = static_cast<eItemKind>(i);
2666 IndexedItemConnectivityViewBase con_view{ m_item_connectivity_list.containerView(i), itemKind(), target_kind };
2667 Int32 stored_max_nb = m_item_connectivity_list.maxNbConnectedItem(i);
2668 const Int32 con_nb_item_size = con_view.nbSourceItem();
2669
2670 info(4) << "Family name=" << fullName() << " I=" << i << " nb_item_size=" << con_nb_item_size;
2671
2672 Int32 max_nb = 0;
2673 if (con_nb_item_size != 0) {
2674 // It is necessary to iterate over all entities and not over \a con_nb_item
2675 // because some values may not be valid if there are
2676 // gaps in the numbering.
2677 ENUMERATE_ITEM (i, allItems()) {
2678 Int32 x = con_view.nbItem(i);
2679 if (x > max_nb)
2680 max_nb = x;
2681 }
2682 if (stored_max_nb < max_nb)
2683 ARCANE_FATAL("Bad value for max connected item family={0} kind={1} stored={2} computed={3}",
2684 name(), i, stored_max_nb, max_nb);
2685 computed_max[i] = max_nb;
2686 }
2687 }
2688 // Checks that the value returned by m_local_connectivity_info
2689 // is at least greater than 'computed_max'
2690 {
2691 std::array<Int32, MAX_KIND> stored_max;
2692 stored_max.fill(0);
2693 auto* ci = m_local_connectivity_info;
2694 stored_max[ItemInternalConnectivityList::NODE_IDX] = ci->maxNodePerItem();
2695 stored_max[ItemInternalConnectivityList::EDGE_IDX] = ci->maxEdgePerItem();
2696 stored_max[ItemInternalConnectivityList::FACE_IDX] = ci->maxFacePerItem();
2697 stored_max[ItemInternalConnectivityList::CELL_IDX] = ci->maxCellPerItem();
2698 // For the following two, there is no equivalent in 'ItemConnectivityInfo' so
2699 // we put the calculated values to avoid generating an error.
2700 stored_max[ItemInternalConnectivityList::HPARENT_IDX] = computed_max[ItemInternalConnectivityList::HPARENT_IDX];
2701 stored_max[ItemInternalConnectivityList::HCHILD_IDX] = computed_max[ItemInternalConnectivityList::HCHILD_IDX];
2702 for (Integer i = 0; i < MAX_KIND; ++i)
2703 if (stored_max[i] < computed_max[i])
2704 ARCANE_FATAL("Bad value for local_connectivity_info family={0} kind={1} stored={2} computed={3}",
2705 name(), i, stored_max[i], computed_max[i]);
2706 }
2707 for (auto ics : m_connectivity_selector_list)
2708 ics->checkValidConnectivityList();
2709}
2710
2711/*---------------------------------------------------------------------------*/
2712/*---------------------------------------------------------------------------*/
2713
2714void ItemFamily::
2715_addConnectivitySelector(ItemConnectivitySelector* selector)
2716{
2717 m_connectivity_selector_list.add(selector);
2718}
2719
2720/*---------------------------------------------------------------------------*/
2721/*---------------------------------------------------------------------------*/
2722
2723void ItemFamily::
2724_buildConnectivitySelectors()
2725{
2726 m_connectivity_selector_list_by_item_kind.clear();
2727 m_connectivity_selector_list_by_item_kind.resize(ItemInternalConnectivityList::MAX_ITEM_KIND);
2728 m_connectivity_selector_list_by_item_kind.fill(nullptr);
2729
2730 for (ItemConnectivitySelector* ics : m_connectivity_selector_list) {
2731 ics->build();
2732 Int32 i = ics->itemConnectivityIndex();
2733 if (i >= 0) {
2734 if (m_connectivity_selector_list_by_item_kind[i])
2735 ARCANE_FATAL("Can not have two connectivity selector for same item kind");
2736 m_connectivity_selector_list_by_item_kind[i] = ics;
2737 }
2738 }
2739}
2740
2741/*---------------------------------------------------------------------------*/
2742/*---------------------------------------------------------------------------*/
2743
2744void ItemFamily::
2745_setTopologyModifier(IItemFamilyTopologyModifier* tm)
2746{
2747 delete m_topology_modifier;
2748 m_topology_modifier = tm;
2749}
2750
2751/*---------------------------------------------------------------------------*/
2752/*---------------------------------------------------------------------------*/
2760void ItemFamily::
2761_updateItemsSharedFlag()
2762{
2763 ItemInternalList items(_itemsInternal());
2764 for (Integer i = 0, n = items.size(); i < n; ++i)
2765 items[i]->removeFlags(ItemFlags::II_Shared);
2766 Int32ConstArrayView comm_ranks = m_variable_synchronizer->communicatingRanks();
2767 Integer nb_rank = comm_ranks.size();
2768 // Iterates through the synchronizer's sharedItems() and sets the flag
2769 // II_Shared for the entities in the list.
2770 for (Integer i = 0; i < nb_rank; ++i) {
2771 Int32ConstArrayView shared_ids = m_variable_synchronizer->sharedItems(i);
2772 for (auto id : shared_ids)
2773 items[id]->addFlags(ItemFlags::II_Shared);
2774 }
2775}
2776
2777/*---------------------------------------------------------------------------*/
2778/*---------------------------------------------------------------------------*/
2779
2780void ItemFamily::
2781_computeConnectivityInfo(ItemConnectivityInfo* ici)
2782{
2783 ici->fill(itemInternalConnectivityList());
2784 info(5) << "COMPUTE CONNECTIVITY INFO family=" << name() << " v=" << ici
2785 << " node=" << ici->maxNodePerItem() << " face=" << ici->maxFacePerItem()
2786 << " edge=" << ici->maxEdgePerItem() << " cell=" << ici->maxCellPerItem();
2787}
2788
2789/*---------------------------------------------------------------------------*/
2790/*---------------------------------------------------------------------------*/
2791
2792void ItemFamily::
2793_handleOldCheckpoint()
2794{
2795 // No need to manage 'm_items_type_id' because it is not present in
2796 // the old protections.
2797 _offsetArrayByOne(m_items_unique_id);
2798 _offsetArrayByOne(m_items_flags);
2799 _offsetArrayByOne(m_items_owner);
2800 (*m_items_unique_id)[0] = NULL_ITEM_UNIQUE_ID;
2801 (*m_items_flags)[0] = 0;
2802 (*m_items_owner)[0] = A_NULL_RANK;
2803}
2804
2805/*---------------------------------------------------------------------------*/
2806/*---------------------------------------------------------------------------*/
2807
2808namespace
2809{
2810
2811 // Returns a view that starts on the second element of the array.
2812 template <typename DataType>
2813 ArrayView<DataType> _getView(Array<DataType>* v)
2814 {
2815 Int32 n = v->size();
2816 return v->subView(1, n - 1);
2817 }
2818
2819} // namespace
2820
2821void ItemFamily::
2822_updateItemViews()
2823{
2824 m_common_item_shared_info->m_unique_ids = _getView(m_items_unique_id);
2825 m_common_item_shared_info->m_flags = _getView(m_items_flags);
2826 m_common_item_shared_info->m_type_ids = _getView(m_items_type_id);
2827 m_common_item_shared_info->m_owners = _getView(m_items_owner);
2828 m_common_item_shared_info->m_parent_item_ids = m_items_nb_parent->view();
2829
2830 m_items_unique_id_view = _getView(m_items_unique_id);
2831}
2832
2833/*---------------------------------------------------------------------------*/
2834/*---------------------------------------------------------------------------*/
2835
2836void ItemFamily::
2837_addOnSizeChangedObservable(VariableRef& var_ref)
2838{
2839 m_observers.addObserver(this, &ItemFamily::_updateItemViews,
2840 var_ref.variable()->onSizeChangedObservable());
2841}
2842
2843/*---------------------------------------------------------------------------*/
2844/*---------------------------------------------------------------------------*/
2845
2847_internalApi()
2848{
2849 return m_internal_api;
2850}
2851
2852/*---------------------------------------------------------------------------*/
2853/*---------------------------------------------------------------------------*/
2854
2855} // End namespace Arcane::mesh
2856
2857/*---------------------------------------------------------------------------*/
2858/*---------------------------------------------------------------------------*/
#define ARCANE_CHECK_POINTER(ptr)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
#define ARCANE_THROW(exception_class,...)
Macro for throwing an exception with formatting.
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
#define ENUMERATE_ITEM(name, group)
Generic enumerator for a node group.
bool checkResizeArray(Array< DataType > &array, Int64 new_size, bool force_resize)
Resizes an array that is indexed by 'ItemLocalId'.
Definition MeshUtils.h:401
Integer size() const
Number of elements in the vector.
constexpr Integer size() const noexcept
Returns the size of the array.
void resize(Int64 s)
Changes the number of elements in the array to s.
void copy(Span< const T > rhs)
Copies the values from rhs into the instance.
void add(ConstReferenceType val)
Adds element val to the end of the array.
T & back()
Last element of the array.
void reserve(Int64 new_capacity)
Reserves memory for new_capacity elements.
ArrayView< T > view() const
Mutable view of this array.
Manages the retrieval of connectivity information.
ItemVectorView connectedItems(ItemLocalId item)
Returns the entities connected to item.
Constant view of an array of type T.
constexpr Integer size() const noexcept
Number of elements in the array.
constexpr bool empty() const noexcept
true if the array is empty (size()==0)
static std::optional< Int32 > tryParseFromEnvironment(StringView s, bool throw_if_invalid)
Template class for converting a type.
Class managing observers associated with an event.
Hash table for associative arrays.
Data * lookup(KeyTypeConstRef id)
Searches for the value corresponding to key id.
bool add(KeyTypeConstRef id, const ValueType &value)
Adds the value value corresponding to key id.
virtual IDataOperation * createDataOperation(Parallel::eReduceType rt)=0
Creates an operation performing a reduction of type rt.
Interface of an operation on a data.
Interface for managing an incremental connectivity.
virtual void removeConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id)=0
Removes the entity with localId() target_local_id from the connectivity of source_item.
Interface for the source of an incremental connectivity.
virtual IItemFamily * sourceFamily() const =0
Source family.
virtual Ref< IIncrementalItemSourceConnectivity > toSourceReference()=0
Returns a reference to the instance.
Interface for the target of an incremental connectivity.
virtual Ref< IIncrementalItemTargetConnectivity > toTargetReference()=0
Returns a reference to the instance.
Interface for connectivity information by entity type.
virtual void notifyLocalIdChanged(IItemFamily *item_family, Int32ConstArrayView old_to_new_ids, Integer nb_item)=0
Update of modified items, possibly compacted.
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.
Definition IItemFamily.h:85
virtual Integer parentFamilyDepth() const =0
Gives the nesting depth of the current mesh.
virtual ItemInternalArrayView itemsInternal()=0
Internal array of entities.
virtual void notifyItemsOwnerChanged()=0
Notifies that the entities specific to the family's subdomain have been modified.
Interface of an entity sorting function.
virtual String name() const =0
Mesh name.
virtual IItemFamily * findItemFamily(eItemKind ik, const String &name, bool create_if_needed=false, bool register_modifier_if_created=false)=0
Returns the family named name.
Interface for managing the compaction of mesh families.
virtual void endCompact()=0
Signals that the compaction is finished.
virtual IMeshCompacter * beginCompact()=0
Starts a compaction on all families of the mesh.
Management of mesh family compaction.
virtual void setSorted(bool v)=0
Indicates whether entities should be sorted during compaction.
virtual void doAllActions()=0
Executes all compaction actions successively.
Mesh manager interface.
Definition IMeshMng.h:41
virtual MeshHandle * findMeshHandle(const String &name, bool throw_exception)=0
Searches for the mesh with name name.
virtual void computeAdjacency(const ItemPairGroup &adjacency_array, eItemKind link_kind, Integer nb_layer)
Calculates adjacencies, stored in adjacency_array.
virtual IMeshUtilities * utilities()=0
Associated utility functions interface.
virtual ItemTypeMng * itemTypeMng() const =0
Associated entity type manager.
virtual IMeshCompactMng * _compactMng()=0
virtual const MeshPartInfo & meshPartInfo() const =0
Mesh part information.
Interface of the parallelism manager for a subdomain.
virtual void allGatherVariable(ConstArrayView< char > send_buf, Array< char > &recv_buf)=0
Performs an all-gather operation across all processors.
virtual char reduce(eReduceType rt, char v)=0
Performs a reduction of type rt on the real v and returns the value.
Interface of the subdomain manager.
Definition ISubDomain.h:78
virtual IVariableMng * variableMng()=0
Returns the variable manager.
Variable manager interface.
virtual IVariable * findVariableFullyQualified(const String &name)=0
Returns the fully qualified variable named name or 0 if no such name exists.
Interface of a variable synchronization service.
virtual void changeLocalIds(Int32ConstArrayView old_to_new_ids)=0
Called when the local IDs of the entities are modified.
Interface of a variable.
Definition IVariable.h:40
virtual String fullName() const =0
Full variable name (with family prefix).
@ PSubDomainDepend
Indicates that the variable value is dependent on the subdomain.
Definition IVariable.h:81
@ PTemporary
Indicates that the variable is temporary.
Definition IVariable.h:114
@ PInShMem
Indicates that the variable must be allocated in shared memory.
Definition IVariable.h:156
@ PExecutionDepend
Indicates that the variable value is dependent on the execution.
Definition IVariable.h:96
@ PPrivate
Indicates that the variable is private.
Definition IVariable.h:103
@ PNoRestore
Indicates that the variable should not be restored.
Definition IVariable.h:120
@ PNoDump
Indicates that the variable should not be saved.
Definition IVariable.h:62
virtual int property() const =0
Returns the properties of the variable.
virtual IDataFactoryMng * dataFactoryMng() const =0
Data factory associated with the variable.
virtual void resizeFromGroup()=0
Sets the number of elements for a mesh variable.
virtual ItemGroup itemGroup() const =0
Associated mesh group.
virtual void compact(Int32ConstArrayView new_to_old_ids)=0
Compresses the variable's values.
virtual void copyItemsMeanValues(Int32ConstArrayView first_source, Int32ConstArrayView second_source, Int32ConstArrayView destination)=0
Copies the mean values of entities numbered first_source and second_source into entities numbered des...
virtual IItemFamily * itemFamily() const =0
Associated entity family.
virtual String name() const =0
Variable name.
virtual void copyItemsValues(Int32ConstArrayView source, Int32ConstArrayView destination)=0
Copies the values of entities numbered source into entities numbered destination.
Base class for a view on unstructured connectivity.
bool isSuppressed() const
True if the entity is suppressed.
ItemUniqueId uniqueId() const
Unique number of the entity.
MutableItemBase toMutable()
Mutable interface of this entity.
Int32 flags() const
Flags of the entity.
bool isDetached() const
True if the entity is detached.
ItemTypeInfo * typeInfo() const
Type of the entity.
Int32 localId() const
Local number (in the subdomain) of the entity.
Information to manage the compaction of entities of a family.
Int32ConstArrayView newToOldLocalIds() const
Conversion between new and old local IDs.
Int32ConstArrayView oldToNewLocalIds() const
Conversion between old and new local IDs.
Event arguments for entity addition or deletion.
Flags for entity characteristics.
Definition ItemFlags.h:39
@ II_NeedRemove
The entity must be removed.
Definition ItemFlags.h:63
@ II_Shared
The entity is shared by another subdomain.
Definition ItemFlags.h:59
@ II_Suppressed
The entity has just been suppressed.
Definition ItemFlags.h:58
Brief: Implementation of a mesh entity group.
bool checkNeedUpdate()
Updates the group if necessary.
void destroy()
Destroys the group. After this call, the group becomes a null group.
void removeSuppressedItems()
Removes entities from the group whose isSuppressed() flag is true.
bool hasComputeFunctor() const
Indicates if the group is calculated.
ItemGroup parentGroup()
Parent group.
void changeIds(Int32ConstArrayView old_to_new_ids)
Changes the indices of the group entities.
Mesh entity group.
Definition ItemGroup.h:51
ItemGroupImpl * internal() const
Returns the group implementation.
Definition ItemGroup.h:125
IVariableSynchronizer * synchronizer() const
Group synchronizer.
Definition ItemGroup.cc:616
const String & name() const
Group name.
Definition ItemGroup.h:81
bool isLocalToSubDomain() const
True if the group is local to the subdomain.
Definition ItemGroup.h:230
void invalidate(bool force_recompute=false)
Invalidates the group.
Definition ItemGroup.h:257
ItemVectorView view() const
View of the group entities.
Definition ItemGroup.cc:580
Integer size() const
Number of elements in the group.
Definition ItemGroup.h:93
IItemFamily * itemFamily() const
Entity family to which this group belongs (0 for the null group).
Definition ItemGroup.h:128
void setItems(Int32ConstArrayView items_local_id)
Sets the entities of the group.
Definition ItemGroup.cc:484
eItemKind itemKind() const
Group kind. This is the kind of its elements.
Definition ItemGroup.h:114
bool hasSynchronizer() const
Indicates if the group has an active synchronizer.
Definition ItemGroup.cc:634
bool isAllItems() const
Indicates if the group is that of all entities.
Definition ItemGroup.cc:607
void checkValid()
Internal check of group validity.
Definition ItemGroup.cc:519
bool null() const
true means the group is the null group
Definition ItemGroup.h:75
void setOwn(bool v)
Sets whether the group property is local or not.
Definition ItemGroup.cc:161
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.
Definition ItemLocalId.h:42
Implementation of an array of lists of entities.
Table of entity lists.
Utility class for printing information about an entity.
Definition ItemPrinter.h:35
Internal shared structure of a mesh entity.
Type of an entity (Item).
Definition ItemTypeId.h:33
Info on a mesh entity type.
Mesh entity type manager.
Definition ItemTypeMng.h:64
ItemTypeInfo * typeFromId(Integer id) const
Type corresponding to the number id.
Unique identifier of an entity.
View on a vector of entities.
Entity vector.
Definition ItemVector.h:60
void add(Int32 local_id)
Adds an entity with local ID local_id to the end of the vector.
Definition ItemVector.h:94
Base class for a mesh element.
Definition Item.h:84
Int32 owner() const
Owner subdomain number of the entity.
Definition Item.h:252
ItemUniqueId uniqueId() const
Unique identifier across all domains.
Definition Item.h:239
Implementation of a collection of elements in vector form.
IMesh * mesh() const
Associated mesh.
Information about a partitioned mesh.
void setOwner(Integer suid, Int32 current_sub_domain)
Sets the sub-domain number of the entity owner.
void setFlags(Int32 f)
Sets the entity flags.
void setParent(Int32 aindex, Int32 parent_local_id)
Sets the i-th parent (currently aindex must be 0).
void applyOperation(IDataOperation *operation) override
Applies the operation.
void addVariable(IVariable *variable) override
Adds a variable to the list of variables concerned by the operation.
void setItemFamily(IItemFamily *family) override
Positions the entity family on which the operation is to be performed.
List of properties.
Definition Properties.h:65
T * get() const
Returns the object referenced by the instance.
Definition Ptr.h:122
Encapsulation of an automatically destructing pointer.
Definition ScopedPtr.h:44
1D vector of data with reference semantics.
Unicode character string constructor.
String toString() const
Returns the constructed character string.
const char * localstr() const
Returns the conversion of the instance into UTF-8 encoding.
Definition String.cc:229
TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium) const
Flow for a debug message.
TraceMessage fatal() const
Flow for a fatal error message.
TraceMessage info() const
Flow for an information message.
ITraceMng * traceMng() const
Trace manager.
1D data vector with value semantics (STL style).
Parameters necessary for building a variable.
Reference to a variable.
Definition VariableRef.h:56
IVariable * variable() const
Associated variable.
Mesh information for a given entity kind.
Information on connectivity by entity type.
Integer maxNodePerItem() const override
Maximum number of nodes per entity.
Integer maxCellPerItem() const override
Maximum number of cells per entity.
Integer maxFacePerItem() const override
Maximum number of faces per entity.
Integer maxEdgePerItem() const override
Maximum number of edges per entity.
Selection between historical and on-demand connectivities.
void resizeVariables(bool force_resize) override
Resizes the variables of this family.
void removeVariable(IVariable *var) override
Removes a variable from this family.
void notifyEndUpdateFromMesh() override
Indicates the end of modification by the mesh.
ItemInternalConnectivityList * unstructuredItemInternalConnectivityList() override
Information on unstructured connectivities.
void addVariable(IVariable *var) override
Adds a variable to this family.
void endAllocate() override
Indicates the end of allocation.
ItemSharedInfo * commonItemSharedInfo() override
Instance of ItemSharedInfo for the family entities.
IItemFamilyTopologyModifier * topologyModifier() override
Topology modifier interface.
VariableArrayInt64 m_items_unique_id
Contains the uniqueIds() of the entities in this family.
VariableArrayInteger m_items_shared_data_index
Index in the ItemSharedInfo array for each entity.
VariableArrayInt32 m_items_flags
Contains the flags() of the entities in this family.
VariableArrayInt16 m_items_type_id
Contains the typeId() of the entities in this family.
VariableArrayInt32 m_items_owner
Contains the owner() of the entities in this family.
VariableItemInt32 m_items_new_owner
Contains the owning sub-domain of the entity.
VariableArrayInt32 m_items_nb_parent
Contains the parent() of the entities in this family.
bool canAllocateBulk() const
Whether _allocateInfosBulk() can be used: nothing allocated, nothing freed.
bool hasUniqueIdMap() const override
Indicates if the family has a uniqueId to localId conversion table.
IMesh * mesh() const override
Associated mesh.
void partialEndUpdateVariable(IVariable *variable) override
Updates a variable.
void _compactItems(bool do_sort)
Compresses the entities.
void partialEndUpdate() override
Partial update.
String fullName() const override
Full family name (with the mesh's name).
Definition ItemFamily.h:141
void _compactFromParentFamily(const ItemFamilyCompactInfos &compact_infos)
Compresses the connectivities.
void _checkComputeSynchronizeInfos(Int32 changed)
Test collectif permettant de savoir s'il faut mettre à jour les infos de synchro.
void _compactOnlyItems(bool do_sort)
Compresses the entities without updating references.
EventObservableView< const ItemFamilyItemListChangedEventArgs & > itemListChangedEvent() override
Event for entity addition and deletion.
void clearItems() override
Deletes all entities in the family.
ItemPairGroup findAdjencyItems(const ItemGroup &group, const ItemGroup &sub_group, eItemKind link_kind, Integer layer) override
Searches for an adjacency list.
void destroyGroups() override
Deletes all groups in this family.
void prepareForDump() override
Prepares data for dumping.
ItemInternalConnectivityList m_item_connectivity_list
Accessor for connectivities via Item and ItemInternal.
Definition ItemFamily.h:463
void addChildFamily(IItemFamily *family) override
Adds a family as a dependency.
void checkValid() override
Check the validity of internal structures (internal).
ItemInternal * findOneItem(Int64 uid) override
Unique ID entity unique_id.
IParallelMng * parallelMng() const override
Associated parallelism manager.
void endUpdate() override
Notifies the end of modification of the entity list.
void compactVariablesAndGroups(const ItemFamilyCompactInfos &compact_infos)
Compresses the variables and groups.
void usedVariables(VariableCollection collection) override
Adds the list of variables used by this family to the collection.
ITraceMng * traceMng() const override
Associated trace manager.
ItemGroup createGroup(const String &name, Int32ConstArrayView elements, bool do_override=false) override
Creates an entity group named name containing the entities local_ids.
eItemKind itemKind() const override
Entity kind.
Integer m_current_id
Family identifier.
Definition ItemFamily.h:449
VariableItemInt32 & itemsNewOwner() override
Variable containing the number of the new subdomain owning the entity.
void copyItemsValues(Int32ConstArrayView source, Int32ConstArrayView destination) override
void copyItemsMeanValues(Int32ConstArrayView first_source, Int32ConstArrayView second_source, Int32ConstArrayView destination) override
ItemGroup allItems() const override
Group of all entities.
void internalRemoveItems(Int32ConstArrayView local_ids, bool keep_ghost=false) override
Removes the entities given by local_ids.
void addGhostItems(Int64ConstArrayView unique_ids, Int32ArrayView items, Int32ConstArrayView owners) override
Allocates ghost entities.
void getCommunicatingSubDomains(Int32Array &sub_domains) const override
List of communicating sub-domains for the entities.
void reduceFromGhostItems(IVariable *v, IDataOperation *operation) override
Applies a reduction operation from ghost items.
ItemConnectivitySet m_target_item_connectivities
connectivite ou ItemFamily == SourceFamily
Definition ItemFamily.h:368
IItemFamily * parentFamily() const override
IItemFamily parent.
void setHasUniqueIdMap(bool v) override
Indicates whether the family has a conversion table from uniqueId to localId.
ItemInfoListView itemInfoListView() override
View on the entity information list.
static bool _cmpIVariablePtr(const IVariable *a, const IVariable *b)
Function to compare two variable names (strcmp).
void removeItems2(ItemDataList &item_data_list) override
Removes entities.
void setParentFamily(IItemFamily *parent) override
Positions the parent IItemFamily.
void compactItems(bool do_sort) override
Compresses the entities.
Integer nbItem() const override
Number of entities.
void notifyItemsUniqueIdChanged() override
Notifies that the unique IDs of the entities have been modified.
ItemVectorView view() override
View on all entities in the family.
void synchronize(VariableCollection variables) override
Synchronizes the variables variables.
ItemPairGroup findAdjacencyItems(const ItemGroup &group, const ItemGroup &sub_group, eItemKind link_kind, Integer layer) override
Searches for an adjacency list.
ItemInternalList itemsInternal() override
Internal array of entities.
void computeSynchronizeInfos() override
Constructs the structures necessary for synchronization.
void checkValidConnectivity() override
Verification of the validity of internal structures concerning connectivity.
void _updateItemsSharedFlag()
Positions Item::isShared() info for the entities of the family.
IVariable * findVariable(const String &name, bool throw_exception) override
Searches for the variable name name associated with this family.
void _readGroups()
Relit les groupes depuis une protection et les recréer si besoin.
Int32 maxLocalId() const override
void setItemSortFunction(IItemInternalSortFunction *sort_function) override
Positions the entity sorting function.
IItemInternalSortFunction * itemSortFunction() const override
Entity sorting function.
ISubDomain * subDomain() const override
Associated sub-domain.
virtual void _notifyEndUpdateFromMesh()
IVariableSynchronizer * allItemsSynchronizer() override
Synchronizer on all entities of the family.
void notifyItemsOwnerChanged() override
Notifies that the entities specific to the family's subdomain have been modified.
Integer parentFamilyDepth() const override
Gives the nesting depth of the current mesh.
ItemGroupCollection groups() const override
Collection of groups in this family.
IItemConnectivityMng * m_connectivity_mng
connectivite ou ItemFamily == TargetFamily
Definition ItemFamily.h:369
void _allocateInfosBulk(Int64ConstArrayView uids, ItemTypeInfo *type, Int32 owner, Int32ArrayView lids)
Allocates every item of uids at once.
IItemConnectivityInfo * localConnectivityInfos() const override
Information on local connectivity within the subdomain for this family.
IItemFamilyCollection childFamilies() override
Child families of this family.
void partialEndUpdateGroup(const ItemGroup &group) override
Updates a group.
IItemConnectivityInfo * globalConnectivityInfos() const override
Information on global connectivity across all subdomains.
void checkUniqueIds(Int64ConstArrayView unique_ids) override
Checks that the unique_ids are truly unique for all subdomains.
ItemGroup findGroup(const String &name) const override
Searches for a group.
void readFromDump() override
Reads data from a dump.
String name() const override
Family name.
Definition ItemFamily.h:140
Associative array of ItemInternal.
void remove(Int64 key)
Removes the value associated with the key key.
void eachItem(const Lambda &lambda)
Template function to iterate over the instance's entities.
bool add(Int64 key, ItemInternal *v)
Adds the value v corresponding to the key key.
Int32 count() const
Number of elements in the table.
Mesh info for a given entity type.
Temporary class to hold an ItemSharedInfo and an entity type.
VariableRefArrayT< Int32 > VariableArrayInt32
Array variable of 32-bit integer type.
VariableRefArrayT< Int64 > VariableArrayInt64
Array variable of 64-bit integer type.
VariableRefArrayT< Int16 > VariableArrayInt16
Array variable of 16-bit integer type.
VariableRefScalarT< String > VariableScalarString
Scalar variable of character string type.
VariableRefArrayT< Integer > VariableArrayInteger
Array variable of integer type.
VariableRefArrayT< String > VariableArrayString
Array variable of character string type.
ItemVariableScalarRefT< Int32 > VariableItemInt32
32-bit integer type quantity
VariableRefScalarT< Integer > VariableScalarInteger
Scalar variable of integer type.
bool isLess(const char *s1, const char *s2)
Returns true if s1 is less than (alphabetical order) s2 , false otherwise.
eReduceType
Supported reduction types.
@ ReduceMax
Maximum of values.
Ref< IVariableSynchronizer > createSynchronizerRef(IParallelMng *pm, IItemFamily *family)
Returns an interface to synchronize variables on the group of the family family.
double getMemoryUsed()
Memory used in bytes.
String getEnvironmentVariable(const String &name)
Environment variable named name.
ArrayView< Int64 > Int64ArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:445
bool arcaneIsCheck()
True if running in check mode.
Definition Misc.cc:66
UniqueArray< Int64 > Int64UniqueArray
Dynamic 1D array of 64-bit integers.
Definition UtilsTypes.h:333
Collection< ItemGroup > ItemGroupCollection
Collection of mesh item groups.
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.
Definition UtilsTypes.h:476
List< ItemGroup > ItemGroupList
Array of mesh item groups.
ArrayView< Integer > IntegerArrayView
C equivalent of a 1D array of integers.
Definition UtilsTypes.h:451
ConstArrayView< ItemInternal * > ItemInternalList
Type of the internal list of entities.
Definition ItemTypes.h:466
Collection< IItemFamily * > IItemFamilyCollection
Collection of item families.
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:474
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:447
eItemKind
Mesh entity type.
Array< Int32 > Int32Array
Dynamic one-dimensional array of 32-bit integers.
Definition UtilsTypes.h:121
std::int32_t Int32
Signed integer type of 32 bits.