Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Item.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/* Item.h (C) 2000-2025 */
9/* */
10/* Information about mesh elements. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ITEM_H
13#define ARCANE_CORE_ITEM_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18#include "arcane/core/ItemInternal.h"
19#include "arcane/core/ItemLocalId.h"
20
21#include <atomic>
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32// Macro to check in Check mode that conversions between the
33// entity kinds are correct.
34#ifdef ARCANE_CHECK
35#define ARCANE_CHECK_KIND(type) _checkKind(type())
36#else
37#define ARCANE_CHECK_KIND(type)
38#endif
39
40#ifdef ARCANE_CHECK
41#define ARCANE_WANT_ITEM_STAT
42#endif
43
44#ifdef ARCANE_WANT_ITEM_STAT
45#define ARCANE_ITEM_ADD_STAT(var) ++var
46#else
47#define ARCANE_ITEM_ADD_STAT(var)
48#endif
49
50/*---------------------------------------------------------------------------*/
51/*---------------------------------------------------------------------------*/
52
53/*!
54 * \brief Base class for a mesh element.
55 *
56 * \ingroup Mesh
57
58 Mesh elements are nodes (Node), cells (Cell),
59 faces (Face), edges (Edge), particles (Particle) or degrees of freedom (DoF).
60 Each of its elements is described
61 in the corresponding derived class.
62
63 This class and its derived classes are lightweight objects that are used by
64 value rather than by reference and should not be kept between two
65 modifications of the family (IItemFamily) they are associated with.
66
67 Regardless of its type, a mesh element has a unique identifier
68 (localId()) for its type and local to the managed subdomain and a unique identifier
69 (uniqueId()) for its type across the entire domain. The numbering is
70 <b>continuous</b> and starts at <b>0</b>. The local identifier is used, for example,
71 to access variables or for connectivity.
72
73 For example, if a mesh has 2 hexahedral cells that join
74 by a face, there are 12 nodes, 11 faces, and 2 cells. In this case, the first
75 node will have identifier 0, the second 1, and so on up to 11. The
76 first face will have identifier 0, the second 1, and so on
77 up to 10.
78
79 There is an entity corresponding to a null object. It is the only one
80 for which null() is true. No operation other than calling null() and comparison
81 operations is valid on the null entity.
82 */
83class ARCANE_CORE_EXPORT Item
84{
85 // To access private constructors
86 friend class ItemEnumeratorBaseT<Item>;
88 friend class ItemVector;
89 friend class ItemVectorView;
90 friend class ItemVectorViewConstIterator;
91 friend class ItemConnectedListViewConstIterator;
92 friend class SimdItem;
93 friend class SimdItemEnumeratorBase;
94 friend class ItemInfoListView;
95 friend class ItemLocalIdToItemConverter;
96 template <typename ItemType> friend class ItemLocalIdToItemConverterT;
97 friend class ItemPairEnumerator;
98 template <int Extent> friend class ItemConnectedListView;
99 template <typename ItemType> friend class ItemEnumeratorBaseT;
100
101 // To access _internal()
102 friend class ItemCompatibility;
103
104 public:
105
106 typedef ItemInternal* ItemInternalPtr;
107
108 //! Type of localId()
110
111 using ItemBase = impl::ItemBase;
112
113 public:
114
115 /*!
116 * \brief Index of an Item in a variable.
117 * \deprecated
118 */
119 class Index
120 {
121 // TODO Deprecate when we remove
122 // the obsolete derived classes.
123 // We cannot do this before because it generates too many
124 // compilation warnings.
125 public:
126
127 Index()
128 : m_local_id(NULL_ITEM_LOCAL_ID)
129 {}
130 explicit Index(Int32 id)
131 : m_local_id(id)
132 {}
133 Index(Item item)
134 : m_local_id(item.localId())
135 {}
136 operator ItemLocalId() const { return ItemLocalId{ m_local_id }; }
137
138 public:
139
140 Int32 localId() const { return m_local_id; }
141
142 private:
143
144 Int32 m_local_id;
145 };
146
147 public:
148
149 /*!
150 * \brief Element types.
151 *
152 * Type values must range from 0 to #NB_TYPE in steps of 1.
153 *
154 * \deprecated. Use types defined in ArcaneTypes.h
155 */
156 enum
157 {
158 Unknown ARCANE_DEPRECATED_REASON("Use 'IT_NullType' instead") = IT_NullType, //!< Null type element
159 Vertex ARCANE_DEPRECATED_REASON("Use 'IT_Vertex' instead") = IT_Vertex, //!< Node type element (1 vertex 1D, 2D and 3D)
160 Bar2 ARCANE_DEPRECATED_REASON("Use 'IT_Line2' instead") = IT_Line2, //!< Edge type element (2 vertices, 1D, 2D and 3D)
161 Tri3 ARCANE_DEPRECATED_REASON("Use 'IT_Triangle3' instead") = IT_Triangle3, //!< Triangle type element (3 vertices, 2D)
162 Quad4 ARCANE_DEPRECATED_REASON("Use 'IT_Quad4' instead") = IT_Quad4, //!< Quad type element (4 vertices, 2D)
163 Pentagon5 ARCANE_DEPRECATED_REASON("Use 'IT_Pentagon5' instead") = IT_Pentagon5, //!< Pentagon type element (5 vertices, 2D)
164 Hexagon6 ARCANE_DEPRECATED_REASON("Use 'IT_Hexagon6' instead") = IT_Hexagon6, //!< Hexagon type element (6 vertices, 2D)
165 Tetra ARCANE_DEPRECATED_REASON("Use 'IT_Tetraedron4' instead") = IT_Tetraedron4, //!< Tetrahedron type element (4 vertices, 3D)
166 Pyramid ARCANE_DEPRECATED_REASON("Use 'IT_Pyramid5' instead") = IT_Pyramid5, //!< Pyramid type element (5 vertices, 3D)
167 Penta ARCANE_DEPRECATED_REASON("Use 'IT_Pentaedron6' instead") = IT_Pentaedron6, //!< Pentahedron type element (6 vertices, 3D)
168 Hexa ARCANE_DEPRECATED_REASON("Use 'IT_Hexaedron8' instead") = IT_Hexaedron8, //!< Hexahedron type element (8 vertices, 3D)
169 Wedge7 ARCANE_DEPRECATED_REASON("Use 'IT_Heptaedron10' instead") = IT_Heptaedron10, //!< Prism type element with 7 faces (pentagonal base)
170 Wedge8 ARCANE_DEPRECATED_REASON("Use 'IT_Octaedron12' instead") = IT_Octaedron12 //!< Prism type element with 8 faces (hexagonal base)
171 // Reduced to minimum for compatibility.
172 };
173
174 //! Null element index
175 static const Int32 NULL_ELEMENT = NULL_ITEM_ID;
176
177 //! Cell type name \a cell_type
178 ARCCORE_DEPRECATED_2021("Use ItemTypeMng::typeName() instead")
179 static String typeName(Int32 type);
180
181 protected:
182
183 //! Constructor reserved for enumerators
184 constexpr ARCCORE_HOST_DEVICE Item(Int32 local_id, ItemSharedInfo* shared_info)
185 : m_shared_info(shared_info)
186 , m_local_id(local_id)
187 {}
188
189 public:
190
191 //! Creation of a null mesh entity
192 Item() = default;
193
194 //! Constructs a reference to the \a internal entity
195 //ARCANE_DEPRECATED_REASON("Remove this overload")
196 Item(ItemInternal* ainternal)
197 {
198 ARCANE_CHECK_PTR(ainternal);
199 m_shared_info = ainternal->m_shared_info;
200 m_local_id = ainternal->m_local_id;
201 ARCANE_ITEM_ADD_STAT(m_nb_created_from_internal);
202 }
203
204 // NOTE: For the following constructor; it is essential to use
205 // const& to avoid ambiguity with the copy constructor
206 //! Constructs a reference to the \a abase entity
207 constexpr ARCCORE_HOST_DEVICE Item(const ItemBase& abase)
208 : m_shared_info(abase.m_shared_info)
209 , m_local_id(abase.m_local_id)
210 {
211 }
212
213 //! Constructs a reference to the \a internal entity
214 Item(const ItemInternalPtr* internals, Int32 local_id)
215 : Item(local_id, internals[local_id]->m_shared_info)
216 {
217 ARCANE_ITEM_ADD_STAT(m_nb_created_from_internalptr);
218 }
219
220 //! Copy operator
222 {
223 _set(ainternal);
224 return (*this);
225 }
226
227 public:
228
229 //! \a true if the entity is null (i.e. not connected to the mesh)
230 constexpr bool null() const { return m_local_id == NULL_ITEM_ID; }
231
232 //! Local identifier of the entity in the processor subdomain
233 constexpr Int32 localId() const { return m_local_id; }
234
235 //! Local identifier of the entity in the processor subdomain
236 constexpr ItemLocalId itemLocalId() const { return ItemLocalId{ m_local_id }; }
237
238 //! Unique identifier across all domains
240 {
241#ifdef ARCANE_CHECK
242 if (m_local_id != NULL_ITEM_LOCAL_ID)
243 arcaneCheckAt((Integer)m_local_id, m_shared_info->m_unique_ids.size());
244#endif
245 // Do not use the normal accessor because this array may be used for the
246 // null cell and in this case m_local_id equals NULL_ITEM_LOCAL_ID (which is negative)
247 // which causes an exception for array overflow.
248 return ItemUniqueId(m_shared_info->m_unique_ids.data()[m_local_id]);
249 }
250
251 //! Owner subdomain number of the entity
252 Int32 owner() const { return m_shared_info->_ownerV2(m_local_id); }
253
254 //! Entity type
255 Int16 type() const { return m_shared_info->_typeId(m_local_id); }
256
257 //! Entity type
258 ItemTypeId itemTypeId() const { return ItemTypeId(type()); }
259
260 //! Family from which the entity originates
261 IItemFamily* itemFamily() const { return m_shared_info->m_item_family; }
262
263 //! Entity kind
264 constexpr eItemKind kind() const { return m_shared_info->m_item_kind; }
265
266 //! \a true if the entity belongs to the subdomain
267 constexpr bool isOwn() const { return (_flags() & ItemFlags::II_Own) != 0; }
268
269 /*!
270 * \brief True if the entity is shared by other subdomains.
271 *
272 * An entity is considered shared if and only if
273 * isOwn() is true and it is ghost for one or more
274 * other subdomains.
275 *
276 * This method is only relevant if the connectivity information
277 * has been calculated (by calling IItemFamily::computeSynchronizeInfos()).
278 */
279 bool isShared() const { return (_flags() & ItemFlags::II_Shared) != 0; }
280
281 //! Converts the entity to the \a ItemWithNodes kind.
282 inline ItemWithNodes toItemWithNodes() const;
283 //! Converts the entity to the \a Node kind.
284 inline Node toNode() const;
285 //! Converts the entity to the \a Cell kind.
286 inline Cell toCell() const;
287 //! Converts the entity to the \a Edge kind.
288 inline Edge toEdge() const;
289 //! Converts the entity to the \a Face kind.
290 inline Face toFace() const;
291 //! Converts the entity to the \a Particle kind.
292 inline Particle toParticle() const;
293 //! Converts the entity to the \a DoF kind.
294 inline DoF toDoF() const;
295
296 //! Number of parents for submeshes
297 Int32 nbParent() const { return _nbParent(); }
298
299 //! i-th parent for submeshes
300 Item parent(Int32 i) const { return m_shared_info->_parentV2(m_local_id, i); }
301
302 //! first parent for submeshes
303 Item parent() const { return m_shared_info->_parentV2(m_local_id, 0); }
304
305 public:
306
307 //! \a true if the entity is of the \a ItemWithNodes kind.
308 constexpr bool isItemWithNodes() const
309 {
310 eItemKind ik = kind();
311 return (ik == IK_Unknown || ik == IK_Edge || ik == IK_Face || ik == IK_Cell);
312 }
313
314 //! \a true if the entity is of the \a Node kind.
315 constexpr bool isNode() const
316 {
317 eItemKind ik = kind();
318 return (ik == IK_Unknown || ik == IK_Node);
319 }
320 //! \a true if the entity is of the \a Cell kind.
321 constexpr bool isCell() const
322 {
323 eItemKind ik = kind();
324 return (ik == IK_Unknown || ik == IK_Cell);
325 }
326 //! \a true if the entity is of the \a Edge kind.
327 constexpr bool isEdge() const
328 {
329 eItemKind ik = kind();
330 return (ik == IK_Unknown || ik == IK_Edge);
331 }
332 //! \a true if the entity is of the \a Face kind.
333 constexpr bool isFace() const
334 {
335 eItemKind ik = kind();
336 return (ik == IK_Unknown || ik == IK_Face);
337 }
338 //! \a true if the entity is of the \a Particle kind.
339 constexpr bool isParticle() const
340 {
341 eItemKind ik = kind();
342 return (ik == IK_Unknown || ik == IK_Particle);
343 }
344 constexpr //! \a true if the entity is of the \a DoF kind
345 bool isDoF() const
346 {
347 eItemKind ik = kind();
348 return (ik == IK_Unknown || ik == IK_DoF);
349 }
350
351 //! Returns if the \a flags are set for the entity
352 constexpr bool hasFlags(Int32 flags) const { return (_flags() & flags); }
353
354 //! Entity flags
355 constexpr Int32 flags() const { return m_shared_info->_flagsV2(m_local_id); }
356
357 public:
358
359 /*!
360 * \brief Internal part of the entity.
361 *
362 * \warning The internal part of the entity should only be modified by
363 * those who know what they are doing.
364 * \deprecated Use itemBase() or mutableItemBase() instead for
365 * cases where the returned instance is not kept.
366 */
367 ARCANE_DEPRECATED_REASON("Y2024: This method is internal to Arcane. use itemBase() or mutableItemBase() instead")
369 {
370 if (m_local_id != NULL_ITEM_LOCAL_ID)
371 return m_shared_info->m_items_internal[m_local_id];
372 return ItemInternal::nullItem();
373 }
374
375 public:
376
377 /*!
378 * \brief Internal part of the entity.
379 *
380 * \warning The internal part of the entity should only be modified by
381 * those who know what they are doing.
382 */
383 impl::ItemBase itemBase() const
384 {
385 return impl::ItemBase(m_local_id, m_shared_info);
386 }
387
388 /*!
389 * \brief Mutable internal part of the entity.
390 *
391 * \warning The internal part of the entity should only be modified by
392 * those who know what they are doing.
393 */
394 impl::MutableItemBase mutableItemBase() const
395 {
396 return impl::MutableItemBase(m_local_id, m_shared_info);
397 }
398
399 /*!
400 * \brief Information about the entity type.
401 *
402 * This method allows obtaining information concerning
403 * a given entity type, such as the local numbering
404 * of its faces or edges.
405 */
406 const ItemTypeInfo* typeInfo() const { return m_shared_info->typeInfoFromId(type()); }
407
408 public:
409
410 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
411 Item* operator->() { return this; }
412
413 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
414 const Item* operator->() const { return this; }
415
416 private:
417
418 //! Shared information among all entities with the same characteristics
419 ItemSharedInfo* m_shared_info = ItemSharedInfo::nullItemSharedInfoPointer;
420
421 protected:
422
423 /*!
424 * \brief Local number (in the subdomain) of the entity.
425 *
426 * For performance reasons, the local number must be
427 * the first field of the class.
428 */
429 Int32 m_local_id = NULL_ITEM_LOCAL_ID;
430
431 protected:
432
433 constexpr void _checkKind(bool is_valid) const
434 {
435 if (!is_valid)
436 _badConversion();
437 }
438 [[noreturn]] void _badConversion() const;
439 void _set(ItemInternal* ainternal)
440 {
441 _setFromInternal(ainternal);
442 }
443 constexpr void _set(const Item& rhs)
444 {
445 _setFromItem(rhs);
446 }
447
448 protected:
449
450 //! Entity flags
451 constexpr Int32 _flags() const { return m_shared_info->_flagsV2(m_local_id); }
452 //! Number of nodes of the entity
453 constexpr Integer _nbNode() const { return _connectivity()->_nbNodeV2(m_local_id); }
454 //! Number of edges of the entity or number of edges connected to the entity (for nodes)
455 constexpr Integer _nbEdge() const { return _connectivity()->_nbEdgeV2(m_local_id); }
456 //! Number of faces of the entity or number of faces connected to the entity (for nodes and edges)
457 constexpr Integer _nbFace() const { return _connectivity()->_nbFaceV2(m_local_id); }
458 //! Number of cells connected to the entity (for nodes, edges and faces)
459 constexpr Integer _nbCell() const { return _connectivity()->_nbCellV2(m_local_id); }
460 //! Number of parents for AMR
461 Int32 _nbHParent() const { return _connectivity()->_nbHParentV2(m_local_id); }
462 //! Number of children for AMR
463 Int32 _nbHChildren() const { return _connectivity()->_nbHChildrenV2(m_local_id); }
464 //! Number of parents for submeshes
465 Integer _nbParent() const { return m_shared_info->nbParent(); }
466 constexpr NodeLocalId _nodeId(Int32 index) const { return NodeLocalId(_connectivity()->_nodeLocalIdV2(m_local_id, index)); }
467 constexpr EdgeLocalId _edgeId(Int32 index) const { return EdgeLocalId(_connectivity()->_edgeLocalIdV2(m_local_id, index)); }
468 constexpr FaceLocalId _faceId(Int32 index) const { return FaceLocalId(_connectivity()->_faceLocalIdV2(m_local_id, index)); }
469 constexpr CellLocalId _cellId(Int32 index) const { return CellLocalId(_connectivity()->_cellLocalIdV2(m_local_id, index)); }
470 Int32 _hParentId(Int32 index) const { return _connectivity()->_hParentLocalIdV2(m_local_id, index); }
471 Int32 _hChildId(Int32 index) const { return _connectivity()->_hChildLocalIdV2(m_local_id, index); }
472 impl::ItemIndexedListView<DynExtent> _nodeList() const { return _connectivity()->nodeList(m_local_id); }
473 impl::ItemIndexedListView<DynExtent> _edgeList() const { return _connectivity()->edgeList(m_local_id); }
474 impl::ItemIndexedListView<DynExtent> _faceList() const { return _connectivity()->faceList(m_local_id); }
475 impl::ItemIndexedListView<DynExtent> _cellList() const { return _connectivity()->cellList(m_local_id); }
476 NodeLocalIdView _nodeIds() const { return _connectivity()->nodeLocalIdsView(m_local_id); }
477 EdgeLocalIdView _edgeIds() const { return _connectivity()->edgeLocalIdsView(m_local_id); }
478 FaceLocalIdView _faceIds() const { return _connectivity()->faceLocalIdsView(m_local_id); }
479 CellLocalIdView _cellIds() const { return _connectivity()->cellLocalIdsView(m_local_id); }
480
481 constexpr inline Node _node(Int32 index) const;
482 constexpr inline Edge _edge(Int32 index) const;
483 constexpr inline Face _face(Int32 index) const;
484 constexpr inline Cell _cell(Int32 index) const;
485
486 ItemBase _hParentBase(Int32 index) const { return _connectivity()->hParentBase(m_local_id, index, m_shared_info); }
487 ItemBase _hChildBase(Int32 index) const { return _connectivity()->hChildBase(m_local_id, index, m_shared_info); }
488 ItemBase _toItemBase() const { return ItemBase(m_local_id, m_shared_info); }
489
490 //! Number of nodes of the entity
491 Int32 _nbLinearNode() const { return itemBase()._nbLinearNode(); }
492
493 private:
494
495 constexpr ItemInternalConnectivityList* _connectivity() const
496 {
497 return m_shared_info->m_connectivity;
498 }
499 void _setFromInternal(ItemBase* rhs)
500 {
501 ARCANE_ITEM_ADD_STAT(m_nb_set_from_internal);
502 m_local_id = rhs->m_local_id;
503 m_shared_info = rhs->m_shared_info;
504 }
505 constexpr void _setFromItem(const Item& rhs)
506 {
507 m_local_id = rhs.m_local_id;
508 m_shared_info = rhs.m_shared_info;
509 }
510
511 public:
512
513 static void dumpStats(ITraceMng* tm);
514 static void resetStats();
515
516 private:
517
518 static std::atomic<int> m_nb_created_from_internal;
519 static std::atomic<int> m_nb_created_from_internalptr;
520 static std::atomic<int> m_nb_set_from_internal;
521
522 private:
523
524 ItemInternal* _internal() const
525 {
526 if (m_local_id != NULL_ITEM_LOCAL_ID)
527 return m_shared_info->m_items_internal[m_local_id];
528 return ItemInternal::nullItem();
529 }
530};
531
532/*---------------------------------------------------------------------------*/
533/*---------------------------------------------------------------------------*/
534
535/*!
536 * \brief Compare two entities.
537 *
538 * \retval true if they are identical (same localId())
539 * \retval false otherwise
540 */
541inline bool
542operator==(const Item& item1, const Item& item2)
543{
544 return item1.localId() == item2.localId();
545}
546
547/*!
548 * \brief Compare two entities.
549 *
550 * \retval true if they are different (different localId())
551 * \retval false otherwise
552 */
553inline bool
554operator!=(const Item& item1, const Item& item2)
555{
556 return item1.localId() != item2.localId();
557}
558
559/*!
560 * \brief Compare two entities.
561 *
562 * \retval true if they are less than (based on localId())
563 * \retval false otherwise
564 */
565inline bool
566operator<(const Item& item1, const Item& item2)
567{
568 return item1.localId() < item2.localId();
569}
570
571/*---------------------------------------------------------------------------*/
572/*---------------------------------------------------------------------------*/
573
574} // End namespace Arcane
575
576/*---------------------------------------------------------------------------*/
577/*---------------------------------------------------------------------------*/
578
579#include "arcane/core/ItemVectorView.h"
580#include "arcane/core/ItemConnectedListView.h"
581
582/*---------------------------------------------------------------------------*/
583/*---------------------------------------------------------------------------*/
584
585namespace Arcane
586{
587
588/*---------------------------------------------------------------------------*/
589/*---------------------------------------------------------------------------*/
590
591/*!
592 * \brief Node of a mesh.
593 *
594 * \ingroup Mesh
595 */
596class ARCANE_CORE_EXPORT Node
597: public Item
598{
599 using ThatClass = Node;
600 // For accessing private constructors
601 friend class ItemEnumeratorBaseT<ThatClass>;
602 friend class ItemConnectedEnumeratorBaseT<ThatClass>;
603 friend class ItemVectorT<ThatClass>;
604 friend class ItemVectorViewT<ThatClass>;
605 friend class ItemConnectedListViewT<ThatClass>;
606 friend class ItemVectorViewConstIteratorT<ThatClass>;
607 friend class ItemConnectedListViewConstIteratorT<ThatClass>;
608 friend class SimdItemT<ThatClass>;
609 friend class ItemInfoListViewT<ThatClass>;
610 friend class ItemLocalIdToItemConverterT<ThatClass>;
611
612 public:
613
614 /*!
615 * \brief Index of a Node in a variable.
616 * \deprecated
617 */
618 class ARCANE_DEPRECATED_REASON("Y2024: Use NodeLocalId instead") Index
619 : public Item::Index
620 {
621 public:
622
623 typedef Item::Index Base;
624
625 public:
626
627 explicit Index(Int32 id)
628 : Base(id)
629 {}
630 Index(Node item)
631 : Base(item)
632 {}
633 operator NodeLocalId() const { return NodeLocalId{ localId() }; }
634 };
635
636 protected:
637
638 //! Constructor reserved for enumerators
639 constexpr Node(Int32 local_id, ItemSharedInfo* shared_info)
640 : Item(local_id, shared_info)
641 {}
642
643 public:
644
645 //! Type of localId()
646 typedef NodeLocalId LocalIdType;
647
648 //! Creation of a node not connected to the mesh
649 Node() = default;
650
651 //! (deprecated) Constructs a reference to the entity \a internal
652 Node(ItemInternal* ainternal)
653 : Item(ainternal)
654 {
655 ARCANE_CHECK_KIND(isNode);
656 }
657
658 //! Constructs a reference to the entity \a abase
659 constexpr Node(const ItemBase& abase)
660 : Item(abase)
661 {
662 ARCANE_CHECK_KIND(isNode);
663 }
664
665 //! Constructs a reference to the entity \a abase
666 constexpr explicit Node(const Item& aitem)
667 : Item(aitem)
668 {
669 ARCANE_CHECK_KIND(isNode);
670 }
671
672 //! Constructs a reference to the entity \a internal
673 Node(const ItemInternalPtr* internals, Int32 local_id)
674 : Item(internals, local_id)
675 {
676 ARCANE_CHECK_KIND(isNode);
677 }
678
679 //! Copy operator
681 {
682 _set(ainternal);
683 return (*this);
684 }
685
686 public:
687
688 //! Kind of the entity
689 constexpr eItemKind kind() const { return IK_Node; }
690
691 //! Local identifier of the entity in the processor subdomain
692 constexpr NodeLocalId itemLocalId() const { return NodeLocalId{ m_local_id }; }
693
694 //! Number of edges connected to the node
695 constexpr Int32 nbEdge() const { return _nbEdge(); }
696
697 //! Number of faces connected to the node
698 constexpr Int32 nbFace() const { return _nbFace(); }
699
700 //! Number of cells connected to the node
701 Int32 nbCell() const { return _nbCell(); }
702
703 //! i-th edge of the node
704 inline Edge edge(Int32 i) const;
705
706 //! i-th face of the node
707 inline Face face(Int32 i) const;
708
709 //! i-th cell of the node
710 inline Cell cell(Int32 i) const;
711
712 //! i-th edge of the node
713 EdgeLocalId edgeId(Int32 i) const { return _edgeId(i); }
714
715 //! i-th face of the node
716 FaceLocalId faceId(Int32 i) const { return _faceId(i); }
717
718 //! i-th cell of the node
719 CellLocalId cellId(Int32 i) const { return _cellId(i); }
720
721 //! List of edges of the node
722 EdgeConnectedListViewType edges() const { return _edgeList(); }
723
724 //! List of faces of the node
725 FaceConnectedListViewType faces() const { return _faceList(); }
726
727 //! List of cells of the node
728 CellConnectedListViewType cells() const { return _cellList(); }
729
730 //! List of edges of the node
731 EdgeLocalIdView edgeIds() const { return _edgeIds(); }
732
733 //! List of faces of the node
734 FaceLocalIdView faceIds() const { return _faceIds(); }
735
736 //! List of cells of the node
737 CellLocalIdView cellIds() const { return _cellIds(); }
738
739 // AMR
740
741 //! Enumerates the cells connected to the node
743 {
744 return _toItemBase()._internalActiveCells2(local_ids);
745 }
746
747 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
748 Node* operator->() { return this; }
749
750 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
751 const Node* operator->() const { return this; }
752};
753
754/*---------------------------------------------------------------------------*/
755/*---------------------------------------------------------------------------*/
756
757constexpr inline Node Item::
758_node(Int32 index) const
759{
760 return Node(_connectivity()->nodeBase(m_local_id, index));
761}
762
763/*---------------------------------------------------------------------------*/
764/*---------------------------------------------------------------------------*/
765
766/*!
767 * \brief Mesh element based on nodes (Edge,Face,Cell).
768 *
769 * \ingroup Mesh
770 */
771class ARCANE_CORE_EXPORT ItemWithNodes
772: public Item
773{
774 using ThatClass = ItemWithNodes;
775 // For accessing private constructors
776 friend class ItemEnumeratorBaseT<ThatClass>;
777 friend class ItemConnectedEnumeratorBaseT<ThatClass>;
778 friend class ItemVectorT<ThatClass>;
779 friend class ItemVectorViewT<ThatClass>;
780 friend class ItemConnectedListViewT<ThatClass>;
781 friend class ItemVectorViewConstIteratorT<ThatClass>;
782 friend class ItemConnectedListViewConstIteratorT<ThatClass>;
783 friend class SimdItemT<ThatClass>;
784 friend class ItemInfoListViewT<ThatClass>;
785 friend class ItemLocalIdToItemConverterT<ThatClass>;
786
787 protected:
788
789 //! Constructor reserved for enumerators
790 constexpr ItemWithNodes(Int32 local_id, ItemSharedInfo* shared_info)
791 : Item(local_id, shared_info)
792 {}
793
794 public:
795
796 //! Creation of an entity not connected to the mesh
797 ItemWithNodes() = default;
798
799 //! (deprecated) Constructs a reference to the entity \a internal
801 : Item(ainternal)
802 {
803 ARCANE_CHECK_KIND(isItemWithNodes);
804 }
805
806 //! Constructs a reference to the entity \a abase
807 constexpr ItemWithNodes(const ItemBase& abase)
808 : Item(abase)
809 {
810 ARCANE_CHECK_KIND(isItemWithNodes);
811 }
812
813 //! Constructs a reference to the entity \a aitem
814 constexpr explicit ItemWithNodes(const Item& aitem)
815 : Item(aitem)
816 {
817 ARCANE_CHECK_KIND(isItemWithNodes);
818 }
819
820 //! Constructs a reference to the entity \a internal
821 ItemWithNodes(const ItemInternalPtr* internals, Int32 local_id)
822 : Item(internals, local_id)
823 {
824 ARCANE_CHECK_KIND(isItemWithNodes);
825 }
826
827 //! Copy operator
829 {
830 _set(ainternal);
831 return (*this);
832 }
833
834 public:
835
836 //! Number of nodes of the entity
837 Int32 nbNode() const { return _nbNode(); }
838
839 //! i-th node of the entity
840 Node node(Int32 i) const { return _node(i); }
841
842 //! List of nodes of the entity
843 NodeConnectedListViewType nodes() const { return _nodeList(); }
844
845 //! List of nodes of the entity
846 NodeLocalIdView nodeIds() const { return _nodeIds(); }
847
848 //! i-th node of the entity.
849 NodeLocalId nodeId(Int32 index) const { return _nodeId(index); }
850
851 //! Number of nodes of the associated linear entity (if entity order 2 or more)
852 Int32 nbLinearNode() const { return _nbLinearNode(); }
853
854 public:
855
856 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
857 ItemWithNodes* operator->() { return this; }
858
859 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
860 const ItemWithNodes* operator->() const { return this; }
861};
862
863/*---------------------------------------------------------------------------*/
864/*---------------------------------------------------------------------------*/
865
866/*!
867 * \brief Edge of a cell.
868 *
869 * Edges only exist in 3D. In 2D, you must use the 'Face' structure.
870 *
871 * \ingroup Mesh
872 */
873class ARCANE_CORE_EXPORT Edge
874: public ItemWithNodes
875{
876 using ThatClass = Edge;
877 // For accessing private constructors
878 friend class ItemEnumeratorBaseT<ThatClass>;
879 friend class ItemConnectedEnumeratorBaseT<ThatClass>;
880 friend class ItemVectorT<ThatClass>;
881 friend class ItemVectorViewT<ThatClass>;
882 friend class ItemConnectedListViewT<ThatClass>;
883 friend class ItemVectorViewConstIteratorT<ThatClass>;
884 friend class ItemConnectedListViewConstIteratorT<ThatClass>;
885 friend class SimdItemT<ThatClass>;
886 friend class ItemInfoListViewT<ThatClass>;
887 friend class ItemLocalIdToItemConverterT<ThatClass>;
888
889 public:
890
891 /*!
892 * \brief Index of an Edge in a variable.
893 * \deprecated
894 */
895 class ARCANE_DEPRECATED_REASON("Y2024: Use EdgeLocalId instead") Index
896 : public Item::Index
897 {
898 public:
899
900 typedef Item::Index Base;
901
902 public:
903
904 explicit Index(Int32 id)
905 : Base(id)
906 {}
907 Index(Edge item)
908 : Base(item)
909 {}
910 operator EdgeLocalId() const { return EdgeLocalId{ localId() }; }
911 };
912
913 private:
914
915 //! Constructor reserved for enumerators
916 Edge(Int32 local_id, ItemSharedInfo* shared_info)
917 : ItemWithNodes(local_id, shared_info)
918 {}
919
920 public:
921
922 //! Type of localId()
923 typedef EdgeLocalId LocalIdType;
924
925 //! Creates a null edge
926 Edge() = default;
927
928 //! (deprecated) Constructs a reference to the entity \a internal
929 Edge(ItemInternal* ainternal)
930 : ItemWithNodes(ainternal)
931 {
932 ARCANE_CHECK_KIND(isEdge);
933 }
934
935 //! Constructs a reference to the entity \a abase
936 constexpr Edge(const ItemBase& abase)
937 : ItemWithNodes(abase)
938 {
939 ARCANE_CHECK_KIND(isEdge);
940 }
941
942 //! Constructs a reference to the entity \a aitem
943 constexpr explicit Edge(const Item& aitem)
944 : ItemWithNodes(aitem)
945 {
946 ARCANE_CHECK_KIND(isEdge);
947 }
948
949 //! Constructs a reference to the entity \a internal
950 Edge(const ItemInternalPtr* internals, Int32 local_id)
951 : ItemWithNodes(internals, local_id)
952 {
953 ARCANE_CHECK_KIND(isEdge);
954 }
955
956 //! Copy operator
957 Edge& operator=(ItemInternal* ainternal)
958 {
959 _set(ainternal);
960 return (*this);
961 }
962
963 public:
964
965 //! Kind of the entity
966 constexpr eItemKind kind() const { return IK_Edge; }
967
968 //! Local identifier of the entity in the processor subdomain
969 EdgeLocalId itemLocalId() const { return EdgeLocalId{ m_local_id }; }
970
971 //! Number of vertices of the edge
972 Int32 nbNode() const { return 2; }
973
974 //! Number of faces connected to the edge
975 Int32 nbFace() const { return _nbFace(); }
976
977 //! Number of cells connected to the edge
978 Int32 nbCell() const { return _nbCell(); }
979
980 //! i-th cell of the edge
981 inline Cell cell(Int32 i) const;
982
983 //! List of edge cells
984 CellConnectedListViewType cells() const { return _cellList(); }
985
986 //! i-th edge cell
987 CellLocalId cellId(Int32 i) const { return _cellId(i); }
988
989 //! List of edge cells
990 CellLocalIdView cellIds() const { return _cellIds(); }
991
992 //! i-th face of the edge
993 inline Face face(Int32 i) const;
994
995 //! List of faces of the edge
996 FaceConnectedListViewType faces() const { return _faceList(); }
997
998 //! i-th face of the edge
999 FaceLocalId faceId(Int32 i) const { return _faceId(i); }
1000
1001 //! List of faces of the edge
1002 FaceLocalIdView faceIds() const { return _faceIds(); }
1003
1004 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
1005 Edge* operator->() { return this; }
1006
1007 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
1008 const Edge* operator->() const { return this; }
1009};
1010
1011/*---------------------------------------------------------------------------*/
1012/*---------------------------------------------------------------------------*/
1013
1014constexpr inline Edge Item::
1015_edge(Int32 index) const
1016{
1017 return Edge(_connectivity()->edgeBase(m_local_id, index));
1018}
1019
1020/*---------------------------------------------------------------------------*/
1021/*---------------------------------------------------------------------------*/
1022
1023/*!
1024 * \brief Face of a cell.
1025 *
1026 * \ingroup Mesh
1027 *
1028 A face is described by the ordered list of its nodes, which gives it an orientation.
1029 */
1030class ARCANE_CORE_EXPORT Face
1031: public ItemWithNodes
1032{
1033 using ThatClass = Face;
1034 // To access private constructors
1035 friend class ItemEnumeratorBaseT<ThatClass>;
1036 friend class ItemConnectedEnumeratorBaseT<ThatClass>;
1037 friend class ItemVectorT<ThatClass>;
1038 friend class ItemVectorViewT<ThatClass>;
1039 friend class ItemConnectedListViewT<ThatClass>;
1040 friend class ItemVectorViewConstIteratorT<ThatClass>;
1041 friend class ItemConnectedListViewConstIteratorT<ThatClass>;
1042 friend class SimdItemT<ThatClass>;
1043 friend class ItemInfoListViewT<ThatClass>;
1044 friend class ItemLocalIdToItemConverterT<ThatClass>;
1045
1046 public:
1047
1048 /*!
1049 * \brief Index of a Face in a variable.
1050 * \deprecated
1051 */
1052 class ARCANE_DEPRECATED_REASON("Y2024: Use FaceLocalId instead") Index
1053 : public Item::Index
1054 {
1055 public:
1056
1057 typedef Item::Index Base;
1058
1059 public:
1060
1061 explicit Index(Int32 id)
1062 : Base(id)
1063 {}
1064 Index(Face item)
1065 : Base(item)
1066 {}
1067 operator FaceLocalId() const { return FaceLocalId{ localId() }; }
1068 };
1069
1070 private:
1071
1072 //! Constructor reserved for enumerators
1073 constexpr Face(Int32 local_id, ItemSharedInfo* shared_info)
1074 : ItemWithNodes(local_id, shared_info)
1075 {}
1076
1077 public:
1078
1079 //! Type of localId()
1080 typedef FaceLocalId LocalIdType;
1081
1082 //! Creation of a face not connected to the mesh
1083 Face() = default;
1084
1085 //! (deprecated) Constructs a reference to the \a internal entity
1086 Face(ItemInternal* ainternal)
1087 : ItemWithNodes(ainternal)
1088 {
1089 ARCANE_CHECK_KIND(isFace);
1090 }
1091
1092 //! Constructs a reference to the \a base entity
1093 constexpr Face(const ItemBase& abase)
1094 : ItemWithNodes(abase)
1095 {
1096 ARCANE_CHECK_KIND(isFace);
1097 }
1098
1099 //! Constructs a reference to the \a item entity
1100 constexpr explicit Face(const Item& aitem)
1101 : ItemWithNodes(aitem)
1102 {
1103 ARCANE_CHECK_KIND(isFace);
1104 }
1105
1106 //! Constructs a reference to the \a internal entity
1107 Face(const ItemInternalPtr* internals, Int32 local_id)
1108 : ItemWithNodes(internals, local_id)
1109 {
1110 ARCANE_CHECK_KIND(isFace);
1111 }
1112
1113 //! Copy operator
1114 Face& operator=(ItemInternal* ainternal)
1115 {
1116 _set(ainternal);
1117 return (*this);
1118 }
1119
1120 public:
1121
1122 //! Entity kind
1123 constexpr eItemKind kind() const { return IK_Face; }
1124
1125 //! Local identifier of the entity in the processor subdomain
1126 FaceLocalId itemLocalId() const { return FaceLocalId{ m_local_id }; }
1127
1128 //! Number of cells of the face (1 or 2)
1129 Int32 nbCell() const { return _nbCell(); }
1130
1131 //! i-th cell of the face
1132 inline Cell cell(Int32 i) const;
1133
1134 //! List of cells of the face
1135 CellConnectedListViewType cells() const { return _cellList(); }
1136
1137 //! i-th cell of the face
1138 CellLocalId cellId(Int32 i) const { return _cellId(i); }
1139
1140 //! List of cells of the face
1141 CellLocalIdView cellIds() const { return _cellIds(); }
1142
1143 /*!
1144 * \brief Indicates if the face is on the subdomain boundary (i.e nbCell()==1)
1145 *
1146 * \warning A face on the subdomain boundary is not necessarily on the global mesh boundary.
1147 */
1148 bool isSubDomainBoundary() const { return (_flags() & ItemFlags::II_Boundary) != 0; }
1149
1150 /*!
1151 * \a true if the face is on the subdomain boundary.
1152 * \deprecated Use isSubDomainBoundary() instead.
1153 */
1154 ARCANE_DEPRECATED_118 bool isBoundary() const { return isSubDomainBoundary(); }
1155
1156 //! Indicates if the face is on the subdomain boundary facing outwards.
1158 {
1160 }
1161
1162 /*!
1163 * \brief Indicates if the face is on the subdomain boundary facing outwards.
1164 *
1165 * \deprecated Use isSubDomainBoundaryOutside()
1166 */
1167 ARCANE_DEPRECATED_118 bool isBoundaryOutside() const
1168 {
1170 }
1171
1172 //! Cell associated with this boundary face (null cell if none)
1173 inline Cell boundaryCell() const;
1174
1175 //! Cell behind the face (null cell if none)
1176 inline Cell backCell() const;
1177
1178 //! Cell behind the face (null cell if none)
1179 CellLocalId backCellId() const { return CellLocalId(_toItemBase().backCellId()); }
1180
1181 //! Cell in front of the face (null cell if none)
1182 inline Cell frontCell() const;
1183
1184 //! Cell in front of the face (null cell if none)
1185 CellLocalId frontCellId() const { return CellLocalId(_toItemBase().frontCellId()); }
1186
1187 /*!
1188 * \brief Opposite cell of this face to the cell \a cell.
1189 *
1190 * \pre backCell()==cell || frontCell()==cell.
1191 */
1192 inline Cell oppositeCell(Cell cell) const;
1193
1194 /*!
1195 * \brief Opposite cell of this face to the cell \a cell.
1196 *
1197 * \pre backCell()==cell || frontCell()==cell.
1198 */
1199 CellLocalId oppositeCellId(CellLocalId cell_id) const
1200 {
1201 ARCANE_ASSERT((backCellId() == cell_id || frontCellId() == cell_id), ("cell is not connected to the face"));
1202 return (backCellId() == cell_id) ? frontCellId() : backCellId();
1203 }
1204
1205 /*!
1206 * \brief Master face associated with this face.
1207 *
1208 * This face is non-null only if the face is tied to an interface
1209 * and is a slave face of that interface (i.e. isSlaveFace() is true)
1210 *
1211 * \sa ITiedInterface
1212 */
1213 Face masterFace() const { return _toItemBase().masterFace(); }
1214
1215 //! \a true if it is the master face of an interface
1216 bool isMasterFace() const { return _toItemBase().isMasterFace(); }
1217
1218 //! \a true if it is a slave face of an interface
1219 bool isSlaveFace() const { return _toItemBase().isSlaveFace(); }
1220
1221 //! \a true if it is a slave or master face of an interface
1222 bool isTiedFace() const { return isSlaveFace() || isMasterFace(); }
1223
1224 /*!
1225 * \brief List of slave faces associated with this master face.
1226 *
1227 * This list only exists for faces where isMasterFace() is true.
1228 * For others, it is empty.
1229 */
1231 {
1232 if (_toItemBase().isMasterFace())
1233 return _faceList();
1235 }
1236
1237 public:
1238
1239 //! Number of edges of the face
1240 Int32 nbEdge() const { return _nbEdge(); }
1241
1242 //! i-th edge of the face
1243 Edge edge(Int32 i) const { return _edge(i); }
1244
1245 //! List of edges of the face
1246 EdgeConnectedListViewType edges() const { return _edgeList(); }
1247
1248 //! i-th edge of the face
1249 EdgeLocalId edgeId(Int32 i) const { return _edgeId(i); }
1250
1251 //! List of edges of the face
1252 EdgeLocalIdView edgeIds() const { return _edgeIds(); }
1253
1254 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
1255 Face* operator->() { return this; }
1256
1257 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
1258 const Face* operator->() const { return this; }
1259};
1260
1261/*---------------------------------------------------------------------------*/
1262/*---------------------------------------------------------------------------*/
1263
1264constexpr inline Face Item::
1265_face(Int32 index) const
1266{
1267 return Face(_connectivity()->faceBase(m_local_id, index));
1268}
1269
1270/*---------------------------------------------------------------------------*/
1271/*---------------------------------------------------------------------------*/
1272
1273/*!
1274 * \brief Cell of a mesh.
1275 *
1276 * \ingroup Mesh
1277 *
1278 Each cell uses memory to store its connectivity. This allows modules to
1279 write their loop identically regardless of the cell type. Initially, this
1280 is the simplest mechanism. It may be possible later to use template classes
1281 to process the same information statically (i.e., all connectivity is
1282 managed at compile time).
1283
1284 Connectivity uses the <b>local</b> numbering of the cell's nodes. It is
1285 stored in the class variables #global_face_list for faces and
1286 #global_edge_list for edges.
1287
1288 The connectivity used is that described in the LIMA notice version 3.1,
1289 with the difference that the numbering starts at zero and not at one.
1290
1291 Since LIMA does not describe the pyramid, the numbering used is that of
1292 the degenerate hexahedron, considering that nodes 4, 5, 6, and 7 are the
1293 pyramid's apex.
1294
1295 In the current version (1.6), edges are not taken into account globally
1296 (i.e.: there are no Edge entities per cell).
1297*/
1298class ARCANE_CORE_EXPORT Cell
1299: public ItemWithNodes
1300{
1301 using ThatClass = Cell;
1302 // To access private constructors
1303 friend class ItemEnumeratorBaseT<ThatClass>;
1304 friend class ItemConnectedEnumeratorBaseT<ThatClass>;
1305 friend class ItemVectorT<ThatClass>;
1306 friend class ItemVectorViewT<ThatClass>;
1307 friend class ItemConnectedListViewT<ThatClass>;
1308 friend class ItemVectorViewConstIteratorT<ThatClass>;
1309 friend class ItemConnectedListViewConstIteratorT<ThatClass>;
1310 friend class SimdItemT<ThatClass>;
1311 friend class ItemInfoListViewT<ThatClass>;
1312 friend class ItemLocalIdToItemConverterT<ThatClass>;
1313
1314 public:
1315
1316 /*!
1317 * \brief Index of a Cell in a variable.
1318 * \deprecated
1319 */
1320 class ARCANE_DEPRECATED_REASON("Y2024: Use CellLocalId instead") Index
1321 : public Item::Index
1322 {
1323 public:
1324
1325 typedef Item::Index Base;
1326
1327 public:
1328
1329 explicit Index(Int32 id)
1330 : Base(id)
1331 {}
1332 Index(Cell item)
1333 : Base(item)
1334 {}
1335 operator CellLocalId() const { return CellLocalId{ localId() }; }
1336 };
1337
1338 private:
1339
1340 //! Constructor reserved for enumerators
1341 Cell(Int32 local_id, ItemSharedInfo* shared_info)
1342 : ItemWithNodes(local_id, shared_info)
1343 {}
1344
1345 public:
1346
1347 //! Type of localId()
1348 typedef CellLocalId LocalIdType;
1349
1350 //! Constructor of a null cell
1351 Cell() = default;
1352
1353 //! (deprecated) Constructs a reference to the \a internal entity
1354 Cell(ItemInternal* ainternal)
1355 : ItemWithNodes(ainternal)
1356 {
1357 ARCANE_CHECK_KIND(isCell);
1358 }
1359
1360 //! Constructs a reference to the \a base entity
1361 constexpr Cell(const ItemBase& abase)
1362 : ItemWithNodes(abase)
1363 {
1364 ARCANE_CHECK_KIND(isCell);
1365 }
1366
1367 //! Constructs a reference to the \a item entity
1368 constexpr explicit Cell(const Item& aitem)
1369 : ItemWithNodes(aitem)
1370 {
1371 ARCANE_CHECK_KIND(isCell);
1372 }
1373
1374 //! Constructs a reference to the \a internal entity
1375 Cell(const ItemInternalPtr* internals, Int32 local_id)
1376 : ItemWithNodes(internals, local_id)
1377 {
1378 ARCANE_CHECK_KIND(isCell);
1379 }
1380
1381 //! Copy operator
1382 Cell& operator=(ItemInternal* ainternal)
1383 {
1384 _set(ainternal);
1385 return (*this);
1386 }
1387
1388 public:
1389
1390 //! Entity kind
1391 constexpr eItemKind kind() const { return IK_Cell; }
1392
1393 //! Local identifier of the entity in the processor subdomain
1394 CellLocalId itemLocalId() const { return CellLocalId{ m_local_id }; }
1395
1396 //! Number of faces of the cell
1397 Int32 nbFace() const { return _nbFace(); }
1398
1399 //! i-th face of the cell
1400 Face face(Int32 i) const { return _face(i); }
1401
1402 //! List of faces of the cell
1403 FaceConnectedListViewType faces() const { return _faceList(); }
1404
1405 //! i-th face of the cell
1406 FaceLocalId faceId(Int32 i) const { return _faceId(i); }
1407
1408 //! List of faces of the cell
1409 FaceLocalIdView faceIds() const { return _faceIds(); }
1410
1411 //! Number of edges of the cell
1412 Int32 nbEdge() const { return _nbEdge(); }
1413
1414 //! i-th edge of the cell
1415 Edge edge(Int32 i) const { return _edge(i); }
1416
1417 //! i-th edge of the cell
1418 EdgeLocalId edgeId(Int32 i) const { return _edgeId(i); }
1419
1420 //! List of edges of the cell
1421 EdgeConnectedListViewType edges() const { return _edgeList(); }
1422
1423 //! List of edges of the cell
1424 EdgeLocalIdView edgeIds() const { return _edgeIds(); }
1425
1426 //! AMR
1427 //! ATT: the notion of parent is used both in the sub-mesh concept and AMR.
1428 //! The first AMR implementation separates the two concepts for consistency reasons.
1429 //! A fusion of the two notions is possible later
1430 //! initially, the names for AMR are in French, i.e. parent -> pere and child -> enfant
1431 //! a single parent
1432 Cell hParent() const { return Cell(_hParentBase(0)); }
1433
1434 //! Number of parents for AMR
1435 Int32 nbHParent() const { return _nbHParent(); }
1436
1437 //! Number of children for AMR
1438 Int32 nbHChildren() const { return _nbHChildren(); }
1439
1440 //! i-th AMR child
1441 Cell hChild(Int32 i) const { return Cell(_hChildBase(i)); }
1442
1443 //! level 0 parent for AMR
1444 Cell topHParent() const { return Cell(_toItemBase().topHParentBase()); }
1445
1446 /*!
1447 * \returns \p true if the item is active (i.e. has no
1448 * active descendants), \p false otherwise. Note that it is sufficient to check
1449 * only the first child. Always returns \p true if AMR is disabled.
1450 */
1451 bool isActive() const { return _toItemBase().isActive(); }
1452
1453 bool isSubactive() const { return _toItemBase().isSubactive(); }
1454
1455 /*!
1456 * \returns \p true if the item is an ancestor (i.e. has an
1457 * active child or an ancestor child), \p false otherwise.
1458 * Always returns \p false if AMR is disabled.
1459 */
1460 bool isAncestor() const { return _toItemBase().isAncestor(); }
1461
1462 /*!
1463 * \returns \p true if the item has children (active or not),
1464 * \p false otherwise. Always returns \p false if AMR is disabled.
1465 */
1466 bool hasHChildren() const { return _toItemBase().hasHChildren(); }
1467
1468 /*!
1469 * \returns the refinement level of the current item. If the item
1470 * parent is \p NULL, then by convention it is at level 0,
1471 * otherwise it is simply at a level higher than its parent.
1472 */
1473 Int32 level() const
1474 {
1475 //! if I don't have a parent, I was created
1476 //! directly from a file or by the user,
1477 //! so I am a level 0 item
1478 if (this->_nbHParent() == 0)
1479 return 0;
1480 //! otherwise I am one level higher than my parent
1481 return (this->_hParentBase(0).level() + 1);
1482 }
1483
1484 /*!
1485 * \returns the rank of the child \p (iitem).
1486 * example: if rank = m_internal->whichChildAmI(iitem); then
1487 * m_internal->hChild(rank) would be iitem;
1488 */
1490 {
1491 return _toItemBase().whichChildAmI(iitem->localId());
1492 }
1493
1494 /*!
1495 * \returns the rank of the child with \p (iitem).
1496 * example: if rank = m_internal->whichChildAmI(iitem); then
1497 * m_internal->hChild(rank) would be iitem;
1498 */
1499 Int32 whichChildAmI(CellLocalId local_id) const
1500 {
1501 return _toItemBase().whichChildAmI(local_id);
1502 }
1503
1504 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
1505 Cell* operator->() { return this; }
1506
1507 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
1508 const Cell* operator->() const { return this; }
1509};
1510
1511/*---------------------------------------------------------------------------*/
1512/*---------------------------------------------------------------------------*/
1513
1514constexpr inline Cell Item::
1515_cell(Int32 index) const
1516{
1517 return Cell(_connectivity()->cellBase(m_local_id, index));
1518}
1519
1520/*---------------------------------------------------------------------------*/
1521/*---------------------------------------------------------------------------*/
1522
1523/*!
1524 * \brief Particle.
1525 * \ingroup Mesh
1526 */
1527class Particle
1528: public Item
1529{
1530 using ThatClass = Particle;
1531 // Pour accéder aux constructeurs privés
1532 friend class ItemEnumeratorBaseT<ThatClass>;
1533 friend class ItemConnectedEnumeratorBaseT<ThatClass>;
1534 friend class ItemVectorT<ThatClass>;
1535 friend class ItemVectorViewT<ThatClass>;
1536 friend class ItemConnectedListViewT<ThatClass>;
1537 friend class ItemVectorViewConstIteratorT<ThatClass>;
1538 friend class ItemConnectedListViewConstIteratorT<ThatClass>;
1539 friend class SimdItemT<ThatClass>;
1540 friend class ItemInfoListViewT<ThatClass>;
1541 friend class ItemLocalIdToItemConverterT<ThatClass>;
1542
1543 private:
1544
1545 //! Constructor reserved for enumerators
1546 Particle(Int32 local_id, ItemSharedInfo* shared_info)
1547 : Item(local_id, shared_info)
1548 {}
1549
1550 public:
1551
1552 //! Type of localId()
1553 typedef ParticleLocalId LocalIdType;
1554
1555 //! Constructor for a null particle
1556 Particle() = default;
1557
1558 //! (deprecated) Constructs a reference to the \a internal entity
1560 : Item(ainternal)
1561 {
1562 ARCANE_CHECK_KIND(isParticle);
1563 }
1564
1565 //! Constructs a reference to the \a abase entity
1566 constexpr Particle(const ItemBase& abase)
1567 : Item(abase)
1568 {
1569 ARCANE_CHECK_KIND(isParticle);
1570 }
1571
1572 //! Constructs a reference to the \a aitem entity
1573 constexpr explicit Particle(const Item& aitem)
1574 : Item(aitem)
1575 {
1576 ARCANE_CHECK_KIND(isParticle);
1577 }
1578
1579 //! Constructs a reference to the \a internal entity
1580 Particle(const ItemInternalPtr* internals, Int32 local_id)
1581 : Item(internals, local_id)
1582 {
1583 ARCANE_CHECK_KIND(isParticle);
1584 }
1585
1586 //! Copy operator
1587 Particle& operator=(ItemInternal* ainternal)
1588 {
1589 _set(ainternal);
1590 return (*this);
1591 }
1592
1593 public:
1594
1595 //! Entity kind
1596 constexpr eItemKind kind() const { return IK_Particle; }
1597
1598 //! Local identifier of the entity in the processor subdomain
1599 ParticleLocalId itemLocalId() const { return ParticleLocalId{ m_local_id }; }
1600
1601 /*!
1602 * \brief Cell to which the particle belongs.
1603 * You must call setCell() before calling this function.
1604 * \precondition hasCell() must be true.
1605 */
1606 Cell cell() const { return _cell(0); }
1607
1608 //! Cell connected to the particle
1609 CellLocalId cellId() const { return _cellId(0); }
1610
1611 //! True if the particle is in a mesh cell
1612 bool hasCell() const { return (_cellId(0).localId() != NULL_ITEM_LOCAL_ID); }
1613
1614 /*!
1615 * \brief Cell to which the particle belongs or null cell.
1616 * Returns cell() if the particle is in a cell or the
1617 * null cell if the particle is not in any cell.
1618 */
1620 {
1621 Int32 cell_local_id = _cellId(0).localId();
1622 if (cell_local_id == NULL_ITEM_LOCAL_ID)
1623 return Cell();
1624 return _cell(0);
1625 }
1626
1627 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
1628 Particle* operator->() { return this; }
1629
1630 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
1631 const Particle* operator->() const { return this; }
1632};
1633
1634/*---------------------------------------------------------------------------*/
1635/*---------------------------------------------------------------------------*/
1636
1637/*!
1638 * \brief degree of freedom class.
1639 *
1640 * \ingroup Mesh
1641 *
1642 * This new DoF item introduces a new connectivity management, offloaded
1643 * into properties and no longer stored in ItemSharedInfo in order to be able to create
1644 * new connectivities based on user needs. By default, no
1645 * connectivity is associated with the DoF. Necessary connectivities will be added by the user.
1646 */
1647class DoF
1648: public Item
1649{
1650 using ThatClass = DoF;
1651 // Pour accéder aux constructeurs privés
1652 friend class ItemEnumeratorBaseT<ThatClass>;
1653 friend class ItemConnectedEnumeratorBaseT<ThatClass>;
1654 friend class ItemVectorT<ThatClass>;
1655 friend class ItemVectorViewT<ThatClass>;
1656 friend class ItemConnectedListViewT<ThatClass>;
1657 friend class ItemVectorViewConstIteratorT<ThatClass>;
1658 friend class ItemConnectedListViewConstIteratorT<ThatClass>;
1659 friend class SimdItemT<ThatClass>;
1660 friend class ItemInfoListViewT<ThatClass>;
1661 friend class ItemLocalIdToItemConverterT<ThatClass>;
1662
1663 private:
1664
1665 //! Constructor reserved for enumerators
1666 constexpr DoF(Int32 local_id, ItemSharedInfo* shared_info)
1667 : Item(local_id, shared_info)
1668 {}
1669
1670 public:
1671
1672 using LocalIdType = DoFLocalId;
1673
1674 //! Constructor for a non-connected cell
1675 DoF() = default;
1676
1677 //! (deprecated) Constructs a reference to the \a internal entity
1678 DoF(ItemInternal* ainternal)
1679 : Item(ainternal)
1680 {
1681 ARCANE_CHECK_KIND(isDoF);
1682 }
1683
1684 //! Constructs a reference to the \a abase entity
1685 constexpr DoF(const ItemBase& abase)
1686 : Item(abase)
1687 {
1688 ARCANE_CHECK_KIND(isDoF);
1689 }
1690
1691 //! Constructs a reference to the \a abase entity
1692 constexpr explicit DoF(const Item& aitem)
1693 : Item(aitem)
1694 {
1695 ARCANE_CHECK_KIND(isDoF);
1696 }
1697
1698 //! Constructs a reference to the \a internal entity
1699 DoF(const ItemInternalPtr* internals, Int32 local_id)
1700 : Item(internals, local_id)
1701 {
1702 ARCANE_CHECK_KIND(isDoF);
1703 }
1704
1705 //! Copy operator
1706 DoF& operator=(ItemInternal* ainternal)
1707 {
1708 _set(ainternal);
1709 return (*this);
1710 }
1711
1712 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
1713 DoF* operator->() { return this; }
1714
1715 ARCANE_DEPRECATED_REASON("Y2022: Do not use this operator. Use operator '.' instead")
1716 const DoF* operator->() const { return this; }
1717
1718 //! Entity kind
1719 constexpr eItemKind kind() const { return IK_DoF; }
1720
1721 //! Local identifier of the entity in the processor subdomain
1722 DoFLocalId itemLocalId() const { return DoFLocalId{ m_local_id }; }
1723};
1724
1725/*---------------------------------------------------------------------------*/
1726/*---------------------------------------------------------------------------*/
1727
1728/*---------------------------------------------------------------------------*/
1729/*---------------------------------------------------------------------------*/
1730
1732edge(Int32 i) const
1733{
1734 return _edge(i);
1735}
1736
1738face(Int32 i) const
1739{
1740 return _face(i);
1741}
1742
1744cell(Int32 i) const
1745{
1746 return _cell(i);
1747}
1748
1749/*---------------------------------------------------------------------------*/
1750/*---------------------------------------------------------------------------*/
1751
1753face(Int32 i) const
1754{
1755 return _face(i);
1756}
1757
1759cell(Int32 i) const
1760{
1761 return _cell(i);
1762}
1763
1764/*---------------------------------------------------------------------------*/
1765/*---------------------------------------------------------------------------*/
1766
1768boundaryCell() const
1769{
1770 return Cell(_toItemBase().boundaryCell());
1771}
1772
1774backCell() const
1775{
1776 return Cell(_toItemBase().backCell());
1777}
1778
1780frontCell() const
1781{
1782 return Cell(_toItemBase().frontCell());
1783}
1784
1786oppositeCell(Cell cell) const
1787{
1788 ARCANE_ASSERT((backCell() == cell || frontCell() == cell), ("cell is not connected to the face"));
1789 return (backCell() == cell) ? frontCell() : backCell();
1790}
1791
1793cell(Int32 i) const
1794{
1795 return _cell(i);
1796}
1797
1798/*---------------------------------------------------------------------------*/
1799/*---------------------------------------------------------------------------*/
1800
1802toItemWithNodes() const
1803{
1804 ARCANE_CHECK_KIND(isItemWithNodes);
1805 return ItemWithNodes(*this);
1806}
1807
1809toNode() const
1810{
1811 ARCANE_CHECK_KIND(isNode);
1812 return Node(*this);
1813}
1814
1816toEdge() const
1817{
1818 ARCANE_CHECK_KIND(isEdge);
1819 return Edge(*this);
1820}
1821
1823toFace() const
1824{
1825 ARCANE_CHECK_KIND(isFace);
1826 return Face(*this);
1827}
1828
1830toCell() const
1831{
1832 ARCANE_CHECK_KIND(isCell);
1833 return Cell(*this);
1834}
1835
1837toParticle() const
1838{
1839 ARCANE_CHECK_KIND(isParticle);
1840 return Particle(*this);
1841}
1842
1844toDoF() const
1845{
1846 ARCANE_CHECK_KIND(isDoF);
1847 return DoF(*this);
1848}
1849
1850/*---------------------------------------------------------------------------*/
1851/*---------------------------------------------------------------------------*/
1852
1853inline ItemLocalId::
1854ItemLocalId(Item item)
1855: m_local_id(item.localId())
1856{
1857}
1858
1859template <typename ItemType> inline ItemLocalIdT<ItemType>::
1860ItemLocalIdT(ItemType item)
1861: ItemLocalId(item.localId())
1862{
1863}
1864
1865/*---------------------------------------------------------------------------*/
1866/*---------------------------------------------------------------------------*/
1867
1869operator[](ItemLocalId local_id) const
1870{
1871 return Item(local_id.localId(), m_item_shared_info);
1872}
1873
1874/*---------------------------------------------------------------------------*/
1875/*---------------------------------------------------------------------------*/
1876
1878operator[](Int32 local_id) const
1879{
1880 return Item(local_id, m_item_shared_info);
1881}
1882
1883/*---------------------------------------------------------------------------*/
1884/*---------------------------------------------------------------------------*/
1885
1886template <typename ItemType> inline ItemType ItemInfoListViewT<ItemType>::
1887operator[](ItemLocalId local_id) const
1888{
1889 return ItemType(local_id.localId(), m_item_shared_info);
1890}
1891
1892/*---------------------------------------------------------------------------*/
1893/*---------------------------------------------------------------------------*/
1894
1895template <typename ItemType> inline ItemType ItemInfoListViewT<ItemType>::
1896operator[](Int32 local_id) const
1897{
1898 return ItemType(local_id, m_item_shared_info);
1899}
1900
1901/*---------------------------------------------------------------------------*/
1902/*---------------------------------------------------------------------------*/
1903
1904inline constexpr ARCCORE_HOST_DEVICE Item ItemLocalIdToItemConverter::
1905operator[](ItemLocalId local_id) const
1906{
1907 return Item(local_id.localId(), m_item_shared_info);
1908}
1909
1910/*---------------------------------------------------------------------------*/
1911/*---------------------------------------------------------------------------*/
1912
1913inline constexpr ARCCORE_HOST_DEVICE Item ItemLocalIdToItemConverter::
1914operator[](Int32 local_id) const
1915{
1916 return Item(local_id, m_item_shared_info);
1917}
1918
1919/*---------------------------------------------------------------------------*/
1920/*---------------------------------------------------------------------------*/
1921
1922template <typename ItemType_> inline constexpr ARCCORE_HOST_DEVICE ItemType_
1924operator[](ItemLocalIdType local_id) const
1925{
1926 return ItemType(local_id.localId(), m_item_shared_info);
1927}
1928
1929/*---------------------------------------------------------------------------*/
1930/*---------------------------------------------------------------------------*/
1931
1932template <typename ItemType_> inline constexpr ARCCORE_HOST_DEVICE ItemType_
1934operator[](Int32 local_id) const
1935{
1936 return ItemType(local_id, m_item_shared_info);
1937}
1938
1939/*---------------------------------------------------------------------------*/
1940/*---------------------------------------------------------------------------*/
1941
1942} // End namespace Arcane
1943
1944/*---------------------------------------------------------------------------*/
1945/*---------------------------------------------------------------------------*/
1946
1947#include "arcane/core/ItemCompatibility.h"
1948
1949/*---------------------------------------------------------------------------*/
1950/*---------------------------------------------------------------------------*/
1951
1952#endif
Declarations of types on entities.
Cell of a mesh.
Definition Item.h:1300
Cell topHParent() const
level 0 parent for AMR
Definition Item.h:1444
Int32 nbEdge() const
Number of edges of the cell.
Definition Item.h:1412
constexpr Cell(const ItemBase &abase)
Constructs a reference to the base entity.
Definition Item.h:1361
FaceConnectedListViewType faces() const
List of faces of the cell.
Definition Item.h:1403
Int32 nbHChildren() const
Number of children for AMR.
Definition Item.h:1438
bool isAncestor() const
Definition Item.h:1460
Face face(Int32 i) const
i-th face of the cell
Definition Item.h:1400
FaceLocalIdView faceIds() const
List of faces of the cell.
Definition Item.h:1409
Cell(ItemInternal *ainternal)
(deprecated) Constructs a reference to the internal entity
Definition Item.h:1354
Int32 nbFace() const
Number of faces of the cell.
Definition Item.h:1397
Cell & operator=(ItemInternal *ainternal)
Copy operator.
Definition Item.h:1382
Cell(const ItemInternalPtr *internals, Int32 local_id)
Constructs a reference to the internal entity.
Definition Item.h:1375
CellLocalId itemLocalId() const
Local identifier of the entity in the processor subdomain.
Definition Item.h:1394
EdgeLocalIdView edgeIds() const
List of edges of the cell.
Definition Item.h:1424
EdgeLocalId edgeId(Int32 i) const
i-th edge of the cell
Definition Item.h:1418
Int32 whichChildAmI(const ItemInternal *iitem) const
Definition Item.h:1489
constexpr Cell(const Item &aitem)
Constructs a reference to the item entity.
Definition Item.h:1368
Cell hChild(Int32 i) const
i-th AMR child
Definition Item.h:1441
bool hasHChildren() const
Definition Item.h:1466
Edge edge(Int32 i) const
i-th edge of the cell
Definition Item.h:1415
Cell()=default
Constructor of a null cell.
Int32 whichChildAmI(CellLocalId local_id) const
Definition Item.h:1499
FaceLocalId faceId(Int32 i) const
i-th face of the cell
Definition Item.h:1406
bool isActive() const
Definition Item.h:1451
Int32 level() const
Definition Item.h:1473
Cell hParent() const
Definition Item.h:1432
EdgeConnectedListViewType edges() const
List of edges of the cell.
Definition Item.h:1421
Int32 nbHParent() const
Number of parents for AMR.
Definition Item.h:1435
constexpr eItemKind kind() const
Entity kind.
Definition Item.h:1391
CellLocalId LocalIdType
Type of localId().
Definition Item.h:1348
degree of freedom class.
Definition Item.h:1649
DoF(const ItemInternalPtr *internals, Int32 local_id)
Constructs a reference to the internal entity.
Definition Item.h:1699
DoF()=default
Constructor for a non-connected cell.
DoFLocalId itemLocalId() const
Local identifier of the entity in the processor subdomain.
Definition Item.h:1722
constexpr DoF(const Item &aitem)
Constructs a reference to the abase entity.
Definition Item.h:1692
DoF & operator=(ItemInternal *ainternal)
Copy operator.
Definition Item.h:1706
DoF(ItemInternal *ainternal)
(deprecated) Constructs a reference to the internal entity
Definition Item.h:1678
constexpr DoF(const ItemBase &abase)
Constructs a reference to the abase entity.
Definition Item.h:1685
constexpr eItemKind kind() const
Entity kind.
Definition Item.h:1719
Edge of a cell.
Definition Item.h:875
FaceConnectedListViewType faces() const
List of faces of the edge.
Definition Item.h:996
constexpr eItemKind kind() const
Kind of the entity.
Definition Item.h:966
CellConnectedListViewType cells() const
List of edge cells.
Definition Item.h:984
Cell cell(Int32 i) const
i-th cell of the edge
Definition Item.h:1759
Face face(Int32 i) const
i-th face of the edge
Definition Item.h:1753
Edge(const ItemInternalPtr *internals, Int32 local_id)
Constructs a reference to the entity internal.
Definition Item.h:950
constexpr Edge(const Item &aitem)
Constructs a reference to the entity aitem.
Definition Item.h:943
FaceLocalIdView faceIds() const
List of faces of the edge.
Definition Item.h:1002
Edge & operator=(ItemInternal *ainternal)
Copy operator.
Definition Item.h:957
Int32 nbFace() const
Number of faces connected to the edge.
Definition Item.h:975
CellLocalIdView cellIds() const
List of edge cells.
Definition Item.h:990
constexpr Edge(const ItemBase &abase)
Constructs a reference to the entity abase.
Definition Item.h:936
Edge()=default
Creates a null edge.
FaceLocalId faceId(Int32 i) const
i-th face of the edge
Definition Item.h:999
Edge(ItemInternal *ainternal)
(deprecated) Constructs a reference to the entity internal
Definition Item.h:929
EdgeLocalId LocalIdType
Type of localId().
Definition Item.h:923
Int32 nbNode() const
Number of vertices of the edge.
Definition Item.h:972
CellLocalId cellId(Int32 i) const
i-th edge cell
Definition Item.h:987
Int32 nbCell() const
Number of cells connected to the edge.
Definition Item.h:978
EdgeLocalId itemLocalId() const
Local identifier of the entity in the processor subdomain.
Definition Item.h:969
Face of a cell.
Definition Item.h:1032
Face()=default
Creation of a face not connected to the mesh.
bool isMasterFace() const
true if it is the master face of an interface
Definition Item.h:1216
constexpr eItemKind kind() const
Entity kind.
Definition Item.h:1123
FaceLocalId LocalIdType
Type of localId().
Definition Item.h:1080
CellLocalId frontCellId() const
Cell in front of the face (null cell if none).
Definition Item.h:1185
Cell frontCell() const
Cell in front of the face (null cell if none).
Definition Item.h:1780
CellLocalId cellId(Int32 i) const
i-th cell of the face
Definition Item.h:1138
EdgeLocalIdView edgeIds() const
List of edges of the face.
Definition Item.h:1252
Cell cell(Int32 i) const
i-th cell of the face
Definition Item.h:1793
Int32 nbCell() const
Number of cells of the face (1 or 2).
Definition Item.h:1129
ARCANE_DEPRECATED_118 bool isBoundary() const
Definition Item.h:1154
FaceConnectedListViewType slaveFaces() const
List of slave faces associated with this master face.
Definition Item.h:1230
constexpr Face(const Item &aitem)
Constructs a reference to the item entity.
Definition Item.h:1100
ARCANE_DEPRECATED_118 bool isBoundaryOutside() const
Indicates if the face is on the subdomain boundary facing outwards.
Definition Item.h:1167
EdgeConnectedListViewType edges() const
List of edges of the face.
Definition Item.h:1246
bool isSubDomainBoundary() const
Indicates if the face is on the subdomain boundary (i.e nbCell()==1).
Definition Item.h:1148
FaceLocalId itemLocalId() const
Local identifier of the entity in the processor subdomain.
Definition Item.h:1126
EdgeLocalId edgeId(Int32 i) const
i-th edge of the face
Definition Item.h:1249
CellConnectedListViewType cells() const
List of cells of the face.
Definition Item.h:1135
Face masterFace() const
Master face associated with this face.
Definition Item.h:1213
bool isSlaveFace() const
true if it is a slave face of an interface
Definition Item.h:1219
Edge edge(Int32 i) const
i-th edge of the face
Definition Item.h:1243
constexpr Face(const ItemBase &abase)
Constructs a reference to the base entity.
Definition Item.h:1093
CellLocalId backCellId() const
Cell behind the face (null cell if none).
Definition Item.h:1179
Face(const ItemInternalPtr *internals, Int32 local_id)
Constructs a reference to the internal entity.
Definition Item.h:1107
bool isSubDomainBoundaryOutside() const
Indicates if the face is on the subdomain boundary facing outwards.
Definition Item.h:1157
Face(ItemInternal *ainternal)
(deprecated) Constructs a reference to the internal entity
Definition Item.h:1086
Cell boundaryCell() const
Cell associated with this boundary face (null cell if none).
Definition Item.h:1768
Int32 nbEdge() const
Number of edges of the face.
Definition Item.h:1240
bool isTiedFace() const
true if it is a slave or master face of an interface
Definition Item.h:1222
CellLocalIdView cellIds() const
List of cells of the face.
Definition Item.h:1141
Face & operator=(ItemInternal *ainternal)
Copy operator.
Definition Item.h:1114
Cell backCell() const
Cell behind the face (null cell if none).
Definition Item.h:1774
Cell oppositeCell(Cell cell) const
Opposite cell of this face to the cell cell.
Definition Item.h:1786
CellLocalId oppositeCellId(CellLocalId cell_id) const
Opposite cell of this face to the cell cell.
Definition Item.h:1199
Interface of an entity family.
Definition IItemFamily.h:83
Base class for mesh entities.
Int32 localId() const
Local number (in the subdomain) of the entity.
Typed base class for enumerators over a list of connected entities.
View of a list of entities connected to another.
Base class for enumerators over a list of entities.
@ II_Shared
The entity is shared by another subdomain.
Definition ItemFlags.h:59
@ 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_Boundary
The entity is on the boundary.
Definition ItemFlags.h:51
Base class for specialized views of entity information.
ItemType operator[](ItemLocalId local_id) const
Entity associated with local ID local_id.
Definition Item.h:1887
Item operator[](ItemLocalId local_id) const
Entity associated with local ID local_id.
Definition Item.h:1869
Class to convert an ItemLocalId to an entity (Item).
constexpr __host__ __device__ ItemType operator[](ItemLocalIdType local_id) const
Entity of local ID local_id.
Definition Item.h:1924
constexpr __host__ __device__ Item operator[](ItemLocalId local_id) const
Entity of local ID local_id.
Definition Item.h:1905
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.
Typed entity vector.
Definition ItemVector.h:168
View on a typed array of entities.
Mesh element based on nodes (Edge,Face,Cell).
Definition Item.h:773
ItemWithNodes(const ItemInternalPtr *internals, Int32 local_id)
Constructs a reference to the entity internal.
Definition Item.h:821
NodeLocalId nodeId(Int32 index) const
i-th node of the entity.
Definition Item.h:849
constexpr ItemWithNodes(const Item &aitem)
Constructs a reference to the entity aitem.
Definition Item.h:814
Node node(Int32 i) const
i-th node of the entity
Definition Item.h:840
constexpr ItemWithNodes(Int32 local_id, ItemSharedInfo *shared_info)
Constructor reserved for enumerators.
Definition Item.h:790
Int32 nbLinearNode() const
Number of nodes of the associated linear entity (if entity order 2 or more).
Definition Item.h:852
NodeConnectedListViewType nodes() const
List of nodes of the entity.
Definition Item.h:843
ItemWithNodes(ItemInternal *ainternal)
(deprecated) Constructs a reference to the entity internal
Definition Item.h:800
ItemWithNodes()=default
Creation of an entity not connected to the mesh.
Int32 nbNode() const
Number of nodes of the entity.
Definition Item.h:837
constexpr ItemWithNodes(const ItemBase &abase)
Constructs a reference to the entity abase.
Definition Item.h:807
NodeLocalIdView nodeIds() const
List of nodes of the entity.
Definition Item.h:846
ItemWithNodes & operator=(ItemInternal *ainternal)
Copy operator.
Definition Item.h:828
Index of an Item in a variable.
Definition Item.h:120
Base class for a mesh element.
Definition Item.h:84
Int32 nbParent() const
Number of parents for submeshes.
Definition Item.h:297
constexpr bool isDoF() const
true if the entity is of the DoF kind
Definition Item.h:345
const ItemTypeInfo * typeInfo() const
Information about the entity type.
Definition Item.h:406
impl::MutableItemBase mutableItemBase() const
Mutable internal part of the entity.
Definition Item.h:394
Int32 _nbHParent() const
Number of parents for AMR.
Definition Item.h:461
static const Int32 NULL_ELEMENT
Null element index.
Definition Item.h:175
constexpr Int32 flags() const
Entity flags.
Definition Item.h:355
Item(ItemInternal *ainternal)
Constructs a reference to the internal entity.
Definition Item.h:196
ItemInternal * internal() const
Internal part of the entity.
Definition Item.h:368
constexpr Int32 localId() const
Local identifier of the entity in the processor subdomain.
Definition Item.h:233
Edge toEdge() const
Converts the entity to the Edge kind.
Definition Item.h:1816
Item(const ItemInternalPtr *internals, Int32 local_id)
Constructs a reference to the internal entity.
Definition Item.h:214
constexpr Integer _nbCell() const
Number of cells connected to the entity (for nodes, edges and faces).
Definition Item.h:459
Item()=default
Creation of a null mesh entity.
constexpr bool isFace() const
true if the entity is of the Face kind.
Definition Item.h:333
static String typeName(Int32 type)
Cell type name cell_type.
Definition Item.cc:54
Int32 owner() const
Owner subdomain number of the entity.
Definition Item.h:252
ItemLocalId LocalIdType
Type of localId().
Definition Item.h:109
constexpr bool isParticle() const
true if the entity is of the Particle kind.
Definition Item.h:339
ItemWithNodes toItemWithNodes() const
Converts the entity to the ItemWithNodes kind.
Definition Item.h:1802
DoF toDoF() const
Converts the entity to the DoF kind.
Definition Item.h:1844
Cell toCell() const
Converts the entity to the Cell kind.
Definition Item.h:1830
@ Tri3
Triangle type element (3 vertices, 2D).
Definition Item.h:161
@ Quad4
Quad type element (4 vertices, 2D).
Definition Item.h:162
@ Pentagon5
Pentagon type element (5 vertices, 2D).
Definition Item.h:163
@ Unknown
Null type element.
Definition Item.h:158
@ Pyramid
Pyramid type element (5 vertices, 3D).
Definition Item.h:166
@ Bar2
Edge type element (2 vertices, 1D, 2D and 3D).
Definition Item.h:160
@ Vertex
Node type element (1 vertex 1D, 2D and 3D).
Definition Item.h:159
@ Hexa
Hexahedron type element (8 vertices, 3D).
Definition Item.h:168
@ Hexagon6
Hexagon type element (6 vertices, 2D).
Definition Item.h:164
@ Penta
Pentahedron type element (6 vertices, 3D).
Definition Item.h:167
@ Wedge8
Prism type element with 8 faces (hexagonal base).
Definition Item.h:170
@ Wedge7
Prism type element with 7 faces (pentagonal base).
Definition Item.h:169
@ Tetra
Tetrahedron type element (4 vertices, 3D).
Definition Item.h:165
constexpr Integer _nbFace() const
Number of faces of the entity or number of faces connected to the entity (for nodes and edges).
Definition Item.h:457
IItemFamily * itemFamily() const
Family from which the entity originates.
Definition Item.h:261
constexpr Integer _nbEdge() const
Number of edges of the entity or number of edges connected to the entity (for nodes).
Definition Item.h:455
Particle toParticle() const
Converts the entity to the Particle kind.
Definition Item.h:1837
constexpr bool hasFlags(Int32 flags) const
Returns if the flags are set for the entity.
Definition Item.h:352
constexpr __host__ __device__ Item(const ItemBase &abase)
Constructs a reference to the abase entity.
Definition Item.h:207
constexpr bool isNode() const
true if the entity is of the Node kind.
Definition Item.h:315
ItemUniqueId uniqueId() const
Unique identifier across all domains.
Definition Item.h:239
constexpr __host__ __device__ Item(Int32 local_id, ItemSharedInfo *shared_info)
Constructor reserved for enumerators.
Definition Item.h:184
constexpr bool null() const
true if the entity is null (i.e. not connected to the mesh)
Definition Item.h:230
constexpr bool isItemWithNodes() const
true if the entity is of the ItemWithNodes kind.
Definition Item.h:308
constexpr Integer _nbNode() const
Number of nodes of the entity.
Definition Item.h:453
constexpr ItemLocalId itemLocalId() const
Local identifier of the entity in the processor subdomain.
Definition Item.h:236
Face toFace() const
Converts the entity to the Face kind.
Definition Item.h:1823
constexpr bool isOwn() const
true if the entity belongs to the subdomain
Definition Item.h:267
Integer _nbParent() const
Number of parents for submeshes.
Definition Item.h:465
constexpr bool isCell() const
true if the entity is of the Cell kind.
Definition Item.h:321
Item parent(Int32 i) const
i-th parent for submeshes
Definition Item.h:300
ItemTypeId itemTypeId() const
Entity type.
Definition Item.h:258
Item parent() const
first parent for submeshes
Definition Item.h:303
Int32 m_local_id
Local number (in the subdomain) of the entity.
Definition Item.h:429
constexpr bool isEdge() const
true if the entity is of the Edge kind.
Definition Item.h:327
impl::ItemBase itemBase() const
Internal part of the entity.
Definition Item.h:383
bool isShared() const
True if the entity is shared by other subdomains.
Definition Item.h:279
constexpr eItemKind kind() const
Entity kind.
Definition Item.h:264
Int32 _nbHChildren() const
Number of children for AMR.
Definition Item.h:463
constexpr Int32 _flags() const
Entity flags.
Definition Item.h:451
Int16 type() const
Entity type.
Definition Item.h:255
Int32 _nbLinearNode() const
Number of nodes of the entity.
Definition Item.h:491
Item & operator=(ItemInternal *ainternal)
Copy operator.
Definition Item.h:221
Node toNode() const
Converts the entity to the Node kind.
Definition Item.h:1809
Node of a mesh.
Definition Item.h:598
constexpr NodeLocalId itemLocalId() const
Local identifier of the entity in the processor subdomain.
Definition Item.h:692
Cell cell(Int32 i) const
i-th cell of the node
Definition Item.h:1744
constexpr eItemKind kind() const
Kind of the entity.
Definition Item.h:689
FaceLocalIdView faceIds() const
List of faces of the node.
Definition Item.h:734
Node(const ItemInternalPtr *internals, Int32 local_id)
Constructs a reference to the entity internal.
Definition Item.h:673
CellConnectedListViewType cells() const
List of cells of the node.
Definition Item.h:728
CellVectorView _internalActiveCells(Int32Array &local_ids) const
Enumerates the cells connected to the node.
Definition Item.h:742
constexpr Int32 nbFace() const
Number of faces connected to the node.
Definition Item.h:698
Node(ItemInternal *ainternal)
(deprecated) Constructs a reference to the entity internal
Definition Item.h:652
EdgeLocalIdView edgeIds() const
List of edges of the node.
Definition Item.h:731
FaceLocalId faceId(Int32 i) const
i-th face of the node
Definition Item.h:716
constexpr Int32 nbEdge() const
Number of edges connected to the node.
Definition Item.h:695
FaceConnectedListViewType faces() const
List of faces of the node.
Definition Item.h:725
constexpr Node(Int32 local_id, ItemSharedInfo *shared_info)
Constructor reserved for enumerators.
Definition Item.h:639
Node & operator=(ItemInternal *ainternal)
Copy operator.
Definition Item.h:680
Face face(Int32 i) const
i-th face of the node
Definition Item.h:1738
constexpr Node(const Item &aitem)
Constructs a reference to the entity abase.
Definition Item.h:666
CellLocalIdView cellIds() const
List of cells of the node.
Definition Item.h:737
constexpr Node(const ItemBase &abase)
Constructs a reference to the entity abase.
Definition Item.h:659
Edge edge(Int32 i) const
i-th edge of the node
Definition Item.h:1732
Int32 nbCell() const
Number of cells connected to the node.
Definition Item.h:701
EdgeConnectedListViewType edges() const
List of edges of the node.
Definition Item.h:722
CellLocalId cellId(Int32 i) const
i-th cell of the node
Definition Item.h:719
EdgeLocalId edgeId(Int32 i) const
i-th edge of the node
Definition Item.h:713
NodeLocalId LocalIdType
Type of localId().
Definition Item.h:646
Particle.
Definition Item.h:1529
Particle()=default
Constructor for a null particle.
bool hasCell() const
True if the particle is in a mesh cell.
Definition Item.h:1612
ParticleLocalId itemLocalId() const
Local identifier of the entity in the processor subdomain.
Definition Item.h:1599
constexpr eItemKind kind() const
Entity kind.
Definition Item.h:1596
Cell cell() const
Cell to which the particle belongs. You must call setCell() before calling this function....
Definition Item.h:1606
CellLocalId cellId() const
Cell connected to the particle.
Definition Item.h:1609
Particle(const ItemInternalPtr *internals, Int32 local_id)
Constructs a reference to the internal entity.
Definition Item.h:1580
constexpr Particle(const ItemBase &abase)
Constructs a reference to the abase entity.
Definition Item.h:1566
Cell cellOrNull() const
Cell to which the particle belongs or null cell. Returns cell() if the particle is in a cell or the n...
Definition Item.h:1619
Particle & operator=(ItemInternal *ainternal)
Copy operator.
Definition Item.h:1587
ParticleLocalId LocalIdType
Type of localId().
Definition Item.h:1553
constexpr Particle(const Item &aitem)
Constructs a reference to the aitem entity.
Definition Item.h:1573
Particle(ItemInternal *ainternal)
(deprecated) Constructs a reference to the internal entity
Definition Item.h:1559
Manages a vector of ItemType entities.
Definition SimdItem.h:272
ItemLocalIdListViewT< Node > NodeLocalIdView
View over the localId() of a list of nodes.
Definition ItemTypes.h:407
ItemVectorViewT< Cell > CellVectorView
View over a vector of cells.
Definition ItemTypes.h:305
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
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
NodeConnectedListView NodeConnectedListViewType
List of connected nodes.
Definition ItemTypes.h:350
Int32 Integer
Type representing an integer.
CellConnectedListView CellConnectedListViewType
List of connected cells.
Definition ItemTypes.h:356
bool operator<(const Item &item1, const Item &item2)
Compare two entities.
Definition Item.h:566
eItemKind
Mesh entity type.
@ IK_Particle
Particle mesh entity.
@ IK_Node
Node mesh entity.
@ IK_Cell
Cell mesh entity.
@ IK_Unknown
Unknown or uninitialized mesh entity.
@ IK_Face
Face mesh entity.
@ IK_DoF
Degree of Freedom mesh entity.
@ IK_Edge
Edge mesh entity.
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
EdgeConnectedListView EdgeConnectedListViewType
List of connected edges.
Definition ItemTypes.h:352
FaceConnectedListView FaceConnectedListViewType
List of connected faces.
Definition ItemTypes.h:354
@ Cell
The mesh is AMR by cell.
Definition MeshKind.h:53
std::int32_t Int32
Signed integer type of 32 bits.