Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ItemInternal.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/* ItemInternal.h (C) 2000-2026 */
9/* */
10/* Internal part of an entity. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ITEMINTERNAL_H
13#define ARCANE_CORE_ITEMINTERNAL_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/ArrayView.h"
18
20#include "arcane/core/ItemIndexedListView.h"
21#include "arcane/core/ItemSharedInfo.h"
22#include "arcane/core/ItemUniqueId.h"
23#include "arcane/core/ItemLocalIdListView.h"
24#include "arcane/core/ItemTypeId.h"
25#include "arcane/core/ItemFlags.h"
26#include "arcane/core/ItemConnectivityContainerView.h"
27#include "arcane/core/ItemInternalVectorView.h"
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32#ifdef null
33#undef null
34#endif
35
36//#define ARCANE_CONNECTIVITYLIST_USE_OWN_SHAREDINFO
37
38#ifdef ARCANE_CONNECTIVITYLIST_USE_OWN_SHAREDINFO
39#define A_INTERNAL_SI(name) m_shared_infos.m_##name
40#else
41#define A_INTERNAL_SI(name) m_items->m_##name##_shared_info
42#endif
43
44/*---------------------------------------------------------------------------*/
45/*---------------------------------------------------------------------------*/
46
47namespace Arcane::mesh
48{
49class IncrementalItemConnectivityBase;
50class PolyhedralFamily;
51class PolyhedralMeshImpl;
52class FaceFamily;
53class MeshRefinement;
54} // namespace Arcane::mesh
55namespace Arcane::Materials
56{
58}
59namespace Arcane
60{
62
63/*---------------------------------------------------------------------------*/
64/*---------------------------------------------------------------------------*/
65
66/*!
67 * \internal
68 * \brief Class for building an instance of ItemBase
69 */
70class ARCANE_CORE_EXPORT ItemBaseBuildInfo
71{
72 public:
73
74 ItemBaseBuildInfo() = default;
75 constexpr ItemBaseBuildInfo(Int32 local_id, ItemSharedInfo* shared_info)
76 : m_local_id(local_id)
77 , m_shared_info(shared_info)
78 {}
79
80 public:
81
82 Int32 m_local_id = NULL_ITEM_LOCAL_ID;
83 ItemSharedInfo* m_shared_info = nullptr;
84};
85
86/*---------------------------------------------------------------------------*/
87/*---------------------------------------------------------------------------*/
88
89/*!
90 * \internal
91 * \brief Connectivity information, for an entity family,
92 * allowing transition between old and new connectivity implementations.
93 */
94class ARCANE_CORE_EXPORT ItemInternalConnectivityList
95{
96 // IMPORTANT: This structure must have the same memory layout
97 // as the C# structure of the same name.
98
99 friend class ItemBase;
100 friend class ItemInternal;
101 friend class Item;
102
103 // For access to _setConnectivity*
104 friend mesh::IncrementalItemConnectivityBase;
105 friend mesh::PolyhedralFamily;
106 friend mesh::PolyhedralMeshImpl;
107
108 // For access to m_items
109 friend mesh::ItemFamily;
110
111 private:
112
113 /*!
114 * \brief Specific view to manage null entities.
115 *
116 * For the null entity, the index is NULL_ITEM_LOCAL_ID (i.e., -1) and it must
117 * be possible to access `m_data` with this index, which is not possible
118 * with the classic ArrayView in check mode.
119 */
120 struct Int32View
121 {
122 public:
123
124 constexpr Int32 operator[](Int32 index) const
125 {
126#ifdef ARCANE_CHECK
127 if (index == NULL_ITEM_LOCAL_ID) {
128 // For the null entity, the size must be 0.
129 if (m_size != 0)
130 arcaneRangeError(index, m_size);
131 }
132 else
133 ARCANE_CHECK_AT(index, m_size);
134#endif
135 return m_data[index];
136 }
137 constexpr void operator=(ConstArrayView<Int32> v)
138 {
139 m_data = v.data();
140 m_size = v.size();
141 }
142 // data[NULL_ITEM_LOCAL_ID] must be valid.
143 // Therefore, (data-1) must point to a valid address
144 void setNull(const Int32* data)
145 {
146 m_data = data;
147 m_size = 0;
148 }
149 operator ConstArrayView<Int32>() const
150 {
151 return ConstArrayView<Int32>(m_size, m_data);
152 }
153 operator SmallSpan<const Int32>() const
154 {
155 return SmallSpan<const Int32>(m_data, m_size);
156 }
157
158 private:
159
160 Int32 m_size;
161 const Int32* m_data;
162 };
163
164 public:
165
166 enum
167 {
168 NODE_IDX = 0,
169 EDGE_IDX = 1,
170 FACE_IDX = 2,
171 CELL_IDX = 3,
172 HPARENT_IDX = 4,
173 HCHILD_IDX = 5,
174 MAX_ITEM_KIND = 6
175 };
176
177 public:
178
179 static ItemInternalConnectivityList nullInstance;
180
181 public:
182
183 ItemInternalConnectivityList()
184 : m_items(nullptr)
185 {
186 for (Integer i = 0; i < MAX_ITEM_KIND; ++i) {
187 m_kind_info[i].m_nb_item_null_data[0] = 0;
188 m_kind_info[i].m_nb_item_null_data[1] = 0;
189 m_kind_info[i].m_max_nb_item = 0;
190 }
191
192 for (Integer i = 0; i < MAX_ITEM_KIND; ++i) {
193 m_container[i].m_nb_item.setNull(&m_kind_info[i].m_nb_item_null_data[1]);
194 m_container[i].m_offset = ConstArrayView<Int32>{};
195 }
196 }
197
198 public:
199
200 void updateMeshItemInternalList()
201 {
202#ifdef ARCANE_CONNECTIVITYLIST_USE_OWN_SHAREDINFO
203 m_shared_infos.m_node = m_items->m_node_shared_info;
204 m_shared_infos.m_edge = m_items->m_edge_shared_info;
205 m_shared_infos.m_face = m_items->m_face_shared_info;
206 m_shared_infos.m_cell = m_items->m_cell_shared_info;
207#endif
208 }
209
210 private:
211
212 /*!
213 * \brief localId() of the \a index-th entity of type \a item_kind
214 * connected to the entity with localid() \a lid.
215 */
216 constexpr Int32 itemLocalId(Int32 item_kind, Int32 lid, Integer index) const
217 {
218 return m_container[item_kind].itemLocalId(lid, index);
219 }
220 //! Number of calls to itemLocalId()
221 Int64 nbAccess() const { return 0; }
222 //! Number of calls to itemLocalIds()
223 Int64 nbAccessAll() const { return 0; }
224
225 private:
226
227 //! Positions the connectivity index array
228 void _setConnectivityIndex(Int32 item_kind, ConstArrayView<Int32> v)
229 {
230 m_container[item_kind].m_indexes = v;
231 }
232 //! Positions the array containing the connectivity list
233 void _setConnectivityList(Int32 item_kind, ArrayView<Int32> v)
234 {
235 m_container[item_kind].m_list = v;
236 m_container[item_kind].m_offset = ConstArrayView<Int32>{};
237 }
238 //! Positions the array containing the number of connected entities.
239 void _setConnectivityNbItem(Int32 item_kind, ConstArrayView<Int32> v)
240 {
241 m_container[item_kind].m_nb_item = v;
242 }
243 //! Positions the maximum number of connected entities.
244 void _setMaxNbConnectedItem(Int32 item_kind, Int32 v)
245 {
246 m_kind_info[item_kind].m_max_nb_item = v;
247 }
248
249 public:
250
251 //! Connectivity index array for entities of kind \a item_kind
252 ARCANE_DEPRECATED_REASON("Y2022: Use containerView() instead")
254 {
255 return m_container[item_kind].m_indexes;
256 }
257 //! Array containing the connectivity list for entities of kind \a item_kind
258 ARCANE_DEPRECATED_REASON("Y2022: Use containerView() instead")
260 {
261 return m_container[item_kind].m_list;
262 }
263 //! Array containing the number of connected entities for entities of kind \a item_kind
264 ARCANE_DEPRECATED_REASON("Y2022: Use containerView() instead")
266 {
267 return m_container[item_kind].m_nb_item;
268 }
269
270 public:
271
272 //! Maximum number of connected entities.
274 {
275 return m_kind_info[item_kind].m_max_nb_item;
276 }
277
278 ItemConnectivityContainerView containerView(Int32 item_kind) const
279 {
280 return m_container[item_kind].containerView();
281 }
282
283 public:
284
285 constexpr ItemBaseBuildInfo nodeBase(Int32 lid, Int32 aindex) const
286 {
287 return ItemBaseBuildInfo(_nodeLocalIdV2(lid, aindex), A_INTERNAL_SI(node));
288 }
289 constexpr ItemBaseBuildInfo edgeBase(Int32 lid, Int32 aindex) const
290 {
291 return ItemBaseBuildInfo(_edgeLocalIdV2(lid, aindex), A_INTERNAL_SI(edge));
292 }
293 constexpr ItemBaseBuildInfo faceBase(Int32 lid, Int32 aindex) const
294 {
295 return ItemBaseBuildInfo(_faceLocalIdV2(lid, aindex), A_INTERNAL_SI(face));
296 }
297 constexpr ItemBaseBuildInfo cellBase(Int32 lid, Int32 aindex) const
298 {
299 return ItemBaseBuildInfo(_cellLocalIdV2(lid, aindex), A_INTERNAL_SI(cell));
300 }
301 ItemBaseBuildInfo hParentBase(Int32 lid, Int32 aindex, ItemSharedInfo* isf) const
302 {
303 return ItemBaseBuildInfo(_hParentLocalIdV2(lid, aindex), isf);
304 }
305 ItemBaseBuildInfo hChildBase(Int32 lid, Int32 aindex, ItemSharedInfo* isf) const
306 {
307 return ItemBaseBuildInfo(_hChildLocalIdV2(lid, aindex), isf);
308 }
309
310 auto nodeList(Int32 lid) const { return impl::ItemIndexedListView{ A_INTERNAL_SI(node), _itemLocalIdListView(NODE_IDX, lid) }; }
311 auto edgeList(Int32 lid) const { return impl::ItemIndexedListView{ A_INTERNAL_SI(edge), _itemLocalIdListView(EDGE_IDX, lid) }; }
312 auto faceList(Int32 lid) const { return impl::ItemIndexedListView{ A_INTERNAL_SI(face), _itemLocalIdListView(FACE_IDX, lid) }; }
313 auto cellList(Int32 lid) const { return impl::ItemIndexedListView{ A_INTERNAL_SI(cell), _itemLocalIdListView(CELL_IDX, lid) }; }
314
315 private:
316
317 // These 4 methods are still used by ItemBase via internalNodes(), internalEdges(), ...
318 // They can be removed when these obsolete methods are removed
319 ItemInternalVectorView nodesV2(Int32 lid) const { return { A_INTERNAL_SI(node), _itemLocalIdListView(NODE_IDX, lid) }; }
320 ItemInternalVectorView edgesV2(Int32 lid) const { return { A_INTERNAL_SI(edge), _itemLocalIdListView(EDGE_IDX, lid) }; }
321 ItemInternalVectorView facesV2(Int32 lid) const { return { A_INTERNAL_SI(face), _itemLocalIdListView(FACE_IDX, lid) }; }
322 ItemInternalVectorView cellsV2(Int32 lid) const { return { A_INTERNAL_SI(cell), _itemLocalIdListView(CELL_IDX, lid) }; }
323
324 NodeLocalIdView nodeLocalIdsView(Int32 lid) const { return NodeLocalIdView(_itemLocalIdListView(NODE_IDX, lid)); }
325 EdgeLocalIdView edgeLocalIdsView(Int32 lid) const { return EdgeLocalIdView(_itemLocalIdListView(EDGE_IDX, lid)); }
326 FaceLocalIdView faceLocalIdsView(Int32 lid) const { return FaceLocalIdView(_itemLocalIdListView(FACE_IDX, lid)); }
327 CellLocalIdView cellLocalIdsView(Int32 lid) const { return CellLocalIdView(_itemLocalIdListView(CELL_IDX, lid)); }
328
329 private:
330
331 constexpr Int32 _nodeLocalIdV2(Int32 lid, Int32 index) const { return itemLocalId(NODE_IDX, lid, index); }
332 constexpr Int32 _edgeLocalIdV2(Int32 lid, Int32 index) const { return itemLocalId(EDGE_IDX, lid, index); }
333 constexpr Int32 _faceLocalIdV2(Int32 lid, Int32 index) const { return itemLocalId(FACE_IDX, lid, index); }
334 constexpr Int32 _cellLocalIdV2(Int32 lid, Int32 index) const { return itemLocalId(CELL_IDX, lid, index); }
335 constexpr Int32 _hParentLocalIdV2(Int32 lid, Int32 index) const { return itemLocalId(HPARENT_IDX, lid, index); }
336 constexpr Int32 _hChildLocalIdV2(Int32 lid, Int32 index) const { return itemLocalId(HCHILD_IDX, lid, index); }
337
338 private:
339
340 ItemInternal* _nodeV2(Int32 lid, Int32 aindex) const { return m_items->nodes[_nodeLocalIdV2(lid, aindex)]; }
341 ItemInternal* _edgeV2(Int32 lid, Int32 aindex) const { return m_items->edges[_edgeLocalIdV2(lid, aindex)]; }
342 ItemInternal* _faceV2(Int32 lid, Int32 aindex) const { return m_items->faces[_faceLocalIdV2(lid, aindex)]; }
343 ItemInternal* _cellV2(Int32 lid, Int32 aindex) const { return m_items->cells[_cellLocalIdV2(lid, aindex)]; }
344 ItemInternal* _hParentV2(Int32 lid, Int32 aindex) const { return m_items->cells[_hParentLocalIdV2(lid, aindex)]; }
345 ItemInternal* _hChildV2(Int32 lid, Int32 aindex) const { return m_items->cells[_hChildLocalIdV2(lid, aindex)]; }
346
347 private:
348
349 constexpr Int32 _nbNodeV2(Int32 lid) const { return m_container[NODE_IDX].m_nb_item[lid]; }
350 constexpr Int32 _nbEdgeV2(Int32 lid) const { return m_container[EDGE_IDX].m_nb_item[lid]; }
351 constexpr Int32 _nbFaceV2(Int32 lid) const { return m_container[FACE_IDX].m_nb_item[lid]; }
352 constexpr Int32 _nbCellV2(Int32 lid) const { return m_container[CELL_IDX].m_nb_item[lid]; }
353 Int32 _nbHParentV2(Int32 lid) const { return m_container[HPARENT_IDX].m_nb_item[lid]; }
354 Int32 _nbHChildrenV2(Int32 lid) const { return m_container[HCHILD_IDX].m_nb_item[lid]; }
355
356 private:
357
358 Int32 _nodeOffset(Int32 lid) const { return m_container[NODE_IDX].itemOffset(lid); }
359 Int32 _edgeOffset(Int32 lid) const { return m_container[EDGE_IDX].itemOffset(lid); }
360 Int32 _faceOffset(Int32 lid) const { return m_container[FACE_IDX].itemOffset(lid); }
361 Int32 _cellOffset(Int32 lid) const { return m_container[CELL_IDX].itemOffset(lid); }
362 Int32 _itemOffset(Int32 item_kind, Int32 lid) const { return m_container[item_kind].itemOffset(lid); }
363
364 private:
365
366 impl::ItemLocalIdListContainerView _itemLocalIdListView(Int32 item_kind, Int32 lid) const
367 {
368 return m_container[item_kind].itemLocalIdListView(lid);
369 }
370
371 private:
372
373 // NOTE : eventually, this class will be merged with ItemConnectivityContainerView
374 //! Container of views for the connectivity information of a family
375 struct Container
376 {
377 impl::ItemLocalIdListContainerView itemLocalIdListView(Int32 lid) const
378 {
379 return impl::ItemLocalIdListContainerView(itemLocalIdsData(lid), m_nb_item[lid], itemOffset(lid));
380 }
381 const Int32* itemLocalIdsData(Int32 lid) const
382 {
383 return &(m_list[m_indexes[lid]]);
384 }
385 constexpr Int32 itemLocalId(Int32 lid, Integer index) const
386 {
387 return m_list[m_indexes[lid] + index] + itemOffset(lid);
388 }
389 ItemConnectivityContainerView containerView() const
390 {
391 return ItemConnectivityContainerView(m_list, m_indexes, m_nb_item);
392 }
393 constexpr Int32 itemOffset([[maybe_unused]] Int32 lid) const
394 {
395#ifdef ARCANE_USE_OFFSET_FOR_CONNECTIVITY
396 return m_offset[lid];
397#else
398 return 0;
399#endif
400 }
401
402 public:
403
404 ConstArrayView<Int32> m_indexes;
405 Int32View m_nb_item;
406 ArrayView<Int32> m_list;
407 ConstArrayView<Int32> m_offset;
408 };
409
410 struct KindInfo
411 {
412 Int32 m_max_nb_item;
413 Int32 m_nb_item_null_data[2];
414 };
415
416 private:
417
418 Container m_container[MAX_ITEM_KIND];
419 KindInfo m_kind_info[MAX_ITEM_KIND];
420
421 MeshItemInternalList* m_items;
422
423 private:
424
425#ifdef ARCANE_CONNECTIVITYLIST_USE_OWN_SHAREDINFO
426 impl::MeshItemSharedInfoList m_shared_infos;
427#endif
428};
429
430/*---------------------------------------------------------------------------*/
431/*---------------------------------------------------------------------------*/
432
433/*!
434 * \brief Base class for mesh entities.
435 *
436 * This class is internal to %Arcane.
437 *
438 * This class is normally internal to Arcane, and it is preferable to use
439 * specialized versions such as Item, Node, Face, Edge, Cell, Particle,
440 * or DoF.
441 *
442 * Instances of this class are temporary objects that should not be retained
443 * between two topological modifications of the mesh if compressions
444 * (IItemFamily::compactItems()) occur during these modifications.
445 *
446 * All methods of this class are read-only and do not allow modification of
447 * an entity.
448 */
449class ARCANE_CORE_EXPORT ItemBase
450: public ItemFlags
451{
452 friend class ::Arcane::ItemInternal;
453 friend class ::Arcane::Item;
454 friend class ::Arcane::ItemInternalCompatibility;
456 friend class ::Arcane::ItemEnumerator;
457 friend MutableItemBase;
458 // For _internalActiveCells2().
459 friend class ::Arcane::Node;
460 // For _itemInternal()
461 friend class ::Arcane::mesh::ItemFamily;
462 friend class ::Arcane::mesh::MeshRefinement;
463
464 private:
465
466 constexpr ItemBase(Int32 local_id, ItemSharedInfo* shared_info)
467 : m_local_id(local_id)
468 , m_shared_info(shared_info)
469 {}
470
471 public:
472
473 ItemBase()
474 : m_shared_info(ItemSharedInfo::nullItemSharedInfoPointer)
475 {}
476 constexpr ItemBase(ItemBaseBuildInfo x)
477 : m_local_id(x.m_local_id)
478 , m_shared_info(x.m_shared_info)
479 {}
480
481 public:
482
483 // TODO: To be removed eventually
484 inline ItemBase(ItemInternal* x);
485
486 public:
487
488 //! Local number (in the subdomain) of the entity
489 Int32 localId() const { return m_local_id; }
490 //! Local number (in the subdomain) of the entity
491 inline ItemLocalId itemLocalId() const;
492 //! Unique number of the entity
494 {
495#ifdef ARCANE_CHECK
496 if (m_local_id != NULL_ITEM_LOCAL_ID)
497 arcaneCheckAt((Integer)m_local_id, m_shared_info->m_unique_ids.size());
498#endif
499 // Do not use the normal accessor because this array can be used for the
500 // null cell and in this case m_local_id equals NULL_ITEM_LOCAL_ID (which is negative)
501 // which causes an array overflow exception.
502 return ItemUniqueId(m_shared_info->m_unique_ids.data()[m_local_id]);
503 }
504
505 //! Number of the owning subdomain of the entity
506 Int32 owner() const { return m_shared_info->_ownerV2(m_local_id); }
507
508 //! Flags of the entity
509 Int32 flags() const { return m_shared_info->_flagsV2(m_local_id); }
510
511 //! Number of nodes of the entity
512 Integer nbNode() const { return _connectivity()->_nbNodeV2(m_local_id); }
513 //! Number of edges of the entity or number of edges connected to the entity (for nodes)
514 Integer nbEdge() const { return _connectivity()->_nbEdgeV2(m_local_id); }
515 //! Number of faces of the entity or number of faces connected to the entity (for nodes and edges)
516 Integer nbFace() const { return _connectivity()->_nbFaceV2(m_local_id); }
517 //! Number of cells connected to the entity (for nodes, edges, and faces)
518 Integer nbCell() const { return _connectivity()->_nbCellV2(m_local_id); }
519 //! Number of parents for AMR
520 Int32 nbHParent() const { return _connectivity()->_nbHParentV2(m_local_id); }
521 //! Number of children for AMR
522 Int32 nbHChildren() const { return _connectivity()->_nbHChildrenV2(m_local_id); }
523 //! Number of parent for sub-meshes
524 Integer nbParent() const { return m_shared_info->nbParent(); }
525
526 public:
527
528 //! Type of the entity
529 Int16 typeId() const { return m_shared_info->_typeId(m_local_id); }
530 //! Type of the entity
531 ItemTypeId itemTypeId() const { return ItemTypeId(typeId()); }
532 //! Type of the entity.
533 ItemTypeInfo* typeInfo() const { return m_shared_info->typeInfoFromId(typeId()); }
534
535 //! @returns the refinement level of the current item. If the parent item is
536 //\p NULL, it is conventionally at level 0; otherwise, it is simply at the
537 //level of its parent.
538 inline Int32 level() const
539 {
540 //! if I do not have a parent, I was created directly from a file
541 //! or by the user, so I am a level 0 item
542 if (this->nbHParent() == 0)
543 return 0;
544 //! otherwise, I am at a higher level than my parent
545 return (this->hParentBase(0).level() + 1);
546 }
547
548 //! @returns \p true if the item is an ancestor (i.e., has an active
549 //! child or an ancestor child), \p false otherwise. Always returns \p false
550 //! if AMR is disabled.
551 inline bool isAncestor() const
552 {
553 if (this->isActive())
554 return false;
555 if (!this->hasHChildren())
556 return false;
557 if (this->hChildBase(0).isActive())
558 return true;
559 return this->hChildBase(0).isAncestor();
560 }
561 //! @returns \p true if the item has children (active or not), \p false
562 //! otherwise. Always returns \p false if AMR is disabled.
563 inline bool hasHChildren() const
564 {
565 if (this->nbHChildren() == 0) // TODO ? to check!
566 return false;
567 else
568 return true;
569 }
570
571 //! @returns \p true if the item is active (i.e., has no active descendants),
572 //! \p false otherwise. Note that it is sufficient to check only the first
573 //! child. Always returns \p true if AMR is disabled.
574 inline bool isActive() const
575 {
576 if ((flags() & II_Inactive) | (flags() & II_CoarsenInactive))
577 return false;
578 else
579 return true;
580 }
581
582 //! @returns \p true if the item is subactive (i.e., not active and has
583 //! no descendants), \p false otherwise. Always returns \p false if AMR
584 //! is disabled.
585 inline bool isSubactive() const
586 {
587 if (this->isActive())
588 return false;
589 if (!this->hasHChildren())
590 return true;
591 return this->hChildBase(0).isSubactive();
592 }
593
594 //! Family the entity belongs to
595 IItemFamily* family() const { return m_shared_info->m_item_family; }
596 //! Kind of the entity
597 eItemKind kind() const { return m_shared_info->m_item_kind; }
598 //! True if the entity is the null entity
599 bool null() const { return m_local_id == NULL_ITEM_LOCAL_ID; }
600 //! True if the entity is the null entity
601 bool isNull() const { return m_local_id == NULL_ITEM_LOCAL_ID; }
602 //! True if the entity belongs to the subdomain
603 bool isOwn() const { return ItemFlags::isOwn(flags()); }
604 /*!
605 * \brief True if the entity is shared by other subdomains.
606 *
607 * This method is only relevant if the connectivity information has
608 * been calculated.
609 */
610 bool isShared() const { return ItemFlags::isShared(flags()); }
611
612 //! True if the entity is suppressed
613 bool isSuppressed() const { return (flags() & II_Suppressed) != 0; }
614 //! True if the entity is detached
615 bool isDetached() const { return (flags() & II_Detached) != 0; }
616
617 //! \a true if the entity is on the boundary
618 bool isBoundary() const { return ItemFlags::isBoundary(flags()); }
619 //! Cell connected to the entity if the entity is a boundary entity (0 if none)
620 ItemBase boundaryCell() const { return (flags() & II_Boundary) ? cellBase(0) : ItemBase(); }
621 //! Cell behind the entity (nullItem() if none)
622 ItemBase backCell() const
623 {
624 if (flags() & II_HasBackCell)
625 return cellBase((flags() & II_BackCellIsFirst) ? 0 : 1);
626 return {};
627 }
628 //! Cell behind the entity (NULL_ITEM_LOCAL_ID if none)
630 {
631 if (flags() & II_HasBackCell)
632 return cellId((flags() & II_BackCellIsFirst) ? 0 : 1);
633 return NULL_ITEM_LOCAL_ID;
634 }
635 //! Cell in front of the entity (nullItem() if none)
636 ItemBase frontCell() const
637 {
638 if (flags() & II_HasFrontCell)
639 return cellBase((flags() & II_FrontCellIsFirst) ? 0 : 1);
640 return {};
641 }
642 //! Cell in front of the entity (NULL_ITEM_LOCAL_ID if none)
644 {
645 if (flags() & II_HasFrontCell)
646 return cellId((flags() & II_FrontCellIsFirst) ? 0 : 1);
647 return NULL_ITEM_LOCAL_ID;
648 }
649 ItemBase masterFace() const
650 {
651 if (flags() & II_SlaveFace)
652 return faceBase(0);
653 return {};
654 }
655 //! \a true if it is the master face of an interface
656 inline bool isMasterFace() const { return flags() & II_MasterFace; }
657
658 //! \a true if it is a slave face of an interface
659 inline bool isSlaveFace() const { return flags() & II_SlaveFace; }
660
661 Int32 parentId(Integer index) const { return m_shared_info->_parentLocalIdV2(m_local_id, index); }
662
663 //@{
664 Int32 nodeId(Integer index) const { return _connectivity()->_nodeLocalIdV2(m_local_id, index); }
665 Int32 edgeId(Integer index) const { return _connectivity()->_edgeLocalIdV2(m_local_id, index); }
666 Int32 faceId(Integer index) const { return _connectivity()->_faceLocalIdV2(m_local_id, index); }
667 Int32 cellId(Integer index) const { return _connectivity()->_cellLocalIdV2(m_local_id, index); }
668 Int32 hParentId(Int32 index) const { return _connectivity()->_hParentLocalIdV2(m_local_id, index); }
669 Int32 hChildId(Int32 index) const { return _connectivity()->_hChildLocalIdV2(m_local_id, index); }
670 //@}
671
672 /*!
673 * \brief Methods using the new connectivities to access connectivity
674 * information. Should not be used outside of Arcane.
675 *
676 * \warning These methods must only be called on entities that possess
677 * the associated connectivity AND are in the new format. For example,
678 * this does not work on Cell->Cell because there is no cell/cell
679 * connectivity. Misuse results in an array overflow.
680 */
681 //@{
682 ARCANE_DEPRECATED_REASON("Y2023: Use nodeList() instead.")
683 ItemInternalVectorView internalNodes() const { return _connectivity()->nodesV2(m_local_id); }
684 ARCANE_DEPRECATED_REASON("Y2023: Use edgeList() instead.")
685 ItemInternalVectorView internalEdges() const { return _connectivity()->edgesV2(m_local_id); }
686 ARCANE_DEPRECATED_REASON("Y2023: Use faceList() instead.")
687 ItemInternalVectorView internalFaces() const { return _connectivity()->facesV2(m_local_id); }
688 ARCANE_DEPRECATED_REASON("Y2023: Use cellList() instead.")
689 ItemInternalVectorView internalCells() const { return _connectivity()->cellsV2(m_local_id); }
690 //@}
691
692 /*!
693 * \brief Methods using the new connectivities to access connectivity
694 * information. Should not be used outside of Arcane.
695 *
696 * \warning These methods must only be called on entities that possess
697 * the associated connectivity. For example, this does not work on
698 * Cell->Cell because there is no cell/cell connectivity. Misuse results
699 * in an array overflow.
700 */
701 //@{
702 impl::ItemIndexedListView<DynExtent> nodeList() const { return _connectivity()->nodeList(m_local_id); }
703 impl::ItemIndexedListView<DynExtent> edgeList() const { return _connectivity()->edgeList(m_local_id); }
704 impl::ItemIndexedListView<DynExtent> faceList() const { return _connectivity()->faceList(m_local_id); }
705 impl::ItemIndexedListView<DynExtent> cellList() const { return _connectivity()->cellList(m_local_id); }
706
707 impl::ItemIndexedListView<DynExtent> itemList(Node*) const { return nodeList(); }
708 impl::ItemIndexedListView<DynExtent> itemList(Edge*) const { return edgeList(); }
709 impl::ItemIndexedListView<DynExtent> itemList(Face*) const { return faceList(); }
710 impl::ItemIndexedListView<DynExtent> itemList(Cell*) const { return cellList(); }
711 //@}
712
713 ItemBase nodeBase(Int32 index) const { return _connectivity()->nodeBase(m_local_id, index); }
714 ItemBase edgeBase(Int32 index) const { return _connectivity()->edgeBase(m_local_id, index); }
715 ItemBase faceBase(Int32 index) const { return _connectivity()->faceBase(m_local_id, index); }
716 ItemBase cellBase(Int32 index) const { return _connectivity()->cellBase(m_local_id, index); }
717 ItemBase hParentBase(Int32 index) const { return _connectivity()->hParentBase(m_local_id, index, m_shared_info); }
718 ItemBase hChildBase(Int32 index) const { return _connectivity()->hChildBase(m_local_id, index, m_shared_info); }
719 inline ItemBase parentBase(Int32 index) const;
720
721 //! Returns whether the flags \a flags are set for the entity
722 bool hasFlags(Int32 flags) const { return (this->flags() & flags); }
723
724 public:
725
726 /*!
727 * @returns the rank of the child \p (iitem).
728 * example: if rank = m_internal->whichChildAmI(iitem); then
729 * m_internal->hChild(rank) would be iitem;
730 */
731 Int32 whichChildAmI(Int32 local_id) const;
732
733 public:
734
735 ItemBase topHParentBase() const;
736
737 public:
738
739 //! Mutable interface of this entity
740 inline MutableItemBase toMutable();
741
742 public:
743
744 ARCANE_DEPRECATED_REASON("Y2024: This method is internal to Arcane.")
745 inline ItemInternal* itemInternal() const;
746
747 ARCANE_DEPRECATED_REASON("Y2024: This method is internal to Arcane.")
748 ItemInternalVectorView _internalActiveCells(Int32Array& local_ids) const
749 {
750 return _internalActiveCells2(local_ids);
751 }
752
753 private:
754
755 Int32 _nbLinearNode() const;
756
757 private:
758
759 /*!
760 * \brief Local number (in the subdomain) of the entity.
761 *
762 * For performance reasons, the local number must be
763 * the first field of the class.
764 */
765 Int32 m_local_id = NULL_ITEM_LOCAL_ID;
766
767 //! Field used only to explicitly manage alignment
768 Int32 m_padding = 0;
769
770 //! Shared info between all entities with the same characteristics
771 ItemSharedInfo* m_shared_info = nullptr;
772
773 private:
774
775 ItemInternalConnectivityList* _connectivity() const
776 {
777 return m_shared_info->m_connectivity;
778 }
779 void _setFromInternal(ItemBase* rhs)
780 {
781 m_local_id = rhs->m_local_id;
782 m_shared_info = rhs->m_shared_info;
783 }
784 void _setFromInternal(const ItemBase& rhs)
785 {
786 m_local_id = rhs.m_local_id;
787 m_shared_info = rhs.m_shared_info;
788 }
789 ItemInternalVectorView _internalActiveCells2(Int32Array& local_ids) const;
790 inline ItemInternal* _itemInternal() const;
791};
792
793/*---------------------------------------------------------------------------*/
794/*---------------------------------------------------------------------------*/
795
796/*!
797 * \brief Methods allowing modification of ItemBase.
798 *
799 * These methods are internal to Arcane.
800 */
801class ARCANE_CORE_EXPORT MutableItemBase
802: public ItemBase
803{
804 friend class ::Arcane::Item;
805 friend ItemBase;
806 // For _setFaceBackAndFrontCell()
807 friend Arcane::mesh::FaceFamily;
808
809 private:
810
811 MutableItemBase(Int32 local_id, ItemSharedInfo* shared_info)
812 : ItemBase(local_id, shared_info)
813 {}
814
815 public:
816
817 MutableItemBase() = default;
818 MutableItemBase(ItemBaseBuildInfo x)
819 : ItemBase(x)
820 {}
821 explicit MutableItemBase(const ItemBase& x)
822 : ItemBase(x)
823 {}
824
825 public:
826
827 // TODO: To be removed eventually
828 inline MutableItemBase(ItemInternal* x);
829
830 public:
831
832 void setUniqueId(Int64 uid)
833 {
834 _checkUniqueId(uid);
835 m_shared_info->m_unique_ids[m_local_id] = uid;
836 }
837
838 //! Nullifies the uniqueId to the value NULL_ITEM_UNIQUE_ID
839 /*! Checks that the value to be canceled is valid in ARCANE_CHECK mode */
840 void unsetUniqueId();
841
842 /*!
843 * \brief Sets the sub-domain number of the entity owner.
844
845 \a current_sub_domain is the sub-domain number calling this operation.
846
847 After calling this function, you must update the mesh to which this entity
848 belongs by calling the IMesh::notifyOwnItemsChanged() method. It is not
849 necessary to call this method for every call to setOwn. Only one
850 call after all modifications is necessary.
851 */
852 void setOwner(Integer suid, Int32 current_sub_domain)
853 {
854 m_shared_info->_setOwnerV2(m_local_id, suid);
855 int f = flags();
856 if (suid == current_sub_domain)
857 f |= II_Own;
858 else
859 f &= ~II_Own;
860 setFlags(f);
861 }
862
863 //! Sets the entity flags
864 void setFlags(Int32 f) { m_shared_info->_setFlagsV2(m_local_id, f); }
865
866 //! Adds the flags \a added_flags to those of the entity
867 void addFlags(Int32 added_flags)
868 {
869 Int32 f = this->flags();
870 f |= added_flags;
871 this->setFlags(f);
872 }
873
874 //! Removes the flags \a removed_flags from those of the entity
875 void removeFlags(Int32 removed_flags)
876 {
877 Int32 f = this->flags();
878 f &= ~removed_flags;
879 this->setFlags(f);
880 }
881
882 //! Sets the detached state of the entity
883 void setDetached(bool v)
884 {
885 int f = flags();
886 if (v)
887 f |= II_Detached;
888 else
889 f &= ~II_Detached;
890 setFlags(f);
891 }
892
893 void reinitialize(Int64 uid, Int32 aowner, Int32 owner_rank)
894 {
895 setUniqueId(uid);
896 setFlags(0);
897 setOwner(aowner, owner_rank);
898 }
899
900 void setLocalId(Int32 local_id)
901 {
902 m_local_id = local_id;
903 }
904
905 //! Sets the \a i-th parent (currently aindex must be 0)
906 void setParent(Int32 aindex, Int32 parent_local_id)
907 {
908 m_shared_info->_setParentV2(m_local_id, aindex, parent_local_id);
909 }
910
911 private:
912
913 void _setFaceBackAndFrontCells(Int32 back_cell_lid, Int32 front_cell_lid);
914
915 void _checkUniqueId(Int64 new_uid) const;
916
917 inline void _setFaceInfos(Int32 mod_flags);
918};
919
920/*---------------------------------------------------------------------------*/
921/*---------------------------------------------------------------------------*/
922
923/*!
924 * \internal
925 * \brief Internal structure of a mesh entity.
926
927 This instance contains the internal structure of a mesh entity.
928 It should only be manipulated by those who know what they are doing...
929
930 To use an entity, you must use the Item class or one of its derived classes.
931
932 In general, the mesh (IMesh) to which the entity belongs maintains
933 different structures allowing the mesh to be manipulated. These structures
934 are often recalculated dynamically when necessary (lazy evaluation). This is
935 the case, for example, with sub-domain specific entity groups or the table
936 for converting global numbers to local numbers. This is why it is essential
937 when performing a series of modifications to instances of this class to
938 notify the mesh of the changes made.
939 */
940class ARCANE_CORE_EXPORT ItemInternal
941: public impl::MutableItemBase
942{
943 // For access to _setSharedInfo()
944 friend class mesh::DynamicMeshKindInfos;
945 friend class mesh::ItemFamily;
946
947 public:
948
949 //! Null entity
951 static ItemInternal* nullItem() { return &nullItemInternal; }
952
953 public:
954
955 // You must use the corresponding method from ItemBase
956
957 //! Connected cell to the entity if the entity is a boundary entity (0 if none)
958 ARCANE_DEPRECATED_REASON("Y2023: use ItemBase::boundaryCell() instead.")
959 ItemInternal* boundaryCell() const { return (flags() & II_Boundary) ? _internalCell(0) : nullItem(); }
960 //! Cell behind the entity (nullItem() if none)
961 ARCANE_DEPRECATED_REASON("Y2023: use ItemBase::backCell() instead.")
963 {
964 if (flags() & II_HasBackCell)
965 return _internalCell((flags() & II_BackCellIsFirst) ? 0 : 1);
966 return nullItem();
967 }
968 //! Cell in front of the entity (nullItem() if none)
969 ARCANE_DEPRECATED_REASON("Y2023: use ItemBase::frontCell() instead.")
971 {
972 if (flags() & II_HasFrontCell)
973 return _internalCell((flags() & II_FrontCellIsFirst) ? 0 : 1);
974 return nullItem();
975 }
976 ARCANE_DEPRECATED_REASON("Y2023: use ItemBase::masterFace() instead.")
977 ItemInternal* masterFace() const
978 {
979 if (flags() & II_SlaveFace)
980 return _internalFace(0);
981 return nullItem();
982 }
983
984 public:
985
986 //! Shared information of the entity.
987 ARCANE_DEPRECATED_REASON("Y2022: This method is internal to Arcane and should not be used.")
988 ItemSharedInfo* sharedInfo() const { return m_shared_info; }
989
990 public:
991
992 ARCANE_DEPRECATED_REASON("Y2023: Use itemList() instead.")
993 ItemInternalVectorView internalItems(Node*) const { return nodeList(); }
994 ARCANE_DEPRECATED_REASON("Y2023: Use itemList() instead.")
995 ItemInternalVectorView internalItems(Edge*) const { return edgeList(); }
996 ARCANE_DEPRECATED_REASON("Y2023: Use itemList() instead.")
997 ItemInternalVectorView internalItems(Face*) const { return faceList(); }
998 ARCANE_DEPRECATED_REASON("Y2023: Use itemList() instead.")
999 ItemInternalVectorView internalItems(Cell*) const { return cellList(); }
1000
1001 public:
1002
1003 ARCANE_DEPRECATED_REASON("Y2023: Use nodeBase() instead.")
1004 ItemInternal* internalNode(Int32 index) const { return _connectivity()->_nodeV2(m_local_id, index); }
1005 ARCANE_DEPRECATED_REASON("Y2023: Use edgeBase() instead.")
1006 ItemInternal* internalEdge(Int32 index) const { return _connectivity()->_edgeV2(m_local_id, index); }
1007 ARCANE_DEPRECATED_REASON("Y2023: Use faceBase() instead.")
1008 ItemInternal* internalFace(Int32 index) const { return _connectivity()->_faceV2(m_local_id, index); }
1009 ARCANE_DEPRECATED_REASON("Y2023: Use cellBase() instead.")
1010 ItemInternal* internalCell(Int32 index) const { return _connectivity()->_cellV2(m_local_id, index); }
1011 ARCANE_DEPRECATED_REASON("Y2023: Use hParentBase() instead.")
1012 ItemInternal* internalHParent(Int32 index) const { return _connectivity()->_hParentV2(m_local_id, index); }
1013 ARCANE_DEPRECATED_REASON("Y2023: Use hChildBase() instead.")
1014 ItemInternal* internalHChild(Int32 index) const { return _connectivity()->_hChildV2(m_local_id, index); }
1015 ARCANE_DEPRECATED_REASON("Y2023: Use parentBase() instead.")
1016 ItemInternal* parent(Integer index) const { return m_shared_info->_parentV2(m_local_id, index); }
1017
1018 public:
1019
1020 const ItemInternal* topHParent() const;
1021 ItemInternal* topHParent();
1022
1023 public:
1024
1025 ARCANE_DEPRECATED_REASON("Y2022: This method always returns 0")
1026 Int32 dataIndex() { return 0; }
1027
1028 public:
1029
1030 /*!
1031 * \brief Pointer to the list of parents.
1032 *
1033 * Since currently only one level is supported, it is only allowed
1034 * to call parentPtr()[0]. This does not allow any verification,
1035 * so it is preferable to use parentId() or setParent() instead.
1036 *
1037 * As of July 2022, this method is no longer used in Arcane, so if
1038 * no code uses it (which should be the case since it is an internal
1039 * method), we can quickly remove it.
1040 */
1041 ARCANE_DEPRECATED_REASON("Y2022: Use parentId() or setParent() instead")
1042 Int32* parentPtr() { return m_shared_info->_parentPtr(m_local_id); }
1043
1044 /*!
1045 * @returns the rank of the child \p (iitem).
1046 * Example: if rank = m_internal->whichChildAmI(iitem); then
1047 * m_internal->hChild(rank) would be iitem;
1048 */
1049 Int32 whichChildAmI(const ItemInternal* iitem) const;
1050
1051 public:
1052
1053 //! Memory required to store the entity information
1054 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
1055 constexpr Integer neededMemory() const { return 0; }
1056
1057 //! Minimum memory required to store the entity information (without buffer)
1058 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
1059 constexpr Integer minimumNeededMemory() const { return 0; }
1060
1061 public:
1062
1063 ARCANE_DEPRECATED_REASON("Y2023: Use nodeId() instead")
1064 Int32 nodeLocalId(Integer index) { return _connectivity()->_nodeLocalIdV2(m_local_id, index); }
1065 ARCANE_DEPRECATED_REASON("Y2023: Use edgeId() instead")
1066 Int32 edgeLocalId(Integer index) { return _connectivity()->_edgeLocalIdV2(m_local_id, index); }
1067 ARCANE_DEPRECATED_REASON("Y2023: Use faceId() instead")
1068 Int32 faceLocalId(Integer index) { return _connectivity()->_faceLocalIdV2(m_local_id, index); }
1069 ARCANE_DEPRECATED_REASON("Y2023: Use cellId() instead")
1070 Int32 cellLocalId(Integer index) { return _connectivity()->_cellLocalIdV2(m_local_id, index); }
1071
1072 public:
1073
1074 ARCANE_DEPRECATED_REASON("Y2022: This method always throws an exception.")
1075 void setDataIndex(Integer);
1076
1077 ARCANE_DEPRECATED_REASON("Y2022: This method is internal to Arcane and should not be used.")
1078 void setSharedInfo(ItemSharedInfo* shared_infos, ItemTypeId type_id)
1079 {
1080 _setSharedInfo(shared_infos, type_id);
1081 }
1082
1083 public:
1084
1085 //! \internal
1086 typedef ItemInternal* ItemInternalPtr;
1087
1088 //! \internal
1089 ARCANE_DEPRECATED_REASON("Y2022: This method is internal to Arcane and should not be used.")
1090 static ItemSharedInfo* _getSharedInfo(const ItemInternalPtr* items)
1091 {
1092 return ((items) ? items[0]->m_shared_info : ItemSharedInfo::nullInstance());
1093 }
1094
1095 private:
1096
1097 void _setSharedInfo(ItemSharedInfo* shared_infos, ItemTypeId type_id)
1098 {
1099 m_shared_info = shared_infos;
1100 shared_infos->_setTypeId(m_local_id, type_id.typeId());
1101 }
1102
1103 ItemInternal* _internalFace(Int32 index) const { return _connectivity()->_faceV2(m_local_id, index); }
1104 ItemInternal* _internalCell(Int32 index) const { return _connectivity()->_cellV2(m_local_id, index); }
1105 ItemInternal* _internalHParent(Int32 index) const { return _connectivity()->_hParentV2(m_local_id, index); }
1106 ItemInternal* _internalHChild(Int32 index) const { return _connectivity()->_hChildV2(m_local_id, index); }
1107};
1108
1109/*---------------------------------------------------------------------------*/
1110/*---------------------------------------------------------------------------*/
1111
1112ItemBase::
1113ItemBase(ItemInternal* x)
1114: m_local_id(x->m_local_id)
1115, m_shared_info(x->m_shared_info)
1116{}
1117
1118/*---------------------------------------------------------------------------*/
1119/*---------------------------------------------------------------------------*/
1120
1121MutableItemBase::
1122MutableItemBase(ItemInternal* x)
1123: ItemBase(x)
1124{}
1125
1126/*---------------------------------------------------------------------------*/
1127/*---------------------------------------------------------------------------*/
1128
1129inline ItemLocalId::
1130ItemLocalId(ItemInternal* item)
1131: m_local_id(item->localId())
1132{
1133}
1134
1135/*---------------------------------------------------------------------------*/
1136/*---------------------------------------------------------------------------*/
1137
1138// TODO: add type check
1139template <typename ItemType> inline ItemLocalIdT<ItemType>::
1141: ItemLocalId(item->localId())
1142{
1143}
1144
1145/*---------------------------------------------------------------------------*/
1146/*---------------------------------------------------------------------------*/
1147
1148inline ItemInternal* impl::ItemBase::
1149itemInternal() const
1150{
1151 if (m_local_id != NULL_ITEM_LOCAL_ID)
1152 return m_shared_info->m_items_internal[m_local_id];
1153 return ItemInternal::nullItem();
1154}
1155
1156/*---------------------------------------------------------------------------*/
1157/*---------------------------------------------------------------------------*/
1158
1159inline ItemInternal* impl::ItemBase::
1160_itemInternal() const
1161{
1162 if (m_local_id != NULL_ITEM_LOCAL_ID)
1163 return m_shared_info->m_items_internal[m_local_id];
1164 return ItemInternal::nullItem();
1165}
1166
1167/*---------------------------------------------------------------------------*/
1168/*---------------------------------------------------------------------------*/
1169
1170inline impl::ItemBase impl::ItemBase::
1171parentBase(Int32 index) const
1172{
1173 return ItemBase(m_shared_info->_parentV2(m_local_id, index));
1174}
1175
1176/*---------------------------------------------------------------------------*/
1177/*---------------------------------------------------------------------------*/
1178
1179inline impl::MutableItemBase impl::ItemBase::
1180toMutable()
1181{
1182 return MutableItemBase(m_local_id, m_shared_info);
1183}
1184
1185/*---------------------------------------------------------------------------*/
1186/*---------------------------------------------------------------------------*/
1187
1189itemLocalId() const
1190{
1191 return ItemLocalId(m_local_id);
1192}
1193
1194/*---------------------------------------------------------------------------*/
1195/*---------------------------------------------------------------------------*/
1196
1197/*!
1198 * \internal
1199 * \brief Methods for conversions between different entity management classes
1200 *
1201 * This class is temporary and internal to Arcane. Only 'friend' classes
1202 * can use it.
1203 */
1205{
1206 friend class SimdItemBase;
1207 friend class SimdItemDirectBase;
1208 friend class SimdItem;
1209 friend class SimdItemEnumeratorBase;
1210 friend class ItemVectorView;
1211 template <typename T> friend class ItemEnumeratorBaseT;
1212 friend class mesh::DynamicMeshKindInfos;
1213 friend class TotalviewAdapter;
1214 template <int Extent> friend class ItemConnectedListView;
1215
1216 private:
1217
1218 //! \internal
1219 typedef ItemInternal* ItemInternalPtr;
1220 static ItemSharedInfo* _getSharedInfo(const ItemInternal* item)
1221 {
1222 return item->m_shared_info;
1223 }
1224 static ItemSharedInfo* _getSharedInfo(const ItemInternalPtr* items, Int32 count)
1225 {
1226 return ((items && count > 0) ? items[0]->m_shared_info : ItemSharedInfo::nullInstance());
1227 }
1228 static const ItemInternalPtr* _getItemInternalPtr(ItemSharedInfo* shared_info)
1229 {
1230 ARCANE_CHECK_PTR(shared_info);
1231 return shared_info->m_items_internal.data();
1232 }
1233};
1234
1235/*---------------------------------------------------------------------------*/
1236/*---------------------------------------------------------------------------*/
1237
1238} // End namespace Arcane
1239
1240/*---------------------------------------------------------------------------*/
1241/*---------------------------------------------------------------------------*/
1242
1243#endif
Declarations of types on entities.
Modifiable view of an array of type T.
Constant view of an array of type T.
constexpr const_pointer data() const noexcept
Pointer to the allocated memory.
constexpr Integer size() const noexcept
Number of elements in the array.
Interface of an entity family.
Definition IItemFamily.h:83
Base class for mesh entities.
Integer nbEdge() const
Number of edges of the entity or number of edges connected to the entity (for nodes).
ItemLocalId itemLocalId() const
Local number (in the subdomain) of the entity.
bool isSuppressed() const
True if the entity is suppressed.
ItemUniqueId uniqueId() const
Unique number of the entity.
Int32 backCellId() const
Cell behind the entity (NULL_ITEM_LOCAL_ID if none).
eItemKind kind() const
Kind of the entity.
Integer nbCell() const
Number of cells connected to the entity (for nodes, edges, and faces).
bool isMasterFace() const
true if it is the master face of an interface
IItemFamily * family() const
Family the entity belongs to.
Int32 owner() const
Number of the owning subdomain of the entity.
bool isActive() const
Int32 level() const
MutableItemBase toMutable()
Mutable interface of this entity.
Int32 flags() const
Flags of the entity.
bool isShared() const
True if the entity is shared by other subdomains.
ItemBase backCell() const
Cell behind the entity (nullItem() if none).
bool isDetached() const
True if the entity is detached.
bool hasFlags(Int32 flags) const
Returns whether the flags flags are set for the entity.
Integer nbFace() const
Number of faces of the entity or number of faces connected to the entity (for nodes and edges).
bool isSubactive() const
impl::ItemIndexedListView< DynExtent > nodeList() const
Methods using the new connectivities to access connectivity information. Should not be used outside o...
ItemTypeInfo * typeInfo() const
Type of the entity.
Int16 typeId() const
Type of the entity.
Int32 nbHParent() const
Number of parents for AMR.
bool hasHChildren() const
bool isOwn() const
True if the entity belongs to the subdomain.
ItemTypeId itemTypeId() const
Type of the entity.
bool isAncestor() const
Int32 nbHChildren() const
Number of children for AMR.
bool isNull() const
True if the entity is the null entity.
Integer nbNode() const
Number of nodes of the entity.
ItemBase boundaryCell() const
Cell connected to the entity if the entity is a boundary entity (0 if none).
bool isBoundary() const
true if the entity is on the boundary
ItemInternalVectorView internalNodes() const
Methods using the new connectivities to access connectivity information. Should not be used outside o...
Int32 frontCellId() const
Cell in front of the entity (NULL_ITEM_LOCAL_ID if none).
Integer nbParent() const
Number of parent for sub-meshes.
bool null() const
True if the entity is the null entity.
ItemBase frontCell() const
Cell in front of the entity (nullItem() if none).
Int32 localId() const
Local number (in the subdomain) of the entity.
bool isSlaveFace() const
true if it is a slave face of an interface
Flags for entity characteristics.
Definition ItemFlags.h:39
@ II_FrontCellIsFirst
The first cell of the entity is the front cell.
Definition ItemFlags.h:54
@ II_MasterFace
The entity is a master face of an interface.
Definition ItemFlags.h:65
@ II_Inactive
The entity is inactive //COARSEN_INACTIVE,.
Definition ItemFlags.h:80
@ II_HasBackCell
The entity has a back cell.
Definition ItemFlags.h:53
@ II_Own
The entity is a domain-specific entity.
Definition ItemFlags.h:56
@ II_Suppressed
The entity has just been suppressed.
Definition ItemFlags.h:58
@ II_Detached
The entity is detached from the mesh.
Definition ItemFlags.h:66
@ II_Boundary
The entity is on the boundary.
Definition ItemFlags.h:51
@ II_SlaveFace
The entity is a slave face of an interface.
Definition ItemFlags.h:64
@ II_CoarsenInactive
The entity is inactive and has children tagged for coarsening.
Definition ItemFlags.h:81
@ II_HasFrontCell
The entity has a front cell.
Definition ItemFlags.h:52
@ II_BackCellIsFirst
The first cell of the entity is the back cell.
Definition ItemFlags.h:55
Int32ConstArrayView connectivityNbItem(Int32 item_kind) const
Array containing the number of connected entities for entities of kind item_kind.
Int32ConstArrayView connectivityList(Int32 item_kind) const
Array containing the connectivity list for entities of kind item_kind.
Int32 maxNbConnectedItem(Int32 item_kind) const
Maximum number of connected entities.
Int32ConstArrayView connectivityIndex(Int32 item_kind) const
Connectivity index array for entities of kind item_kind.
constexpr Integer minimumNeededMemory() const
Minimum memory required to store the entity information (without buffer).
constexpr Integer neededMemory() const
Memory required to store the entity information.
ItemInternal * boundaryCell() const
Connected cell to the entity if the entity is a boundary entity (0 if none).
ItemSharedInfo * sharedInfo() const
Shared information of the entity.
ItemInternal * frontCell() const
Cell in front of the entity (nullItem() if none).
ItemInternal * backCell() const
Cell behind the entity (nullItem() if none).
static ItemInternal nullItemInternal
Null entity.
Int32 * parentPtr()
Pointer to the list of parents.
Index of an ItemType entity in a variable.
Definition ItemLocalId.h:92
Index of an Item in a variable.
Definition ItemLocalId.h:42
Type of an entity (Item).
Definition ItemTypeId.h:33
Info on a mesh entity type.
Unique identifier of an entity.
Methods allowing modification of ItemBase.
void setOwner(Integer suid, Int32 current_sub_domain)
Sets the sub-domain number of the entity owner.
void setDetached(bool v)
Sets the detached state of the entity.
void setFlags(Int32 f)
Sets the entity flags.
void unsetUniqueId()
Nullifies the uniqueId to the value NULL_ITEM_UNIQUE_ID.
void setParent(Int32 aindex, Int32 parent_local_id)
Sets the i-th parent (currently aindex must be 0).
void addFlags(Int32 added_flags)
Adds the flags added_flags to those of the entity.
void removeFlags(Int32 removed_flags)
Removes the flags removed_flags from those of the entity.
Node of a mesh.
Definition Item.h:598
View of an array of elements of type T.
Definition Span.h:805
ItemLocalIdListViewT< Node > NodeLocalIdView
View over the localId() of a list of nodes.
Definition ItemTypes.h:407
ItemLocalIdListViewT< Edge > EdgeLocalIdView
View over the localId() of a list of edges.
Definition ItemTypes.h:417
ItemLocalIdListViewT< Face > FaceLocalIdView
View on the localIds() of a list of faces.
Definition ItemTypes.h:427
ItemLocalIdListViewT< Cell > CellLocalIdView
View on the localIds() of a list of cells.
Definition ItemTypes.h:437
Always enables tracing in Arcane parts concerning materials.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
eItemKind
Mesh entity type.
std::int16_t Int16
Signed integer type of 16 bits.
Array< Int32 > Int32Array
Dynamic one-dimensional array of 32-bit integers.
Definition UtilsTypes.h:127
std::int32_t Int32
Signed integer type of 32 bits.