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();
346unguardedIndexes()
const
348 return m_p->m_indexes;
354Array<Int32>& ItemPairGroupImpl::
355unguardedLocalIds()
const
357 return m_p->m_sub_items_local_id;
367 return m_p->m_indexes;
377 return m_p->m_sub_items_local_id;
383void ItemPairGroupImpl::
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.
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.
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).
void addRef() override
Increments the reference counter.
const ItemGroup & subItemGroup() const
Group of sub-entities.
void invalidate(bool force_recompute)
Invalidates the group.
bool null() const
Returns true if the group is null.
virtual void deleteMe()=0
Destroys the referenced object.
void addRef() override
Increments the reference counter.
void removeRef() override
Decrements the reference counter.
View of an array of elements of type T.
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.