TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
DecoupeBord.cpp
1/****************************************************************************
2* Copyright (c) 2026, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#include <DecoupeBord.h>
17#include <EFichier.h>
18#include <TRUSTArrays.h>
19#include <Param.h>
20#include <SFichier.h>
21#include <Parser_U.h>
22#include <Synonyme_info.h>
23
24Implemente_instanciable_32_64(DecoupeBord_32_64,"DecoupeBord",Interprete_geometrique_base_32_64<_T_>);
25Add_synonym(DecoupeBord,"DecoupeBord_pour_rayonnement");
26
27// XD decoupebord interprete decoupebord_pour_rayonnement BRACE To subdivide the external boundary of a domain into
28// XD_CONT several parts (may be useful for better accuracy when using radiation model in transparent medium). To
29// XD_CONT specify the boundaries of the fine_domain_name domain to be splitted. These boundaries will be cut according
30// XD_CONT the coarse mesh defined by either the keyword domaine_grossier (each boundary face of the coarse mesh
31// XD_CONT coarse_domain_name will be used to group boundary faces of the fine mesh to define a new boundary), either by
32// XD_CONT the keyword nb_parts_naif (each boundary of the fine mesh is splitted into a partition with nx*ny*nz
33// XD_CONT elements), either by a geometric condition given by a formulae with the keyword condition_geometrique. If
34// XD_CONT used, the coarse_domain_name domain should have the same boundaries name of the fine_domain_name domain. NL2
35// XD_CONT A mesh file (ASCII format, except if binaire option is specified) named by default newgeom (or specified by
36// XD_CONT the nom_fichier_sortie keyword) will be created and will contain the fine_domain_name domain with the
37// XD_CONT splitted boundaries named boundary_name%I (where I is between from 0 and n-1). Furthermore, several files
38// XD_CONT named boundary_name%I and boundary_name_xv will be created, containing the definition of the subdived
39// XD_CONT boundaries. newgeom will be used to calculate view factors with geom2ansys script whereas only the
40// XD_CONT boundary_name_xv files will be necessary for the radiation calculation. The file listb will contain the list
41// XD_CONT of the boundaries boundary_name%I.
42
43template <typename _SIZE_>
45{
46 return Interprete::printOn(os);
47}
48
49template <typename _SIZE_>
51{
52 return Interprete::readOn(is);
53}
54
55
56//// Helper implementation class - only visible here
57template <typename _SIZE_>
59{
60public:
61 using int_t = _SIZE_;
62 using ArrOfInt_t = ArrOfInt_T<_SIZE_>;
63 using IntTab_t = IntTab_T<_SIZE_>;
64 using IntVect_t = IntVect_T<_SIZE_>;
65 using DoubleTab_t = DoubleTab_T<_SIZE_>;
66 using ArrsOfInt_t = ArrsOfInt_T<_SIZE_>;
67
70
71 static void create_listb_from_domaine2(const Domaine_t& dom1, const Domaine_t& dom_oth,const Noms& nomdec);
72 static void create_listb_from_xyz(const Domaine_t& dom, const Noms& nomdec,const Noms& expr);
73 static void create_listb_naif(const Domaine_t& dom, const Noms& nomdec,const ArrOfInt& nbdec);
74 static void create_listb_geom(const Domaine_t& dom, const Noms& nomdec,const ArrOfInt& nbdec);
75
76 static inline int check_front_sz(const Frontiere_t& fr)
77 {
78 int_t tmp=fr.nb_faces();
79 if (tmp >= std::numeric_limits<int>::max())
80 {
81 Cerr << "Too many faces in frontiere '" << fr.le_nom() << "' (exceed 32b limit) - the support for this is not yet implemented." << finl;
82 Cerr << "Please contact TRUST support!" << finl;
83 Process::exit(-1);
84 }
85 return (int)tmp;
86 }
87};
88
89
90template <typename _SIZE_>
91void Impl_32_64<_SIZE_>::create_listb_from_domaine2(const Domaine_t& dom1, const Domaine_t& dom_oth,const Noms& nomdec)
92{
93 const DoubleTab_t& xs1=dom1.coord_sommets();
94 const DoubleTab_t& xs2=dom_oth.coord_sommets();
95
96 int nbfr=dom1.nb_front_Cl();
97
98 SFichier listb(dom1.le_nom()+".boundary_list");
99
100 for (int l=0; l<nbfr; l++)
101 {
102 const Frontiere_t& fr1=dom1.frontiere(l);
103 const Nom& nomfr1=fr1.le_nom();
104 int l2=dom_oth.rang_frontiere(nomfr1);
105
106 if(l2<0)
107 {
108 Cerr << " The domains " << dom1.le_nom() << " and " << dom_oth.le_nom() << " do not have the same names of boundaries " << finl;
109 Cerr<<nomfr1<<" not found in "<<dom1.le_nom() <<finl;
110 Cerr << " Make sure they were generated in a similar way (almost to the mesh size) " << finl;
112 }
113 const Frontiere_t& fr2=dom_oth.frontiere(l2);
114
115 if (nomdec.search(nomfr1)!=-1)
116 {
117 int_t nbfaces1=fr1.nb_faces();
118 const IntTab_t& sommets_face1 = (ref_cast(Frontiere_t,fr1)).les_sommets_des_faces();
119
120 int nbfaces2 = check_front_sz(fr2);
121 const IntTab_t& sommets_face2 = (ref_cast(Frontiere_t,fr2)).les_sommets_des_faces();
122
123 ArrsOfInt_t faces_associees(nbfaces2);
124
125 ArrOfDouble xg1(Objet_U::dimension); // center of gravity of face fr1
126 ArrOfDouble xg2(Objet_U::dimension); // center of gravity of face fr2
127
128 int nb_som_face=sommets_face1.dimension_int(1);
129
130 for (int_t face1=0; face1<nbfaces1; face1++) // Build the associated face list
131 {
132 xg1=0.;
133
134 for (int i=0; i<nb_som_face; i++)
135 for (int j=0; j<Objet_U::dimension; j++)
136 xg1[j]+=xs1(sommets_face1(face1,i),j); // center of gravity of face1 (not divided by nb_som_face)
137
138 // search for the corresponding face in dom2
139
140 double dist_min=1.e6;
141 int face_min=-1;
142
143 for (int face2=0; face2<nbfaces2; face2++)
144 {
145 xg2=0.;
146
147 for (int i=0; i<nb_som_face; i++)
148 for (int j=0; j<Objet_U::dimension; j++)
149 xg2[j]+=xs2(sommets_face2(face2,i),j); //center of gravity of face2 (not divided by nb_som_face)
150
151 double dist=0.;
152
153 for (int j=0; j<Objet_U::dimension; j++)
154 dist+=(xg2[j]-xg1[j])*(xg2[j]-xg1[j]);
155
156 if(dist<dist_min)
157 {
158 dist_min=dist ;
159 face_min=face2;
160 }
161 }
162
163 faces_associees[face_min].append_array(face1);
164 }
165
166 for (int face2=0; face2<nbfaces2; face2++) // Write output files
167 {
168 Nom nomfic(nomfr1);
169 nomfic+="%";
170 Nom n;
171 n=face2;
172 nomfic+=n;
173 SFichier s(nomfic);
174 s<<faces_associees[face2]<<finl;
175 listb<<nomfic<<finl;
176 s.close();
177 }
178
179 }
180 }
181
182 listb.close();
183}
184
185template <typename _SIZE_>
186void Impl_32_64<_SIZE_>::create_listb_from_xyz(const Domaine_t& dom, const Noms& nomdec,const Noms& expr)
187{
188 int n1=nomdec.size();
189 int n2=expr.size();
190 if(n1!=n2)
191 {
192 Cerr<<"The numbers of boundaries in 'bords_a_decouper' and 'condition_geometrique' have to be the same"<<finl;
194 }
195
196 const DoubleTab_t& xs1=dom.coord_sommets();
197 Parser_U parser;
199 parser.addVar("x");
200 parser.addVar("y");
201 if (Objet_U::dimension==3)
202 parser.addVar("z");
203
204 int nbfr=dom.nb_front_Cl();
205
206 SFichier listb(dom.le_nom()+".boundary_list");
207
208 for (int l=0; l<nbfr; l++)
209 {
210 const Frontiere_t& fr1=dom.frontiere(l);
211 const Nom& nomfr1=fr1.le_nom();
212
213 int inc=nomdec.search(nomfr1);
214 if (inc!=-1)
215 {
216 Nom expr2(expr[inc]);
217 parser.setString(expr2);
218 parser.parseString();
219
220 int nbfaces1 = check_front_sz(fr1);
221
222 const IntTab_t& sommets_face1 = (ref_cast(Frontiere_t,fr1)).les_sommets_des_faces();
223
224 ArrsOfInt_t faces_associees(1000); // hardcoded size which should be sufficient
225
226 ArrOfDouble xg1(Objet_U::dimension); // center of gravity of face fr1
227
228 int nb_som_face=sommets_face1.dimension_int(1);
229 int nb=0;
230
231 for (int face1=0; face1<nbfaces1; face1++) // Build the associated face list
232 {
233 xg1=0.;
234
235 for (int i=0; i<nb_som_face; i++)
236 for (int j=0; j<Objet_U::dimension; j++)
237 xg1[j]+=xs1(sommets_face1(face1,i),j); // center of gravity of face1 (not divided by nb_som_face)
238 xg1/=nb_som_face;
239 parser.setVar("x",xg1[0]);
240
241 parser.setVar("y",xg1[1]);
242 if (Objet_U::dimension==3)
243 parser.setVar("z",xg1[2]);
244 double res=parser.eval();
245 int face_min=static_cast<int>(res+0.5);
246 nb=std::max(nb,face_min);
247 //faces_associees.dimensionner_force(nb+1);
248
249 faces_associees[face_min].append_array(face1);
250 //Cerr << face1 << " associated with " << face_min << finl;
251 }
252
253 for (int face2=0; face2<nb+1; face2++) // Write output files
254 {
255 Nom nomfic(nomfr1);
256 nomfic+="%";
257 Nom n;
258 n=face2;
259 nomfic+=n;
260 SFichier s(nomfic);
261 s<<faces_associees[face2]<<finl;
262 listb<<nomfic<<finl;
263 s.close();
264 }
265 }
266 }
267
268 listb.close();
269}
270
271template <typename _SIZE_>
272void Impl_32_64<_SIZE_>::create_listb_naif(const Domaine_t& dom, const Noms& nomdec,const ArrOfInt& nbdec)
273{
274 int n1=nomdec.size();
275 int n2=nbdec.size_array();
276 if(n1!=n2)
277 {
278 Cerr << "The numbers of boundaries in 'bords_a_decouper' and 'nb_parts_naif' are not the same : check your data file"<<finl;
280 }
281
282 SFichier listb(dom.le_nom()+".boundary_list");
283 int nbfr=dom.nb_front_Cl();
284 for (int l=0; l<nbfr; l++)
285 {
286 const Frontiere_t& fr=dom.frontiere(l);
287 int nbfaces = check_front_sz(fr);
288
289 int compt=0;
290 const Nom& nomfr=fr.le_nom();
291 int inc=nomdec.search(nomfr);
292 if (inc!=-1)
293 {
294 int nb=nbdec[inc];
295 nb=std::min(nb,nbfaces);
296 if (nbfaces!=0)
297 {
298 int nc=nbfaces/nb;
299
300 //Cerr<<nbfaces<<finl;
301 if ((nb*nc)<nbfaces) nc++;
302 //Cerr<<"nc "<<nc<<finl;
303 Cerr<<nomfr<<" splitting in "<<nb<<" parts, average number of faces "<<nbfaces/(1.*nb)<<finl;
304 // Cerr<<"average number of faces "<<nc<<" boundary split "<<nomfr<<" into "<<nbfaces/nc<<" parts"<<finl;
305 for (int i=0; i<nb; i++)
306 {
307 if (i==nb-1) nc=nbfaces-compt;
308 IntVect p(nc);
309 for (int j=0; j<nc; j++) p[j]=compt++;
310 Nom nomfic(nomfr);
311 nomfic+="%";
312 Nom n;
313 n=i;
314 nomfic+=n;
315 SFichier s(nomfic);
316 s<<p<<finl;
317 listb<<nomfic<<finl;
318 s.close();
319 }
320 }
321
322 }
323 }
324 listb.close();
325}
326
327template <typename _SIZE_>
328void Impl_32_64<_SIZE_>::create_listb_geom(const Domaine_t& dom, const Noms& nomdec,const ArrOfInt& nbdec)
329{
330 if((Objet_U::dimension)!=3)
331 {
332 Cerr<<"nb_parts_geom has been defined for dimension 3 only"<<finl;;
334 }
335
336 int n1=nomdec.size();
337 int n2=nbdec.size_array();
338 if((2*n1)!=n2)
339 {
340 Cerr << "The 'nb_parts_geom' has to be twice the number of boundaries in 'bords_a_decouper' : check your data file"<<finl;
342 }
343
344 const DoubleTab_t& xs=dom.coord_sommets();
345 int nbfr=dom.nb_front_Cl();
346
347 Parser_U parser;
348 parser.setNbVar(3);
349 parser.addVar("x");
350 parser.addVar("y");
351 parser.addVar("z");
352 Noms expr_tot(n1);
353
354 for (int l=0; l<nbfr; l++)
355 {
356 const Frontiere_t& fr=dom.frontiere(l);
357 int_t nbfaces=fr.nb_faces();
358 const Nom& nomfr=fr.le_nom();
359 int inc=nomdec.search(nomfr);
360 if (inc!=-1)
361 {
362 int nb1=nbdec[2*inc];
363 int nb2=nbdec[2*inc+1];
364
365 if (nbfaces!=0)
366 {
367 const IntTab_t& sommets_face = (ref_cast(Frontiere_t,fr)).les_sommets_des_faces();
368 int nb_som_face = dom.les_sommets().dimension_int(1);
369
370 ArrOfDouble coord_min(3);
371 coord_min=1e6;
372 ArrOfDouble coord_max(3);
373 coord_max=-1e6;
374
375 for (int_t face=0; face<nbfaces; face++)
376 {
377 for (int i=0; i<nb_som_face; i++)
378 for (int j=0; j<3; j++)
379 {
380 coord_min[j] = std::min(coord_min[j],xs(sommets_face(face,i),j));
381 coord_max[j] = std::max(coord_max[j],xs(sommets_face(face,i),j));
382 }
383 }
384
385 Nom expr="0.+";
386
387 if(coord_min[0]==coord_max[0]) // plan x=cste
388 {
389 double dy=(coord_max[1]-coord_min[1])/nb1;
390 double dz=(coord_max[2]-coord_min[2])/nb2;
391
392 for (int j=1; j<nb1; j++)
393 {
394 double pas=j*dy;
395 expr+="(y>";
396 expr+=Nom(pas);
397 expr+=")+";
398 }
399 expr+=Nom(nb1);
400 expr+="*(";
401 for (int k=1; k<nb2; k++)
402 {
403 double pas=k*dz;
404 expr+="(z>";
405 expr+=Nom(pas);
406 expr+=")+";
407 }
408 }
409 else if (coord_min[1]==coord_max[1]) // plan y=cste
410 {
411 double dx=(coord_max[0]-coord_min[0])/nb1;
412 double dz=(coord_max[2]-coord_min[2])/nb2;
413
414 for (int i=1; i<nb1; i++)
415 {
416 double pas=i*dx;
417 expr+="(x>";
418 expr+=Nom(pas);
419 expr+=")+";
420 }
421 expr+=Nom(nb1);
422 expr+="*(";
423 for (int k=1; k<nb2; k++)
424 {
425 double pas=k*dz;
426 expr+="(z>";
427 expr+=Nom(pas);
428 expr+=")+";
429 }
430 }
431 else if (coord_min[2]==coord_max[2]) // plan z=cste
432 {
433 double dx=(coord_max[0]-coord_min[0])/nb1;
434 double dy=(coord_max[1]-coord_min[1])/nb2;
435
436 for (int i=1; i<nb1; i++)
437 {
438 double pas=i*dx;
439 expr+="(x>";
440 expr+=Nom(pas);
441 expr+=")+";
442 }
443 expr+=Nom(nb1);
444 expr+="*(";
445 for (int j=1; j<nb2; j++)
446 {
447 double pas=j*dy;
448 expr+="(y>";
449 expr+=Nom(pas);
450 expr+=")+";
451 }
452 }
453 else
454 {
455 Cerr <<"the boundary "<<nomfr<<" is not plane : nb_parts_geom can't be used"<<finl;
457 }
458
459 expr+="0.)";
460 Cerr << "fontiere : "<<nomfr<<" - expression : " <<expr<<finl;
461 parser.setString(expr);
462 parser.parseString();
463 expr_tot[inc]=expr;
464
465 }//if (nbfaces!=0)
466 }//if (inc!=-1)
467 }//for (int l=0;l<nbfr;l++)
468
469 Cerr <<"create_listb_from_xyz .... "<<finl;
470 create_listb_from_xyz(dom, nomdec,expr_tot);
471 Cerr <<" ... ok "<<finl;
472}
473
474template <typename _SIZE_>
476{
477 using Impl_ = Impl_32_64<_SIZE_>;
478
479 Nom nom_dom1,nom_dom2;
480 Nom nom_fichier_sortie("");
481 //LIST(Nom) list_nom_dec;
482 Noms nomdec;
483 ArrOfInt nb_parts,nb_parts_geom;
484 Param param(this->que_suis_je());
485 int binaire=0;
486 Noms expr;
487 param.ajouter("domaine",&nom_dom1,Param::REQUIRED); // XD_ADD_P ref_domaine
488 // XD_CONT not_set
489 param.ajouter("domaine_grossier",&nom_dom2); // XD_ADD_P ref_domaine
490 // XD_CONT not_set
491 param.ajouter("nb_parts_naif",&nb_parts); // XD_ADD_P listentier
492 // XD_CONT not_set
493 param.ajouter("nb_parts_geom",&nb_parts_geom); // XD_ADD_P listentier
494 // XD_CONT not_set
495 param.ajouter("condition_geometrique",&expr); // XD_ADD_P listchaine
496 // XD_CONT not_set
497 param.ajouter("bords_a_decouper",&nomdec,Param::REQUIRED); // XD_ADD_P listchaine
498 // XD_CONT not_set
499 param.ajouter("nom_fichier_sortie",&nom_fichier_sortie); // XD_ADD_P chaine
500 // XD_CONT not_set
501 param.ajouter("binaire",&binaire); // XD_ADD_P entier
502 // XD_CONT not_set
504 // make a copy of dom1 to modify it
505 this->associer_domaine(nom_dom1);
506 const Domaine_t& dom_1=this->domaine();
507 if (nom_fichier_sortie=="")
508 {
509 nom_fichier_sortie=dom_1.le_nom()+".newgeom";
510 }
511 Domaine_t dom1;
512 dom1=dom_1;
513 if (nom_dom2!=Nom())
514 {
515 if (!sub_type(Domaine_t, this->objet(nom_dom2)))
516 {
517 Cerr << nom_dom2 << " is not an object of type Domaine " << finl;
518 Cerr << " Please correct your data set" << finl;
520 }
521
522 const Domaine_t& dom_2=ref_cast(Domaine_t, this->objet(nom_dom2));
523 Impl_::create_listb_from_domaine2(dom1,dom_2,nomdec);
524 }
525 else
526 {
527 if (expr.size()!=0)
528 Impl_::create_listb_from_xyz(dom1,nomdec,expr);
529 else if (nb_parts.size_array()!=0)
530 Impl_::create_listb_naif(dom1,nomdec,nb_parts);
531 else if (nb_parts_geom.size_array()!=0)
532 Impl_::create_listb_geom(dom1,nomdec,nb_parts_geom);
533 else
534 {
535 Cerr<<"in DecoupeBord_32_64_pour_rayonnement : You must specify domaine_grossier or nb_parts_naif or nb_part_geom or condition_geometrique"<<finl;
537 }
538
539 }
540 Nom nom_file(dom1.le_nom()+".boundary_list");
541 decouper(dom1,nom_file);
542
543 Cout <<"Writing of the new geometry in the file " << nom_fichier_sortie <<finl;
544 SFichier fic;
545 fic.set_bin(binaire);
546 fic.ouvrir(nom_fichier_sortie);
547 fic <<dom1 <<finl;
548
549 return is;
550}
551
552template <typename _SIZE_>
554{
555 Cerr << "Splitting to the radiation of the boundaries of the domain " << dom.le_nom() << finl;
556 int_t nb_faces_bord_sa=dom. nb_faces_bord();
557 int_t nb_faces_raccord_sa=dom. nb_faces_raccord();
558 if (this->nproc()!=1)
559 {
560 Cerr << " The splitting DecoupeBord_32_64 can be done only in sequential " << finl;
562 }
563
564 // write the new geometry in sequential
565 int nbtot=0;
566 {
567 // count the number of lines in nom_file
568 EFichier listb2(nom_file);
569 Nom toto;
570 listb2>>toto;
571 while(listb2.good())
572 {
573 listb2>>toto;
574 nbtot++;
575 }
576 }
577
578 EFichier listb2(nom_file);
579 Noms nomborddec(nbtot);
580 for (int nf=0; nf<nbtot; nf++) listb2>>nomborddec[nf];
581
582 int nbfr=dom.nb_front_Cl();
583 Bords_t& listbord=dom.faces_bord();
584 Raccords_t& listrac=dom.faces_raccord();
585 Bords_t listbord2;
586 Raccords_t listrac2;
587 int nbbord=dom.nb_bords();
588 IntVect decoup(nbfr); // BoolVect in fact ...
589 Noms nomsdesbordsorg(nbfr);
590 // iterate over all boundaries
591 for (int b=0; b<nbfr; b++)
592 {
593 Frontiere_t& org=dom.frontiere(b);
594 const Nom& nombord=org.le_nom();
595 nomsdesbordsorg[b]=nombord;
596 decoup(b)=0;
597 SFichier bord_xv(dom.le_nom()+"."+nomsdesbordsorg[b]+"_xv");
598 bord_xv.setf(ios::scientific);
599 bord_xv.precision(12);
600 for (int nf=0; nf<nbtot; nf++)
601 {
602 Nom nombord_dec=nomborddec[nf];
603 const char* marq=strchr(nombord_dec,'%');
604 if (marq)
605 {
606 nombord_dec.prefix(marq);
607 // check if the split boundaries correspond to the current boundary
608 if (nombord==nombord_dec)
609 {
610 decoup(b)=1;
611 Bord_t toto_bord;
612 Raccord_t toto_rac;
613 if (b>=nbbord) toto_rac.typer(org.le_type());
614 Frontiere_t& toto=(b<nbbord?ref_cast(Frontiere_t,toto_bord):ref_cast(Frontiere_t,toto_rac.valeur()));
615 Nom nombord_dec_bis=nomborddec[nf];
616 toto.nommer(nombord_dec_bis);
617 IntVect_t listfaces;
618 // retrieve the list of faces
619 EFichier lis(nombord_dec_bis);
620 lis>>listfaces;
621 // generate the faces associated with this new boundary
622 Faces_t& Facesorg=org.faces();
623 Faces_t& newfaces=toto.faces();
624 newfaces.typer(Facesorg.type_face());
625 int_t newnbfaces=listfaces.size();
626 int nbsom=Facesorg.nb_som_faces();
627 newfaces.dimensionner(newnbfaces);
628 const IntTab_t& sommetsorg=Facesorg.les_sommets();
629 IntTab_t& newsommet=newfaces.les_sommets();
630 for (int_t i=0; i<newnbfaces; i++)
631 for (int j=0; j<nbsom; j++)
632 newsommet(i,j)=sommetsorg(listfaces[i],j);
633 DoubleTab_t position;
634
635 Faces_t::Calculer_centres_gravite(position,newfaces.type_face(),dom.coord_sommets(),newsommet);
636
637 bord_xv<<nombord_dec_bis<<finl;
638 bord_xv<<position<<finl;
639 if (b<nbbord)
640 listbord2.add(toto_bord);
641 else
642 listrac2.add(toto_rac);
643 }
644 }
645 }
646 bord_xv.close();
647 }
648 // remove the split boundaries from the domain
649 for (int b2=0; b2<nbbord; b2++)
650 if (decoup(b2))
651 listbord.suppr(dom.bord(nomsdesbordsorg[b2]));
652 for (int r2=nbbord; r2<nbfr; r2++)
653 if (decoup(r2))
654 listrac.suppr(dom.raccord(nomsdesbordsorg[r2]));
655 listbord.add(listbord2);
656 listrac.add(listrac2);
657
658 int_t nb_faces_bord=dom.nb_faces_bord();
659 if (nb_faces_bord!=nb_faces_bord_sa)
660 {
661 Cerr<<"the new number of boundary faces is false :"<<nb_faces_bord;
662 Cerr<<" instead of "<<nb_faces_bord_sa<<finl;
664 }
665 int_t nb_faces_raccord=dom.nb_faces_raccord();
666 if (nb_faces_raccord!=nb_faces_raccord_sa)
667 {
668 Cerr<<"the new number of connection faces is false :"<<nb_faces_raccord;
669 Cerr<<" instead of "<<nb_faces_raccord_sa<<finl;
671 }
672}
673
674
675template class DecoupeBord_32_64<int>;
676#if INT_is_64_ == 2
677template class DecoupeBord_32_64<trustIdType>;
678#endif
679
class DecoupeBord Generates a mesh by splitting each block into 40 tetrahedra.
Definition DecoupeBord.h:32
Bord_32_64< _SIZE_ > Bord_t
Definition DecoupeBord.h:45
DoubleTab_T< _SIZE_ > DoubleTab_t
Definition DecoupeBord.h:40
Raccords_32_64< _SIZE_ > Raccords_t
Definition DecoupeBord.h:49
Entree & interpreter_(Entree &) override
OWN_PTR(Raccord_base_32_64< _SIZE_ >) Raccord_t
Definition DecoupeBord.h:48
Bords_32_64< _SIZE_ > Bords_t
Definition DecoupeBord.h:46
Frontiere_32_64< _SIZE_ > Frontiere_t
Definition DecoupeBord.h:47
IntTab_T< _SIZE_ > IntTab_t
Definition DecoupeBord.h:38
void decouper(Domaine_t &dom, const Nom &nom_file)
IntVect_T< _SIZE_ > IntVect_t
Definition DecoupeBord.h:39
Domaine_32_64< _SIZE_ > Domaine_t
Definition DecoupeBord.h:43
Faces_32_64< _SIZE_ > Faces_t
Definition DecoupeBord.h:44
class Domaine_32_64 A Domain is a mesh composed of a set of geometric elements of the same type.
Definition Domaine.h:62
int nb_front_Cl() const
Definition Domaine.h:236
int_t nb_faces_bord() const
Definition Domaine.h:165
Raccord_t & raccord(int i)
Definition Domaine.h:248
DoubleTab_t & les_sommets()
Definition Domaine.h:113
int rang_frontiere(const Nom &) const
Definition Domaine.cpp:1051
Bords_t & faces_bord()
Definition Domaine.h:198
int_t nb_faces_raccord() const
Definition Domaine.h:171
const Frontiere_t & frontiere(int i) const
Definition Domaine.h:539
Raccords_t & faces_raccord()
Definition Domaine.h:253
Bord_t & bord(int i)
Definition Domaine.h:193
int nb_bords() const
Definition Domaine.h:192
const DoubleTab_t & coord_sommets() const
Definition Domaine.h:112
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
File for reading. This class is to the C++ ifstream class what the Entree class is to the.
Definition EFichier.h:29
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
void typer(const Motcle &)
Sets the type of the faces.
Definition Faces.cpp:382
int_t dimensionner(int_t)
(Re-)sizes the faces. The neighbors are resized accordingly.
Definition Faces.cpp:336
const IntTab_t & les_sommets() const
Returns the array of vertices of all faces.
Definition Faces.h:74
Type_Face type_face() const
Definition Faces.h:65
static void Calculer_centres_gravite(DoubleTab_t &xv, Type_Face type_face_, const DoubleTab_t &coord, const IntTab_t &sommet)
Definition Faces.cpp:778
int nb_som_faces() const
Returns the number of vertices per face.
Definition Faces.h:149
Class Frontiere.
Definition Frontiere.h:32
void nommer(const Nom &) override
Gives a name to the boundary.
Definition Frontiere.cpp:74
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Frontiere.h:49
int_t nb_faces() const
Returns the number of faces of the boundary.
Definition Frontiere.h:59
const Faces_t & faces() const
Definition Frontiere.h:54
static void create_listb_from_domaine2(const Domaine_t &dom1, const Domaine_t &dom_oth, const Noms &nomdec)
Domaine_32_64< _SIZE_ > Domaine_t
DoubleTab_T< _SIZE_ > DoubleTab_t
static void create_listb_from_xyz(const Domaine_t &dom, const Noms &nomdec, const Noms &expr)
ArrOfInt_T< _SIZE_ > ArrOfInt_t
IntVect_T< _SIZE_ > IntVect_t
Frontiere_32_64< _SIZE_ > Frontiere_t
static void create_listb_naif(const Domaine_t &dom, const Noms &nomdec, const ArrOfInt &nbdec)
IntTab_T< _SIZE_ > IntTab_t
ArrsOfInt_T< _SIZE_ > ArrsOfInt_t
static void create_listb_geom(const Domaine_t &dom, const Noms &nomdec, const ArrOfInt &nbdec)
static int check_front_sz(const Frontiere_t &fr)
Class Interprete_geometrique_base.
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Nom & prefix(const char *const)
Definition Nom.cpp:324
An array of character strings (VECT(Nom)).
Definition Noms.h:26
int search(const Nom &t) const
Definition Noms.cpp:39
friend class Entree
Definition Objet_U.h:71
static int dimension
Definition Objet_U.h:94
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
const char * le_type() const
Returns the type name of the Objet_U.
Definition Objet_U.cpp:190
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
@ REQUIRED
Definition Param.h:115
int lire_avec_accolades_depuis(Entree &is)
Parse the parameter block { ... } from is.
Definition Param.cpp:32
class Parser_U Version of the Parser class, deriving from Objet_U.
Definition Parser_U.h:32
void setVar(const char *sv, double val)
Definition Parser_U.h:149
void setString(const std::string &s)
Definition Parser_U.h:194
void setNbVar(int nvar)
Definition Parser_U.h:174
void parseString()
Definition Parser_U.h:116
double eval()
Definition Parser_U.h:125
void addVar(const char *v)
Definition Parser_U.h:183
static int nproc()
Returns the number of processors in the current group. See Comm_Group::nproc() and PE_Groups::current...
Definition Process.cpp:102
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
Definition SFichier.h:29
virtual int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::out)
void precision(int pre) override
void setf(IOS_FORMAT code) override
Base class for output streams.
Definition Sortie.h:52
void set_bin(bool bin) override
Changes the write mode of the file.
Definition Sortie.cpp:252
_SIZE_ size_array() const
int dimension_int(int d) const
Definition TRUSTTab.tpp:152
_SIZE_ size() const
Definition TRUSTVect.tpp:45