14#include "arcane/std/internal/SodStandardGroupsBuilder.h"
16#include "arcane/utils/ArrayView.h"
17#include "arcane/utils/Real3.h"
19#include "arcane/IMesh.h"
20#include "arcane/IItemFamily.h"
21#include "arcane/Item.h"
22#include "arcane/ItemPrinter.h"
23#include "arcane/ItemEnumerator.h"
24#include "arcane/MeshVariable.h"
35void SodStandardGroupsBuilder::
38 info() <<
"Creation group de face '" << name <<
"'"
39 <<
" size=" << faces_lid.size();
41 IItemFamily* face_family = mesh->faceFamily();
43 FaceInfoListView mesh_faces(face_family);
45 for( Integer z=0, zs=faces_lid.size(); z<zs; ++ z){
46 Face face(mesh_faces[faces_lid[z]]);
48 for( NodeLocalId inode : face.nodes() )
53 face_family->createGroup(name,faces_lid);
59void SodStandardGroupsBuilder::
60generateGroups(IMesh* mesh,Real3 min_pos,Real3 max_pos,
Real middle_x,
Real middle_height)
63 Int32 mesh_dimension = mesh->dimension();
65 const Real min_x = min_pos.x;
66 const Real min_y = min_pos.y;
67 const Real min_z = min_pos.z;
68 const Real max_x = max_pos.x;
69 const Real max_y = max_pos.y;
70 const Real max_z = max_pos.z;
71 IItemFamily* cell_family = mesh->cellFamily();
72 info() <<
"Generate standard groups for SOD: "
73 <<
" min=" << min_pos <<
" max=" << max_pos
74 <<
" middle_x=" << middle_x <<
" middle_height=" << middle_height;
86 Integer face_local_id = face.localId();
94 for( Node inode : face.nodes() ){
95 Real3 coord = nodes_coord_var[inode];
112 xmin_surface_lid.add(face_local_id);
114 xmax_surface_lid.add(face_local_id);
116 ymin_surface_lid.add(face_local_id);
118 ymax_surface_lid.add(face_local_id);
120 zmin_surface_lid.add(face_local_id);
122 zmax_surface_lid.add(face_local_id);
125 _createFaceGroup(mesh,
"XMIN",xmin_surface_lid);
126 _createFaceGroup(mesh,
"XMAX",xmax_surface_lid);
127 if (mesh_dimension>=2){
128 _createFaceGroup(mesh,
"YMIN",ymin_surface_lid);
129 _createFaceGroup(mesh,
"YMAX",ymax_surface_lid);
131 if (mesh_dimension==3){
132 _createFaceGroup(mesh,
"ZMIN",zmin_surface_lid);
133 _createFaceGroup(mesh,
"ZMAX",zmax_surface_lid);
141 const Real xlimit = middle_x;
144 bool is_in_zd =
false;
145 bool is_in_zg =
false;
146 const Cell& cell = *icell;
147 Integer local_id = cell.localId();
148 for( Node inode : cell.nodes() ){
149 Real x = nodes_coord_var[inode].x;
159 for( Node inode : cell.nodes() ){
160 Real x = nodes_coord_var[inode].x;
161 info() <<
" X=" << x;
163 info() <<
" is equal to " << xlimit;
165 Real s = math::abs(x) + math::abs(xlimit);
168 info() <<
" nearly s=" << s <<
" d=" << d <<
" r=" << r;
169 info() <<
" r<0.0=" << (r<0.0) <<
" r>-e=" << (r>-FloatInfo<Real>::nearlyEpsilon())
170 <<
" r<e=" << (r<FloatInfo<Real>::nearlyEpsilon());
173 info() <<
" is in zd";
175 info() <<
" is in zg";
177 ARCANE_FATAL(
"SodGenerator: cell '{0}' is in both ZG and ZD",ItemPrinter(cell));
180 zg_lid.add(local_id);
184 zd_lid.add(local_id);
187 info() <<
"Create ZG with " << zg_lid.size() <<
" cells";
188 cell_family->createGroup(
"ZG",zg_lid);
189 info() <<
"Create ZD with " << zd_lid.size() <<
" cells";
190 cell_family->createGroup(
"ZD",zd_lid);
195 ItemGroup zdGroup = cell_family->findGroup(
"ZD");
197 fatal()<<
"zdGroup has not been found!";
200 const Real height_limit = middle_height;
202 bool is_in_zd_bas =
false;
203 bool is_in_zd_haut =
false;
205 Integer local_id = cell.localId();
206 for( Node inode : cell.nodes() ){
207 Real height = (mesh_dimension==2)?nodes_coord_var[inode].y:nodes_coord_var[inode].z;
211 if (height > height_limit)
212 is_in_zd_haut =
true;
218 fatal() <<
"SodGenerator: cell " << ItemPrinter(cell) <<
" in ZD_BAS and ZD_HAUT";
220 zd_bas_lid.add(local_id);
224 zd_haut_lid.add(local_id);
227 info() <<
"Create ZD_BAS with " << zd_bas_lid.size() <<
" cells";
228 cell_family->createGroup(
"ZD_BAS",zd_bas_lid);
229 info() <<
"Create ZD_HAUT with " << zd_haut_lid.size() <<
" cells";
230 cell_family->createGroup(
"ZD_HAUT",zd_haut_lid);
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium) const
Flot pour un message de debug.
TraceMessage info() const
Flot pour un message d'information.
TraceMessage fatal() const
Flot pour un message d'erreur fatale.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Grandeur au noeud de type coordonnées.
constexpr ARCCORE_HOST_DEVICE bool isNearlyEqual(const _Type &a, const _Type &b)
Teste si deux valeurs sont à un peu près égales. Pour les types entiers, cette fonction est équivalen...
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
bool arcaneIsDebug()
Vrai si la macro ARCANE_DEBUG est définie.
UniqueArray< Int32 > Int32UniqueArray
Tableau dynamique à une dimension d'entiers 32 bits.
Namespace contenant les types liés aux traces.
@ Highest
Niveau le plus élevé
Int32 Integer
Type représentant un entier.