Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ItemPairGroup.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/* ItemPairGroup.h (C) 2000-2025 */
9/* */
10/* Table of entity lists. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ITEMPAIRGROUP_H
13#define ARCANE_CORE_ITEMPAIRGROUP_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/AutoRef.h"
18#include "arcane/utils/Iterator.h"
19#include "arcane/utils/IFunctorWithArgument.h"
20
21#include "arcane/core/ItemPairGroupImpl.h"
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane
28{
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33//NOTE: The complete documentation is in ItemPairGroup.cc
34
38class ARCANE_CORE_EXPORT ItemPairGroup
39{
40 public:
41
47
48 public:
49
53 explicit ItemPairGroup(ItemPairGroupImpl* prv);
58 ItemPairGroup(const ItemGroup& group, const ItemGroup& sub_item_group,
59 eItemKind link_kind);
61 ItemPairGroup(const ItemGroup& group, const ItemGroup& sub_item_group,
62 CustomFunctor* functor);
65 : m_impl(from.m_impl)
66 {}
67
68 const ItemPairGroup& operator=(const ItemPairGroup& from)
69 {
70 m_impl = from.m_impl;
71 return (*this);
72 }
73 virtual ~ItemPairGroup() = default;
74
75 public:
76
78 inline bool null() const { return m_impl->null(); }
80 inline eItemKind itemKind() const { return m_impl->itemKind(); }
82 inline eItemKind subItemKind() const { return m_impl->subItemKind(); }
83
84 public:
85
92 ItemPairGroupImpl* internal() const { return m_impl.get(); }
93
95 IItemFamily* itemFamily() const { return m_impl->itemFamily(); }
96
98 IItemFamily* subItemFamily() const { return m_impl->subItemFamily(); }
99
101 IMesh* mesh() const { return m_impl->mesh(); }
102
104 const ItemGroup& itemGroup() const { return m_impl->itemGroup(); }
105
107 const ItemGroup& subItemGroup() const { return m_impl->subItemGroup(); }
108
109 public:
110
113 void invalidate(bool force_recompute = false)
114 {
115 m_impl->invalidate(force_recompute);
116 }
117
119 void checkValid() { m_impl->checkValid(); }
120
121 public:
122
123 ItemPairEnumerator enumerator() const;
124
125 protected:
126
129
130 protected:
131
134 {
135 return (impl->itemKind() == ik && impl->subItemKind() == aik) ? impl : ItemPairGroupImpl::checkSharedNull();
136 }
137};
138
139/*---------------------------------------------------------------------------*/
140/*---------------------------------------------------------------------------*/
141
147inline bool
148operator==(const ItemPairGroup& g1, const ItemPairGroup& g2)
149{
150 return g1.internal() == g2.internal();
151}
152
158inline bool
159operator!=(const ItemPairGroup& g1, const ItemPairGroup& g2)
160{
161 return g1.internal() != g2.internal();
162}
163
164/*---------------------------------------------------------------------------*/
165/*---------------------------------------------------------------------------*/
166
170template <typename ItemKind, typename SubItemKind>
171class ItemPairGroupT
172: public ItemPairGroup
173{
174 public:
175
177 typedef ItemPairGroupT<ItemKind, SubItemKind> ThatClass;
180 typedef ItemTraitsT<SubItemKind> SubTraitsType;
181
182 typedef typename TraitsType::ItemType ItemType;
183 typedef typename TraitsType::ItemGroupType ItemGroupType;
184 typedef typename SubTraitsType::ItemType SubItemType;
185 typedef typename SubTraitsType::ItemGroupType SubItemGroupType;
186
187 public:
188
189 ItemPairGroupT() {}
190 ItemPairGroupT(const ItemPairGroup& from)
191 : ItemPairGroup(_check(from.internal(), TraitsType::kind(), SubTraitsType::kind()))
192 {}
193 ItemPairGroupT(const ThatClass& from)
194 : ItemPairGroup(from)
195 {}
196 ItemPairGroupT(const ItemGroupType& group, const SubItemGroupType& sub_group,
197 eItemKind link_kind)
198 : ItemPairGroup(group, sub_group, link_kind)
199 {}
200 ItemPairGroupT(const ItemGroupType& group, const SubItemGroupType& sub_group,
201 CustomFunctor* functor)
202 : ItemPairGroup(group, sub_group, functor)
203 {}
204 ~ItemPairGroupT() {}
205
206 public:
207
208 const ThatClass& operator=(const ThatClass& from)
209 {
210 m_impl = from.internal();
211 return (*this);
212 }
213 const ThatClass& operator=(const ItemPairGroup& from)
214 {
215 _assign(from);
216 return (*this);
217 }
218
219 protected:
220
221 void _assign(const ItemPairGroup& from)
222 {
223 m_impl = _check(from.internal(), TraitsType::kind(), SubTraitsType::kind());
224 }
225};
226
227/*---------------------------------------------------------------------------*/
228/*---------------------------------------------------------------------------*/
229
230} // namespace Arcane
231
232/*---------------------------------------------------------------------------*/
233/*---------------------------------------------------------------------------*/
234
235#endif
Declarations of types on entities.
Encapsulation of a pointer with a reference counter.
Definition AutoRef.h:43
Interface of a functor with an argument but without a return value.
Interface of an entity family.
Definition IItemFamily.h:83
Mesh entity group.
Definition ItemGroup.h:51
Enumerator over an array of arrays of mesh entities.
Implementation of an array of lists of entities.
Reference to a group of a given kind.
ItemTraitsT< ItemKind > TraitsType
Type of the class containing the entity characteristics.
ItemPairGroupT< ItemKind, SubItemKind > ThatClass
Type of this class.
Wrapper for an ItemPairGroup::CustomFunctor.
Table of entity lists.
IFunctorWithArgumentT< ItemPairGroupBuilder & > CustomFunctor
Functor for custom connectivity calculation.
eItemKind itemKind() const
Type of entities in the group.
const ItemGroup & itemGroup() const
Initial item group.
IItemFamily * itemFamily() const
Entity family to which this group belongs (0 for a null list).
eItemKind subItemKind() const
Type of sub-entities in the group.
ItemPairGroup(const ItemPairGroup &from)
Copy constructor.
static ItemPairGroupImpl * _check(ItemPairGroupImpl *impl, eItemKind ik, eItemKind aik)
Returns the group impl if it is of kind kt, the null group otherwise.
void checkValid()
Internal check of group validity.
void invalidate(bool force_recompute=false)
Invalidates the list.
IItemFamily * subItemFamily() const
Entity family to which this group belongs (0 for a null list).
ItemPairGroup()
Constructs an empty table.
AutoRefT< ItemPairGroupImpl > m_impl
Internal representation of the group.
const ItemGroup & subItemGroup() const
Final item group (after bounce).
ItemPairGroupImpl * internal() const
Returns the group implementation.
bool null() const
true means the group is the null group
IMesh * mesh() const
Mesh to which this list belongs (0 for a null list).
Characteristics of mesh elements.
Definition ItemTypes.h:625
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
eItemKind
Mesh entity type.