Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
CartesianMeshNumberingMngInternal.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/* CartesianMeshNumberingMngInternal.h (C) 2000-2026 */
9/* */
10/* Cartesian mesh numbering manager. The numbering of cells and nodes is */
11/* quite classical, the numbering of faces is explained (among others) in */
12/* the methods 'faceUniqueId()' and 'cellFaceUniqueIds()'. */
13/*---------------------------------------------------------------------------*/
14/*---------------------------------------------------------------------------*/
15
16#ifndef ARCANE_CARTESIANMESH_INTERNAL_CARTESIANMESHNUMBERINGMNGINTERNAL_H
17#define ARCANE_CARTESIANMESH_INTERNAL_CARTESIANMESHNUMBERINGMNGINTERNAL_H
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22#include "arcane/cartesianmesh/internal/ICartesianMeshNumberingMngInternal.h"
23
24#include "arcane/utils/TraceAccessor.h"
25#include "arcane/utils/Vector3.h"
26
27#include "arcane/core/Item.h"
28
29#include <unordered_map>
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34namespace Arcane
35{
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39
40class CartesianMeshNumberingMngInternal
41: public TraceAccessor
43{
44 public:
45
46 explicit CartesianMeshNumberingMngInternal(IMesh* mesh);
47
48 public:
49
50 void build() override;
51 void saveInfosInProperties() override;
52 void recreateFromDump() override;
53
55
56 void printStatus() override;
57
58 void prepareLevel(Int32 level) override;
59 void updateFirstLevel() override;
60
61 Int64 firstCellUniqueId(Int32 level) const override;
62 Int64 firstNodeUniqueId(Int32 level) const override;
63 Int64 firstFaceUniqueId(Int32 level) const override;
64
65 CartCoord globalNbCellsX(Int32 level) const override;
66 CartCoord globalNbCellsY(Int32 level) const override;
67 CartCoord globalNbCellsZ(Int32 level) const override;
68
69 CartCoord globalNbNodesX(Int32 level) const override;
70 CartCoord globalNbNodesY(Int32 level) const override;
71 CartCoord globalNbNodesZ(Int32 level) const override;
72
73 CartCoord globalNbFacesX(Int32 level) const override;
74 CartCoord globalNbFacesY(Int32 level) const override;
75 CartCoord globalNbFacesZ(Int32 level) const override;
76
77 CartCoord globalNbFacesXCartesianView(Int32 level) const override;
78 CartCoord globalNbFacesYCartesianView(Int32 level) const override;
79 CartCoord globalNbFacesZCartesianView(Int32 level) const override;
80
81 Int64 nbCellInLevel(Int32 level) const override;
82 Int64 nbNodeInLevel(Int32 level) const override;
83 Int64 nbFaceInLevel(Int32 level) const override;
84
85 Int32 pattern() const override;
86
87 Int32 cellLevel(Int64 uid) const override;
88 Int32 nodeLevel(Int64 uid) const override;
89 Int32 faceLevel(Int64 uid) const override;
90
91 CartCoord offsetLevelToLevel(CartCoord coord, Int32 level_from, Int32 level_to) const override;
92 CartCoord3 offsetLevelToLevel(CartCoord3 coord, Int32 level_from, Int32 level_to) const override;
93
94 CartCoord faceOffsetLevelToLevel(CartCoord coord, Int32 level_from, Int32 level_to) const override;
95
96 CartCoord3 cellUniqueIdToCoord(Int64 uid, Int32 level) override;
97 CartCoord3 cellUniqueIdToCoord(Cell cell) override;
98
99 CartCoord cellUniqueIdToCoordX(Int64 uid, Int32 level) override;
100 CartCoord cellUniqueIdToCoordX(Cell cell) override;
101
102 CartCoord cellUniqueIdToCoordY(Int64 uid, Int32 level) override;
103 CartCoord cellUniqueIdToCoordY(Cell cell) override;
104
105 CartCoord cellUniqueIdToCoordZ(Int64 uid, Int32 level) override;
106 CartCoord cellUniqueIdToCoordZ(Cell cell) override;
107
108 CartCoord nodeUniqueIdToCoordX(Int64 uid, Int32 level) override;
109 CartCoord nodeUniqueIdToCoordX(Node node) override;
110
111 CartCoord nodeUniqueIdToCoordY(Int64 uid, Int32 level) override;
112 CartCoord nodeUniqueIdToCoordY(Node node) override;
113
114 CartCoord nodeUniqueIdToCoordZ(Int64 uid, Int32 level) override;
115 CartCoord nodeUniqueIdToCoordZ(Node node) override;
116
117 CartCoord faceUniqueIdToCoordX(Int64 uid, Int32 level) override;
118 CartCoord faceUniqueIdToCoordX(Face face) override;
119
120 CartCoord faceUniqueIdToCoordY(Int64 uid, Int32 level) override;
121 CartCoord faceUniqueIdToCoordY(Face face) override;
122
123 CartCoord faceUniqueIdToCoordZ(Int64 uid, Int32 level) override;
124 CartCoord faceUniqueIdToCoordZ(Face face) override;
125
126 Int64 cellUniqueId(CartCoord3 cell_coord, Int32 level) override;
127 Int64 cellUniqueId(CartCoord2 cell_coord, Int32 level) override;
128
129 Int64 nodeUniqueId(CartCoord3 node_coord, Int32 level) override;
130 Int64 nodeUniqueId(CartCoord2 node_coord, Int32 level) override;
131
132 Int64 faceUniqueId(CartCoord3 face_coord, Int32 level) override;
133 Int64 faceUniqueId(CartCoord2 face_coord, Int32 level) override;
134
135 Int32 nbNodeByCell() override;
136 void cellNodeUniqueIds(CartCoord3 cell_coord, Int32 level, ArrayView<Int64> uid) override;
137 void cellNodeUniqueIds(CartCoord2 cell_coord, Int32 level, ArrayView<Int64> uid) override;
138 void cellNodeUniqueIds(Int64 cell_uid, Int32 level, ArrayView<Int64> uid) override;
139 void cellNodeUniqueIds(Cell cell, ArrayView<Int64> uid) override;
140
141 Int32 nbFaceByCell() override;
142 void cellFaceUniqueIds(CartCoord3 cell_coord, Int32 level, ArrayView<Int64> uid) override;
143 void cellFaceUniqueIds(CartCoord2 cell_coord, Int32 level, ArrayView<Int64> uid) override;
144 void cellFaceUniqueIds(Int64 cell_uid, Int32 level, ArrayView<Int64> uid) override;
145 void cellFaceUniqueIds(Cell cell, ArrayView<Int64> uid) override;
146
147 void cellUniqueIdsAroundCell(CartCoord3 cell_coord, Int32 level, ArrayView<Int64> uid) override;
148 void cellUniqueIdsAroundCell(CartCoord2 cell_coord, Int32 level, ArrayView<Int64> uid) override;
149 void cellUniqueIdsAroundCell(Int64 cell_uid, Int32 level, ArrayView<Int64> uid) override;
150 void cellUniqueIdsAroundCell(Cell cell, ArrayView<Int64> uid) override;
151
152 void cellUniqueIdsAroundNode(CartCoord3 node_coord, Int32 level, ArrayView<Int64> uid) override;
153 void cellUniqueIdsAroundNode(CartCoord2 node_coord, Int32 level, ArrayView<Int64> uid) override;
154 void cellUniqueIdsAroundNode(Int64 node_uid, Int32 level, ArrayView<Int64> uid) override;
155 void cellUniqueIdsAroundNode(Node node, ArrayView<Int64> uid) override;
156
157 void setChildNodeCoordinates(Cell parent_cell) override;
158 void setParentNodeCoordinates(Cell parent_cell) override;
159
160 Int64 parentCellUniqueIdOfCell(Int64 uid, Int32 level, bool do_fatal) override;
161 Int64 parentCellUniqueIdOfCell(Cell cell, bool do_fatal) override;
162
163 Int64 childCellUniqueIdOfCell(Cell cell, CartCoord3 child_coord_in_parent) override;
164 Int64 childCellUniqueIdOfCell(Cell cell, CartCoord2 child_coord_in_parent) override;
165 Int64 childCellUniqueIdOfCell(Cell cell, Int32 child_index_in_parent) override;
166
167 Cell childCellOfCell(Cell cell, CartCoord3 child_coord_in_parent) override;
168 Cell childCellOfCell(Cell cell, CartCoord2 child_coord_in_parent) override;
169
170 Int64 parentNodeUniqueIdOfNode(Int64 uid, Int32 level, bool do_fatal) override;
171 Int64 parentNodeUniqueIdOfNode(Node node, bool do_fatal) override;
172
173 Int64 childNodeUniqueIdOfNode(Int64 uid, Int32 level) override;
174 Int64 childNodeUniqueIdOfNode(Node node) override;
175
176 Int64 parentFaceUniqueIdOfFace(Int64 uid, Int32 level, bool do_fatal) override;
177 Int64 parentFaceUniqueIdOfFace(Face face, bool do_fatal) override;
178
179 Int64 childFaceUniqueIdOfFace(Int64 uid, Int32 level, Int32 child_index_in_parent) override;
180 Int64 childFaceUniqueIdOfFace(Face face, Int32 child_index_in_parent) override;
181
182 private:
183
193 Int64x3 _face3DNumberingThreeParts(Int32 level) const;
194
195 static void _pushFront(UniqueArray<Int64>& array, Int64 elem);
196
197 private:
198
199 IMesh* m_mesh;
200
201 Ref<Properties> m_properties;
202
203 Integer m_dimension;
204 Int32 m_pattern;
205
206 UniqueArray<Int32> m_p_to_l_level;
207 Int32 m_max_level;
208 Int32 m_min_level;
209
210 Int64 m_latest_cell_uid;
211 UniqueArray<Int64> m_first_cell_uid_level;
212
213 Int64 m_latest_node_uid;
214 UniqueArray<Int64> m_first_node_uid_level;
215
216 Int64 m_latest_face_uid;
217 UniqueArray<Int64> m_first_face_uid_level;
218
219 CartCoord3 m_nb_cell_ground;
220
221 // Part for converting original numbering <-> new numbering (face).
222 bool m_converting_numbering_face;
223 Int32 m_ori_level;
224 std::unordered_map<Int64, Int64> m_face_ori_numbering_to_new;
225 std::unordered_map<Int64, Int64> m_face_new_numbering_to_ori;
226};
227
228/*---------------------------------------------------------------------------*/
229/*---------------------------------------------------------------------------*/
230
231} // End namespace Arcane
232
233/*---------------------------------------------------------------------------*/
234/*---------------------------------------------------------------------------*/
235
236#endif
Modifiable view of an array of type T.
CartCoord globalNbFacesXCartesianView(Int32 level) const override
Method allowing the retrieval of the size of the "Cartesian grid" view containing the faces.
Int32 pattern() const override
Method allowing the retrieval of the refinement pattern used in each cell. For example,...
Int64 childNodeUniqueIdOfNode(Int64 uid, Int32 level) override
Method to retrieve the uniqueId of a child node of a parent node.
Int64x3 _face3DNumberingThreeParts(Int32 level) const
Method to retrieve the number of faces for the three parts of the numbering.
void printStatus() override
Method allowing the description of the object's state.
Int64 nbNodeInLevel(Int32 level) const override
Method allowing the retrieval of the total number of nodes in a level.
Cell childCellOfCell(Cell cell, CartCoord3 child_coord_in_parent) override
Method to retrieve a child cell of a parent cell based on the position of the child cell within the p...
Int64 nbCellInLevel(Int32 level) const override
Method allowing the retrieval of the total number of cells in a level.
CartCoord faceUniqueIdToCoordX(Int64 uid, Int32 level) override
Method to retrieve the X coordinate of a face using its uniqueId.
void cellFaceUniqueIds(CartCoord3 cell_coord, Int32 level, ArrayView< Int64 > uid) override
Method to retrieve the uniqueIds of a cell's faces based on its coordinates.
CartCoord cellUniqueIdToCoordX(Int64 uid, Int32 level) override
Method to retrieve the X coordinate of a cell using its uniqueId.
Int64 childFaceUniqueIdOfFace(Int64 uid, Int32 level, Int32 child_index_in_parent) override
Method to retrieve the uniqueId of a child face of a parent face based on the index of the child face...
void cellUniqueIdsAroundCell(CartCoord3 cell_coord, Int32 level, ArrayView< Int64 > uid) override
Method to retrieve the uniqueIds of cells around a cell.
CartCoord3 cellUniqueIdToCoord(Int64 uid, Int32 level) override
Method to retrieve the coordinates of a cell using its uniqueId.
CartCoord offsetLevelToLevel(CartCoord coord, Int32 level_from, Int32 level_to) const override
Method allowing the retrieval of the position of the first child node/cell from the position of the p...
void cellUniqueIdsAroundNode(CartCoord3 node_coord, Int32 level, ArrayView< Int64 > uid) override
Method to retrieve the uniqueIds of cells around a node.
void setChildNodeCoordinates(Cell parent_cell) override
Method to define the spatial coordinates of the nodes of child cells of a parent cell....
CartCoord nodeUniqueIdToCoordX(Int64 uid, Int32 level) override
Method to retrieve the X coordinate of a node using its uniqueId.
CartCoord globalNbFacesYCartesianView(Int32 level) const override
Method allowing the retrieval of the size of the "Cartesian grid" view containing the faces.
Int64 parentFaceUniqueIdOfFace(Int64 uid, Int32 level, bool do_fatal) override
Method to retrieve the uniqueId of a face's parent.
void prepareLevel(Int32 level) override
Method allowing the preparation of a new level.
Int64 firstFaceUniqueId(Int32 level) const override
Method allowing the retrieval of the first unique ID used by the faces of a level....
Int64 nbFaceInLevel(Int32 level) const override
Method allowing the retrieval of the total number of faces in a level.
CartCoord nodeUniqueIdToCoordY(Int64 uid, Int32 level) override
Method to retrieve the Y coordinate of a node using its uniqueId.
Int32 faceLevel(Int64 uid) const override
Method allowing the retrieval of the level of a face with its UID.
void updateFirstLevel() override
Method allowing the update of the first level.
CartCoord faceOffsetLevelToLevel(CartCoord coord, Int32 level_from, Int32 level_to) const override
Method to obtain the position of the first child face from the position of the parent face.
CartCoord globalNbCellsZ(Int32 level) const override
Method allowing the retrieval of the global number of cells in Z for a level.
CartCoord nodeUniqueIdToCoordZ(Int64 uid, Int32 level) override
Method to retrieve the Z coordinate of a node using its uniqueId.
Int64 firstCellUniqueId(Int32 level) const override
Method allowing the retrieval of the first unique ID used by the cells of a level....
Int64 parentNodeUniqueIdOfNode(Int64 uid, Int32 level, bool do_fatal) override
Method to retrieve the uniqueId of a node's parent.
void renumberingFacesLevel0FromOriginalArcaneNumbering() override
Method allowing the renumbering of level 0 faces.
CartCoord globalNbFacesZCartesianView(Int32 level) const override
Method allowing the retrieval of the size of the "Cartesian grid" view containing the faces.
CartCoord globalNbFacesZ(Int32 level) const override
Method allowing the retrieval of the global number of faces in Z for a level.
Int32 nbNodeByCell() override
Method to retrieve the number of nodes in a cell.
CartCoord globalNbNodesX(Int32 level) const override
Method allowing the retrieval of the global number of nodes in X for a level.
CartCoord globalNbNodesZ(Int32 level) const override
Method allowing the retrieval of the global number of nodes in Z for a level.
Int32 cellLevel(Int64 uid) const override
Method allowing the retrieval of the level of a cell with its UID.
CartCoord cellUniqueIdToCoordZ(Int64 uid, Int32 level) override
Method to retrieve the Z coordinate of a cell using its uniqueId.
Int32 nbFaceByCell() override
Method to retrieve the number of faces in a cell.
void cellNodeUniqueIds(CartCoord3 cell_coord, Int32 level, ArrayView< Int64 > uid) override
Method to retrieve the uniqueIds of the nodes of a cell from its coordinates.
CartCoord faceUniqueIdToCoordZ(Int64 uid, Int32 level) override
Method to retrieve the Z coordinate of a face using its uniqueId.
CartCoord faceUniqueIdToCoordY(Int64 uid, Int32 level) override
Method to retrieve the Y coordinate of a face using its uniqueId.
Int64 cellUniqueId(CartCoord3 cell_coord, Int32 level) override
Method to retrieve the uniqueId of a cell from its position and level.
CartCoord globalNbCellsX(Int32 level) const override
Method allowing the retrieval of the global number of cells in X for a level.
Int64 nodeUniqueId(CartCoord3 node_coord, Int32 level) override
Method to retrieve the uniqueId of a node from its position and level.
void setParentNodeCoordinates(Cell parent_cell) override
Method to define the spatial coordinates of the nodes of a parent cell. This method must be called af...
CartCoord globalNbCellsY(Int32 level) const override
Method allowing the retrieval of the global number of cells in Y for a level.
Int64 firstNodeUniqueId(Int32 level) const override
Method allowing the retrieval of the first unique ID used by the nodes of a level....
CartCoord globalNbNodesY(Int32 level) const override
Method allowing the retrieval of the global number of nodes in Y for a level.
Int64 faceUniqueId(CartCoord3 face_coord, Int32 level) override
Method to retrieve the uniqueId of a face from its position and level.
CartCoord globalNbFacesY(Int32 level) const override
Method allowing the retrieval of the global number of faces in Y for a level.
Int32 nodeLevel(Int64 uid) const override
Method allowing the retrieval of the level of a node with its UID.
Int64 childCellUniqueIdOfCell(Cell cell, CartCoord3 child_coord_in_parent) override
Method to retrieve the uniqueId of a child cell of a parent cell based on the position of the child c...
CartCoord globalNbFacesX(Int32 level) const override
Method allowing the retrieval of the global number of faces in X for a level.
CartCoord cellUniqueIdToCoordY(Int64 uid, Int32 level) override
Method to retrieve the Y coordinate of a cell using its uniqueId.
Int64 parentCellUniqueIdOfCell(Int64 uid, Int32 level, bool do_fatal) override
Method to retrieve the uniqueId of a cell's parent.
Cell of a mesh.
Definition Item.h:1300
Face of a cell.
Definition Item.h:1032
Interface for Cartesian mesh numbering manager.
Node of a mesh.
Definition Item.h:598
Reference to an instance.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
1D data vector with value semantics (STL style).
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 CartCoord
Represents a coordinate of an element in the Cartesian grid (in X or Y or Z).
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
Int32x2 CartCoord2
Represents the 2D coordinates of an element in the Cartesian grid {x, y}.
std::int32_t Int32
Signed integer type of 32 bits.
Int32x3 CartCoord3
Represents the 3D coordinates of an element in the Cartesian grid {x, y, z}.