Arcane  v4.1.2.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
src/arcane/cartesianmesh/CartesianConnectivity.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* CartesianConnectivity.h (C) 2000-2025 */
9/* */
10/* Informations de connectivité d'un maillage cartésien. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CARTESIANMESH_CARTESIANCONNECTIVITY_H
13#define ARCANE_CARTESIANMESH_CARTESIANCONNECTIVITY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18#include "arcane/core/Item.h"
20#include "arcane/cartesianmesh/CartesianMeshGlobal.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
56class ARCANE_CARTESIANMESH_EXPORT CartesianConnectivity
57{
58 // NOTE: Pour l'instant, on doit conserver par entité les entités connectées par
59 // direction, car la numérotation ne permet pas de les retrouver simplement.
60 // À terme, on pourra le déduire directement.
61
62 friend class CartesianConnectivityLocalId;
63 friend class CartesianMeshImpl;
64
71 {
72 P_UpperLeft = 0,
73 P_UpperRight = 1,
74 P_LowerRight = 2,
75 P_LowerLeft = 3,
76
77 P_TopZUpperLeft = 4,
78 P_TopZUpperRight = 5,
79 P_TopZLowerRight = 6,
80 P_TopZLowerLeft = 7
81 };
82
83 private:
84
86 struct Index
87 {
88 friend class CartesianConnectivity;
89
90 private:
91
92 void fill(Int32 i) { v[0] = v[1] = v[2] = v[3] = v[4] = v[5] = v[6] = v[7] = i; }
93 Int32 v[8];
94 };
95
98 {
99 friend class CartesianConnectivity;
100
101 public:
102
103 void compute();
104
105 private:
106
107 ePosition permutation[3][8];
108 };
109
110 public:
111
113 Cell upperLeft(Node n) const { return _nodeToCell(n, P_UpperLeft); }
115 Cell upperRight(Node n) const { return _nodeToCell(n, P_UpperRight); }
117 Cell lowerRight(Node n) const { return _nodeToCell(n, P_LowerRight); }
119 Cell lowerLeft(Node n) const { return _nodeToCell(n, P_LowerLeft); }
120
122 ARCCORE_HOST_DEVICE CellLocalId upperLeftId(NodeLocalId n) const { return _nodeToCellLocalId(n, P_UpperLeft); }
124 ARCCORE_HOST_DEVICE CellLocalId upperRightId(NodeLocalId n) const { return _nodeToCellLocalId(n, P_UpperRight); }
126 ARCCORE_HOST_DEVICE CellLocalId lowerRightId(NodeLocalId n) const { return _nodeToCellLocalId(n, P_LowerRight); }
128 ARCCORE_HOST_DEVICE CellLocalId lowerLeftId(NodeLocalId n) const { return _nodeToCellLocalId(n, P_LowerLeft); }
129
131 ARCCORE_HOST_DEVICE CellLocalId upperLeftId(NodeLocalId n, Int32 dir) const { return _nodeToCellLocalId(n, dir, P_UpperLeft); }
133 ARCCORE_HOST_DEVICE CellLocalId upperRightId(NodeLocalId n, Int32 dir) const { return _nodeToCellLocalId(n, dir, P_UpperRight); }
135 ARCCORE_HOST_DEVICE CellLocalId lowerRightId(NodeLocalId n, Int32 dir) const { return _nodeToCellLocalId(n, dir, P_LowerRight); }
137 ARCCORE_HOST_DEVICE CellLocalId lowerLeftId(NodeLocalId n, Int32 dir) const { return _nodeToCellLocalId(n, dir, P_LowerLeft); }
138
140 Cell topZUpperLeft(Node n) const { return _nodeToCell(n, P_TopZUpperLeft); }
142 Cell topZUpperRight(Node n) const { return _nodeToCell(n, P_TopZUpperRight); }
144 Cell topZLowerRight(Node n) const { return _nodeToCell(n, P_TopZLowerRight); }
146 Cell topZLowerLeft(Node n) const { return _nodeToCell(n, P_TopZLowerLeft); }
147
149 ARCCORE_HOST_DEVICE CellLocalId topZUpperLeftId(NodeLocalId n) const { return _nodeToCellLocalId(n, P_TopZUpperLeft); }
151 ARCCORE_HOST_DEVICE CellLocalId topZUpperRightId(NodeLocalId n) const { return _nodeToCellLocalId(n, P_TopZUpperRight); }
153 ARCCORE_HOST_DEVICE CellLocalId topZLowerRightId(NodeLocalId n) const { return _nodeToCellLocalId(n, P_TopZLowerRight); }
155 ARCCORE_HOST_DEVICE CellLocalId topZLowerLeftId(NodeLocalId n) const { return _nodeToCellLocalId(n, P_TopZLowerLeft); }
156
158 ARCCORE_HOST_DEVICE CellLocalId topZUpperLeftId(NodeLocalId n, Int32 dir) const { return _nodeToCellLocalId(n, dir, P_TopZUpperLeft); }
160 ARCCORE_HOST_DEVICE CellLocalId topZUpperRightId(NodeLocalId n, Int32 dir) const { return _nodeToCellLocalId(n, dir, P_TopZUpperRight); }
162 ARCCORE_HOST_DEVICE CellLocalId topZLowerRightId(NodeLocalId n, Int32 dir) const { return _nodeToCellLocalId(n, dir, P_TopZLowerRight); }
164 ARCCORE_HOST_DEVICE CellLocalId topZLowerLeftId(NodeLocalId n, Int32 dir) const { return _nodeToCellLocalId(n, dir, P_TopZLowerLeft); }
165
167 Node upperLeft(Cell c) const { return _cellToNode(c, P_UpperLeft); }
169 Node upperRight(Cell c) const { return _cellToNode(c, P_UpperRight); }
171 Node lowerRight(Cell c) const { return _cellToNode(c, P_LowerRight); }
173 Node lowerLeft(Cell c) const { return _cellToNode(c, P_LowerLeft); }
174
176 ARCCORE_HOST_DEVICE NodeLocalId upperLeftId(CellLocalId c) const { return _cellToNodeLocalId(c, P_UpperLeft); }
178 ARCCORE_HOST_DEVICE NodeLocalId upperRightId(CellLocalId c) const { return _cellToNodeLocalId(c, P_UpperRight); }
180 ARCCORE_HOST_DEVICE NodeLocalId lowerRightId(CellLocalId c) const { return _cellToNodeLocalId(c, P_LowerRight); }
182 ARCCORE_HOST_DEVICE NodeLocalId lowerLeftId(CellLocalId c) const { return _cellToNodeLocalId(c, P_LowerLeft); }
183
185 ARCCORE_HOST_DEVICE NodeLocalId upperLeftId(CellLocalId c, Int32 dir) const { return _cellToNodeLocalId(c, dir, P_UpperLeft); }
187 ARCCORE_HOST_DEVICE NodeLocalId upperRightId(CellLocalId c, Int32 dir) const { return _cellToNodeLocalId(c, dir, P_UpperRight); }
189 ARCCORE_HOST_DEVICE NodeLocalId lowerRightId(CellLocalId c, Int32 dir) const { return _cellToNodeLocalId(c, dir, P_LowerRight); }
191 ARCCORE_HOST_DEVICE NodeLocalId lowerLeftId(CellLocalId c, Int32 dir) const { return _cellToNodeLocalId(c, dir, P_LowerLeft); }
192
194 Node topZUpperLeft(Cell c) const { return _cellToNode(c, P_TopZUpperLeft); }
196 Node topZUpperRight(Cell c) const { return _cellToNode(c, P_TopZUpperRight); }
198 Node topZLowerRight(Cell c) const { return _cellToNode(c, P_TopZLowerRight); }
200 Node topZLowerLeft(Cell c) const { return _cellToNode(c, P_TopZLowerLeft); }
201
203 ARCCORE_HOST_DEVICE NodeLocalId topZUpperLeftId(CellLocalId c) const { return _cellToNodeLocalId(c, P_TopZUpperLeft); }
205 ARCCORE_HOST_DEVICE NodeLocalId topZUpperRightId(CellLocalId c) const { return _cellToNodeLocalId(c, P_TopZUpperRight); }
207 ARCCORE_HOST_DEVICE NodeLocalId topZLowerRightId(CellLocalId c) const { return _cellToNodeLocalId(c, P_TopZLowerRight); }
209 ARCCORE_HOST_DEVICE NodeLocalId topZLowerLeftId(CellLocalId c) const { return _cellToNodeLocalId(c, P_TopZLowerLeft); }
210
212 ARCCORE_HOST_DEVICE NodeLocalId topZUpperLeftId(CellLocalId c, Int32 dir) const { return _cellToNodeLocalId(c, dir, P_TopZUpperLeft); }
214 ARCCORE_HOST_DEVICE NodeLocalId topZUpperRightId(CellLocalId c, Int32 dir) const { return _cellToNodeLocalId(c, dir, P_TopZUpperRight); }
216 ARCCORE_HOST_DEVICE NodeLocalId topZLowerRightId(CellLocalId c, Int32 dir) const { return _cellToNodeLocalId(c, dir, P_TopZLowerRight); }
218 ARCCORE_HOST_DEVICE NodeLocalId topZLowerLeftId(CellLocalId c, Int32 dir) const { return _cellToNodeLocalId(c, dir, P_TopZLowerLeft); }
219
220 private:
221
223 void _computeInfos(IMesh* mesh, VariableNodeReal3& nodes_coord, VariableCellReal3& cells_coord);
224 void _computeInfos(ICartesianMesh* cmesh);
226 void _setStorage(ArrayView<Index> nodes_to_cell, ArrayView<Index> cells_to_node,
227 const Permutation* permutation);
228
229 private:
230
231 ARCCORE_HOST_DEVICE CellLocalId _nodeToCellLocalId(NodeLocalId n, ePosition p) const
232 {
233 return CellLocalId(m_nodes_to_cell[n].v[p]);
234 }
235 ARCCORE_HOST_DEVICE NodeLocalId _cellToNodeLocalId(CellLocalId c, ePosition p) const
236 {
237 return NodeLocalId(m_cells_to_node[c].v[p]);
238 }
239 ARCCORE_HOST_DEVICE CellLocalId _nodeToCellLocalId(NodeLocalId n, Int32 dir, ePosition p) const
240 {
241 ARCCORE_CHECK_AT(dir, 3);
242 return _nodeToCellLocalId(n, m_permutation->permutation[dir][p]);
243 }
244 ARCCORE_HOST_DEVICE NodeLocalId _cellToNodeLocalId(CellLocalId c, Int32 dir, ePosition p) const
245 {
246 ARCCORE_CHECK_AT(dir, 3);
247 return _cellToNodeLocalId(c, m_permutation->permutation[dir][p]);
248 }
249 Cell _nodeToCell(Node n, ePosition p) const { return m_cells[m_nodes_to_cell[n.localId()].v[p]]; }
250 Node _cellToNode(Cell c, ePosition p) const { return m_nodes[m_cells_to_node[c.localId()].v[p]]; }
251
252 private:
253
254 // Ces deux méthodes sont pour les tests
255 Index& _index(Node n) { return m_nodes_to_cell[n.localId()]; }
256 Index& _index(Cell c) { return m_cells_to_node[c.localId()]; }
257
258 private:
259
260 ArrayView<Index> m_nodes_to_cell;
261 ArrayView<Index> m_cells_to_node;
262 CellInfoListView m_cells;
263 NodeInfoListView m_nodes;
264 const Permutation* m_permutation = nullptr;
265
266 private:
267
268 void _computeInfos2D(IMesh* mesh, VariableNodeReal3& nodes_coord, VariableCellReal3& cells_coord);
269 void _computeInfos2D(ICartesianMesh* cmesh);
270 void _computeInfos3D(IMesh* mesh, VariableNodeReal3& nodes_coord, VariableCellReal3& cells_coord);
271 void _computeInfos3D(ICartesianMesh* cmesh);
272};
273
274/*---------------------------------------------------------------------------*/
275/*---------------------------------------------------------------------------*/
281class ARCANE_CARTESIANMESH_EXPORT CartesianConnectivityLocalId
283{
284 private:
285
286 using Index = CartesianConnectivity::Index;
287
288 public:
289
290 CartesianConnectivityLocalId(const CartesianConnectivity& c)
292 {
293 }
294};
295
296/*---------------------------------------------------------------------------*/
297/*---------------------------------------------------------------------------*/
298
299} // End namespace Arcane
300
301/*---------------------------------------------------------------------------*/
302/*---------------------------------------------------------------------------*/
303
304#endif
305
Vue modifiable d'un tableau d'un type T.
Informations de connectivité d'un maillage cartésien.
__host__ __device__ NodeLocalId upperLeftId(CellLocalId c) const
Noeud en haut à gauche de la maille c.
__host__ __device__ CellLocalId topZLowerLeftId(NodeLocalId n, Int32 dir) const
En 3D, maille en bas à gauche du noeud n pour la direction dir.
__host__ __device__ CellLocalId lowerRightId(NodeLocalId n, Int32 dir) const
Maille en bas à droite du noeud n pour la direction dir.
Node topZLowerLeft(Cell c) const
En 3D, noeud au dessus en bas à gauche de la maille c.
Cell lowerRight(Node n) const
Maille en bas à droite du noeud n.
Node upperRight(Cell c) const
Noeud en haut à droite de la maille c.
__host__ __device__ NodeLocalId upperRightId(CellLocalId c, Int32 dir) const
Noeud en haut à droite de la maille c pour la direction dir.
__host__ __device__ NodeLocalId topZUpperRightId(CellLocalId c, Int32 dir) const
En 3D, noeud au dessus en haut à droite de la maille c pour la direction dir.
__host__ __device__ NodeLocalId topZUpperLeftId(CellLocalId c) const
En 3D, noeud au dessus en haut à gauche de la maille c.
__host__ __device__ NodeLocalId lowerLeftId(CellLocalId c) const
Noeud en bad à gauche de la maille c.
__host__ __device__ CellLocalId topZUpperLeftId(NodeLocalId n) const
En 3D, maille en haut à gauche du noeud n.
Cell upperLeft(Node n) const
Maille en haut à gauche du noeud n.
__host__ __device__ NodeLocalId upperRightId(CellLocalId c) const
Noeud en haut à droite de la maille c.
__host__ __device__ NodeLocalId topZLowerRightId(CellLocalId c, Int32 dir) const
En 3D, noeud au dessus en bas à droite de la maille c pour la direction dir.
Node upperLeft(Cell c) const
Noeud en haut à gauche de la maille c.
__host__ __device__ CellLocalId topZUpperLeftId(NodeLocalId n, Int32 dir) const
En 3D, maille en haut à gauche du noeud n pour la direction dir.
__host__ __device__ CellLocalId topZUpperRightId(NodeLocalId n, Int32 dir) const
En 3D, maille en haut à droite du noeud n pour la direction dir.
__host__ __device__ NodeLocalId topZLowerLeftId(CellLocalId c) const
En 3D, noeud au dessus en bas à gauche de la maille c.
Cell topZUpperRight(Node n) const
En 3D, maille en haut à droite du noeud n.
__host__ __device__ CellLocalId topZUpperRightId(NodeLocalId n) const
En 3D, maille en haut à droite du noeud n.
__host__ __device__ CellLocalId lowerLeftId(NodeLocalId n) const
Maille en bas à gauche du noeud n.
__host__ __device__ CellLocalId upperRightId(NodeLocalId n) const
Maille en haut à droite du noeud n.
__host__ __device__ NodeLocalId topZUpperRightId(CellLocalId c) const
En 3D, noeud au dessus en haut à droite de la maille c.
__host__ __device__ CellLocalId lowerRightId(NodeLocalId n) const
Maille en bas à droite du noeud n.
__host__ __device__ NodeLocalId topZLowerRightId(CellLocalId c) const
En 3D, noeud au dessus en bas à droite de la maille c.
Cell lowerLeft(Node n) const
Maille en bas à gauche du noeud n.
Cell topZLowerRight(Node n) const
En 3D, maille en bas à droite du noeud n.
__host__ __device__ NodeLocalId lowerRightId(CellLocalId c) const
Noeud en bas à droite de la maille c.
__host__ __device__ NodeLocalId lowerLeftId(CellLocalId c, Int32 dir) const
Noeud en bad à gauche de la maille c pour la direction dir.
Cell topZLowerLeft(Node n) const
En 3D, maille en bas à gauche du noeud n.
Node topZUpperRight(Cell c) const
En 3D, noeud au dessus en haut à droite de la maille c.
__host__ __device__ CellLocalId topZLowerRightId(NodeLocalId n, Int32 dir) const
En 3D, maille en bas à droite du noeud n pour la direction dir.
Node lowerLeft(Cell c) const
Noeud en bad à gauche de la maille c.
__host__ __device__ NodeLocalId topZUpperLeftId(CellLocalId c, Int32 dir) const
En 3D, noeud au dessus en haut à gauche de la maille c pour la direction dir.
Cell upperRight(Node n) const
Maille en haut à droite du noeud n.
__host__ __device__ NodeLocalId upperLeftId(CellLocalId c, Int32 dir) const
Noeud en haut à gauche de la maille c pour la direction dir.
Node topZUpperLeft(Cell c) const
En 3D, noeud au dessus en haut à gauche de la maille c.
__host__ __device__ CellLocalId lowerLeftId(NodeLocalId n, Int32 dir) const
Maille en bas à gauche du noeud n pour la direction dir.
Node lowerRight(Cell c) const
Noeud en bas à droite de la maille c.
Node topZLowerRight(Cell c) const
En 3D, noeud au dessus en bas à droite de la maille c.
__host__ __device__ NodeLocalId lowerRightId(CellLocalId c, Int32 dir) const
Noeud en bas à droite de la maille c pour la direction dir.
Cell topZUpperLeft(Node n) const
En 3D, maille en haut à gauche du noeud n.
__host__ __device__ CellLocalId upperLeftId(NodeLocalId n, Int32 dir) const
Maille en haut à gauche du noeud n pour la direction dir.
__host__ __device__ NodeLocalId topZLowerLeftId(CellLocalId c, Int32 dir) const
En 3D, noeud au dessus en bas à gauche de la maille c pour la direction dir.
__host__ __device__ CellLocalId topZLowerRightId(NodeLocalId n) const
En 3D, maille en bas à droite du noeud n.
__host__ __device__ CellLocalId topZLowerLeftId(NodeLocalId n) const
En 3D, maille en bas à gauche du noeud n.
__host__ __device__ CellLocalId upperLeftId(NodeLocalId n) const
Maille en haut à gauche du noeud n.
__host__ __device__ CellLocalId upperRightId(NodeLocalId n, Int32 dir) const
Maille en haut à droite du noeud n pour la direction dir.
Maille d'un maillage.
Definition Item.h:1214
Interface d'un maillage cartésien.
Noeud d'un maillage.
Definition Item.h:582
MeshVariableScalarRefT< Cell, Real3 > VariableCellReal3
Grandeur au centre des mailles de type coordonnées.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Grandeur au noeud de type coordonnées.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
@ Cell
Le maillage est AMR par maille.
Definition MeshKind.h:52
std::int32_t Int32
Type entier signé sur 32 bits.
Liste des 8 entités autout d'une autre entité
void compute()
Calcule les permutations des 8 ePosition pour chaque direction.