1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2013 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.
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
28 #include "HomardDriver.hxx"
29 #include "Utils_SALOME_Exception.hxx"
30 #include "utilities.h"
32 //=============================================================================
33 //=============================================================================
34 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
35 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
36 _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ),
37 _Texte( "" ), _bLu( false )
39 MESSAGE("siter = "<<siter<<", siterp1 = "<<siterp1);
40 // Le repertoire ou se trouve l'executable HOMARD
42 if ( getenv("HOMARD_REP_EXE_PRIVATE") != NULL ) { dir = getenv("HOMARD_REP_EXE_PRIVATE") ; }
43 else { dir = getenv("HOMARD_REP_EXE") ; }
44 MESSAGE("dir ="<<dir);
45 // L'executable HOMARD
46 std::string executable ;
47 if ( getenv("HOMARD_EXE_PRIVATE") != NULL ) { executable = getenv("HOMARD_EXE_PRIVATE") ; }
48 else { executable = getenv("HOMARD_EXE") ; }
49 MESSAGE("executable ="<<executable);
50 // Memorisation du nom complet de l'executable HOMARD
51 _HOMARD_Exec = dir + "/" + executable ;
52 MESSAGE("==> _HOMARD_Exec ="<<_HOMARD_Exec) ;
57 //=============================================================================
58 //=============================================================================
59 HomardDriver::~HomardDriver()
62 //===============================================================================
64 //===============================================================================
65 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
67 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
69 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
70 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
71 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
72 _Texte += "Langue \"" + Langue + "\"\n" ;
75 //===============================================================================
76 void HomardDriver::TexteAdap( )
80 _Texte += "Action homa\n" ;
81 _Texte += "CCAssoci med\n" ;
82 _Texte += "ModeHOMA 1\n" ;
83 _Texte += "NumeIter " + _siter + "\n" ;
86 //===============================================================================
87 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
89 MESSAGE("TexteInit, TypeBila ="<<TypeBila);
91 _Texte += "ModeHOMA 2\n" ;
92 std::stringstream saux1 ;
94 std::string saux2 = saux1.str() ;
95 _Texte += "TypeBila " + saux2 + "\n" ;
98 _Texte += "NumeIter 0\n" ;
99 _Texte += "Action info_av\n" ;
100 _Texte += "CCAssoci med\n" ;
104 _Texte += "NumeIter " + _siter + "\n" ;
105 _Texte += "Action info_ap\n" ;
106 _Texte += "CCAssoci homard\n" ;
110 //===============================================================================
111 // B. Les maillages en entree et en sortie
112 //===============================================================================
113 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
115 MESSAGE("TexteMaillage, NomMesh ="<<NomMesh<<", MeshFile ="<<MeshFile<<", apres ="<<apres);
118 if ( apres < 1 ) { saux = "__" ; }
120 _Texte += "# Maillages Med " + saux + "\n" ;
121 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
122 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
125 //===============================================================================
126 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
128 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
130 if ( apres < 1 ) { saux = "__" ; }
131 else { saux = "P1" ; }
133 _Texte += "# Maillage HOMARD " + liter + "\n" ;
134 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
137 //===============================================================================
138 // C. Le pilotage de l'adaptation
139 //===============================================================================
140 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
142 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
143 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
145 // Type de conformite
152 saux = "conforme_boites" ;
162 saux = "non_conforme_1_noeud" ;
167 saux = "non_conforme_1_arete" ;
172 saux = "non_conforme_indicateur" ;
176 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
178 // Type de raffinement/deraffinement
180 if ( TypeAdap == -1 )
184 saux = "TypeRaff uniforme\n" ;
188 saux = "TypeRaff non\n" ;
192 saux += "TypeDera uniforme" ;
196 saux += "TypeDera non" ;
203 saux = "TypeRaff libre\n" ;
207 saux = "TypeRaff non\n" ;
211 saux += "TypeDera libre" ;
215 saux += "TypeDera non" ;
218 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
220 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
222 //===============================================================================
223 void HomardDriver::TexteCompo( int NumeComp, const std::string NompCompo)
225 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NompCompo = "<<NompCompo);
226 _Texte +="CCCoChaI \"" + NompCompo + "\"\n" ;
228 //===============================================================================
229 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 )
231 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
232 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
234 std::string saux, saux2 ;
237 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
238 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
239 // Attention a mettre le bon signe a ZoneTypeHOMARD :
240 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
241 // <0 signifie que l'on deraffinera
244 if ( ZoneType >= 11 and ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
245 else if ( ZoneType >= 31 and ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
246 else if ( ZoneType >= 61 and ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
247 else { ZoneTypeHOMARD = ZoneType ; }
249 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
251 std::stringstream saux1 ;
253 saux = "#\n# Zone numero " + saux1.str() + "\n" ;
255 { std::stringstream saux1 ;
256 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
257 saux += "ZoRaType " + saux1.str() + "\n" ;
262 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
263 // Y Homard <=> Y Salome
265 saux += "#Rectangle\n" ;
266 { std::stringstream saux1 ;
267 saux1 << NumeZone << " " << x0 ;
268 saux += "ZoRaXmin " + saux1.str() + "\n" ;
270 { std::stringstream saux1 ;
271 saux1 << NumeZone << " " << x1 ;
272 saux += "ZoRaXmax " + saux1.str() + "\n" ;
274 { std::stringstream saux1 ;
275 saux1 << NumeZone << " " << x2 ;
276 saux += "ZoRaYmin " + saux1.str() + "\n" ;
278 { std::stringstream saux1 ;
279 saux1 << NumeZone << " " << x3 ;
280 saux += "ZoRaYmax " + saux1.str() + "\n" ;
284 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
285 // Y Homard <=> Z Salome
287 saux += "#Rectangle\n" ;
288 { std::stringstream saux1 ;
289 saux1 << NumeZone << " " << x2 ;
290 saux += "ZoRaXmin " + saux1.str() + "\n" ;
292 { std::stringstream saux1 ;
293 saux1 << NumeZone << " " << x3 ;
294 saux += "ZoRaXmax " + saux1.str() + "\n" ;
296 { std::stringstream saux1 ;
297 saux1 << NumeZone << " " << x4 ;
298 saux += "ZoRaYmin " + saux1.str() + "\n" ;
300 { std::stringstream saux1 ;
301 saux1 << NumeZone << " " << x5 ;
302 saux += "ZoRaYmax " + saux1.str() + "\n" ;
306 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
307 // Y Homard <=> Z Salome
309 saux += "#Rectangle\n" ;
310 { std::stringstream saux1 ;
311 saux1 << NumeZone << " " << x0 ;
312 saux += "ZoRaXmin " + saux1.str() + "\n" ;
314 { std::stringstream saux1 ;
315 saux1 << NumeZone << " " << x1 ;
316 saux += "ZoRaXmax " + saux1.str() + "\n" ;
318 { std::stringstream saux1 ;
319 saux1 << NumeZone << " " << x4 ;
320 saux += "ZoRaYmin " + saux1.str() + "\n" ;
322 { std::stringstream saux1 ;
323 saux1 << NumeZone << " " << x5 ;
324 saux += "ZoRaYmax " + saux1.str() + "\n" ;
328 // Cas du parallelepipede
330 else if ( ZoneType == 2 )
332 saux += "# Boite\n" ;
333 { std::stringstream saux1 ;
334 saux1 << NumeZone << " " << x0 ;
335 saux += "ZoRaXmin " + saux1.str() + "\n" ;
337 { std::stringstream saux1 ;
338 saux1 << NumeZone << " " << x1 ;
339 saux += "ZoRaXmax " + saux1.str() + "\n" ;
341 { std::stringstream saux1 ;
342 saux1 << NumeZone << " " << x2 ;
343 saux += "ZoRaYmin " + saux1.str() + "\n" ;
345 { std::stringstream saux1 ;
346 saux1 << NumeZone << " " << x3 ;
347 saux += "ZoRaYmax " + saux1.str() + "\n" ;
349 { std::stringstream saux1 ;
350 saux1 << NumeZone << " " << x4 ;
351 saux += "ZoRaZmin " + saux1.str() + "\n" ;
353 { std::stringstream saux1 ;
354 saux1 << NumeZone << " " << x5 ;
355 saux += "ZoRaZmax " + saux1.str() + "\n" ;
361 else if ( ZoneType == 31 or ZoneType == 61 )
363 saux += "# Sphere\n" ;
364 { std::stringstream saux1 ;
365 saux1 << NumeZone << " " << x0 ;
366 saux += "ZoRaXCen " + saux1.str() + "\n" ;
368 { std::stringstream saux1 ;
369 saux1 << NumeZone << " " << x1 ;
370 saux += "ZoRaYCen " + saux1.str() + "\n" ;
372 { std::stringstream saux1 ;
373 saux1 << NumeZone << " " << x6 ;
374 saux2 = saux1.str() ;
375 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
376 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
378 if ( ZoneType == 61 )
379 { std::stringstream saux1 ;
380 saux1 << NumeZone << " " << x8 ;
381 saux += "ZoRaRayI " + saux1.str() + "\n" ;
384 else if ( ZoneType == 32 or ZoneType == 62 )
386 saux += "# Sphere\n" ;
387 { std::stringstream saux1 ;
388 saux1 << NumeZone << " " << x1 ;
389 saux += "ZoRaXCen " + saux1.str() + "\n" ;
391 { std::stringstream saux1 ;
392 saux1 << NumeZone << " " << x2 ;
393 saux += "ZoRaYCen " + saux1.str() + "\n" ;
395 { std::stringstream saux1 ;
396 saux1 << NumeZone << " " << x6 ;
397 saux2 = saux1.str() ;
398 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
399 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
401 if ( ZoneType == 62 )
402 { std::stringstream saux1 ;
403 saux1 << NumeZone << " " << x8 ;
404 saux += "ZoRaRayI " + saux1.str() + "\n" ;
407 else if ( ZoneType == 33 or ZoneType == 63 )
409 saux += "# Sphere\n" ;
410 { std::stringstream saux1 ;
411 saux1 << NumeZone << " " << x0 ;
412 saux += "ZoRaXCen " + saux1.str() + "\n" ;
414 { std::stringstream saux1 ;
415 saux1 << NumeZone << " " << x2 ;
416 saux += "ZoRaYCen " + saux1.str() + "\n" ;
418 { std::stringstream saux1 ;
419 saux1 << NumeZone << " " << x6 ;
420 saux2 = saux1.str() ;
421 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
422 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
424 if ( ZoneType == 63 )
425 { std::stringstream saux1 ;
426 saux1 << NumeZone << " " << x8 ;
427 saux += "ZoRaRayI " + saux1.str() + "\n" ;
433 else if ( ZoneType == 4 )
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 << " " << x1 ;
442 saux += "ZoRaYCen " + saux1.str() + "\n" ;
444 { std::stringstream saux1 ;
445 saux1 << NumeZone << " " << x2 ;
446 saux += "ZoRaZCen " + saux1.str() + "\n" ;
448 { std::stringstream saux1 ;
449 saux1 << NumeZone << " " << x3 ;
450 saux += "ZoRaRayo " + saux1.str() + "\n" ;
454 // Cas du cylindre ou du tuyau
456 else if ( ZoneType == 5 or ZoneType == 7 )
458 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
459 else { saux += "# Tuyau\n" ; }
460 { std::stringstream saux1 ;
461 saux1 << NumeZone << " " << x0 ;
462 saux += "ZoRaXBas " + saux1.str() + "\n" ;
464 { std::stringstream saux1 ;
465 saux1 << NumeZone << " " << x1 ;
466 saux += "ZoRaYBas " + saux1.str() + "\n" ;
468 { std::stringstream saux1 ;
469 saux1 << NumeZone << " " << x2 ;
470 saux += "ZoRaZBas " + saux1.str() + "\n" ;
472 { std::stringstream saux1 ;
473 saux1 << NumeZone << " " << x3 ;
474 saux += "ZoRaXAxe " + saux1.str() + "\n" ;
476 { std::stringstream saux1 ;
477 saux1 << NumeZone << " " << x4 ;
478 saux += "ZoRaYAxe " + saux1.str() + "\n" ;
480 { std::stringstream saux1 ;
481 saux1 << NumeZone << " " << x5 ;
482 saux += "ZoRaZAxe " + saux1.str() + "\n" ;
484 { std::stringstream saux1 ;
485 saux1 << NumeZone << " " << x6 ;
486 saux2 = saux1.str() ;
487 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
488 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
490 { std::stringstream saux1 ;
491 saux1 << NumeZone << " " << x7 ;
492 saux += "ZoRaHaut " + saux1.str() + "\n" ;
495 { std::stringstream saux1 ;
496 saux1 << NumeZone << " " << x8 ;
497 saux += "ZoRaRayI " + saux1.str() + "\n" ;
501 _Texte += saux + "#\n" ;
503 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
505 //===============================================================================
506 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
507 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
508 int UsField, int UsCmpI )
510 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
511 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
513 std::string saux, saux2 ;
516 _Texte += "# Champ d'indicateurs\n" ;
517 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
518 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
520 // Cas ou on prend le dernier pas de temps
521 if ( TimeStep == -2 )
522 { _Texte += "CCNumPTI Last\n" ; }
523 // Cas avec pas de temps
524 else if ( TimeStep >= 0 )
527 std::stringstream saux1 ;
529 saux2 = saux1.str() ;
530 _Texte += "CCNumPTI " + saux2 + "\n" ;
534 std::stringstream saux1 ;
536 saux2 = saux1.str() ;
537 _Texte += "CCNumOrI " + saux2 + "\n" ;
552 std::stringstream saux1 ;
554 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
568 std::stringstream saux1 ;
570 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
575 { saux = "MAILLE" ; }
580 _Texte += "CCModeFI " + saux + "\n" ;
587 { saux = "INFINI" ; }
589 { saux = "V_RELATIVE" ; }
592 _Texte += "CCUsCmpI " + saux + "\n" ;
595 //===============================================================================
596 void HomardDriver::TexteGroup( const std::string GroupName )
598 MESSAGE("TexteGroup, GroupName = "<<GroupName);
600 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
603 //===============================================================================
605 //===============================================================================
606 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
608 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
610 // Type de suivi de frontiere
612 std::stringstream saux1 ;
613 saux1 << BoundaryOption ;
614 std::string saux = saux1.str() ;
615 _Texte += "SuivFron " + saux + "\n" ;
618 //===============================================================================
619 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
621 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
622 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
624 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
625 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
628 //===============================================================================
629 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
631 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
633 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
636 //===============================================================================
637 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 )
639 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
640 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
641 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
642 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
644 std::string saux, saux2 ;
648 std::stringstream saux1 ;
649 saux1 << NumeBoundary ;
650 saux2 = saux1.str() ;
651 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
652 if ( BoundaryType == 1 )
653 { saux += "# Cylindre\n" ; }
654 if ( BoundaryType == 2 )
655 { saux += "# Sphere\n" ; }
656 if ( BoundaryType == 3 or BoundaryType == 4 )
657 { saux += "# Cone\n" ; }
659 // Le nom de la frontiere
661 { std::stringstream saux1 ;
662 saux1 << NumeBoundary ;
663 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
668 { std::stringstream saux1 ;
669 saux1 << NumeBoundary << " " << BoundaryType ;
670 saux += "FAType " + saux1.str() + "\n" ;
675 if ( BoundaryType == 1 )
677 { std::stringstream saux1 ;
678 saux1 << NumeBoundary << " " << x0 ;
679 saux2 = saux1.str() ;
680 saux += "FAXCen " + saux1.str() + "\n" ;
682 { std::stringstream saux1 ;
683 saux1 << NumeBoundary << " " << x1 ;
684 saux += "FAYCen " + saux1.str() + "\n" ;
686 { std::stringstream saux1 ;
687 saux1 << NumeBoundary << " " << x2 ;
688 saux += "FAZCen " + saux1.str() + "\n" ;
690 { std::stringstream saux1 ;
691 saux1 << NumeBoundary << " " << x3 ;
692 saux += "FAXAxe " + saux1.str() + "\n" ;
694 { std::stringstream saux1 ;
695 saux1 << NumeBoundary << " " << x4 ;
696 saux += "FAYAxe " + saux1.str() + "\n" ;
698 { std::stringstream saux1 ;
699 saux1 << NumeBoundary << " " << x5 ;
700 saux += "FAZAxe " + saux1.str() + "\n" ;
702 { std::stringstream saux1 ;
703 saux1 << NumeBoundary << " " << x6 ;
704 saux += "FARayon " + saux1.str() + "\n" ;
710 else if ( BoundaryType == 2 )
712 { std::stringstream saux1 ;
713 saux1 << NumeBoundary << " " << x0 ;
714 saux += "FAXCen " + saux1.str() + "\n" ;
716 { std::stringstream saux1 ;
717 saux1 << NumeBoundary << " " << x1 ;
718 saux += "FAYCen " + saux1.str() + "\n" ;
720 { std::stringstream saux1 ;
721 saux1 << NumeBoundary << " " << x2 ;
722 saux += "FAZCen " + saux1.str() + "\n" ;
724 { std::stringstream saux1 ;
725 saux1 << NumeBoundary << " " << x3 ;
726 saux += "FARayon " + saux1.str() + "\n" ;
730 // Cas du cone defini par un axe et un angle
732 if ( BoundaryType == 3 )
734 { std::stringstream saux1 ;
735 saux1 << NumeBoundary << " " << x0 ;
736 saux += "FAXAxe " + saux1.str() + "\n" ;
738 { std::stringstream saux1 ;
739 saux1 << NumeBoundary << " " << x1 ;
740 saux += "FAYAxe " + saux1.str() + "\n" ;
742 { std::stringstream saux1 ;
743 saux1 << NumeBoundary << " " << x2 ;
744 saux += "FAZAxe " + saux1.str() + "\n" ;
746 { std::stringstream saux1 ;
747 saux1 << NumeBoundary << " " << x3 ;
748 saux += "FAAngle " + saux1.str() + "\n" ;
750 { std::stringstream saux1 ;
751 saux1 << NumeBoundary << " " << x4 ;
752 saux += "FAXCen " + saux1.str() + "\n" ;
754 { std::stringstream saux1 ;
755 saux1 << NumeBoundary << " " << x5 ;
756 saux += "FAYCen " + saux1.str() + "\n" ;
758 { std::stringstream saux1 ;
759 saux1 << NumeBoundary << " " << x6 ;
760 saux += "FAZCen " + saux1.str() + "\n" ;
764 // Cas du cone defini par les 2 rayons
766 if ( BoundaryType == 4 )
768 { std::stringstream saux1 ;
769 saux1 << NumeBoundary << " " << x0 ;
770 saux += "FAXCen " + saux1.str() + "\n" ;
772 { std::stringstream saux1 ;
773 saux1 << NumeBoundary << " " << x1 ;
774 saux += "FAYCen " + saux1.str() + "\n" ;
776 { std::stringstream saux1 ;
777 saux1 << NumeBoundary << " " << x2 ;
778 saux += "FAZCen " + saux1.str() + "\n" ;
780 { std::stringstream saux1 ;
781 saux1 << NumeBoundary << " " << x3 ;
782 saux += "FARayon " + saux1.str() + "\n" ;
784 { std::stringstream saux1 ;
785 saux1 << NumeBoundary << " " << x4 ;
786 saux += "FAXCen2 " + saux1.str() + "\n" ;
788 { std::stringstream saux1 ;
789 saux1 << NumeBoundary << " " << x5 ;
790 saux += "FAYCen2 " + saux1.str() + "\n" ;
792 { std::stringstream saux1 ;
793 saux1 << NumeBoundary << " " << x6 ;
794 saux += "FAZCen2 " + saux1.str() + "\n" ;
796 { std::stringstream saux1 ;
797 saux1 << NumeBoundary << " " << x7 ;
798 saux += "FARayon2 " + saux1.str() + "\n" ;
802 _Texte += saux + "#\n" ;
805 //===============================================================================
806 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
808 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
809 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
810 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
814 std::string saux, saux2 ;
815 std::stringstream saux1 ;
816 saux1 << NumeBoundary ;
817 saux2 = saux1.str() ;
818 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
820 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
821 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
823 _Texte += saux + "#\n" ;
826 //===============================================================================
827 // E. Les interpolations
828 //===============================================================================
829 // Les fichiers d'entree et de sortie des champs a interpoler
830 void HomardDriver::TexteFieldInterp( const std::string FieldFile, const std::string MeshFile )
832 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
834 _Texte += "#\n# Interpolations des champs\n" ;
837 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
839 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
841 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
843 //===============================================================================
844 // Tous les champs sont a interpoler
845 void HomardDriver::TexteFieldInterpAll( )
847 MESSAGE("TexteFieldInterpAll");
849 _Texte += "CCChaTou oui\n" ;
851 //===============================================================================
852 // Ecrit les caracteristiques de chaque interpolation sous la forme :
853 // CCChaNom 1 "DEPL" ! Nom du 1er champ a interpoler
854 // CCChaTIn 1 0 ! Mode d'interpolation : automatique
855 // CCChaNom 2 "VOLUME" ! Nom du 2nd champ a interpoler
856 // CCChaTIn 2 1 ! Mode d'interpolation : une variable extensive
857 // CCChaPdT 2 14 ! Pas de temps 14
858 // CCChaNuO 2 14 ! Numero d'ordre 14
861 // NumeChamp : numero d'ordre du champ a interpoler
862 // FieldName : nom du champ
863 // TypeInterp : type d'interpolation
864 // TimeStep : pas de temps retenu (>0 si pas de precision)
865 // Rank : numero d'ordre retenu
867 void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank)
869 MESSAGE("TexteFieldInterpNameType, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName<<", TypeInterp = "<<TypeInterp);
870 MESSAGE("TexteFieldInterpNameType, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
871 // Numero d'ordre du champ a interpoler
872 std::stringstream saux1 ;
874 std::string saux = saux1.str() ;
876 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
877 // Type d'interpolation pour le champ
878 _Texte +="CCChaTIn " + saux + " " + TypeInterp + "\n" ;
883 std::stringstream saux1 ;
885 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
888 std::stringstream saux1 ;
890 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
894 //===============================================================================
895 // F. Les options avancees
896 //===============================================================================
897 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput )
899 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", LevelOutput ="<<LevelOutput);
903 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
904 _Texte += "TypeElem ignore_pyra\n" ;
908 _Texte += "# Niveaux extremes\n" ;
909 { std::stringstream saux1 ;
911 _Texte += "NiveauMa " + saux1.str() + "\n" ;
916 _Texte += "# Diametre minimal\n" ;
917 { std::stringstream saux1 ;
919 _Texte += "DiametMi " + saux1.str() + "\n" ;
925 { _Texte += "# Raffinement" ; }
927 { _Texte += "# Deraffinement" ; }
928 _Texte += " des regions sans indicateur\n" ;
929 { std::stringstream saux1 ;
931 _Texte += "AdapInit " + saux1.str() + "\n" ;
934 if ( LevelOutput != 0 )
936 _Texte += "# Sortie des niveaux de raffinement\n" ;
937 _Texte += "NCNiveau NIVEAU\n" ;
940 //===============================================================================
942 //===============================================================================
943 void HomardDriver::TexteInfoCompute( int MessInfo )
945 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
949 _Texte += "# Messages d'informations\n" ;
950 { std::stringstream saux1 ;
952 _Texte += "MessInfo " + saux1.str() + "\n" ;
956 //===============================================================================
957 void HomardDriver::CreeFichier( )
960 if ( _siter != _siterp1 )
961 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
963 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
965 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
966 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
970 //===============================================================================
971 // Creation du fichier de donnees pour l'information
972 //===============================================================================
973 void HomardDriver::CreeFichierDonn( )
976 MESSAGE("CreeFichierDonn");
977 _NomFichierDonn = "info.donn" ;
983 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
984 if (Fic.is_open() == true) { Fic << data << std::endl ; }
988 //===============================================================================
989 int HomardDriver::ExecuteHomard(int option)
991 MESSAGE("ExecuteHomard, avec option = "<<option);
992 std::string commande ;
994 // Copie des Fichiers HOMARD
995 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
996 codret = system(commande.c_str()) ;
998 // Execution de HOMARD
1001 commande = _HOMARD_Exec.c_str() ;
1002 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1003 codret = system(commande.c_str());
1004 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1005 _NomFichierDonn = "" ;