14#include "arcane/cartesianmesh/internal/CartesianMeshPatch.h"
16#include "arcane/IMesh.h"
17#include "arcane/ItemPrinter.h"
19#include "arcane/cartesianmesh/ICartesianMesh.h"
20#include "arcane/cartesianmesh/CartesianConnectivity.h"
34CartesianMeshPatch(ICartesianMesh* cmesh,Integer patch_index)
35: TraceAccessor(cmesh->traceMng())
37, m_amr_patch_index(patch_index)
39 Integer nb_dir = cmesh->mesh()->dimension();
40 for( Integer i=0; i<nb_dir; ++i ){
42 m_cell_directions[i]._internalInit(cmesh,dir,patch_index);
43 m_face_directions[i]._internalInit(cmesh,dir,patch_index);
44 m_node_directions[i]._internalInit(cmesh,dir,patch_index);
54 for( Integer i=0; i<3; ++i ){
55 m_cell_directions[i]._internalDestroy();
56 m_face_directions[i]._internalDestroy();
57 m_node_directions[i]._internalDestroy();
71 return cellDirection(
MD_DirX).allCells();
80void CartesianMeshPatch::
83 using Int8 = std::int8_t;
91 bool is_2d = m_mesh->mesh()->dimension()==2;
93 ARCANE_FATAL(
"Invalid call. This mesh is not a 2D mesh");
107 if (node_coord.
y>cell_coord.
y)
108 nodes_indirection[CNP_PreviousLeft] = i;
110 nodes_indirection[CNP_PreviousRight] = i;
113 cellDirection(MD_DirX).setNodesIndirection(nodes_indirection);
116 nodes_indirection.fill(-1);
117 for( Int8 i=0; i<i8_nb_node; ++i ){
118 Node node = cell0.
node(i);
119 Real3 node_coord = nodes_coord[node];
120 if (node_coord.y>cell_coord.
y){
121 if (node_coord.x>cell_coord.
x)
122 nodes_indirection[CNP_NextRight] = i;
124 nodes_indirection[CNP_NextLeft] = i;
127 if (node_coord.x>cell_coord.
x)
128 nodes_indirection[CNP_PreviousRight] = i;
130 nodes_indirection[CNP_PreviousLeft] = i;
133 cellDirection(MD_DirY).setNodesIndirection(nodes_indirection);
142void CartesianMeshPatch::
143_computeNodeCellInformations3D(Cell cell0,Real3 cell0_coord,VariableNodeReal3& nodes_coord)
145 using Int8 = std::int8_t;
146 Int8 nodes_indirection_i[CellDirectionMng::MAX_NB_NODE];
147 ArrayView<Int8> nodes_indirection(CellDirectionMng::MAX_NB_NODE,nodes_indirection_i);
148 Integer nb_node = cell0.nbNode();
150 ARCANE_FATAL(
"Number of nodes should be '8' (v={0})",nb_node);
152 Real3 cell_coord = cell0_coord;
153 bool is_3d = m_mesh->mesh()->dimension()==3;
155 ARCANE_FATAL(
"Invalid call. This mesh is not a 3D mesh");
158 nodes_indirection.fill(-1);
159 for( Int8 i=0; i<i8_nb_node; ++i ){
160 Node node = cell0.node(i);
161 Real3 node_coord = nodes_coord[node];
162 if (node_coord.z>cell_coord.z){
163 if (node_coord.x>cell_coord.x){
164 if (node_coord.y>cell_coord.y)
165 nodes_indirection[CNP_TopNextLeft] = i;
167 nodes_indirection[CNP_TopNextRight] = i;
170 if (node_coord.y>cell_coord.y)
171 nodes_indirection[CNP_TopPreviousLeft] = i;
173 nodes_indirection[CNP_TopPreviousRight] = i;
177 if (node_coord.x>cell_coord.x){
178 if (node_coord.y>cell_coord.y)
179 nodes_indirection[CNP_NextLeft] = i;
181 nodes_indirection[CNP_NextRight] = i;
184 if (node_coord.y>cell_coord.y)
185 nodes_indirection[CNP_PreviousLeft] = i;
187 nodes_indirection[CNP_PreviousRight] = i;
191 cellDirection(MD_DirX).setNodesIndirection(nodes_indirection);
194 nodes_indirection.fill(-1);
195 for( Int8 i=0; i<i8_nb_node; ++i ){
196 Node node = cell0.node(i);
197 Real3 node_coord = nodes_coord[node];
198 if (node_coord.z>cell_coord.z){
199 if (node_coord.y>cell_coord.y){
200 if (node_coord.x>cell_coord.x)
201 nodes_indirection[CNP_TopNextRight] = i;
203 nodes_indirection[CNP_TopNextLeft] = i;
206 if (node_coord.x>cell_coord.x)
207 nodes_indirection[CNP_TopPreviousRight] = i;
209 nodes_indirection[CNP_TopPreviousLeft] = i;
213 if (node_coord.y>cell_coord.y){
214 if (node_coord.x>cell_coord.x)
215 nodes_indirection[CNP_NextRight] = i;
217 nodes_indirection[CNP_NextLeft] = i;
220 if (node_coord.x>cell_coord.x)
221 nodes_indirection[CNP_PreviousRight] = i;
223 nodes_indirection[CNP_PreviousLeft] = i;
227 cellDirection(MD_DirY).setNodesIndirection(nodes_indirection);
229 nodes_indirection.fill(-1);
230 for( Int8 i=0; i<i8_nb_node; ++i ){
231 Node node = cell0.node(i);
232 Real3 node_coord = nodes_coord[node];
233 if (node_coord.y>cell_coord.y){
234 if (node_coord.z>cell_coord.z){
235 if (node_coord.x>cell_coord.x)
236 nodes_indirection[CNP_TopNextRight] = i;
238 nodes_indirection[CNP_TopNextLeft] = i;
241 if (node_coord.x>cell_coord.x)
242 nodes_indirection[CNP_TopPreviousRight] = i;
244 nodes_indirection[CNP_TopPreviousLeft] = i;
248 if (node_coord.z>cell_coord.z){
249 if (node_coord.x>cell_coord.x)
250 nodes_indirection[CNP_NextRight] = i;
252 nodes_indirection[CNP_NextLeft] = i;
255 if (node_coord.x>cell_coord.x)
256 nodes_indirection[CNP_PreviousRight] = i;
258 nodes_indirection[CNP_PreviousLeft] = i;
262 cellDirection(MD_DirZ).setNodesIndirection(nodes_indirection);
268void CartesianMeshPatch::
269_internalComputeNodeCellInformations(Cell cell0,Real3 cell0_coord,VariableNodeReal3& nodes_coord)
271 int dim = m_mesh->mesh()->dimension();
273 _computeNodeCellInformations3D(cell0,cell0_coord,nodes_coord);
275 _computeNodeCellInformations2D(cell0,cell0_coord,nodes_coord);
277 ARCANE_THROW(NotImplementedException,
"this method is implemented only for 2D and 3D mesh (dim={0})",dim);
283void CartesianMeshPatch::
288 Integer
nb_dir = m_mesh->mesh()->dimension();
289 for( Integer i=0; i<
nb_dir; ++i ){
294 info(4) <<
"PATCH i=" << m_amr_patch_index <<
" nb_cell=" <<
dm_cells.size();
326 info(4) <<
"PATCH i=" << m_amr_patch_index <<
" nb_null_face_cell=" <<
nb_null_face_cell;
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Infos sur les mailles d'une direction spécifique X,Y ou Z d'un maillage structuré.
Maille avec info directionnelle des faces.
Maille avant et après une maille suivant une direction.
Infos sur maille avant et après une face suivant une direction.
Infos sur les face d'une direction spécifique X,Y ou Z d'un maillage structuré.
Classe utilitaire pour imprimer les infos sur une entité.
Node node(Int32 i) const
i-ème noeud de l'entité
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Classe gérant un vecteur de réel de dimension 3.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Arccore::Int8 Int8
Type représentant un entier sur 8 bits.
eMeshDirection
Type de la direction pour un maillage structuré
Int32 Integer
Type représentant un entier.
Real y
deuxième composante du triplet
Real x
première composante du triplet