Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ItemFlags.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/* ItemFlags.h (C) 2000-2026 */
9/* */
10/* Flags containing the characteristics of an entity. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ITEMFLAGS_H
13#define ARCANE_CORE_ITEMFLAGS_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28/*!
29 * \brief Flags for entity characteristics.
30 *
31 * These flags allow storing information about entities (Item).
32 * They are reserved for %Arcane and must not be used outside
33 * of Arcane. The only exception concerns the values ItemFlags::II_UserMark1
34 * and ItemFlags::II_UserMark2. They can be associated with entities via
35 * the methods MutableItemBase::addFlags(), MutableItemBase::removeFlags() or
36 * ItemBase::hasFlags().
37 */
38class ARCANE_CORE_EXPORT ItemFlags
39{
40 public:
41
42 using FlagType = Int32;
43
44 public:
45
46 // The 'readable' display of the flags is implemented in ItemPrinter.
47 // It must be updated if values here are modified or added.
48
49 enum : FlagType
50 {
51 II_Boundary = 1 << 1, //!< The entity is on the boundary
52 II_HasFrontCell = 1 << 2, //!< The entity has a front cell
53 II_HasBackCell = 1 << 3, //!< The entity has a back cell
54 II_FrontCellIsFirst = 1 << 4, //!< The first cell of the entity is the front cell
55 II_BackCellIsFirst = 1 << 5, //!< The first cell of the entity is the back cell
56 II_Own = 1 << 6, //!< The entity is a domain-specific entity
57 II_Added = 1 << 7, //!< The entity has just been added
58 II_Suppressed = 1 << 8, //!< The entity has just been suppressed
59 II_Shared = 1 << 9, //!< The entity is shared by another subdomain
60 II_SubDomainBoundary = 1 << 10, //!< The entity is at the boundary of two subdomains
61 //II_JustRemoved = 1 << 11, //!< The entity has just been removed
62 II_JustAdded = 1 << 12, //!< The entity has just been added
63 II_NeedRemove = 1 << 13, //!< The entity must be removed
64 II_SlaveFace = 1 << 14, //!< The entity is a slave face of an interface
65 II_MasterFace = 1 << 15, //!< The entity is a master face of an interface
66 II_Detached = 1 << 16, //!< The entity is detached from the mesh
67 /*
68 * \brief The entity uses edges instead of faces.
69 *
70 * This is only used for 2D cells of non-manifold meshes. If set, it means that
71 * 1D entities are of type Edge and not of type Face.
72 */
73 II_HasEdgeFor1DItems = 1 << 17,
74
75 II_Coarsen = 1 << 18, //!< The entity is marked for coarsening
76 II_DoNothing = 1 << 19, //!< The entity is blocked
77 II_Refine = 1 << 20, //!< The entity is marked for refinement
78 II_JustRefined = 1 << 21, //!< The entity has just been refined
79 II_JustCoarsened = 1 << 22, //!< The entity has just been coarsened
80 II_Inactive = 1 << 23, //!< The entity is inactive //COARSEN_INACTIVE,
81 II_CoarsenInactive = 1 << 24, //!< The entity is inactive and has children tagged for coarsening
82
83 /*!
84 * \brief [AMR Patch] The entity is marked as overlapping with
85 * at least one AMR patch.
86 */
87 II_Overlap = 1 << 25,
88
89 /*!
90 * \brief [AMR Patch] The entity is marked as being in an AMR patch.
91 */
92 II_InPatch = 1 << 26,
93
94 II_UserMark1 = 1 << 30, //!< User mark
95 II_UserMark2 = 1 << 31 //!< User mark
96 };
97
98 static const int II_InterfaceFlags = II_Boundary + II_HasFrontCell + II_HasBackCell +
99 II_FrontCellIsFirst + II_BackCellIsFirst;
100
101 static constexpr bool isOwn(FlagType f) { return (f & II_Own) != 0; }
102 static constexpr bool isShared(FlagType f) { return (f & II_Shared) != 0; }
103 static constexpr bool isBoundary(FlagType f) { return (f & II_Boundary) != 0; }
104 static constexpr bool isSubDomainBoundary(FlagType f) { return (f & II_Boundary) != 0; }
105 static constexpr bool hasBackCell(FlagType f) { return (f & II_HasBackCell) != 0; }
106 static constexpr bool isSubDomainBoundaryOutside(FlagType f)
107 {
108 return isSubDomainBoundary(f) && hasBackCell(f);
109 }
110
111 /*!
112 * \brief Index in the face for the back cell.
113 *
114 * \retval -1 if there is no cell behind.
115 * \retval 0 or 1 for the index of the back cell.
116 *
117 * If the index is positive, it is possible to retrieve
118 * the back cell via Face::cell(ItemFlags::backCellIndex(f)).
119 */
120 static constexpr Int32 backCellIndex(FlagType f)
121 {
122 if (f & II_HasBackCell)
123 return (f & II_BackCellIsFirst) ? 0 : 1;
124 return -1;
125 }
126
127 /*!
128 * \brief Index in the face for the front cell.
129 *
130 * \retval -1 if there is no cell in front.
131 * \retval 0 or 1 for the index of the front cell.
132 *
133 * If the index is positive, it is possible to retrieve
134 * the front cell via Face::cell(ItemFlags::frontCellIndex(f)).
135 */
136 static constexpr Int32 frontCellIndex(FlagType f)
137 {
138 if (f & II_HasFrontCell)
139 return (f & II_FrontCellIsFirst) ? 0 : 1;
140 return -1;
141 }
142};
143
144/*---------------------------------------------------------------------------*/
145/*---------------------------------------------------------------------------*/
146
147} // End namespace Arcane
148
149/*---------------------------------------------------------------------------*/
150/*---------------------------------------------------------------------------*/
151
152#endif
Arcane configuration file.
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_NeedRemove
The entity must be removed.
Definition ItemFlags.h:63
@ 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_Refine
The entity is marked for refinement.
Definition ItemFlags.h:77
@ II_Overlap
[AMR Patch] The entity is marked as overlapping with at least one AMR patch.
Definition ItemFlags.h:87
@ II_JustAdded
The entity has just been added.
Definition ItemFlags.h:62
@ II_InPatch
[AMR Patch] The entity is marked as being in an AMR patch.
Definition ItemFlags.h:92
@ 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_SubDomainBoundary
The entity is at the boundary of two subdomains.
Definition ItemFlags.h:60
@ II_JustRefined
The entity has just been refined.
Definition ItemFlags.h:78
@ 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_Added
The entity has just been added.
Definition ItemFlags.h:57
@ 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_UserMark2
User mark.
Definition ItemFlags.h:95
@ II_HasFrontCell
The entity has a front cell.
Definition ItemFlags.h:52
@ II_DoNothing
The entity is blocked.
Definition ItemFlags.h:76
@ II_BackCellIsFirst
The first cell of the entity is the back cell.
Definition ItemFlags.h:55
@ II_Coarsen
The entity is marked for coarsening.
Definition ItemFlags.h:75
@ II_JustCoarsened
The entity has just been coarsened.
Definition ItemFlags.h:79
@ II_UserMark1
User mark.
Definition ItemFlags.h:94
static constexpr Int32 backCellIndex(FlagType f)
Index in the face for the back cell.
Definition ItemFlags.h:120
static constexpr Int32 frontCellIndex(FlagType f)
Index in the face for the front cell.
Definition ItemFlags.h:136
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int32_t Int32
Signed integer type of 32 bits.