Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ItemInfoListView.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/* ItemInfoListView.h (C) 2000-2024 */
9/* */
10/* View of a list to obtain information about entities. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_ITEMINFOLISTVIEW_H
13#define ARCANE_ITEMINFOLISTVIEW_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/ItemGenericInfoListView.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28/*!
29 * \brief View of a list to obtain information about entities.
30 *
31 * Like all views, these instances are temporary and should not be
32 * kept between two modifications of the associated family.
33 *
34 * The methods of this class are only valid if the instance has been initialized
35 * with a non-null family (IItemFamily).
36 *
37 * Via this class, it is possible to retrieve an Item instance from
38 * an ItemLocalId.
39 */
40class ARCANE_CORE_EXPORT ItemInfoListView
41: public ItemGenericInfoListView
42{
43 using BaseClass = ItemGenericInfoListView;
44 friend class mesh::ItemFamily;
45 friend ItemVector;
46 friend ItemPairEnumerator;
47 friend ItemGenericInfoListView;
48 template <int Extent> friend class ItemConnectedListView;
49 template <typename ItemType> friend class ItemEnumeratorBaseT;
50
51 // To be deleted when we no longer need _itemsInternal()
52 friend ItemVectorView;
53
54 public:
55
56 ItemInfoListView() = default;
57
58 /*!
59 * \brief Constructs a view associated with the family \a family.
60 *
61 * \a family may be \a nullptr in which case the instance is not
62 * usable for retrieving entity information
63 */
64 explicit ItemInfoListView(IItemFamily* family);
65
66 public:
67
68 //! Associated family
69 IItemFamily* itemFamily() const { return m_item_shared_info->itemFamily(); }
70
71 // NOTE: The definitions of the two operator[] methods are in Item.h
72
73 //! Entity associated with local ID \a local_id
74 inline Item operator[](ItemLocalId local_id) const;
75
76 //! Entity associated with local ID \a local_id
77 inline Item operator[](Int32 local_id) const;
78
79 private:
80
81 // Only ItemFamily can create instances via this constructor
82 explicit ItemInfoListView(ItemSharedInfo* shared_info)
83 : ItemGenericInfoListView(shared_info)
84 {}
85
86 protected:
87
88 using BaseClass::m_flags;
89 using BaseClass::m_item_shared_info;
90 void _checkValid(eItemKind expected_kind);
91};
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
96/*!
97 * \brief Base class for specialized views of entity information.
98 */
99template <typename ItemType>
100class ItemInfoListViewT
101: public ItemInfoListView
102{
103 public:
104
105 ItemInfoListViewT() = default;
106
107 //! Constructs a view associated with the family \a family.
109 : ItemInfoListView(family)
110 {
112 }
113
114 public:
115
116 // NOTE: The definitions of the two operator[] methods are in Item.h
117
118 //! Entity associated with local ID \a local_id
119 inline ItemType operator[](ItemLocalId local_id) const;
120
121 //! Entity associated with local ID \a local_id
122 inline ItemType operator[](Int32 local_id) const;
123};
124
125/*---------------------------------------------------------------------------*/
126/*---------------------------------------------------------------------------*/
127
128/*!
129 * \brief View of node information.
130 */
131class NodeInfoListView
132: public ItemInfoListViewT<Node>
133{
134 public:
135
136 using BaseClass = ItemInfoListViewT<Node>;
137
138 public:
139
140 NodeInfoListView() = default;
141
142 //! Constructs a view associated with the family \a family.
144 : BaseClass(family)
145 {}
146};
147
148/*---------------------------------------------------------------------------*/
149/*---------------------------------------------------------------------------*/
150
151/*!
152 * \brief View of edge information.
153 */
154class EdgeInfoListView
155: public ItemInfoListViewT<Edge>
156{
157 public:
158
159 using BaseClass = ItemInfoListViewT<Edge>;
160
161 public:
162
163 EdgeInfoListView() = default;
164
165 //! Constructs a view associated with the family \a family.
167 : BaseClass(family)
168 {}
169};
170
171/*---------------------------------------------------------------------------*/
172/*---------------------------------------------------------------------------*/
173
174/*!
175 * \brief View of face information.
176 */
177class FaceInfoListView
178: public ItemInfoListViewT<Face>
179{
180 public:
181
182 using BaseClass = ItemInfoListViewT<Face>;
183
184 public:
185
186 FaceInfoListView() = default;
187
188 //! Constructs a view associated with the family \a family.
190 : BaseClass(family)
191 {}
192
193 public:
194
195 constexpr ARCCORE_HOST_DEVICE bool isSubDomainBoundary(FaceLocalId local_id) const
196 {
197 return ItemFlags::isSubDomainBoundary(m_flags[local_id]);
198 }
199 constexpr ARCCORE_HOST_DEVICE bool isSubDomainBoundaryOutside(FaceLocalId local_id) const
200 {
201 return ItemFlags::isSubDomainBoundaryOutside(m_flags[local_id]);
202 }
203 constexpr ARCCORE_HOST_DEVICE Int32 backCellIndex(FaceLocalId local_id) const
204 {
205 return ItemFlags::backCellIndex(m_flags[local_id]);
206 }
207 constexpr ARCCORE_HOST_DEVICE Int32 frontCellIndex(FaceLocalId local_id) const
208 {
209 return ItemFlags::frontCellIndex(m_flags[local_id]);
210 }
211};
212
213/*---------------------------------------------------------------------------*/
214/*---------------------------------------------------------------------------*/
215
216/*!
217 * \brief View of cell information.
218 */
219class CellInfoListView
220: public ItemInfoListViewT<Cell>
221{
222 public:
223
224 using BaseClass = ItemInfoListViewT<Cell>;
225
226 public:
227
228 CellInfoListView() = default;
229
230 //! Constructs a view associated with the family \a family.
232 : BaseClass(family)
233 {}
234};
235
236/*---------------------------------------------------------------------------*/
237/*---------------------------------------------------------------------------*/
238
239/*!
240 * \brief View of particle information.
241 */
242class ParticleInfoListView
243: public ItemInfoListViewT<Particle>
244{
245 public:
246
247 using BaseClass = ItemInfoListViewT<Particle>;
248
249 public:
250
251 ParticleInfoListView() = default;
252
253 //! Constructs a view associated with the family \a family.
255 : BaseClass(family)
256 {}
257};
258
259/*---------------------------------------------------------------------------*/
260/*---------------------------------------------------------------------------*/
261
262/*!
263 * \brief View of DoF information.
264 */
265class DoFInfoListView
266: public ItemInfoListViewT<DoF>
267{
268 public:
269
270 using BaseClass = ItemInfoListViewT<DoF>;
271
272 public:
273
274 DoFInfoListView() = default;
275
276 //! Constructs a view associated with the family \a family.
277 explicit DoFInfoListView(IItemFamily* family)
278 : BaseClass(family)
279 {}
280};
281
282/*---------------------------------------------------------------------------*/
283/*---------------------------------------------------------------------------*/
284
285} // End namespace Arcane
286
287/*---------------------------------------------------------------------------*/
288/*---------------------------------------------------------------------------*/
289
290#endif
CellInfoListView(IItemFamily *family)
Constructs a view associated with the family family.
DoFInfoListView(IItemFamily *family)
Constructs a view associated with the family family.
EdgeInfoListView(IItemFamily *family)
Constructs a view associated with the family family.
FaceInfoListView(IItemFamily *family)
Constructs a view associated with the family family.
Interface of an entity family.
Definition IItemFamily.h:83
static constexpr Int32 backCellIndex(FlagType f)
Index in the face for the back cell.
Definition ItemFlags.h:120
static constexpr Int32 frontCellIndex(FlagType f)
Index in the face for the front cell.
Definition ItemFlags.h:136
View of the generic information of an entity family.
ItemInfoListViewT(IItemFamily *family)
Constructs a view associated with the family family.
ItemType operator[](Int32 local_id) const
Entity associated with local ID local_id.
Definition Item.h:1896
ItemType operator[](ItemLocalId local_id) const
Entity associated with local ID local_id.
Definition Item.h:1887
View of a list to obtain information about entities.
IItemFamily * itemFamily() const
Associated family.
void _checkValid(eItemKind expected_kind)
Checks that the entity kind matches the expected one.
Index of an Item in a variable.
Definition ItemLocalId.h:42
static eItemKind kind()
Entity kind.
Definition ItemTypes.h:629
Base class for a mesh element.
Definition Item.h:84
NodeInfoListView(IItemFamily *family)
Constructs a view associated with the family family.
ParticleInfoListView(IItemFamily *family)
Constructs a view associated with the family family.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int32_t Int32
Signed integer type of 32 bits.