1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2023 CEA, EDF
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // Pilote l'ecriture du fichier de configuration pour lancer l'execution de HOMARD
30 #include "HomardDriver.hxx"
31 #include "Utils_SALOME_Exception.hxx"
32 #include "utilities.h"
34 //=============================================================================
35 //=============================================================================
36 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
37 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
38 _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ),
39 _Texte( "" ), _bLu( false )
41 MESSAGE("siter = "<<siter<<", siterp1 = "<<siterp1);
42 // Le repertoire ou se trouve l'executable HOMARD
44 if ( getenv("HOMARD_REP_EXE_PRIVATE") != NULL ) { dir = getenv("HOMARD_REP_EXE_PRIVATE") ; }
45 else { dir = getenv("HOMARD_REP_EXE") ; }
46 MESSAGE("dir ="<<dir);
47 // L'executable HOMARD
48 std::string executable ;
49 if ( getenv("HOMARD_EXE_PRIVATE") != NULL ) { executable = getenv("HOMARD_EXE_PRIVATE") ; }
50 else { executable = getenv("HOMARD_EXE") ; }
51 MESSAGE("executable ="<<executable);
52 // Memorisation du nom complet de l'executable HOMARD
53 _HOMARD_Exec = dir + "/" + executable ;
54 MESSAGE("==> _HOMARD_Exec ="<<_HOMARD_Exec) ;
59 //=============================================================================
60 //=============================================================================
61 HomardDriver::~HomardDriver()
64 //===============================================================================
66 //===============================================================================
67 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
69 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
71 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
72 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
73 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
74 _Texte += "Langue \"" + Langue + "\"\n" ;
77 //===============================================================================
78 void HomardDriver::TexteAdap( int ExtType )
82 _Texte += "Action homa\n" ;
83 if ( ExtType == 0 ) { _Texte += "CCAssoci med\n" ; }
84 else if ( ExtType == 1 ) { _Texte += "CCAssoci saturne\n" ; }
85 else { _Texte += "CCAssoci saturne_2d\n" ; }
86 _Texte += "ModeHOMA 1\n" ;
87 _Texte += "NumeIter " + _siter + "\n" ;
91 //===============================================================================
92 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
94 MESSAGE("TexteInfo: TypeBila ="<<TypeBila<<", NumeIter ="<<NumeIter);
96 _Texte += "ModeHOMA 2\n" ;
97 std::stringstream saux1 ;
99 std::string saux2 = saux1.str() ;
100 _Texte += "TypeBila " + saux2 + "\n" ;
103 _Texte += "NumeIter 0\n" ;
104 _Texte += "Action info_av\n" ;
105 _Texte += "CCAssoci med\n" ;
109 _Texte += "NumeIter " + _siter + "\n" ;
110 _Texte += "Action info_ap\n" ;
111 _Texte += "CCAssoci homard\n" ;
116 //===============================================================================
117 void HomardDriver::TexteMajCoords( int NumeIter )
119 MESSAGE("TexteMajCoords: NumeIter ="<<NumeIter);
121 _Texte += "ModeHOMA 5\n" ;
122 _Texte += "NumeIter " + _siterp1 + "\n" ;
123 _Texte += "Action homa\n" ;
124 _Texte += "CCAssoci med\n" ;
125 _Texte += "EcriFiHO N_SANS_FRONTIERE\n" ;
129 //===============================================================================
130 // B. Les maillages en entree et en sortie
131 //===============================================================================
132 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
134 MESSAGE("TexteMaillage, NomMesh = "<<NomMesh);
135 MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
136 MESSAGE("TexteMaillage, apres = "<<apres);
139 if ( apres < 1 ) { saux = "__" ; }
141 _Texte += "# Maillages Med " + saux + "\n" ;
142 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
143 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
146 //===============================================================================
147 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
149 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
151 if ( apres < 1 ) { saux = "__" ; }
152 else { saux = "P1" ; }
154 _Texte += "# Maillage HOMARD " + liter + "\n" ;
155 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
158 //===============================================================================
159 // C. Le pilotage de l'adaptation
160 //===============================================================================
161 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
163 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
164 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
166 // Type de conformite
173 saux = "NON_CONFORME_1_ARETE" ;
178 saux = "CONFORME_BOITES" ;
188 saux = "NON_CONFORME" ;
193 saux = "NON_CONFORME_1_NOEUD" ;
198 saux = "NON_CONFORME_INDICATEUR" ;
202 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
204 // Type de raffinement/deraffinement
206 if ( TypeAdap == -1 )
210 saux = "TypeRaff uniforme\n" ;
214 saux = "TypeRaff non\n" ;
218 saux += "TypeDera uniforme" ;
222 saux += "TypeDera non" ;
229 saux = "TypeRaff libre\n" ;
233 saux = "TypeRaff non\n" ;
237 saux += "TypeDera libre" ;
241 saux += "TypeDera non" ;
244 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
246 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
248 //===============================================================================
249 void HomardDriver::TexteCompo( int NumeComp, const std::string NomCompo)
251 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NomCompo = "<<NomCompo);
252 _Texte +="CCCoChaI \"" + NomCompo + "\"\n" ;
254 //===============================================================================
255 void HomardDriver::TexteZone( int NumeZone, int ZoneType, int TypeUse, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8 )
257 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
258 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
260 std::string saux, saux2 ;
263 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
264 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
265 // Attention a mettre le bon signe a ZoneTypeHOMARD :
266 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
267 // <0 signifie que l'on deraffinera
270 if ( ZoneType >= 11 && ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
271 else if ( ZoneType >= 31 && ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
272 else if ( ZoneType >= 61 && ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
273 else { ZoneTypeHOMARD = ZoneType ; }
275 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
277 std::stringstream saux1 ;
279 saux = "#\n# Zone numero " + saux1.str() + "\n" ;
281 { std::stringstream saux1 ;
282 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
283 saux += "ZoRaType " + saux1.str() + "\n" ;
288 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
289 // Y Homard <=> Y Salome
291 saux += "#Rectangle\n" ;
292 { std::stringstream saux1 ;
293 saux1 << NumeZone << " " << x0 ;
294 saux += "ZoRaXmin " + saux1.str() + "\n" ;
296 { std::stringstream saux1 ;
297 saux1 << NumeZone << " " << x1 ;
298 saux += "ZoRaXmax " + saux1.str() + "\n" ;
300 { std::stringstream saux1 ;
301 saux1 << NumeZone << " " << x2 ;
302 saux += "ZoRaYmin " + saux1.str() + "\n" ;
304 { std::stringstream saux1 ;
305 saux1 << NumeZone << " " << x3 ;
306 saux += "ZoRaYmax " + saux1.str() + "\n" ;
310 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
311 // Y Homard <=> Z Salome
313 saux += "#Rectangle\n" ;
314 { std::stringstream saux1 ;
315 saux1 << NumeZone << " " << x2 ;
316 saux += "ZoRaXmin " + saux1.str() + "\n" ;
318 { std::stringstream saux1 ;
319 saux1 << NumeZone << " " << x3 ;
320 saux += "ZoRaXmax " + saux1.str() + "\n" ;
322 { std::stringstream saux1 ;
323 saux1 << NumeZone << " " << x4 ;
324 saux += "ZoRaYmin " + saux1.str() + "\n" ;
326 { std::stringstream saux1 ;
327 saux1 << NumeZone << " " << x5 ;
328 saux += "ZoRaYmax " + saux1.str() + "\n" ;
332 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
333 // Y Homard <=> Z Salome
335 saux += "#Rectangle\n" ;
336 { std::stringstream saux1 ;
337 saux1 << NumeZone << " " << x0 ;
338 saux += "ZoRaXmin " + saux1.str() + "\n" ;
340 { std::stringstream saux1 ;
341 saux1 << NumeZone << " " << x1 ;
342 saux += "ZoRaXmax " + saux1.str() + "\n" ;
344 { std::stringstream saux1 ;
345 saux1 << NumeZone << " " << x4 ;
346 saux += "ZoRaYmin " + saux1.str() + "\n" ;
348 { std::stringstream saux1 ;
349 saux1 << NumeZone << " " << x5 ;
350 saux += "ZoRaYmax " + saux1.str() + "\n" ;
354 // Cas du parallelepipede
356 else if ( ZoneType == 2 )
358 saux += "# Boite\n" ;
359 { std::stringstream saux1 ;
360 saux1 << NumeZone << " " << x0 ;
361 saux += "ZoRaXmin " + saux1.str() + "\n" ;
363 { std::stringstream saux1 ;
364 saux1 << NumeZone << " " << x1 ;
365 saux += "ZoRaXmax " + saux1.str() + "\n" ;
367 { std::stringstream saux1 ;
368 saux1 << NumeZone << " " << x2 ;
369 saux += "ZoRaYmin " + saux1.str() + "\n" ;
371 { std::stringstream saux1 ;
372 saux1 << NumeZone << " " << x3 ;
373 saux += "ZoRaYmax " + saux1.str() + "\n" ;
375 { std::stringstream saux1 ;
376 saux1 << NumeZone << " " << x4 ;
377 saux += "ZoRaZmin " + saux1.str() + "\n" ;
379 { std::stringstream saux1 ;
380 saux1 << NumeZone << " " << x5 ;
381 saux += "ZoRaZmax " + saux1.str() + "\n" ;
387 else if ( ZoneType == 31 || ZoneType == 61 )
389 saux += "# Sphere\n" ;
390 { std::stringstream saux1 ;
391 saux1 << NumeZone << " " << x0 ;
392 saux += "ZoRaXCen " + saux1.str() + "\n" ;
394 { std::stringstream saux1 ;
395 saux1 << NumeZone << " " << x1 ;
396 saux += "ZoRaYCen " + saux1.str() + "\n" ;
398 { std::stringstream saux1 ;
399 saux1 << NumeZone << " " << x6 ;
400 saux2 = saux1.str() ;
401 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
402 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
404 if ( ZoneType == 61 )
405 { std::stringstream saux1 ;
406 saux1 << NumeZone << " " << x8 ;
407 saux += "ZoRaRayI " + saux1.str() + "\n" ;
410 else if ( ZoneType == 32 || ZoneType == 62 )
412 saux += "# Sphere\n" ;
413 { std::stringstream saux1 ;
414 saux1 << NumeZone << " " << x1 ;
415 saux += "ZoRaXCen " + saux1.str() + "\n" ;
417 { std::stringstream saux1 ;
418 saux1 << NumeZone << " " << x2 ;
419 saux += "ZoRaYCen " + saux1.str() + "\n" ;
421 { std::stringstream saux1 ;
422 saux1 << NumeZone << " " << x6 ;
423 saux2 = saux1.str() ;
424 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
425 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
427 if ( ZoneType == 62 )
428 { std::stringstream saux1 ;
429 saux1 << NumeZone << " " << x8 ;
430 saux += "ZoRaRayI " + saux1.str() + "\n" ;
433 else if ( ZoneType == 33 || ZoneType == 63 )
435 saux += "# Sphere\n" ;
436 { std::stringstream saux1 ;
437 saux1 << NumeZone << " " << x0 ;
438 saux += "ZoRaXCen " + saux1.str() + "\n" ;
440 { std::stringstream saux1 ;
441 saux1 << NumeZone << " " << x2 ;
442 saux += "ZoRaYCen " + saux1.str() + "\n" ;
444 { std::stringstream saux1 ;
445 saux1 << NumeZone << " " << x6 ;
446 saux2 = saux1.str() ;
447 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
448 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
450 if ( ZoneType == 63 )
451 { std::stringstream saux1 ;
452 saux1 << NumeZone << " " << x8 ;
453 saux += "ZoRaRayI " + saux1.str() + "\n" ;
459 else if ( ZoneType == 4 )
461 saux += "# Sphere\n" ;
462 { std::stringstream saux1 ;
463 saux1 << NumeZone << " " << x0 ;
464 saux += "ZoRaXCen " + saux1.str() + "\n" ;
466 { std::stringstream saux1 ;
467 saux1 << NumeZone << " " << x1 ;
468 saux += "ZoRaYCen " + saux1.str() + "\n" ;
470 { std::stringstream saux1 ;
471 saux1 << NumeZone << " " << x2 ;
472 saux += "ZoRaZCen " + saux1.str() + "\n" ;
474 { std::stringstream saux1 ;
475 saux1 << NumeZone << " " << x3 ;
476 saux += "ZoRaRayo " + saux1.str() + "\n" ;
480 // Cas du cylindre ou du tuyau
482 else if ( ZoneType == 5 || ZoneType == 7 )
484 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
485 else { saux += "# Tuyau\n" ; }
486 { std::stringstream saux1 ;
487 saux1 << NumeZone << " " << x0 ;
488 saux += "ZoRaXBas " + saux1.str() + "\n" ;
490 { std::stringstream saux1 ;
491 saux1 << NumeZone << " " << x1 ;
492 saux += "ZoRaYBas " + saux1.str() + "\n" ;
494 { std::stringstream saux1 ;
495 saux1 << NumeZone << " " << x2 ;
496 saux += "ZoRaZBas " + saux1.str() + "\n" ;
498 { std::stringstream saux1 ;
499 saux1 << NumeZone << " " << x3 ;
500 saux += "ZoRaXAxe " + saux1.str() + "\n" ;
502 { std::stringstream saux1 ;
503 saux1 << NumeZone << " " << x4 ;
504 saux += "ZoRaYAxe " + saux1.str() + "\n" ;
506 { std::stringstream saux1 ;
507 saux1 << NumeZone << " " << x5 ;
508 saux += "ZoRaZAxe " + saux1.str() + "\n" ;
510 { std::stringstream saux1 ;
511 saux1 << NumeZone << " " << x6 ;
512 saux2 = saux1.str() ;
513 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
514 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
516 { std::stringstream saux1 ;
517 saux1 << NumeZone << " " << x7 ;
518 saux += "ZoRaHaut " + saux1.str() + "\n" ;
521 { std::stringstream saux1 ;
522 saux1 << NumeZone << " " << x8 ;
523 saux += "ZoRaRayI " + saux1.str() + "\n" ;
527 _Texte += saux + "#\n" ;
529 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
531 //===============================================================================
532 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
533 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
534 int UsField, int UsCmpI )
536 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
537 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
539 std::string saux, saux2 ;
542 _Texte += "# Champ d'indicateurs\n" ;
543 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
544 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
546 // Cas ou on prend le dernier pas de temps
547 if ( TimeStep == -2 )
548 { _Texte += "CCNumPTI Last\n" ; }
549 // Cas avec pas de temps
550 else if ( TimeStep >= 0 )
553 std::stringstream saux1 ;
555 saux2 = saux1.str() ;
556 _Texte += "CCNumPTI " + saux2 + "\n" ;
560 std::stringstream saux1 ;
562 saux2 = saux1.str() ;
563 _Texte += "CCNumOrI " + saux2 + "\n" ;
578 std::stringstream saux1 ;
580 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
594 std::stringstream saux1 ;
596 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
601 { saux = "MAILLE" ; }
606 _Texte += "CCModeFI " + saux + "\n" ;
613 { saux = "INFINI" ; }
615 { saux = "RELATIF" ; }
618 _Texte += "CCUsCmpI " + saux + "\n" ;
621 //===============================================================================
622 void HomardDriver::TexteGroup( const std::string GroupName )
624 MESSAGE("TexteGroup, GroupName = "<<GroupName);
626 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
629 //===============================================================================
631 //===============================================================================
632 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
634 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
636 // Type de suivi de frontiere
638 std::stringstream saux1 ;
639 saux1 << BoundaryOption ;
640 std::string saux = saux1.str() ;
641 _Texte += "SuivFron " + saux + "\n" ;
643 }//===============================================================================
644 void HomardDriver::TexteBoundaryCAOGr( const std::string GroupName )
646 MESSAGE("TexteBoundaryCAOGr, GroupName = "<<GroupName);
648 _Texte += "GrFroCAO \"" + GroupName + "\"\n" ;
652 //===============================================================================
653 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
655 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
656 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
658 _Texte += "#\n# Frontiere discrete\n" ;
659 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
660 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
663 //===============================================================================
664 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
666 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
668 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
671 //===============================================================================
672 void HomardDriver::TexteBoundaryAn( const std::string NameBoundary, int NumeBoundary, int BoundaryType, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7 )
674 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
675 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
676 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
677 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
679 std::string saux, saux2 ;
683 std::stringstream saux1 ;
684 saux1 << NumeBoundary ;
685 saux2 = saux1.str() ;
686 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
687 if ( BoundaryType == 1 )
688 { saux += "# Cylindre\n" ; }
689 if ( BoundaryType == 2 )
690 { saux += "# Sphere\n" ; }
691 if ( BoundaryType == 3 || BoundaryType == 4 )
692 { saux += "# Cone\n" ; }
693 if ( BoundaryType == 5 )
694 { saux += "# Tore\n" ; }
696 // Le nom de la frontiere
698 { std::stringstream saux1 ;
699 saux1 << NumeBoundary ;
700 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
705 { std::stringstream saux1 ;
706 saux1 << NumeBoundary << " " << BoundaryType ;
707 saux += "FAType " + saux1.str() + "\n" ;
712 if ( BoundaryType == 1 )
714 { std::stringstream saux1 ;
715 saux1 << NumeBoundary << " " << x0 ;
716 saux2 = saux1.str() ;
717 saux += "FAXCen " + saux1.str() + "\n" ;
719 { std::stringstream saux1 ;
720 saux1 << NumeBoundary << " " << x1 ;
721 saux += "FAYCen " + saux1.str() + "\n" ;
723 { std::stringstream saux1 ;
724 saux1 << NumeBoundary << " " << x2 ;
725 saux += "FAZCen " + saux1.str() + "\n" ;
727 { std::stringstream saux1 ;
728 saux1 << NumeBoundary << " " << x3 ;
729 saux += "FAXAxe " + saux1.str() + "\n" ;
731 { std::stringstream saux1 ;
732 saux1 << NumeBoundary << " " << x4 ;
733 saux += "FAYAxe " + saux1.str() + "\n" ;
735 { std::stringstream saux1 ;
736 saux1 << NumeBoundary << " " << x5 ;
737 saux += "FAZAxe " + saux1.str() + "\n" ;
739 { std::stringstream saux1 ;
740 saux1 << NumeBoundary << " " << x6 ;
741 saux += "FARayon " + saux1.str() + "\n" ;
747 else if ( BoundaryType == 2 )
749 { std::stringstream saux1 ;
750 saux1 << NumeBoundary << " " << x0 ;
751 saux += "FAXCen " + saux1.str() + "\n" ;
753 { std::stringstream saux1 ;
754 saux1 << NumeBoundary << " " << x1 ;
755 saux += "FAYCen " + saux1.str() + "\n" ;
757 { std::stringstream saux1 ;
758 saux1 << NumeBoundary << " " << x2 ;
759 saux += "FAZCen " + saux1.str() + "\n" ;
761 { std::stringstream saux1 ;
762 saux1 << NumeBoundary << " " << x3 ;
763 saux += "FARayon " + saux1.str() + "\n" ;
767 // Cas du cone defini par un axe et un angle
769 if ( BoundaryType == 3 )
771 { std::stringstream saux1 ;
772 saux1 << NumeBoundary << " " << x0 ;
773 saux += "FAXAxe " + saux1.str() + "\n" ;
775 { std::stringstream saux1 ;
776 saux1 << NumeBoundary << " " << x1 ;
777 saux += "FAYAxe " + saux1.str() + "\n" ;
779 { std::stringstream saux1 ;
780 saux1 << NumeBoundary << " " << x2 ;
781 saux += "FAZAxe " + saux1.str() + "\n" ;
783 { std::stringstream saux1 ;
784 saux1 << NumeBoundary << " " << x3 ;
785 saux += "FAAngle " + saux1.str() + "\n" ;
787 { std::stringstream saux1 ;
788 saux1 << NumeBoundary << " " << x4 ;
789 saux += "FAXCen " + saux1.str() + "\n" ;
791 { std::stringstream saux1 ;
792 saux1 << NumeBoundary << " " << x5 ;
793 saux += "FAYCen " + saux1.str() + "\n" ;
795 { std::stringstream saux1 ;
796 saux1 << NumeBoundary << " " << x6 ;
797 saux += "FAZCen " + saux1.str() + "\n" ;
801 // Cas du cone defini par les 2 rayons
803 if ( BoundaryType == 4 )
805 { std::stringstream saux1 ;
806 saux1 << NumeBoundary << " " << x0 ;
807 saux += "FAXCen " + saux1.str() + "\n" ;
809 { std::stringstream saux1 ;
810 saux1 << NumeBoundary << " " << x1 ;
811 saux += "FAYCen " + saux1.str() + "\n" ;
813 { std::stringstream saux1 ;
814 saux1 << NumeBoundary << " " << x2 ;
815 saux += "FAZCen " + saux1.str() + "\n" ;
817 { std::stringstream saux1 ;
818 saux1 << NumeBoundary << " " << x3 ;
819 saux += "FARayon " + saux1.str() + "\n" ;
821 { std::stringstream saux1 ;
822 saux1 << NumeBoundary << " " << x4 ;
823 saux += "FAXCen2 " + saux1.str() + "\n" ;
825 { std::stringstream saux1 ;
826 saux1 << NumeBoundary << " " << x5 ;
827 saux += "FAYCen2 " + saux1.str() + "\n" ;
829 { std::stringstream saux1 ;
830 saux1 << NumeBoundary << " " << x6 ;
831 saux += "FAZCen2 " + saux1.str() + "\n" ;
833 { std::stringstream saux1 ;
834 saux1 << NumeBoundary << " " << x7 ;
835 saux += "FARayon2 " + saux1.str() + "\n" ;
841 if ( BoundaryType == 5 )
843 { std::stringstream saux1 ;
844 saux1 << NumeBoundary << " " << x0 ;
845 saux2 = saux1.str() ;
846 saux += "FAXCen " + saux1.str() + "\n" ;
848 { std::stringstream saux1 ;
849 saux1 << NumeBoundary << " " << x1 ;
850 saux += "FAYCen " + saux1.str() + "\n" ;
852 { std::stringstream saux1 ;
853 saux1 << NumeBoundary << " " << x2 ;
854 saux += "FAZCen " + saux1.str() + "\n" ;
856 { std::stringstream saux1 ;
857 saux1 << NumeBoundary << " " << x3 ;
858 saux += "FAXAxe " + saux1.str() + "\n" ;
860 { std::stringstream saux1 ;
861 saux1 << NumeBoundary << " " << x4 ;
862 saux += "FAYAxe " + saux1.str() + "\n" ;
864 { std::stringstream saux1 ;
865 saux1 << NumeBoundary << " " << x5 ;
866 saux += "FAZAxe " + saux1.str() + "\n" ;
868 { std::stringstream saux1 ;
869 saux1 << NumeBoundary << " " << x6 ;
870 saux += "FARayon " + saux1.str() + "\n" ;
872 { std::stringstream saux1 ;
873 saux1 << NumeBoundary << " " << x7 ;
874 saux += "FARayon2 " + saux1.str() + "\n" ;
878 _Texte += saux + "#\n" ;
881 //===============================================================================
882 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
884 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
885 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
886 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
890 std::string saux, saux2 ;
891 std::stringstream saux1 ;
892 saux1 << NumeBoundary ;
893 saux2 = saux1.str() ;
894 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
896 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
897 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
899 _Texte += saux + "#\n" ;
902 //===============================================================================
903 // E. Les interpolations
904 //===============================================================================
905 // Les fichiers d'entree et de sortie des champs a interpoler
906 void HomardDriver::TexteFieldInterp( const std::string FieldFile, const std::string MeshFile )
908 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
910 _Texte += "#\n# Interpolations des champs\n" ;
913 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
915 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
917 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
919 //===============================================================================
920 // Tous les champs sont a interpoler
921 void HomardDriver::TexteFieldInterpAll( )
923 MESSAGE("TexteFieldInterpAll");
925 _Texte += "CCChaTou oui\n" ;
927 //===============================================================================
928 // Ecrit les caracteristiques de chaque interpolation sous la forme :
929 // CCChaNom 1 "DEPL" ! Nom du 1er champ a interpoler
930 // CCChaTIn 1 0 ! Mode d'interpolation : automatique
931 // CCChaNom 2 "VOLUME" ! Nom du 2nd champ a interpoler
932 // CCChaTIn 2 1 ! Mode d'interpolation : une variable extensive
933 // CCChaPdT 2 14 ! Pas de temps 14
934 // CCChaNuO 2 14 ! Numero d'ordre 14
937 // NumeChamp : numero d'ordre du champ a interpoler
938 // FieldName : nom du champ
939 // TypeInterp : type d'interpolation
940 // TimeStep : pas de temps retenu (>0 si pas de precision)
941 // Rank : numero d'ordre retenu
943 void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank)
945 MESSAGE("TexteFieldInterpNameType, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName<<", TypeInterp = "<<TypeInterp);
946 MESSAGE("TexteFieldInterpNameType, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
947 // Numero d'ordre du champ a interpoler
948 std::stringstream saux1 ;
950 std::string saux = saux1.str() ;
952 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
953 // Type d'interpolation pour le champ
954 _Texte +="CCChaTIn " + saux + " " + TypeInterp + "\n" ;
959 std::stringstream saux1 ;
961 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
964 std::stringstream saux1 ;
966 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
970 //===============================================================================
971 // F. Les options avancees
972 //===============================================================================
973 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
975 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
979 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
980 _Texte += "TypeElem ignore_pyra\n" ;
984 _Texte += "# Niveaux extremes\n" ;
985 { std::stringstream saux1 ;
987 _Texte += "NiveauMa " + saux1.str() + "\n" ;
992 _Texte += "# Diametre minimal\n" ;
993 { std::stringstream saux1 ;
995 _Texte += "DiametMi " + saux1.str() + "\n" ;
1001 { _Texte += "# Raffinement" ; }
1003 { _Texte += "# Deraffinement" ; }
1004 _Texte += " des regions sans indicateur\n" ;
1005 { std::stringstream saux1 ;
1007 _Texte += "AdapInit " + saux1.str() + "\n" ;
1010 if ( ExtraOutput % 2 == 0 )
1012 _Texte += "# Sortie des niveaux de raffinement\n" ;
1013 _Texte += "NCNiveau NIVEAU\n" ;
1015 if ( ExtraOutput % 3 == 0 )
1017 _Texte += "# Sortie des qualités des mailles\n" ;
1018 _Texte += "NCQualit QUAL\n" ;
1020 if ( ExtraOutput % 5 == 0 )
1022 _Texte += "# Sortie des diamètres des mailles\n" ;
1023 _Texte += "NCDiamet DIAM\n" ;
1025 if ( ExtraOutput % 7 == 0 )
1027 _Texte += "# Sortie des parents des mailles\n" ;
1028 _Texte += "NCParent PARENT\n" ;
1030 if ( ExtraOutput % 11 == 0 )
1032 _Texte += "# Volumes voisins par recollement\n" ;
1033 _Texte += "NCVoisRc Voisin-Recollement\n" ;
1036 //===============================================================================
1038 //===============================================================================
1039 void HomardDriver::TexteInfoCompute( int MessInfo )
1041 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
1043 if ( MessInfo != 0 )
1045 _Texte += "# Messages d'informations\n" ;
1046 { std::stringstream saux1 ;
1048 _Texte += "MessInfo " + saux1.str() + "\n" ;
1052 //===============================================================================
1053 void HomardDriver::CreeFichier( )
1056 if ( _modeHOMARD == 1 )
1057 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
1058 else if ( _modeHOMARD == 2 )
1059 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
1060 else if ( _modeHOMARD == 5 )
1061 { _NomFichierConf = _NomFichierConfBase + ".majc" ; }
1063 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
1064 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
1068 //===============================================================================
1069 // Creation du fichier de donnees pour l'information
1070 //===============================================================================
1071 void HomardDriver::CreeFichierDonn( )
1074 MESSAGE("CreeFichierDonn");
1075 _NomFichierDonn = "info.donn" ;
1081 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1082 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1086 //===============================================================================
1087 int HomardDriver::ExecuteHomard(int option)
1089 MESSAGE("ExecuteHomard, avec option = "<<option);
1090 std::string commande ;
1092 // Copie des Fichiers HOMARD
1093 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1094 codret = system(commande.c_str()) ;
1096 // Execution de HOMARD
1099 commande = _HOMARD_Exec.c_str() ;
1100 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1101 codret = system(commande.c_str());
1102 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1103 _NomFichierDonn = "" ;