1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2016 CEA/DEN, EDF R&D
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 { _Texte += "CCAssoci saturne_2d\n" ; }
85 _Texte += "ModeHOMA 1\n" ;
86 _Texte += "NumeIter " + _siter + "\n" ;
89 //===============================================================================
90 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
92 MESSAGE("TexteInit, TypeBila ="<<TypeBila);
94 _Texte += "ModeHOMA 2\n" ;
95 std::stringstream saux1 ;
97 std::string saux2 = saux1.str() ;
98 _Texte += "TypeBila " + saux2 + "\n" ;
101 _Texte += "NumeIter 0\n" ;
102 _Texte += "Action info_av\n" ;
103 _Texte += "CCAssoci med\n" ;
107 _Texte += "NumeIter " + _siter + "\n" ;
108 _Texte += "Action info_ap\n" ;
109 _Texte += "CCAssoci homard\n" ;
113 //===============================================================================
114 // B. Les maillages en entree et en sortie
115 //===============================================================================
116 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
118 MESSAGE("TexteMaillage, NomMesh = "<<NomMesh);
119 MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
120 MESSAGE("TexteMaillage, apres = "<<apres);
123 if ( apres < 1 ) { saux = "__" ; }
125 _Texte += "# Maillages Med " + saux + "\n" ;
126 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
127 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
130 //===============================================================================
131 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
133 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
135 if ( apres < 1 ) { saux = "__" ; }
136 else { saux = "P1" ; }
138 _Texte += "# Maillage HOMARD " + liter + "\n" ;
139 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
142 //===============================================================================
143 // C. Le pilotage de l'adaptation
144 //===============================================================================
145 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
147 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
148 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
150 // Type de conformite
157 saux = "NON_CONFORME_1_ARETE" ;
162 saux = "CONFORME_BOITES" ;
172 saux = "NON_CONFORME" ;
177 saux = "NON_CONFORME_1_NOEUD" ;
182 saux = "NON_CONFORME_INDICATEUR" ;
186 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
188 // Type de raffinement/deraffinement
190 if ( TypeAdap == -1 )
194 saux = "TypeRaff uniforme\n" ;
198 saux = "TypeRaff non\n" ;
202 saux += "TypeDera uniforme" ;
206 saux += "TypeDera non" ;
213 saux = "TypeRaff libre\n" ;
217 saux = "TypeRaff non\n" ;
221 saux += "TypeDera libre" ;
225 saux += "TypeDera non" ;
228 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
230 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
232 //===============================================================================
233 void HomardDriver::TexteCompo( int NumeComp, const std::string NompCompo)
235 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NompCompo = "<<NompCompo);
236 _Texte +="CCCoChaI \"" + NompCompo + "\"\n" ;
238 //===============================================================================
239 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 )
241 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
242 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
244 std::string saux, saux2 ;
247 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
248 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
249 // Attention a mettre le bon signe a ZoneTypeHOMARD :
250 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
251 // <0 signifie que l'on deraffinera
254 if ( ZoneType >= 11 && ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
255 else if ( ZoneType >= 31 && ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
256 else if ( ZoneType >= 61 && ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
257 else { ZoneTypeHOMARD = ZoneType ; }
259 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
261 std::stringstream saux1 ;
263 saux = "#\n# Zone numero " + saux1.str() + "\n" ;
265 { std::stringstream saux1 ;
266 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
267 saux += "ZoRaType " + saux1.str() + "\n" ;
272 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
273 // Y Homard <=> Y Salome
275 saux += "#Rectangle\n" ;
276 { std::stringstream saux1 ;
277 saux1 << NumeZone << " " << x0 ;
278 saux += "ZoRaXmin " + saux1.str() + "\n" ;
280 { std::stringstream saux1 ;
281 saux1 << NumeZone << " " << x1 ;
282 saux += "ZoRaXmax " + saux1.str() + "\n" ;
284 { std::stringstream saux1 ;
285 saux1 << NumeZone << " " << x2 ;
286 saux += "ZoRaYmin " + saux1.str() + "\n" ;
288 { std::stringstream saux1 ;
289 saux1 << NumeZone << " " << x3 ;
290 saux += "ZoRaYmax " + saux1.str() + "\n" ;
294 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
295 // Y Homard <=> Z Salome
297 saux += "#Rectangle\n" ;
298 { std::stringstream saux1 ;
299 saux1 << NumeZone << " " << x2 ;
300 saux += "ZoRaXmin " + saux1.str() + "\n" ;
302 { std::stringstream saux1 ;
303 saux1 << NumeZone << " " << x3 ;
304 saux += "ZoRaXmax " + saux1.str() + "\n" ;
306 { std::stringstream saux1 ;
307 saux1 << NumeZone << " " << x4 ;
308 saux += "ZoRaYmin " + saux1.str() + "\n" ;
310 { std::stringstream saux1 ;
311 saux1 << NumeZone << " " << x5 ;
312 saux += "ZoRaYmax " + saux1.str() + "\n" ;
316 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
317 // Y Homard <=> Z Salome
319 saux += "#Rectangle\n" ;
320 { std::stringstream saux1 ;
321 saux1 << NumeZone << " " << x0 ;
322 saux += "ZoRaXmin " + saux1.str() + "\n" ;
324 { std::stringstream saux1 ;
325 saux1 << NumeZone << " " << x1 ;
326 saux += "ZoRaXmax " + saux1.str() + "\n" ;
328 { std::stringstream saux1 ;
329 saux1 << NumeZone << " " << x4 ;
330 saux += "ZoRaYmin " + saux1.str() + "\n" ;
332 { std::stringstream saux1 ;
333 saux1 << NumeZone << " " << x5 ;
334 saux += "ZoRaYmax " + saux1.str() + "\n" ;
338 // Cas du parallelepipede
340 else if ( ZoneType == 2 )
342 saux += "# Boite\n" ;
343 { std::stringstream saux1 ;
344 saux1 << NumeZone << " " << x0 ;
345 saux += "ZoRaXmin " + saux1.str() + "\n" ;
347 { std::stringstream saux1 ;
348 saux1 << NumeZone << " " << x1 ;
349 saux += "ZoRaXmax " + saux1.str() + "\n" ;
351 { std::stringstream saux1 ;
352 saux1 << NumeZone << " " << x2 ;
353 saux += "ZoRaYmin " + saux1.str() + "\n" ;
355 { std::stringstream saux1 ;
356 saux1 << NumeZone << " " << x3 ;
357 saux += "ZoRaYmax " + saux1.str() + "\n" ;
359 { std::stringstream saux1 ;
360 saux1 << NumeZone << " " << x4 ;
361 saux += "ZoRaZmin " + saux1.str() + "\n" ;
363 { std::stringstream saux1 ;
364 saux1 << NumeZone << " " << x5 ;
365 saux += "ZoRaZmax " + saux1.str() + "\n" ;
371 else if ( ZoneType == 31 || ZoneType == 61 )
373 saux += "# Sphere\n" ;
374 { std::stringstream saux1 ;
375 saux1 << NumeZone << " " << x0 ;
376 saux += "ZoRaXCen " + saux1.str() + "\n" ;
378 { std::stringstream saux1 ;
379 saux1 << NumeZone << " " << x1 ;
380 saux += "ZoRaYCen " + saux1.str() + "\n" ;
382 { std::stringstream saux1 ;
383 saux1 << NumeZone << " " << x6 ;
384 saux2 = saux1.str() ;
385 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
386 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
388 if ( ZoneType == 61 )
389 { std::stringstream saux1 ;
390 saux1 << NumeZone << " " << x8 ;
391 saux += "ZoRaRayI " + saux1.str() + "\n" ;
394 else if ( ZoneType == 32 || ZoneType == 62 )
396 saux += "# Sphere\n" ;
397 { std::stringstream saux1 ;
398 saux1 << NumeZone << " " << x1 ;
399 saux += "ZoRaXCen " + saux1.str() + "\n" ;
401 { std::stringstream saux1 ;
402 saux1 << NumeZone << " " << x2 ;
403 saux += "ZoRaYCen " + saux1.str() + "\n" ;
405 { std::stringstream saux1 ;
406 saux1 << NumeZone << " " << x6 ;
407 saux2 = saux1.str() ;
408 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
409 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
411 if ( ZoneType == 62 )
412 { std::stringstream saux1 ;
413 saux1 << NumeZone << " " << x8 ;
414 saux += "ZoRaRayI " + saux1.str() + "\n" ;
417 else if ( ZoneType == 33 || ZoneType == 63 )
419 saux += "# Sphere\n" ;
420 { std::stringstream saux1 ;
421 saux1 << NumeZone << " " << x0 ;
422 saux += "ZoRaXCen " + saux1.str() + "\n" ;
424 { std::stringstream saux1 ;
425 saux1 << NumeZone << " " << x2 ;
426 saux += "ZoRaYCen " + saux1.str() + "\n" ;
428 { std::stringstream saux1 ;
429 saux1 << NumeZone << " " << x6 ;
430 saux2 = saux1.str() ;
431 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
432 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
434 if ( ZoneType == 63 )
435 { std::stringstream saux1 ;
436 saux1 << NumeZone << " " << x8 ;
437 saux += "ZoRaRayI " + saux1.str() + "\n" ;
443 else if ( ZoneType == 4 )
445 saux += "# Sphere\n" ;
446 { std::stringstream saux1 ;
447 saux1 << NumeZone << " " << x0 ;
448 saux += "ZoRaXCen " + saux1.str() + "\n" ;
450 { std::stringstream saux1 ;
451 saux1 << NumeZone << " " << x1 ;
452 saux += "ZoRaYCen " + saux1.str() + "\n" ;
454 { std::stringstream saux1 ;
455 saux1 << NumeZone << " " << x2 ;
456 saux += "ZoRaZCen " + saux1.str() + "\n" ;
458 { std::stringstream saux1 ;
459 saux1 << NumeZone << " " << x3 ;
460 saux += "ZoRaRayo " + saux1.str() + "\n" ;
464 // Cas du cylindre ou du tuyau
466 else if ( ZoneType == 5 || ZoneType == 7 )
468 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
469 else { saux += "# Tuyau\n" ; }
470 { std::stringstream saux1 ;
471 saux1 << NumeZone << " " << x0 ;
472 saux += "ZoRaXBas " + saux1.str() + "\n" ;
474 { std::stringstream saux1 ;
475 saux1 << NumeZone << " " << x1 ;
476 saux += "ZoRaYBas " + saux1.str() + "\n" ;
478 { std::stringstream saux1 ;
479 saux1 << NumeZone << " " << x2 ;
480 saux += "ZoRaZBas " + saux1.str() + "\n" ;
482 { std::stringstream saux1 ;
483 saux1 << NumeZone << " " << x3 ;
484 saux += "ZoRaXAxe " + saux1.str() + "\n" ;
486 { std::stringstream saux1 ;
487 saux1 << NumeZone << " " << x4 ;
488 saux += "ZoRaYAxe " + saux1.str() + "\n" ;
490 { std::stringstream saux1 ;
491 saux1 << NumeZone << " " << x5 ;
492 saux += "ZoRaZAxe " + saux1.str() + "\n" ;
494 { std::stringstream saux1 ;
495 saux1 << NumeZone << " " << x6 ;
496 saux2 = saux1.str() ;
497 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
498 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
500 { std::stringstream saux1 ;
501 saux1 << NumeZone << " " << x7 ;
502 saux += "ZoRaHaut " + saux1.str() + "\n" ;
505 { std::stringstream saux1 ;
506 saux1 << NumeZone << " " << x8 ;
507 saux += "ZoRaRayI " + saux1.str() + "\n" ;
511 _Texte += saux + "#\n" ;
513 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
515 //===============================================================================
516 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
517 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
518 int UsField, int UsCmpI )
520 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
521 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
523 std::string saux, saux2 ;
526 _Texte += "# Champ d'indicateurs\n" ;
527 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
528 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
530 // Cas ou on prend le dernier pas de temps
531 if ( TimeStep == -2 )
532 { _Texte += "CCNumPTI Last\n" ; }
533 // Cas avec pas de temps
534 else if ( TimeStep >= 0 )
537 std::stringstream saux1 ;
539 saux2 = saux1.str() ;
540 _Texte += "CCNumPTI " + saux2 + "\n" ;
544 std::stringstream saux1 ;
546 saux2 = saux1.str() ;
547 _Texte += "CCNumOrI " + saux2 + "\n" ;
562 std::stringstream saux1 ;
564 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
578 std::stringstream saux1 ;
580 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
585 { saux = "MAILLE" ; }
590 _Texte += "CCModeFI " + saux + "\n" ;
597 { saux = "INFINI" ; }
599 { saux = "RELATIF" ; }
602 _Texte += "CCUsCmpI " + saux + "\n" ;
605 //===============================================================================
606 void HomardDriver::TexteGroup( const std::string GroupName )
608 MESSAGE("TexteGroup, GroupName = "<<GroupName);
610 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
613 //===============================================================================
615 //===============================================================================
616 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
618 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
620 // Type de suivi de frontiere
622 std::stringstream saux1 ;
623 saux1 << BoundaryOption ;
624 std::string saux = saux1.str() ;
625 _Texte += "SuivFron " + saux + "\n" ;
628 //===============================================================================
629 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
631 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
632 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
634 _Texte += "#\n# Frontiere discrete\n" ;
635 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
636 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
639 //===============================================================================
640 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
642 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
644 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
647 //===============================================================================
648 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 )
650 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
651 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
652 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
653 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
655 std::string saux, saux2 ;
659 std::stringstream saux1 ;
660 saux1 << NumeBoundary ;
661 saux2 = saux1.str() ;
662 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
663 if ( BoundaryType == 1 )
664 { saux += "# Cylindre\n" ; }
665 if ( BoundaryType == 2 )
666 { saux += "# Sphere\n" ; }
667 if ( BoundaryType == 3 || BoundaryType == 4 )
668 { saux += "# Cone\n" ; }
669 if ( BoundaryType == 5 )
670 { saux += "# Tore\n" ; }
672 // Le nom de la frontiere
674 { std::stringstream saux1 ;
675 saux1 << NumeBoundary ;
676 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
681 { std::stringstream saux1 ;
682 saux1 << NumeBoundary << " " << BoundaryType ;
683 saux += "FAType " + saux1.str() + "\n" ;
688 if ( BoundaryType == 1 )
690 { std::stringstream saux1 ;
691 saux1 << NumeBoundary << " " << x0 ;
692 saux2 = saux1.str() ;
693 saux += "FAXCen " + saux1.str() + "\n" ;
695 { std::stringstream saux1 ;
696 saux1 << NumeBoundary << " " << x1 ;
697 saux += "FAYCen " + saux1.str() + "\n" ;
699 { std::stringstream saux1 ;
700 saux1 << NumeBoundary << " " << x2 ;
701 saux += "FAZCen " + saux1.str() + "\n" ;
703 { std::stringstream saux1 ;
704 saux1 << NumeBoundary << " " << x3 ;
705 saux += "FAXAxe " + saux1.str() + "\n" ;
707 { std::stringstream saux1 ;
708 saux1 << NumeBoundary << " " << x4 ;
709 saux += "FAYAxe " + saux1.str() + "\n" ;
711 { std::stringstream saux1 ;
712 saux1 << NumeBoundary << " " << x5 ;
713 saux += "FAZAxe " + saux1.str() + "\n" ;
715 { std::stringstream saux1 ;
716 saux1 << NumeBoundary << " " << x6 ;
717 saux += "FARayon " + saux1.str() + "\n" ;
723 else if ( BoundaryType == 2 )
725 { std::stringstream saux1 ;
726 saux1 << NumeBoundary << " " << x0 ;
727 saux += "FAXCen " + saux1.str() + "\n" ;
729 { std::stringstream saux1 ;
730 saux1 << NumeBoundary << " " << x1 ;
731 saux += "FAYCen " + saux1.str() + "\n" ;
733 { std::stringstream saux1 ;
734 saux1 << NumeBoundary << " " << x2 ;
735 saux += "FAZCen " + saux1.str() + "\n" ;
737 { std::stringstream saux1 ;
738 saux1 << NumeBoundary << " " << x3 ;
739 saux += "FARayon " + saux1.str() + "\n" ;
743 // Cas du cone defini par un axe et un angle
745 if ( BoundaryType == 3 )
747 { std::stringstream saux1 ;
748 saux1 << NumeBoundary << " " << x0 ;
749 saux += "FAXAxe " + saux1.str() + "\n" ;
751 { std::stringstream saux1 ;
752 saux1 << NumeBoundary << " " << x1 ;
753 saux += "FAYAxe " + saux1.str() + "\n" ;
755 { std::stringstream saux1 ;
756 saux1 << NumeBoundary << " " << x2 ;
757 saux += "FAZAxe " + saux1.str() + "\n" ;
759 { std::stringstream saux1 ;
760 saux1 << NumeBoundary << " " << x3 ;
761 saux += "FAAngle " + saux1.str() + "\n" ;
763 { std::stringstream saux1 ;
764 saux1 << NumeBoundary << " " << x4 ;
765 saux += "FAXCen " + saux1.str() + "\n" ;
767 { std::stringstream saux1 ;
768 saux1 << NumeBoundary << " " << x5 ;
769 saux += "FAYCen " + saux1.str() + "\n" ;
771 { std::stringstream saux1 ;
772 saux1 << NumeBoundary << " " << x6 ;
773 saux += "FAZCen " + saux1.str() + "\n" ;
777 // Cas du cone defini par les 2 rayons
779 if ( BoundaryType == 4 )
781 { std::stringstream saux1 ;
782 saux1 << NumeBoundary << " " << x0 ;
783 saux += "FAXCen " + saux1.str() + "\n" ;
785 { std::stringstream saux1 ;
786 saux1 << NumeBoundary << " " << x1 ;
787 saux += "FAYCen " + saux1.str() + "\n" ;
789 { std::stringstream saux1 ;
790 saux1 << NumeBoundary << " " << x2 ;
791 saux += "FAZCen " + saux1.str() + "\n" ;
793 { std::stringstream saux1 ;
794 saux1 << NumeBoundary << " " << x3 ;
795 saux += "FARayon " + saux1.str() + "\n" ;
797 { std::stringstream saux1 ;
798 saux1 << NumeBoundary << " " << x4 ;
799 saux += "FAXCen2 " + saux1.str() + "\n" ;
801 { std::stringstream saux1 ;
802 saux1 << NumeBoundary << " " << x5 ;
803 saux += "FAYCen2 " + saux1.str() + "\n" ;
805 { std::stringstream saux1 ;
806 saux1 << NumeBoundary << " " << x6 ;
807 saux += "FAZCen2 " + saux1.str() + "\n" ;
809 { std::stringstream saux1 ;
810 saux1 << NumeBoundary << " " << x7 ;
811 saux += "FARayon2 " + saux1.str() + "\n" ;
817 if ( BoundaryType == 5 )
819 { std::stringstream saux1 ;
820 saux1 << NumeBoundary << " " << x0 ;
821 saux2 = saux1.str() ;
822 saux += "FAXCen " + saux1.str() + "\n" ;
824 { std::stringstream saux1 ;
825 saux1 << NumeBoundary << " " << x1 ;
826 saux += "FAYCen " + saux1.str() + "\n" ;
828 { std::stringstream saux1 ;
829 saux1 << NumeBoundary << " " << x2 ;
830 saux += "FAZCen " + saux1.str() + "\n" ;
832 { std::stringstream saux1 ;
833 saux1 << NumeBoundary << " " << x3 ;
834 saux += "FAXAxe " + saux1.str() + "\n" ;
836 { std::stringstream saux1 ;
837 saux1 << NumeBoundary << " " << x4 ;
838 saux += "FAYAxe " + saux1.str() + "\n" ;
840 { std::stringstream saux1 ;
841 saux1 << NumeBoundary << " " << x5 ;
842 saux += "FAZAxe " + saux1.str() + "\n" ;
844 { std::stringstream saux1 ;
845 saux1 << NumeBoundary << " " << x6 ;
846 saux += "FARayon " + saux1.str() + "\n" ;
848 { std::stringstream saux1 ;
849 saux1 << NumeBoundary << " " << x7 ;
850 saux += "FARayon2 " + saux1.str() + "\n" ;
854 _Texte += saux + "#\n" ;
857 //===============================================================================
858 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
860 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
861 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
862 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
866 std::string saux, saux2 ;
867 std::stringstream saux1 ;
868 saux1 << NumeBoundary ;
869 saux2 = saux1.str() ;
870 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
872 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
873 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
875 _Texte += saux + "#\n" ;
878 //===============================================================================
879 // E. Les interpolations
880 //===============================================================================
881 // Les fichiers d'entree et de sortie des champs a interpoler
882 void HomardDriver::TexteFieldInterp( const std::string FieldFile, const std::string MeshFile )
884 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
886 _Texte += "#\n# Interpolations des champs\n" ;
889 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
891 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
893 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
895 //===============================================================================
896 // Tous les champs sont a interpoler
897 void HomardDriver::TexteFieldInterpAll( )
899 MESSAGE("TexteFieldInterpAll");
901 _Texte += "CCChaTou oui\n" ;
903 //===============================================================================
904 // Ecrit les caracteristiques de chaque interpolation sous la forme :
905 // CCChaNom 1 "DEPL" ! Nom du 1er champ a interpoler
906 // CCChaTIn 1 0 ! Mode d'interpolation : automatique
907 // CCChaNom 2 "VOLUME" ! Nom du 2nd champ a interpoler
908 // CCChaTIn 2 1 ! Mode d'interpolation : une variable extensive
909 // CCChaPdT 2 14 ! Pas de temps 14
910 // CCChaNuO 2 14 ! Numero d'ordre 14
913 // NumeChamp : numero d'ordre du champ a interpoler
914 // FieldName : nom du champ
915 // TypeInterp : type d'interpolation
916 // TimeStep : pas de temps retenu (>0 si pas de precision)
917 // Rank : numero d'ordre retenu
919 void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank)
921 MESSAGE("TexteFieldInterpNameType, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName<<", TypeInterp = "<<TypeInterp);
922 MESSAGE("TexteFieldInterpNameType, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
923 // Numero d'ordre du champ a interpoler
924 std::stringstream saux1 ;
926 std::string saux = saux1.str() ;
928 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
929 // Type d'interpolation pour le champ
930 _Texte +="CCChaTIn " + saux + " " + TypeInterp + "\n" ;
935 std::stringstream saux1 ;
937 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
940 std::stringstream saux1 ;
942 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
946 //===============================================================================
947 // F. Les options avancees
948 //===============================================================================
949 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
951 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
955 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
956 _Texte += "TypeElem ignore_pyra\n" ;
960 _Texte += "# Niveaux extremes\n" ;
961 { std::stringstream saux1 ;
963 _Texte += "NiveauMa " + saux1.str() + "\n" ;
968 _Texte += "# Diametre minimal\n" ;
969 { std::stringstream saux1 ;
971 _Texte += "DiametMi " + saux1.str() + "\n" ;
977 { _Texte += "# Raffinement" ; }
979 { _Texte += "# Deraffinement" ; }
980 _Texte += " des regions sans indicateur\n" ;
981 { std::stringstream saux1 ;
983 _Texte += "AdapInit " + saux1.str() + "\n" ;
986 if ( ExtraOutput % 2 == 0 )
988 _Texte += "# Sortie des niveaux de raffinement\n" ;
989 _Texte += "NCNiveau NIVEAU\n" ;
991 if ( ExtraOutput % 3 == 0 )
993 _Texte += "# Sortie des qualités des mailles\n" ;
994 _Texte += "NCQualit QUAL\n" ;
996 if ( ExtraOutput % 5 == 0 )
998 _Texte += "# Sortie des diamètres des mailles\n" ;
999 _Texte += "NCDiamet DIAM\n" ;
1001 if ( ExtraOutput % 7 == 0 )
1003 _Texte += "# Sortie des parents des mailles\n" ;
1004 _Texte += "NCParent PARENT\n" ;
1007 //===============================================================================
1009 //===============================================================================
1010 void HomardDriver::TexteInfoCompute( int MessInfo )
1012 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
1014 if ( MessInfo != 0 )
1016 _Texte += "# Messages d'informations\n" ;
1017 { std::stringstream saux1 ;
1019 _Texte += "MessInfo " + saux1.str() + "\n" ;
1023 //===============================================================================
1024 void HomardDriver::CreeFichier( )
1027 if ( _siter != _siterp1 )
1028 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
1030 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
1032 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
1033 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
1037 //===============================================================================
1038 // Creation du fichier de donnees pour l'information
1039 //===============================================================================
1040 void HomardDriver::CreeFichierDonn( )
1043 MESSAGE("CreeFichierDonn");
1044 _NomFichierDonn = "info.donn" ;
1050 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1051 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1055 //===============================================================================
1056 int HomardDriver::ExecuteHomard(int option)
1058 MESSAGE("ExecuteHomard, avec option = "<<option);
1059 std::string commande ;
1061 // Copie des Fichiers HOMARD
1062 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1063 codret = system(commande.c_str()) ;
1065 // Execution de HOMARD
1068 commande = _HOMARD_Exec.c_str() ;
1069 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1070 codret = system(commande.c_str());
1071 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1072 _NomFichierDonn = "" ;