17#include <Connectivite_som_elem.h>
18#include <Static_Int_Lists.h>
19#include <Faces_builder.h>
29template <
typename _SIZE_>
32template <
typename _SIZE_>
35template <
typename _SIZE_>
50template <
typename _SIZE_>
68inline void check_boundary_name(
const Nom& name)
71 if (name==
"devant" || name==
"derriere")
73 Cerr <<
"Problem : you must change the name of the boundary : " <<name<<finl;
74 Cerr <<
"because the extrusion keyword is going to create new boundaries named derriere and devant" << finl;
75 Cerr <<
"which will create a conflict." << finl;
85template <
typename _SIZE_>
108 Type_Face type_face = dom.type_elem()->type_face(0);
109 les_faces.
typer(type_face);
116 construire_connectivite_som_elem(nb_sommets_tot,
118 connectivite_som_elem,
124 connectivite_som_elem,
131 int_t newnbsom = (oldnbsom*(
NZ+1)+
NZ*oldsz+nbfaces2D*
NZ);
138 for (
int i=0; i<oldnbsom; i++)
140 double x = coord_sommets(i,0);
141 double y = coord_sommets(i,1);
144 z=coord_sommets(i,2);
146 for (
int k=0; k<=
NZ; k++)
148 new_soms(k*oldnbsom+i,0)=x;
149 new_soms(k*oldnbsom+i,1)=y;
150 new_soms(k*oldnbsom+i,2)=z;
160 for (
int_t i=0; i<oldsz; i++)
162 int_t i0=les_elems(i,0);
163 int_t i1=les_elems(i,1);
164 int_t i2=les_elems(i,2);
166 double xg = 1./3.*(coord_sommets(i0,0)+coord_sommets(i1,0)+coord_sommets(i2,0))+0.5*dx;
167 double yg = 1./3.*(coord_sommets(i0,1)+coord_sommets(i1,1)+coord_sommets(i2,1))+0.5*dy;
170 z = 1./3.*(coord_sommets(i0,2)+coord_sommets(i1,2)+coord_sommets(i2,2))+0.5*dz;
171 for (
int k=0; k<
NZ; k++)
174 new_soms((oldnbsom*(
NZ+1)+k*oldsz+i),0)=xg;
175 new_soms((oldnbsom*(
NZ+1)+k*oldsz+i),1)=yg;
176 new_soms((oldnbsom*(
NZ+1)+k*oldsz+i),2)=z;
186 for (
int i=0; i<nbfaces2D; i++)
191 double x01 = 0.5*(coord_sommets(i0,0)+coord_sommets(i1,0))+0.5*dx;
192 double y01 = 0.5*(coord_sommets(i0,1)+coord_sommets(i1,1))+0.5*dy;
195 z = 0.5*(coord_sommets(i0,2)+coord_sommets(i1,2))+0.5*dz;
197 for (
int k=0; k<
NZ; k++)
199 new_soms((oldnbsom*(
NZ+1)+
NZ*oldsz+k*nbfaces2D+i),0)=x01;
200 new_soms((oldnbsom*(
NZ+1)+
NZ*oldsz+k*nbfaces2D+i),1)=y01;
201 new_soms((oldnbsom*(
NZ+1)+
NZ*oldsz+k*nbfaces2D+i),2)=z;
218 for (
int_t i=0; i<oldsz; i++)
220 int_t i0=les_elems(i,0);
221 int_t i1=les_elems(i,1);
222 int_t i2=les_elems(i,2);
226 for (
int k=0; k<
NZ; k++)
228 new_elems(2*k*oldsz+2*i,0) = i0;
229 new_elems(2*k*oldsz+2*i,1) = i1;
230 new_elems(2*k*oldsz+2*i,2) = i2;
231 new_elems(2*k*oldsz+2*i,3) = ig;
234 new_elems(2*k*oldsz+2*i+1,0) = i0+oldnbsom;
235 new_elems(2*k*oldsz+2*i+1,1) = i1+oldnbsom;
236 new_elems(2*k*oldsz+2*i+1,2) = i2+oldnbsom;
237 new_elems(2*k*oldsz+2*i+1,3) = ig;
252 for (
int_t i=0; i<nbfaces2D; i++)
254 for (
int ivois=0; ivois<2; ivois++)
266 int_t ig=oldnbsom*(
NZ+1)+k*oldsz+elem;
268 new_elems(cpt,0) = i0;
269 new_elems(cpt,1) = i1;
270 new_elems(cpt,2) = i01;
271 new_elems(cpt++,3) = ig;
273 new_elems(cpt,0) = i0+oldnbsom;
274 new_elems(cpt,1) = i1+oldnbsom;
275 new_elems(cpt,2) = i01;
276 new_elems(cpt++,3) = ig;
278 new_elems(cpt,0) = i1;
279 new_elems(cpt,1) = i1+oldnbsom;
280 new_elems(cpt,2) = i01;
281 new_elems(cpt++,3) = ig;
283 new_elems(cpt,0) = i0;
284 new_elems(cpt,1) = i0+oldnbsom;
285 new_elems(cpt,2) = i01;
286 new_elems(cpt++,3) = ig;
298 les_elems.
ref(new_elems);
302 dom.
typer(
"Tetraedre");
309 Cerr <<
"It is not known yet how to extrude "
316template <
typename _SIZE_>
317void Extruder_32_64<_SIZE_>::traiter_faces_dvt(Faces_t& les_faces_bord, Faces_t& les_faces, int_t oldnbsom, int_t oldsz, int_t nbfaces2D )
319 int_t size_2D = les_faces_bord.nb_faces();
321 IntTab_t les_sommets(4*size_2D*NZ, 3);
323 for (int_t i=0; i<size_2D; i++)
325 int_t i0=les_faces_bord.sommet(i,0);
326 int_t i1=les_faces_bord.sommet(i,1);
333 for (int_t iface=0; iface<nbfaces2D; iface++)
335 int_t j0=les_faces.sommet(iface,0);
336 int_t j1=les_faces.sommet(iface,1);
338 if (((i0==j0) &&(i1==j1)) || ((i0==j1) &&(i1==j0)))
346 for (int_t k=0; k<NZ; k++)
350 int_t j01 = oldnbsom*(NZ+1)+NZ*oldsz+k*nbfaces2D+jface;
352 les_sommets(k*4*size_2D+4*i,0) = i0;
353 les_sommets(k*4*size_2D+4*i,1) = i1;
354 les_sommets(k*4*size_2D+4*i,2) = j01;
356 les_sommets(k*4*size_2D+4*i+1,0) = j01;
357 les_sommets(k*4*size_2D+4*i+1,1) = i1;
358 les_sommets(k*4*size_2D+4*i+1,2) = i1+oldnbsom;
361 les_sommets(k*4*size_2D+4*i+2,0) = j01;
362 les_sommets(k*4*size_2D+4*i+2,1) = i0+oldnbsom;
363 les_sommets(k*4*size_2D+4*i+2,2) = i1+oldnbsom;
366 les_sommets(k*4*size_2D+4*i+3,0) = j01;
367 les_sommets(k*4*size_2D+4*i+3,1) = i0+oldnbsom;
368 les_sommets(k*4*size_2D+4*i+3,2) = i0;
375 les_faces_bord.typer(Type_Face::triangle_3D);
376 les_faces_bord.les_sommets().ref(les_sommets);
377 les_faces_bord.voisins().resize(4*size_2D*NZ, 2);
378 les_faces_bord.voisins()=-1;
382template <
typename _SIZE_>
391 check_boundary_name(itr.le_nom());
392 Faces_t& les_faces_bord = itr.faces();
393 traiter_faces_dvt(les_faces_bord, les_faces, oldnbsom, oldsz, nbfaces2D);
398 check_boundary_name(itr->le_nom());
399 Faces_t& les_faces_bord = itr->faces();
400 traiter_faces_dvt(les_faces_bord, les_faces, oldnbsom, oldsz, nbfaces2D);
406 les_faces_dvt.
typer(Type_Face::triangle_3D);
413 derriere.
nommer(
"derriere");
415 les_faces_der.
typer(Type_Face::triangle_3D);
421 for (
int_t i=0; i<oldsz; i++)
423 int_t i0=les_elems(2*i,0);
424 int_t i1=les_elems(2*i,1);
425 int_t i2=les_elems(2*i,2);
431 som_der(i,0) = i0+oldnbsom*
NZ;
432 som_der(i,1) = i1+oldnbsom*
NZ;
433 som_der(i,2) = i2+oldnbsom*
NZ;
442template <
typename _SIZE_>
456 Type_Face type_face = dom.type_elem()->type_face(0);
457 les_faces.
typer(type_face);
464 construire_connectivite_som_elem(nb_sommets_tot,
466 connectivite_som_elem,
472 connectivite_som_elem,
477 int_t newnbsom = oldnbsom*(
NZ+1);
484 for (i=0; i<oldnbsom; i++)
486 double x = coord_sommets(i,0);
487 double y = coord_sommets(i,1);
490 z=coord_sommets(i,2);
491 for (
int k=0; k<=
NZ; k++)
493 new_soms(k*oldnbsom+i,0)=x;
494 new_soms(k*oldnbsom+i,1)=y;
495 new_soms(k*oldnbsom+i,2)=z;
512 for (i=0; i<oldsz; i++)
514 int_t i0=les_elems(i,0);
515 int_t i1=les_elems(i,1);
516 int_t i2=les_elems(i,2);
517 int_t i3=les_elems(i,3);
522 new_elems(k*oldsz+i,0) = i0;
523 new_elems(k*oldsz+i,1) = i1;
524 new_elems(k*oldsz+i,2) = i2;
525 new_elems(k*oldsz+i,3) = i3;
526 new_elems(k*oldsz+i,4) = i0+oldnbsom;
527 new_elems(k*oldsz+i,5) = i1+oldnbsom;
528 new_elems(k*oldsz+i,6) = i2+oldnbsom;
529 new_elems(k*oldsz+i,7) = i3+oldnbsom;
539 les_elems.
ref(new_elems);
543 if ((dom.type_elem()->
que_suis_je()) ==
"Quadrangle")
544 dom.
typer(
"Hexaedre_VEF");
546 dom.
typer(
"Hexaedre");
550template <
typename _SIZE_>
551void Extruder_32_64<_SIZE_>::traiter_faces_dvt_hexa(Faces_t& les_faces_bord, int_t oldnbsom)
553 int_t size_2D = les_faces_bord.nb_faces();
555 IntTab_t les_sommets(size_2D*NZ, 4);
557 for (int_t i=0; i<size_2D; i++)
559 int_t i0=les_faces_bord.sommet(i,0);
560 int_t i1=les_faces_bord.sommet(i,1);
563 for (int_t k=0; k<NZ; k++)
565 les_sommets(k*size_2D+i,0) = i0;
566 les_sommets(k*size_2D+i,1) = i1;
567 les_sommets(k*size_2D+i,2) = i0+oldnbsom;
568 les_sommets(k*size_2D+i,3) = i1+oldnbsom;
575 les_faces_bord.typer(Type_Face::quadrangle_3D);
576 les_faces_bord.les_sommets().ref(les_sommets);
577 les_faces_bord.voisins().resize(size_2D*NZ, 2);
578 les_faces_bord.voisins()=-1;
580template <
typename _SIZE_>
588 check_boundary_name(itr.le_nom());
589 Faces_t& les_faces_bord = itr.faces();
590 traiter_faces_dvt_hexa(les_faces_bord, oldnbsom);
595 check_boundary_name(itr->le_nom());
598 traiter_faces_dvt_hexa(les_faces_bord, oldnbsom);
604 les_faces_dvt.
typer(Type_Face::quadrangle_3D);
611 derriere.
nommer(
"derriere");
613 les_faces_der.
typer(Type_Face::quadrangle_3D);
619 for (
int_t i=0; i<oldsz; i++)
621 int_t i0=les_elems(i,0);
622 int_t i1=les_elems(i,1);
623 int_t i2=les_elems(i,2);
624 int_t i3=les_elems(i,3);
631 som_der(i,0) = i0+oldnbsom*
NZ;
632 som_der(i,1) = i1+oldnbsom*
NZ;
633 som_der(i,2) = i2+oldnbsom*
NZ;
634 som_der(i,3) = i3+oldnbsom*
NZ;
DoubleTab_t & les_sommets()
Raccords_t & faces_raccord()
void typer(const Nom &)
Sets the element type of the domain using the name passed as parameter.
int_t nb_som_tot() const
Returns the total number of vertices of the domain i.e. the number of real and virtual vertices on th...
int_t nb_som() const
Returns the number of vertices of the domain.
void ajouter(const DoubleTab_t &soms)
Adds nodes (or vertices) to the domain (without checking for duplicates).
Class defining operators and methods for all reading operation in an input flow (file,...
class Extruder This class is an interpreter used to read and execute
DoubleTab_T< _SIZE_ > DoubleTab_t
Faces_builder_32_64< _SIZE_ > Faces_builder_t
Faces_32_64< _SIZE_ > Faces_t
Bord_32_64< _SIZE_ > Bord_t
IntTab_T< _SIZE_ > IntTab_t
Static_Int_Lists_32_64< _SIZE_ > Static_Int_Lists_t
Domaine_32_64< _SIZE_ > Domaine_t
Entree & interpreter_(Entree &) override
Main function of the Extruder interpreter. Extrudes the domain.
virtual void extruder_dvt_hexa(Domaine_t &, Faces_t &, int_t, int_t)
virtual void extruder_dvt(Domaine_t &, Faces_t &, int_t, int_t)
void extruder(Domaine_t &)
Extrudes all elements of a domain: transforms the geometric elements of the domain into 3D elements.
void extruder_hexa(Domaine_t &)
void typer(const Motcle &)
Sets the type of the faces.
void associer_domaine(const Domaine_t &z)
IntTab_t & voisins()
Returns the array of neighbors (of the faces).
int_t voisin(int_t, int) const
Returns the number of the i-th neighbor of face.
const IntTab_t & les_sommets() const
Returns the array of vertices of all faces.
int_t sommet(int_t, int) const
Returns the number of the j-th vertex of the i-th face.
void creer_faces_reeles(Domaine_t &domaine, const Static_Int_Lists_t &connect_som_elem, Faces_t &les_faces, IntTab_t &elem_faces)
From the description of the domain elements and boundaries (borders, connections, face groups,...
void nommer(const Nom &) override
Gives a name to the boundary.
const Faces_t & faces() const
Class Interprete_geometrique_base.
void mettre_a_jour_sous_domaine(Domaine_t &domaine, int_t &elem, int_t num_premier_elem, int_t nb_elem) const
Adds the new elements into the sub-domains.
void associer_domaine(Nom &nom_dom)
Domaine_t & domaine(int i=0)
class Nom: a character string for naming TRUST objects.
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter_arr_size_predefinie(const char *keyword, const ArrOfInt *value, Param::Nature nat=Param::OPTIONAL)
Register an ArrOfInt whose size has already been fixed.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
int lire_avec_accolades_depuis(Entree &is)
Parse the parameter block { ... } from is.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static void init_sequential_domain(Domaine_32_64< _SIZE_ > &dom)
Create parallel descriptors for the vertex and element arrays of the domain (necessary because Scatte...
static void uninit_sequential_domain(Domaine_32_64< _SIZE_ > &dom)
Method used by interpreters that modify the domain (sequential), destroys the descriptors of vertices...
Base class for output streams.
virtual void ref(const TRUSTTab &)
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension(int d) const