Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ItemGroupImpl.h
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/* ItemGroupImpl.h (C) 2000-2025 */
9/* */
10/* Implementation of a mesh entity group. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_ITEMGROUPIMPL_H
13#define ARCANE_ITEMGROUPIMPL_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18#include "arcane/core/SharedReference.h"
19#include "arcane/utils/SharedPtr.h"
20
21#include "arcane/core/GroupIndexTable.h"
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane
27{
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31// Macro to detect design changes in ItemGroupImpl
32#define ITEMGROUP_USE_OBSERVERS
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
38class IObservable;
40class IMesh;
43class GroupIndexTable;
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
49
72class ARCANE_CORE_EXPORT ItemGroupImpl
73: public SharedReference
74{
75 private:
76
77 friend class ItemGroupSubPartsByType;
78 friend ItemGroup;
79 class ItemSorter;
80
81 public:
82
85
89 ItemGroupImpl(IItemFamily* family, const String& name);
90
96
97 virtual ~ItemGroupImpl();
98
99 private:
100
101 static ItemGroupImpl* shared_null;
102
103 public:
104
105 static ItemGroupImpl* checkSharedNull();
106
107 public:
108
109 virtual ISharedReference& sharedReference() { return *this; }
110
111 public:
112
114 const String& name() const;
115
117 const String& fullName() const;
118
120 virtual Integer nbRef() const { return refCount(); }
121
123 ItemGroupImpl* parent() const;
124
126 bool null() const;
127
129 bool isOwn() const;
130
132 void setOwn(bool v);
133
135 ItemGroupImpl* ownGroup();
136
138 ItemGroupImpl* ghostGroup();
139
140 // Items in the group lying on the boundary between two subdomains
141 // Implemented for faces only
142 ItemGroupImpl* interfaceGroup();
143
145 ItemGroupImpl* nodeGroup();
146
148 ItemGroupImpl* edgeGroup();
149
151 ItemGroupImpl* faceGroup();
152
154 ItemGroupImpl* cellGroup();
155
157
158 ItemGroupImpl* createSubGroup(const String& suffix, IItemFamily* family, ItemGroupComputeFunctor* functor);
159
161
162 ItemGroupImpl* findSubGroup(const String& suffix);
163
170 ItemGroupImpl* innerFaceGroup();
171
178 ItemGroupImpl* outerFaceGroup();
179
181
186 ItemGroupImpl* activeCellGroup();
187
191 ItemGroupImpl* ownActiveCellGroup();
192
198 ItemGroupImpl* levelCellGroup(const Integer& level);
199
203 ItemGroupImpl* ownLevelCellGroup(const Integer& level);
204
212 ItemGroupImpl* activeFaceGroup();
213
221 ItemGroupImpl* ownActiveFaceGroup();
222
229 ItemGroupImpl* innerActiveFaceGroup();
230
238 ItemGroupImpl* outerActiveFaceGroup();
239
241
243 bool isLocalToSubDomain() const;
244
246 void setLocalToSubDomain(bool v);
247
249 IMesh* mesh() const;
250
252 eItemKind itemKind() const;
253
255 IItemFamily* itemFamily() const;
256
258 Integer size() const;
259
261 bool empty() const;
262
264 void clear();
265
267 ItemGroup parentGroup();
268
275 void invalidate(bool force_recompute);
276
281 void addItems(Int32ConstArrayView items_local_id, bool check_if_present);
282
284 void setItems(Int32ConstArrayView items_local_id);
285
287 void setItems(Int32ConstArrayView items_local_id, bool do_sort);
288
290 void removeItems(Int32ConstArrayView items_local_id, bool check_if_present);
291
293 void removeAddItems(Int32ConstArrayView removed_local_id,
294 Int32ConstArrayView added_local_id,
295 bool check_if_present);
296
300 void removeSuppressedItems();
301
303 void checkValid();
304
312 bool checkNeedUpdate();
313
315 Int32ConstArrayView itemsLocalId() const;
316
324 void beginTransaction();
325
327 void endTransaction();
328
329 ARCANE_DEPRECATED_REASON("Y2022: Use itemInfoListView() instead")
331 ItemInternalList itemsInternal() const;
332
334 ItemInfoListView itemInfoListView() const;
335
341 void setIsAllItems();
342
344 bool isAllItems() const;
345
347 void changeIds(Int32ConstArrayView old_to_new_ids);
348
350 void applyOperation(IItemOperationByBasicType* operation);
351
353 bool needSynchronization() const;
354
356 Int64 timestamp() const;
357
364 void attachObserver(const void* ref, IItemGroupObserver* obs);
365
371 void detachObserver(const void* ref);
372
381 bool hasInfoObserver() const;
382
384 void setComputeFunctor(IFunctor* functor);
385
387 bool hasComputeFunctor() const;
388
396 void destroy();
397
399 SharedPtrT<GroupIndexTable> localIdToIndex();
400
402 IVariableSynchronizer* synchronizer();
403
405 bool hasSynchronizer();
406
410 bool checkIsSorted() const;
411
413 bool isContigousLocalIds() const { return isContiguousLocalIds(); }
414
416 bool isContiguousLocalIds() const;
417
420
426 void checkLocalIdsAreContiguous() const;
427
438 void shrinkMemory();
439
441 Int64 capacity() const;
442
444 ItemGroupImplInternal* _internalApi() const;
445
446 public:
447
454 ARCANE_DEPRECATED_REASON("Y2024: This method is internal to Arcane")
455 Int32Array& unguardedItemsLocalId(const bool self_invalidate = true);
456
457 public:
458
460 static void _buildSharedNull();
462 static void _destroySharedNull();
463
464 private:
465
467 void _computeChildrenByType();
469 void _executeExtend(const Int32ConstArrayView* info);
471 void _executeReduce(const Int32ConstArrayView* info);
473 void _executeCompact(const Int32ConstArrayView* info);
477 void _executeInvalidate();
479 void _updateNeedInfoFlag(const bool flag);
481
482 void _forceInvalidate(const bool self_invalidate);
483
484 void _checkUpdateSimdPadding();
486 virtual void deleteMe();
487
488 private:
489
491
492 private:
493
495 void _removeItems(SmallSpan<const Int32> items_local_id);
496 bool _checkNeedUpdateNoPadding();
497 bool _checkNeedUpdateWithPadding();
498 bool _checkNeedUpdate(bool do_padding);
499};
500
501/*---------------------------------------------------------------------------*/
502/*---------------------------------------------------------------------------*/
503
504} // End namespace Arcane
505
506/*---------------------------------------------------------------------------*/
507/*---------------------------------------------------------------------------*/
508
509#endif
Declarations of types on entities.
Base class of a hash table between group items and their positions in the table.
Interface of an entity family.
Definition IItemFamily.h:83
Interface of an operator on entities sorted by type.
Interface of a reference counter.
Interface of a variable synchronization service.
Functor for calculating elements of a group.
Internal API of ItemGroupImpl in Arcane.
Brief: Implementation of a mesh entity group.
virtual Integer nbRef() const
Number of references on the group.
void _executeReorder(const Int32ConstArrayView *info)
Sub-group invalidation.
ItemGroupImpl * parent() const
Parent group (0 if none).
void checkLocalIdsAreContiguous() const
Checks if the group entities have contiguous localIds().
const String & fullName() const
Full group name (with mesh + family).
void _updateNeedInfoFlag(const bool flag)
Forced update of the restructuring information flag.
void _executeInvalidate()
Sub-group invalidation.
virtual void deleteMe()
Notification from SharedReference indicating that the instance must be destroyed.
void checkLocalIdsAreContigous() const
bool isContiguousLocalIds() const
Indicates if the group entities have contiguous localIds().
bool isContigousLocalIds() const
void _removeItems(SmallSpan< const Int32 > items_local_id)
Removes the entities items_local_id from the group.
ItemGroupImpl()
Constructs a null group.
void _forceInvalidate(const bool self_invalidate)
Recursive forced invalidation.
ItemGroupInternal * m_p
Group implementation.
const String & name() const
Group name.
Implementation of the ItemGroupImpl class.
Mesh entity group.
Definition ItemGroup.h:51
View of a list to obtain information about entities.
Implementation of an array of lists of entities.
Int32 refCount() const override
Returns the value of the reference counter.
View of an array of elements of type T.
Definition Span.h:805
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
ConstArrayView< ItemInternal * > ItemInternalList
Type of the internal list of entities.
Definition ItemTypes.h:466
eItemKind
Mesh entity type.
Array< Int32 > Int32Array
Dynamic one-dimensional array of 32-bit integers.
Definition UtilsTypes.h:127
std::int32_t Int32
Signed integer type of 32 bits.