44 Cerr <<
"Redresser_hexaedres_vdf can't be used during a parallel calculation." << finl;
49 int nb_sommets = les_sommets.
dimension(0);
53 const Elem_geom_base& elem=
domaine().type_elem().valeur();
54 Cerr <<
"Attempt on the mesh ";
55 if (sub_type(Rectangle,elem)) Cerr <<
"to correct rectangles..." << finl;
56 else if (sub_type(Quadrangle_VEF,elem)) Cerr <<
"to correct VEF quadrangles into rectangles..." << finl;
57 else if (sub_type(Hexaedre,elem)) Cerr <<
"to correct hexahedra..." << finl;
58 else if (sub_type(Hexaedre_VEF,elem)) Cerr <<
"to correct VEF hexahedra into regular hexahedra..." << finl;
61 Cerr <<
"This type of element ("<<elem.
que_suis_je()<<
") is not supported by Redresser_hexaedres_vdf" << finl;
66 Elem_geom_base& new_elem=
domaine().type_elem().valeur();
69 double correction_max = 0;
73 for (
int direction = 0; direction <
dimension; direction++)
75 ArrOfInt marqueurs(nb_sommets);
76 ArrOfInt liste_sommets;
78 int prochain_sommet = 0;
79 while (prochain_sommet < nb_sommets)
82 for (; prochain_sommet < nb_sommets; prochain_sommet++)
83 if (! marqueurs[prochain_sommet])
85 if (prochain_sommet == nb_sommets)
89 double x = les_sommets(prochain_sommet, 0);
90 double y = les_sommets(prochain_sommet, 1);
91 double z = (
dimension == 3) ? les_sommets(prochain_sommet, 2) : 0.;
92 double xmin = (direction==0) ? (x-epsilon) : (-DMAXFLOAT);
93 double xmax = (direction==0) ? (x+epsilon) : (+DMAXFLOAT);
94 double ymin = (direction==1) ? (y-epsilon) : (-DMAXFLOAT);
95 double ymax = (direction==1) ? (y+epsilon) : (+DMAXFLOAT);
96 double zmin = (direction==2) ? (z-epsilon) : (-DMAXFLOAT);
97 double zmax = (direction==2) ? (z+epsilon) : (+DMAXFLOAT);
102 for (
int i = 0; i < n; i++)
104 const int j = liste_sommets[i];
106 if (j == prochain_sommet)
110 const double coord_ref = les_sommets(prochain_sommet, direction);
114 const double coord = les_sommets(j, direction);
115 if (std::fabs(coord-coord_ref) > epsilon)
118 correction_max=std::max(correction_max,std::fabs(coord_ref-les_sommets(j, direction)));
120 les_sommets(j, direction) = coord_ref;
123 marqueurs[prochain_sommet] = 1;
127 Cerr <<
"Redresser_hexaedres_vdf, epsilon=" << epsilon <<
" maximum_correction=" << correction_max << finl;
130 Cerr <<
"Redresser_hexaedres_vdf failed" << finl;
131 Cerr <<
"it has failed to make regular hexahedra on the mesh." << finl;
135 ok=ref_cast(Rectangle,new_elem).reordonner_elem();
137 ok=ref_cast(Hexaedre,new_elem).reordonner_elem();
140 Cerr <<
"End and success of Redresser_hexaedres_vdf" << finl;
DoubleTab_t & les_sommets()
void typer(const Nom &)
Type les elements du domaine avec le nom passe en parametre.
int_t search_elements_box(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, ArrOfInt_t &elements) const
cherche tous les elements ou points ayant potentiellement une intersection non vide avec la boite don...