50 Cerr <<
" Distance_paroi : the calculation of the distance to the wall is made in sequential mode !! " << finl;
59 Noms nom_paroi(nb_paroi);
61 for (
int i=0; i< nb_paroi; i++) is >> nom_paroi[i];
64 if( (format !=
"binaire") && (format !=
"formatte"))
66 Cerr<<
"Define the writing's format 'formatte' to write the file Wall_length.xyz"<<finl;
67 Cerr<<
"both in binary and ascii format, otherwise specify 'binaire'"<<finl;
74 fichier +=
"_Wall_length.xyz";
76 Cerr <<
"In Distanceparoi::interpreter : Generate faces" << finl;
77 Faces* les_faces_ptr=
new(Faces);
78 Faces& les_faces= *les_faces_ptr;
84 Type_Face type_face = dom.type_elem()->type_face(0);
85 les_faces.
typer(type_face);
88 Static_Int_Lists connectivite_som_elem;
92 construire_connectivite_som_elem(nb_sommets_tot,
94 connectivite_som_elem,
97 Faces_builder faces_builder;
100 connectivite_som_elem,
104 Cerr <<
"In Distanceparoi::interpreter : Generate faces finished" << finl;
116 DoubleVect wall_length(nb_elem_tot);
118 DoubleVect dist_min(wall_length);
120 ifstream fic1(fichier);
123 Cerr <<
" file " << fichier <<
" already exits : to generate a new one, this file has to be deleted" << finl;
128 Cerr <<
" Generation of the external file named : " << fichier << finl;
130 for (
int b=0; b<nb_paroi; b++)
133 const Frontiere& la_frontiere=dom.
frontiere(rang);
136 const IntTab& sommets_face = (ref_cast(Frontiere,la_frontiere)).les_sommets_des_faces();
139 int nb_faces = la_frontiere.
nb_faces();
140 int nfin = ndeb + nb_faces;
144 for (
int face=ndeb; face<nfin; face++)
147 if((((face-ndeb)*100)/nb_faces)>pourcent)
149 pourcent=((face-ndeb)*100)/nb_faces;
150 Cerr <<
"\r"<< pourcent <<
" % performs of " << nom_paroi[b] ;
155 double compx_0=(xv(face,0));
156 double compy_0=(xv(face,1));
158 int som1=sommets_face(face-ndeb,0);
159 int som2=sommets_face(face-ndeb,1);
161 double nx= xs(som1,1)-xs(som2,1);
162 double ny=-(xs(som1,0)-xs(som2,0));
164 double norme=sqrt(nx*nx+ny*ny);
167 Cerr <<
"Error in Distanceparoi::interpreter_" << finl;
168 Cerr <<
"Two nodes " << som1 <<
" and " << som2 <<
" seems to have same coordinates:" << finl;
169 Cerr <<
"xs(" << som1 <<
")=" << xs(som1,0) <<
" ys(" << som1 <<
")= " << xs(som1,1) << finl;
170 Cerr <<
"xs(" << som2 <<
")=" << xs(som2,0) <<
" ys(" << som2 <<
")= " << xs(som2,1) << finl;
171 Cerr <<
"Check your mesh and suppress same nodes or contact TRUST support." << finl;
181 for (
int num_elem=0; num_elem<nb_elem_tot; num_elem++)
183 double min_loc=dist_min[num_elem];
185 double compx=(compx_0-xp(num_elem,0));
188 double compy=(compy_0-xp(num_elem,1));
192 double w_dist=sqrt(compx*compx+compy*compy);
196 double compx_vect=compx*nx;
197 double compy_vect=compy*ny;
200 double w_distproj=sqrt(compx_vect*compx_vect+compy_vect*compy_vect);
201 wall_length[num_elem]=w_distproj;
202 dist_min[num_elem]=w_dist;
212 double compx_0=(xv(face,0));
213 double compy_0=(xv(face,1));
214 double compz_0=(xv(face,2));
216 int som1=sommets_face(face-ndeb,0);
217 int som2=sommets_face(face-ndeb,1);
218 int som3=sommets_face(face-ndeb,2);
220 double x1= xs(som2,0)-xs(som1,0);
221 double y1= xs(som2,1)-xs(som1,1);
222 double z1= xs(som2,2)-xs(som1,2);
224 double x2= xs(som3,0)-xs(som1,0);
225 double y2= xs(som3,1)-xs(som1,1);
226 double z2= xs(som3,2)-xs(som1,2);
228 double nx= y1*z2 - z1*y2 ;
229 double ny= z1*x2 - x1*z2 ;
230 double nz= x1*y2 - y1*x2 ;
232 double norme=sqrt(nx*nx+ny*ny+nz*nz);
234 if ( (dom.
chercher_elements(compx_0+nx, compy_0+ny, compz_0+nz)) < 0 ) norme*=-1.;
241 for (
int num_elem=0; num_elem<nb_elem_tot; num_elem++)
243 double min_loc=dist_min[num_elem];
245 double compx=(compx_0-xp(num_elem,0));
248 double compy=(compy_0-xp(num_elem,1));
251 double compz=(compz_0-xp(num_elem,2));
255 double w_dist=sqrt(compx*compx+compy*compy+compz*compz);
259 double compx_vect=compx*nx;
260 double compy_vect=compy*ny;
261 double compz_vect=compz*nz;
263 double w_distproj=sqrt(compx_vect*compx_vect+compy_vect*compy_vect+compz_vect*compz_vect);
264 wall_length[num_elem]=w_distproj;
265 dist_min[num_elem]=w_dist;
274 Cerr <<
"ERROR : Dimension 2 or 3 are required to calculate wall distance "<< finl;
282 Cerr<<
" Max distance"<< local_max_vect(dist_min)<<
" "<< local_max_vect(wall_length)<<finl;
288 fic_sauv<<nom_paroi<<finl;
292 fic_sauv << (int)1 <<ntot << (
int)1 << ntot << finl << ntot << finl;
294 for (
int p=0; p<nb_elem_tot; p++)
296 fic_sauv<<xp(p,0)<<
" "<<xp(p,1);
298 fic_sauv<<
" "<<wall_length(p)<<finl;
301 fic_sauv << ntot << (int)0 << (
int)0 << (int)0 << (
int)1 << (int)0 << finl << ntot << finl << (
int)1 << (int)0 << (
int)0 <<finl;
303 if (format==
"formatte")
306 fichier +=
"_Wall_length_formatted.xyz";
308 fic_sauv_format<<nom_paroi<<finl;
311 fic_sauv_format << (int)1 <<ntot2 << (
int)1 << ntot2 << finl << ntot2 << finl;
312 for (
int p=0; p<nb_elem_tot; p++)
314 fic_sauv_format<<xp(p,0)<<
" "<<xp(p,1);
316 fic_sauv_format<<
" "<<wall_length(p)<<finl;
318 fic_sauv_format << ntot2 << (int)0 << (
int)0 << (int)0 << (
int)1 << (int)0 << finl << ntot2 << finl << (
int)1 << (int)0 << (
int)0 <<finl;
321 delete les_faces_ptr;
SmallArrOfTID_t & chercher_elements(const DoubleTab &pos, SmallArrOfTID_t &elem, int reel=0) const
Recherche des elements contenant les points dont les coordonnees sont specifiees.
void calculer_centres_gravite(DoubleTab_t &xp) const
Calcule les centres de gravites des elements du domaine.
const Frontiere_t & frontiere(int i) const
const DoubleTab_t & coord_sommets() const
int_t nb_som_tot() const
Renvoie le nombre total de sommets du domaine i.e. le nombre de sommets reels et virtuels sur le proc...
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.