14#include "arcane/utils/ArcanePrecomp.h"
16#include "arcane/utils/Array.h"
17#include "arcane/utils/IFunctor.h"
19#include "arcane/core/ItemGroupObserver.h"
20#include "arcane/core/ItemPairGroupImpl.h"
21#include "arcane/core/ItemPairGroup.h"
22#include "arcane/core/IItemFamily.h"
23#include "arcane/core/ItemGroup.h"
24#include "arcane/core/IMesh.h"
39class ItemPairGroupImplNull
40:
public ItemPairGroupImpl
44 ItemPairGroupImplNull()
58class ItemPairGroupImplPrivate
62 ItemPairGroupImplPrivate();
64 ~ItemPairGroupImplPrivate();
68 inline bool null()
const {
return m_is_null; }
71 inline eItemKind subKind()
const {
return m_sub_kind; }
101ItemPairGroupImplPrivate::
102ItemPairGroupImplPrivate()
104, m_item_family(nullptr)
105, m_sub_item_family(nullptr)
109, m_need_recompute(false)
110, m_compute_functor(nullptr)
118ItemPairGroupImplPrivate::
120: m_mesh(group.
mesh())
121, m_item_family(group.itemFamily())
122, m_sub_item_family(sub_group.itemFamily())
124, m_sub_item_group(sub_group)
126, m_kind(group.itemKind())
127, m_sub_kind(sub_group.itemKind())
128, m_need_recompute(false)
129, m_compute_functor(nullptr)
137ItemPairGroupImplPrivate::
138~ItemPairGroupImplPrivate()
140 delete m_compute_functor;
146void ItemPairGroupImplPrivate::
169 shared_null =
new ItemPairGroupImplNull();
170 shared_null->addRef();
182 m_p->m_item_group.internal()->attachObserver(
this,
newItemGroupObserverT(m_p, &ItemPairGroupImplPrivate::invalidate));
183 m_p->m_sub_item_group.internal()->attachObserver(
this,
newItemGroupObserverT(m_p, &ItemPairGroupImplPrivate::invalidate));
201 m_p->m_item_group.internal()->detachObserver(
this);
202 m_p->m_sub_item_group.internal()->detachObserver(
this);
251 return m_p->m_item_family;
260 return m_p->m_sub_item_family;
287 return m_p->subKind();
296 return m_p->m_item_group;
305 return m_p->m_sub_item_group;
322 m_p->m_need_recompute =
true;
333 if (
m_p->m_need_recompute) {
334 m_p->m_need_recompute =
false;
335 if (
m_p->m_compute_functor)
336 m_p->m_compute_functor->executeFunctor();
348 return m_p->m_indexes;
357 return m_p->m_sub_items_local_id;
367 return m_p->m_indexes;
373Span<const Int32> ItemPairGroupImpl::
377 return m_p->m_sub_items_local_id;
386 delete m_p->m_compute_functor;
387 m_p->m_compute_functor = functor;
Modifiable view of an array of type T.
Base class for 1D data vectors.
Interface of an entity family.
virtual ~ItemPairGroupImplNull()
Frees resources.
eItemKind m_kind
Kind of entities in the group.
bool m_need_recompute
True if the group must be recalculated.
IItemFamily * m_item_family
Associated family.
IItemFamily * m_sub_item_family
Associated family.
IMesh * m_mesh
Associated group manager.
bool m_is_null
True if the group is null.
Implementation of an array of lists of entities.
ItemPairGroupImplPrivate * m_p
Group implementation.
IMesh * mesh() const
Mesh to which the group belongs (0 for the null group).
eItemKind subItemKind() const
Group kind. This is the kind of its elements.
const ItemGroup & itemGroup() const
Group of entities.
bool checkNeedUpdate()
Updates the group if necessary.
void checkValid()
Checks that the group is valid.
~ItemPairGroupImpl() override
Releases resources.
eItemKind itemKind() const
Group kind. This is the kind of its elements.
Array< Int32 > & unguardedLocalIds() const
IItemFamily * subItemFamily() const
Family to which the group belongs (or 0 if none).
void removeRef() override
Decrements the reference counter.
IItemFamily * itemFamily() const
Family to which the group belongs (or 0 if none).
Array< Int64 > & unguardedIndexes() const
void addRef() override
Increments the reference counter.
const ItemGroup & subItemGroup() const
Group of sub-entities.
void invalidate(bool force_recompute)
Invalidates the group.
void setComputeFunctor(IFunctor *functor)
bool null() const
Returns true if the group is null.
void addRef() override
Increments the reference counter.
void removeRef() override
Decrements the reference counter.
1D data vector with value semantics (STL style).
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
eItemKind
Mesh entity type.
@ IK_Unknown
Unknown or uninitialized mesh entity.
IItemGroupObserver * newItemGroupObserverT(T *object, typename IItemGroupObserver::FuncTraits< T >::FuncPtr funcptr)
Utility for simplified creation of ItemGroupObserverT.