14#include "arcane/std/internal/SodStandardGroupsBuilder.h"
16#include "arcane/utils/ArrayView.h"
17#include "arcane/utils/Real3.h"
19#include "arcane/core/IMesh.h"
20#include "arcane/core/IItemFamily.h"
21#include "arcane/core/Item.h"
22#include "arcane/core/ItemPrinter.h"
24#include "arcane/core/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);
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;
72 info() <<
"Generate standard groups for SOD: "
73 <<
" min=" << min_pos <<
" max=" << max_pos
74 <<
" middle_x=" << middle_x <<
" middle_height=" << middle_height;
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);
124 _createFaceGroup(
mesh,
"XMIN", xmin_surface_lid);
125 _createFaceGroup(
mesh,
"XMAX", xmax_surface_lid);
126 if (mesh_dimension >= 2) {
127 _createFaceGroup(
mesh,
"YMIN", ymin_surface_lid);
128 _createFaceGroup(
mesh,
"YMAX", ymax_surface_lid);
130 if (mesh_dimension == 3) {
131 _createFaceGroup(
mesh,
"ZMIN", zmin_surface_lid);
132 _createFaceGroup(
mesh,
"ZMAX", zmax_surface_lid);
140 const Real xlimit = middle_x;
142 bool is_in_zd =
false;
143 bool is_in_zg =
false;
144 const Cell& cell = *icell;
147 Real x = nodes_coord_var[inode].x;
158 Real x = nodes_coord_var[inode].x;
159 info() <<
" X=" << x;
161 info() <<
" is equal to " << xlimit;
163 Real s = math::abs(x) + math::abs(xlimit);
166 info() <<
" nearly s=" << s <<
" d=" << d <<
" r=" << r;
168 <<
" r<e=" << (r < FloatInfo<Real>::nearlyEpsilon());
171 info() <<
" is in zd";
173 info() <<
" is in zg";
178 zg_lid.
add(local_id);
182 zd_lid.
add(local_id);
185 info() <<
"Create ZG with " << zg_lid.
size() <<
" cells";
187 info() <<
"Create ZD with " << zd_lid.
size() <<
" cells";
198 const Real height_limit = middle_height;
200 bool is_in_zd_bas =
false;
201 bool is_in_zd_haut =
false;
205 Real height = (mesh_dimension == 2) ? nodes_coord_var[inode].y : nodes_coord_var[inode].z;
209 if (height > height_limit)
210 is_in_zd_haut =
true;
216 fatal() <<
"SodGenerator: cell " <<
ItemPrinter(cell) <<
" in ZD_BAS and ZD_HAUT";
218 zd_bas_lid.
add(local_id);
222 zd_haut_lid.
add(local_id);
225 info() <<
"Create ZD_BAS with " << zd_bas_lid.
size() <<
" cells";
227 info() <<
"Create ZD_HAUT with " << zd_haut_lid.
size() <<
" cells";
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Integer size() const
Number of elements in the vector.
void add(ConstReferenceType val)
Adds element val to the end of the array.
Information about the floating-point type.
Interface of an entity family.
virtual ItemGroup findGroup(const String &name) const =0
Searches for a group.
virtual ItemGroup createGroup(const String &name, Int32ConstArrayView local_ids, bool do_override=false)=0
Creates an entity group named name containing the entities local_ids.
bool null() const
true means the group is the null group
Utility class for printing information about an entity.
NodeConnectedListViewType nodes() const
List of nodes of the entity.
constexpr Int32 localId() const
Local identifier of the entity in the processor subdomain.
Class managing a 3-dimensional real vector.
void generateGroups(IMesh *mesh, Real3 min_pos, Real3 max_pos, Real middle_x, Real middle_height, bool do_zg_and_zd)
Creates the groups for initializing a Sod shock tube.
Unicode character string.
TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium) const
Flow for a debug message.
TraceMessage fatal() const
Flow for a fatal error message.
TraceMessage info() const
Flow for an information message.
1D data vector with value semantics (STL style).
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Coordinate type quantity at node.
constexpr __host__ __device__ bool isNearlyEqual(const _Type &a, const _Type &b)
Tests if two values are approximately equal. For integer types, this function is equivalent to IsEqua...
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
bool arcaneIsDebug()
True if the ARCANE_DEBUG macro is defined.
double Real
Type representing a real number.
std::int32_t Int32
Signed integer type of 32 bits.
Real y
second component of the triplet
Real z
third component of the triplet
Real x
first component of the triplet