Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ItemSharedInfo.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/* ItemSharedInfo.h (C) 2000-2025 */
9/* */
10/* Common information for multiple entities. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ITEMSHAREDINFO_H
13#define ARCANE_CORE_ITEMSHAREDINFO_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
19#include "arcane/core/ItemTypeInfo.h"
20#include "arcane/core/MeshItemInternalList.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane::mesh
26{
27class ItemFamily;
30} // namespace Arcane::mesh
31
32namespace Arcane
33{
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
38class ItemInternal;
41
42/*---------------------------------------------------------------------------*/
43/*---------------------------------------------------------------------------*/
44
55class ARCANE_CORE_EXPORT ItemSharedInfo
56{
57 friend class ItemBase;
58 friend class MutableItemBase;
59 friend class Item;
60 friend class ItemGenericInfoListView;
61 friend class ItemInternal;
62 friend class ItemInfoListView;
63 friend class mesh::ItemFamily;
64 friend class mesh::DynamicMeshKindInfos;
66 friend class ItemInternalVectorView;
67 friend class ItemVectorViewConstIterator;
68 friend class ItemConnectedListViewConstIterator;
69 friend class ItemVectorView;
70 friend class ItemEnumeratorBase;
71 friend class ItemInternalCompatibility;
72 friend class SimdItemBase;
73 friend class SimdItemEnumeratorBase;
74 template <int Extent> friend class ItemConnectedListView;
75
76 public:
77
78 static const Int32 NULL_INDEX = static_cast<Int32>(-1);
79
80 public:
81
82 // TODO: Make private. Access must now go through nullInstance()
84 static ItemSharedInfo nullItemSharedInfo;
85
86 private:
87
88 static ItemSharedInfo* nullItemSharedInfoPointer;
89
90 public:
91
92 static ItemSharedInfo* nullInstance() { return nullItemSharedInfoPointer; }
93
94 public:
95
97
98 private:
99
100 // Only ItemFamily can create instances of this class other than the null instance.
102 ItemInternalConnectivityList* connectivity);
103
104 public:
105
106 eItemKind itemKind() const { return m_item_kind; }
107 IItemFamily* itemFamily() const { return m_item_family; }
108 Int32 nbParent() const { return m_nb_parent; }
109 ItemTypeInfo* typeInfoFromId(Int32 type_id) const;
110
111 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
112 constexpr Int32 nbNode() const { return 0; }
113 ARCANE_DEPRECATED_REASON("Y2020: This method always return 0")
114 constexpr Int32 nbEdge() const { return 0; }
115 ARCANE_DEPRECATED_REASON("Y2020: This method always return 0")
116 constexpr Int32 nbFace() const { return 0; }
117 ARCANE_DEPRECATED_REASON("Y2020: This method always return 0")
118 constexpr Int32 nbCell() const { return 0; }
119 ARCANE_DEPRECATED_REASON("Y2020: This method always return 0")
120 constexpr Int32 nbHParent() const { return 0; }
121 ARCANE_DEPRECATED_REASON("Y2020: This method always return 0")
122 constexpr Int32 nbHChildren() const { return 0; }
123
124 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception. Use ItemInternal::typeId() instead")
125 Int32 typeId() const;
126
127 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
128 Int32 firstNode() const { return 0; }
129 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
130 Int32 firstEdge() const { return 0; }
131 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
132 Int32 firstFace() const { return 0; }
133 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
134 Int32 firstCell() const { return 0; }
135 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
136 Int32 firstParent() const { return 0; }
137 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
138 Int32 firstHParent() const { return 0; }
139 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
140 Int32 firstHChild() const { return 0; }
141
142 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
143 constexpr Int32 neededMemory() const { return 0; }
144 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
145 constexpr Int32 minimumNeededMemory() const { return 0; }
146 ARCCORE_DEPRECATED_2021("This method always return 'false'")
147 constexpr bool hasLegacyConnectivity() const { return false; }
148
149 void updateMeshItemInternalList();
150
151 public:
152
153 void print(std::ostream& o) const;
154
155 public:
156
157 ARCANE_DEPRECATED_REASON("Y2022: This list is always empty")
158 ItemInternalVectorView nodes(Int32) const;
159
160 ARCANE_DEPRECATED_REASON("Y2020: This list is always empty")
161 ItemInternalVectorView edges(Int32) const;
162
163 ARCANE_DEPRECATED_REASON("Y2020: This list is always empty")
164 ItemInternalVectorView faces(Int32) const;
165
166 ARCANE_DEPRECATED_REASON("Y2020: This list is always empty")
167 ItemInternalVectorView cells(Int32) const;
168
169 ARCANE_DEPRECATED_REASON("Y2020: This list is always empty")
170 ItemInternalVectorView hChildren(Int32) const;
171
172 public:
173
174 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception. Use _parentV2() instead")
175 ItemInternal* parent(Integer, Integer) const;
176
177 private:
178
179 ItemInternal* _parentV2(Int32 local_id, [[maybe_unused]] Integer aindex) const
180 {
181 // Currently only one parent is supported, so \a aindex must be 0.
182 ARCANE_ASSERT((aindex == 0), ("Only one parent access implemented"));
183 return _parent(m_parent_item_ids[local_id]);
184 }
185 Int32 _parentLocalIdV2(Int32 local_id, [[maybe_unused]] Integer aindex) const
186 {
187 // Currently only one parent is supported, so \a aindex must be 0.
188 ARCANE_ASSERT((aindex == 0), ("Only one parent access implemented"));
189 return m_parent_item_ids[local_id];
190 }
191 void _setParentV2(Int32 local_id, Integer aindex, Int32 parent_local_id);
192 Int32* _parentPtr(Int32 local_id);
193
194 public:
195
196 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'nullptr'")
197 ItemInternal* node(Int32, Int32) const { return nullptr; }
198 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'nullptr'")
199 ItemInternal* edge(Int32, Int32) const { return nullptr; }
200 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'nullptr'")
201 ItemInternal* face(Int32, Int32) const { return nullptr; }
202 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'nullptr'")
203 ItemInternal* cell(Int32, Int32) const { return nullptr; }
204 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'nullptr'")
205 ItemInternal* hParent(Integer, Integer) const { return nullptr; }
206 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'nullptr'")
207 ItemInternal* hChild(Int32, Int32) const { return nullptr; }
208
209 public:
210
211 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'NULL_ITEM_LOCAL_ID'")
212 Int32 nodeLocalId(Int32, Int32) const { return NULL_ITEM_LOCAL_ID; }
213 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'NULL_ITEM_LOCAL_ID'")
214 Int32 edgeLocalId(Int32, Int32) const { return NULL_ITEM_LOCAL_ID; }
215 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'NULL_ITEM_LOCAL_ID'")
216 Int32 faceLocalId(Int32, Int32) const { return NULL_ITEM_LOCAL_ID; }
217 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'NULL_ITEM_LOCAL_ID'")
218 Int32 cellLocalId(Int32, Int32) const { return NULL_ITEM_LOCAL_ID; }
219 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'NULL_ITEM_LOCAL_ID'")
220 Integer parentLocalId(Integer, Integer) const { return NULL_ITEM_LOCAL_ID; }
221 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'NULL_ITEM_LOCAL_ID'")
222 Int32 hParentLocalId(Integer, Integer) const { return NULL_ITEM_LOCAL_ID; }
223 ARCANE_DEPRECATED_REASON("Y2020: This method always return 'NULL_ITEM_LOCAL_ID'")
224 Int32 hChildLocalId(Integer, Integer) const { return NULL_ITEM_LOCAL_ID; }
225
226 public:
227
228 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception.")
229 void setNode(Int32, Int32, Int32) const;
230 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception.")
231 void setEdge(Int32, Int32, Int32) const;
232 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception.")
233 void setFace(Int32, Int32, Int32) const;
234 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception.")
235 void setCell(Int32, Int32, Int32) const;
236 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception.")
237 void setHParent(Int32, Int32, Int32) const;
238 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception.")
239 void setHChild(Int32, Int32, Int32) const;
240
241 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception. Use _setParentV2() instead")
242 void setParent(Integer, Integer, Integer) const;
243
244 public:
245
246 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
247 constexpr Int32 edgeAllocated() const { return 0; }
248 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
249 constexpr Int32 faceAllocated() const { return 0; }
250 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
251 constexpr Int32 cellAllocated() const { return 0; }
252 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
253 constexpr Int32 hParentAllocated() const { return 0; }
254 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
255 constexpr Int32 hChildAllocated() const { return 0; }
256
257 public:
258
259 ARCANE_DEPRECATED_REASON("Y2022: This method always returns 'nullptr'")
260 const Int32* _infos() const { return nullptr; }
261 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception.")
262 void _setInfos(Int32* ptr);
263
264 private:
265
266 // ATTENTION:
267 // Any modification to the list or the type of fields must be
268 // reported in the C# wrapper (tools/wrapper/core/csharp) and
269 // in the proxy for totalview (src/arcane/totalview)
270 MeshItemInternalList* m_items = nullptr;
271 ItemInternalConnectivityList* m_connectivity;
272 IItemFamily* m_item_family = nullptr;
273 ItemTypeMng* m_item_type_mng = nullptr;
274 Int64ArrayView m_unique_ids;
275 Int32ArrayView m_parent_item_ids;
276 Int32ArrayView m_owners;
277 Int32ArrayView m_flags;
278 Int16ArrayView m_type_ids;
279 eItemKind m_item_kind = IK_Unknown;
280 Int32 m_nb_parent = 0;
282
283 public:
284
285 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception. Use _ownerV2() instead")
286 Int32 owner(Int32) const;
287 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception. Use _setOwnerV2() instead")
288 void setOwner(Int32, Int32) const;
289 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception. Use _flagsV2() instead")
290 Int32 flags(Int32) const;
291 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception. Use _setFlagsV2() instead")
292 void setFlags(Int32, Int32) const;
293
294 private:
295
296 constexpr Int32 _ownerV2(Int32 local_id) const { return m_owners[local_id]; }
297 void _setOwnerV2(Int32 local_id, Int32 aowner) { m_owners[local_id] = aowner; }
298 constexpr Int32 _flagsV2(Int32 local_id) const { return m_flags[local_id]; }
299 void _setFlagsV2(Int32 local_id, Int32 f) { m_flags[local_id] = f; }
300
301 constexpr Int16 _typeId(Int32 local_id) const { return m_type_ids[local_id]; }
302 void _setTypeId(Int32 local_id, Int16 v) { m_type_ids[local_id] = v; }
303
304 public:
305
306 // TODO: to be removed
307 ARCANE_DEPRECATED_REASON("Y2022: COMMON_BASE_MEMORY is always 0")
308 static const Int32 COMMON_BASE_MEMORY = 0;
309
310 private:
311
312 void _init(eItemKind ik);
314 ItemInternal* _parent(Int32 id) const;
315};
316
317/*---------------------------------------------------------------------------*/
318/*---------------------------------------------------------------------------*/
319
320inline std::ostream&
321operator<<(std::ostream& o, const ItemSharedInfo& isi)
322{
323 isi.print(o);
324 return o;
325}
326
327/*---------------------------------------------------------------------------*/
328/*---------------------------------------------------------------------------*/
329
330} // End namespace Arcane
331
332/*---------------------------------------------------------------------------*/
333/*---------------------------------------------------------------------------*/
334
335#endif
Declarations of Arcane's general types.
Int32 print(ITraceMng *tm, bool is_no_continue=true)
Prints a message for an unknown exception.
Declarations of types on entities.
Constant view of an array of type T.
Interface of an entity family.
Definition IItemFamily.h:83
Connectivity information, for an entity family, allowing transition between old and new connectivity ...
Internal view on an array of entities.
Internal structure of a mesh entity.
Internal shared structure of a mesh entity.
ConstArrayView< ItemInternal * > m_items_internal
ItemInternal of entities.
static ItemSharedInfo nullItemSharedInfo
For the null entity.
Indirection tables for mesh entities.
Mesh information for a given entity kind.
Temporary class to hold an ItemSharedInfo and an entity type.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
eItemKind
Mesh entity type.
std::int32_t Int32
Signed integer type of 32 bits.