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
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( )
82 _Texte += "Action homa\n" ;
83 _Texte += "CCAssoci med\n" ;
84 _Texte += "ModeHOMA 1\n" ;
85 _Texte += "NumeIter " + _siter + "\n" ;
88 //===============================================================================
89 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
91 MESSAGE("TexteInit, TypeBila ="<<TypeBila);
93 _Texte += "ModeHOMA 2\n" ;
94 std::stringstream saux1 ;
96 std::string saux2 = saux1.str() ;
97 _Texte += "TypeBila " + saux2 + "\n" ;
100 _Texte += "NumeIter 0\n" ;
101 _Texte += "Action info_av\n" ;
102 _Texte += "CCAssoci med\n" ;
106 _Texte += "NumeIter " + _siter + "\n" ;
107 _Texte += "Action info_ap\n" ;
108 _Texte += "CCAssoci homard\n" ;
112 //===============================================================================
113 // B. Les maillages en entree et en sortie
114 //===============================================================================
115 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
117 MESSAGE("TexteMaillage, NomMesh ="<<NomMesh<<", MeshFile ="<<MeshFile<<", apres ="<<apres);
120 if ( apres < 1 ) { saux = "__" ; }
122 _Texte += "# Maillages Med " + saux + "\n" ;
123 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
124 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
127 //===============================================================================
128 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
130 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
132 if ( apres < 1 ) { saux = "__" ; }
133 else { saux = "P1" ; }
135 _Texte += "# Maillage HOMARD " + liter + "\n" ;
136 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
139 //===============================================================================
140 // C. Le pilotage de l'adaptation
141 //===============================================================================
142 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
144 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
145 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
147 // Type de conformite
154 saux = "conforme_boites" ;
164 saux = "non_conforme_1_noeud" ;
169 saux = "non_conforme_1_arete" ;
174 saux = "non_conforme_indicateur" ;
178 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
180 // Type de raffinement/deraffinement
182 if ( TypeAdap == -1 )
186 saux = "TypeRaff uniforme\n" ;
190 saux = "TypeRaff non\n" ;
194 saux += "TypeDera uniforme" ;
198 saux += "TypeDera non" ;
205 saux = "TypeRaff libre\n" ;
209 saux = "TypeRaff non\n" ;
213 saux += "TypeDera libre" ;
217 saux += "TypeDera non" ;
220 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
222 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
224 //===============================================================================
225 void HomardDriver::TexteCompo( int NumeComp, const std::string NompCompo)
227 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NompCompo = "<<NompCompo);
228 _Texte +="CCCoChaI \"" + NompCompo + "\"\n" ;
230 //===============================================================================
231 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 )
233 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
234 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
236 std::string saux, saux2 ;
239 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
240 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
241 // Attention a mettre le bon signe a ZoneTypeHOMARD :
242 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
243 // <0 signifie que l'on deraffinera
246 if ( ZoneType >= 11 && ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
247 else if ( ZoneType >= 31 && ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
248 else if ( ZoneType >= 61 && ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
249 else { ZoneTypeHOMARD = ZoneType ; }
251 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
253 std::stringstream saux1 ;
255 saux = "#\n# Zone numero " + saux1.str() + "\n" ;
257 { std::stringstream saux1 ;
258 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
259 saux += "ZoRaType " + saux1.str() + "\n" ;
264 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
265 // Y Homard <=> Y Salome
267 saux += "#Rectangle\n" ;
268 { std::stringstream saux1 ;
269 saux1 << NumeZone << " " << x0 ;
270 saux += "ZoRaXmin " + saux1.str() + "\n" ;
272 { std::stringstream saux1 ;
273 saux1 << NumeZone << " " << x1 ;
274 saux += "ZoRaXmax " + saux1.str() + "\n" ;
276 { std::stringstream saux1 ;
277 saux1 << NumeZone << " " << x2 ;
278 saux += "ZoRaYmin " + saux1.str() + "\n" ;
280 { std::stringstream saux1 ;
281 saux1 << NumeZone << " " << x3 ;
282 saux += "ZoRaYmax " + saux1.str() + "\n" ;
286 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
287 // Y Homard <=> Z Salome
289 saux += "#Rectangle\n" ;
290 { std::stringstream saux1 ;
291 saux1 << NumeZone << " " << x2 ;
292 saux += "ZoRaXmin " + saux1.str() + "\n" ;
294 { std::stringstream saux1 ;
295 saux1 << NumeZone << " " << x3 ;
296 saux += "ZoRaXmax " + saux1.str() + "\n" ;
298 { std::stringstream saux1 ;
299 saux1 << NumeZone << " " << x4 ;
300 saux += "ZoRaYmin " + saux1.str() + "\n" ;
302 { std::stringstream saux1 ;
303 saux1 << NumeZone << " " << x5 ;
304 saux += "ZoRaYmax " + saux1.str() + "\n" ;
308 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
309 // Y Homard <=> Z Salome
311 saux += "#Rectangle\n" ;
312 { std::stringstream saux1 ;
313 saux1 << NumeZone << " " << x0 ;
314 saux += "ZoRaXmin " + saux1.str() + "\n" ;
316 { std::stringstream saux1 ;
317 saux1 << NumeZone << " " << x1 ;
318 saux += "ZoRaXmax " + saux1.str() + "\n" ;
320 { std::stringstream saux1 ;
321 saux1 << NumeZone << " " << x4 ;
322 saux += "ZoRaYmin " + saux1.str() + "\n" ;
324 { std::stringstream saux1 ;
325 saux1 << NumeZone << " " << x5 ;
326 saux += "ZoRaYmax " + saux1.str() + "\n" ;
330 // Cas du parallelepipede
332 else if ( ZoneType == 2 )
334 saux += "# Boite\n" ;
335 { std::stringstream saux1 ;
336 saux1 << NumeZone << " " << x0 ;
337 saux += "ZoRaXmin " + saux1.str() + "\n" ;
339 { std::stringstream saux1 ;
340 saux1 << NumeZone << " " << x1 ;
341 saux += "ZoRaXmax " + saux1.str() + "\n" ;
343 { std::stringstream saux1 ;
344 saux1 << NumeZone << " " << x2 ;
345 saux += "ZoRaYmin " + saux1.str() + "\n" ;
347 { std::stringstream saux1 ;
348 saux1 << NumeZone << " " << x3 ;
349 saux += "ZoRaYmax " + saux1.str() + "\n" ;
351 { std::stringstream saux1 ;
352 saux1 << NumeZone << " " << x4 ;
353 saux += "ZoRaZmin " + saux1.str() + "\n" ;
355 { std::stringstream saux1 ;
356 saux1 << NumeZone << " " << x5 ;
357 saux += "ZoRaZmax " + saux1.str() + "\n" ;
363 else if ( ZoneType == 31 || ZoneType == 61 )
365 saux += "# Sphere\n" ;
366 { std::stringstream saux1 ;
367 saux1 << NumeZone << " " << x0 ;
368 saux += "ZoRaXCen " + saux1.str() + "\n" ;
370 { std::stringstream saux1 ;
371 saux1 << NumeZone << " " << x1 ;
372 saux += "ZoRaYCen " + saux1.str() + "\n" ;
374 { std::stringstream saux1 ;
375 saux1 << NumeZone << " " << x6 ;
376 saux2 = saux1.str() ;
377 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
378 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
380 if ( ZoneType == 61 )
381 { std::stringstream saux1 ;
382 saux1 << NumeZone << " " << x8 ;
383 saux += "ZoRaRayI " + saux1.str() + "\n" ;
386 else if ( ZoneType == 32 || ZoneType == 62 )
388 saux += "# Sphere\n" ;
389 { std::stringstream saux1 ;
390 saux1 << NumeZone << " " << x1 ;
391 saux += "ZoRaXCen " + saux1.str() + "\n" ;
393 { std::stringstream saux1 ;
394 saux1 << NumeZone << " " << x2 ;
395 saux += "ZoRaYCen " + saux1.str() + "\n" ;
397 { std::stringstream saux1 ;
398 saux1 << NumeZone << " " << x6 ;
399 saux2 = saux1.str() ;
400 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
401 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
403 if ( ZoneType == 62 )
404 { std::stringstream saux1 ;
405 saux1 << NumeZone << " " << x8 ;
406 saux += "ZoRaRayI " + saux1.str() + "\n" ;
409 else if ( ZoneType == 33 || ZoneType == 63 )
411 saux += "# Sphere\n" ;
412 { std::stringstream saux1 ;
413 saux1 << NumeZone << " " << x0 ;
414 saux += "ZoRaXCen " + saux1.str() + "\n" ;
416 { std::stringstream saux1 ;
417 saux1 << NumeZone << " " << x2 ;
418 saux += "ZoRaYCen " + saux1.str() + "\n" ;
420 { std::stringstream saux1 ;
421 saux1 << NumeZone << " " << x6 ;
422 saux2 = saux1.str() ;
423 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
424 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
426 if ( ZoneType == 63 )
427 { std::stringstream saux1 ;
428 saux1 << NumeZone << " " << x8 ;
429 saux += "ZoRaRayI " + saux1.str() + "\n" ;
435 else if ( ZoneType == 4 )
437 saux += "# Sphere\n" ;
438 { std::stringstream saux1 ;
439 saux1 << NumeZone << " " << x0 ;
440 saux += "ZoRaXCen " + saux1.str() + "\n" ;
442 { std::stringstream saux1 ;
443 saux1 << NumeZone << " " << x1 ;
444 saux += "ZoRaYCen " + saux1.str() + "\n" ;
446 { std::stringstream saux1 ;
447 saux1 << NumeZone << " " << x2 ;
448 saux += "ZoRaZCen " + saux1.str() + "\n" ;
450 { std::stringstream saux1 ;
451 saux1 << NumeZone << " " << x3 ;
452 saux += "ZoRaRayo " + saux1.str() + "\n" ;
456 // Cas du cylindre ou du tuyau
458 else if ( ZoneType == 5 || ZoneType == 7 )
460 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
461 else { saux += "# Tuyau\n" ; }
462 { std::stringstream saux1 ;
463 saux1 << NumeZone << " " << x0 ;
464 saux += "ZoRaXBas " + saux1.str() + "\n" ;
466 { std::stringstream saux1 ;
467 saux1 << NumeZone << " " << x1 ;
468 saux += "ZoRaYBas " + saux1.str() + "\n" ;
470 { std::stringstream saux1 ;
471 saux1 << NumeZone << " " << x2 ;
472 saux += "ZoRaZBas " + saux1.str() + "\n" ;
474 { std::stringstream saux1 ;
475 saux1 << NumeZone << " " << x3 ;
476 saux += "ZoRaXAxe " + saux1.str() + "\n" ;
478 { std::stringstream saux1 ;
479 saux1 << NumeZone << " " << x4 ;
480 saux += "ZoRaYAxe " + saux1.str() + "\n" ;
482 { std::stringstream saux1 ;
483 saux1 << NumeZone << " " << x5 ;
484 saux += "ZoRaZAxe " + saux1.str() + "\n" ;
486 { std::stringstream saux1 ;
487 saux1 << NumeZone << " " << x6 ;
488 saux2 = saux1.str() ;
489 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
490 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
492 { std::stringstream saux1 ;
493 saux1 << NumeZone << " " << x7 ;
494 saux += "ZoRaHaut " + saux1.str() + "\n" ;
497 { std::stringstream saux1 ;
498 saux1 << NumeZone << " " << x8 ;
499 saux += "ZoRaRayI " + saux1.str() + "\n" ;
503 _Texte += saux + "#\n" ;
505 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
507 //===============================================================================
508 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
509 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
510 int UsField, int UsCmpI )
512 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
513 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
515 std::string saux, saux2 ;
518 _Texte += "# Champ d'indicateurs\n" ;
519 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
520 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
522 // Cas ou on prend le dernier pas de temps
523 if ( TimeStep == -2 )
524 { _Texte += "CCNumPTI Last\n" ; }
525 // Cas avec pas de temps
526 else if ( TimeStep >= 0 )
529 std::stringstream saux1 ;
531 saux2 = saux1.str() ;
532 _Texte += "CCNumPTI " + saux2 + "\n" ;
536 std::stringstream saux1 ;
538 saux2 = saux1.str() ;
539 _Texte += "CCNumOrI " + saux2 + "\n" ;
554 std::stringstream saux1 ;
556 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
570 std::stringstream saux1 ;
572 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
577 { saux = "MAILLE" ; }
582 _Texte += "CCModeFI " + saux + "\n" ;
589 { saux = "INFINI" ; }
591 { saux = "V_RELATIVE" ; }
594 _Texte += "CCUsCmpI " + saux + "\n" ;
597 //===============================================================================
598 void HomardDriver::TexteGroup( const std::string GroupName )
600 MESSAGE("TexteGroup, GroupName = "<<GroupName);
602 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
605 //===============================================================================
607 //===============================================================================
608 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
610 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
612 // Type de suivi de frontiere
614 std::stringstream saux1 ;
615 saux1 << BoundaryOption ;
616 std::string saux = saux1.str() ;
617 _Texte += "SuivFron " + saux + "\n" ;
620 //===============================================================================
621 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
623 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
624 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
626 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
627 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
630 //===============================================================================
631 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
633 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
635 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
638 //===============================================================================
639 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 )
641 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
642 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
643 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
644 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
646 std::string saux, saux2 ;
650 std::stringstream saux1 ;
651 saux1 << NumeBoundary ;
652 saux2 = saux1.str() ;
653 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
654 if ( BoundaryType == 1 )
655 { saux += "# Cylindre\n" ; }
656 if ( BoundaryType == 2 )
657 { saux += "# Sphere\n" ; }
658 if ( BoundaryType == 3 || BoundaryType == 4 )
659 { saux += "# Cone\n" ; }
661 // Le nom de la frontiere
663 { std::stringstream saux1 ;
664 saux1 << NumeBoundary ;
665 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
670 { std::stringstream saux1 ;
671 saux1 << NumeBoundary << " " << BoundaryType ;
672 saux += "FAType " + saux1.str() + "\n" ;
677 if ( BoundaryType == 1 )
679 { std::stringstream saux1 ;
680 saux1 << NumeBoundary << " " << x0 ;
681 saux2 = saux1.str() ;
682 saux += "FAXCen " + saux1.str() + "\n" ;
684 { std::stringstream saux1 ;
685 saux1 << NumeBoundary << " " << x1 ;
686 saux += "FAYCen " + saux1.str() + "\n" ;
688 { std::stringstream saux1 ;
689 saux1 << NumeBoundary << " " << x2 ;
690 saux += "FAZCen " + saux1.str() + "\n" ;
692 { std::stringstream saux1 ;
693 saux1 << NumeBoundary << " " << x3 ;
694 saux += "FAXAxe " + saux1.str() + "\n" ;
696 { std::stringstream saux1 ;
697 saux1 << NumeBoundary << " " << x4 ;
698 saux += "FAYAxe " + saux1.str() + "\n" ;
700 { std::stringstream saux1 ;
701 saux1 << NumeBoundary << " " << x5 ;
702 saux += "FAZAxe " + saux1.str() + "\n" ;
704 { std::stringstream saux1 ;
705 saux1 << NumeBoundary << " " << x6 ;
706 saux += "FARayon " + saux1.str() + "\n" ;
712 else if ( BoundaryType == 2 )
714 { std::stringstream saux1 ;
715 saux1 << NumeBoundary << " " << x0 ;
716 saux += "FAXCen " + saux1.str() + "\n" ;
718 { std::stringstream saux1 ;
719 saux1 << NumeBoundary << " " << x1 ;
720 saux += "FAYCen " + saux1.str() + "\n" ;
722 { std::stringstream saux1 ;
723 saux1 << NumeBoundary << " " << x2 ;
724 saux += "FAZCen " + saux1.str() + "\n" ;
726 { std::stringstream saux1 ;
727 saux1 << NumeBoundary << " " << x3 ;
728 saux += "FARayon " + saux1.str() + "\n" ;
732 // Cas du cone defini par un axe et un angle
734 if ( BoundaryType == 3 )
736 { std::stringstream saux1 ;
737 saux1 << NumeBoundary << " " << x0 ;
738 saux += "FAXAxe " + saux1.str() + "\n" ;
740 { std::stringstream saux1 ;
741 saux1 << NumeBoundary << " " << x1 ;
742 saux += "FAYAxe " + saux1.str() + "\n" ;
744 { std::stringstream saux1 ;
745 saux1 << NumeBoundary << " " << x2 ;
746 saux += "FAZAxe " + saux1.str() + "\n" ;
748 { std::stringstream saux1 ;
749 saux1 << NumeBoundary << " " << x3 ;
750 saux += "FAAngle " + saux1.str() + "\n" ;
752 { std::stringstream saux1 ;
753 saux1 << NumeBoundary << " " << x4 ;
754 saux += "FAXCen " + saux1.str() + "\n" ;
756 { std::stringstream saux1 ;
757 saux1 << NumeBoundary << " " << x5 ;
758 saux += "FAYCen " + saux1.str() + "\n" ;
760 { std::stringstream saux1 ;
761 saux1 << NumeBoundary << " " << x6 ;
762 saux += "FAZCen " + saux1.str() + "\n" ;
766 // Cas du cone defini par les 2 rayons
768 if ( BoundaryType == 4 )
770 { std::stringstream saux1 ;
771 saux1 << NumeBoundary << " " << x0 ;
772 saux += "FAXCen " + saux1.str() + "\n" ;
774 { std::stringstream saux1 ;
775 saux1 << NumeBoundary << " " << x1 ;
776 saux += "FAYCen " + saux1.str() + "\n" ;
778 { std::stringstream saux1 ;
779 saux1 << NumeBoundary << " " << x2 ;
780 saux += "FAZCen " + saux1.str() + "\n" ;
782 { std::stringstream saux1 ;
783 saux1 << NumeBoundary << " " << x3 ;
784 saux += "FARayon " + saux1.str() + "\n" ;
786 { std::stringstream saux1 ;
787 saux1 << NumeBoundary << " " << x4 ;
788 saux += "FAXCen2 " + saux1.str() + "\n" ;
790 { std::stringstream saux1 ;
791 saux1 << NumeBoundary << " " << x5 ;
792 saux += "FAYCen2 " + saux1.str() + "\n" ;
794 { std::stringstream saux1 ;
795 saux1 << NumeBoundary << " " << x6 ;
796 saux += "FAZCen2 " + saux1.str() + "\n" ;
798 { std::stringstream saux1 ;
799 saux1 << NumeBoundary << " " << x7 ;
800 saux += "FARayon2 " + saux1.str() + "\n" ;
804 _Texte += saux + "#\n" ;
807 //===============================================================================
808 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
810 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
811 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
812 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
816 std::string saux, saux2 ;
817 std::stringstream saux1 ;
818 saux1 << NumeBoundary ;
819 saux2 = saux1.str() ;
820 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
822 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
823 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
825 _Texte += saux + "#\n" ;
828 //===============================================================================
829 // E. Les interpolations
830 //===============================================================================
831 // Les fichiers d'entree et de sortie des champs a interpoler
832 void HomardDriver::TexteFieldInterp( const std::string FieldFile, const std::string MeshFile )
834 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
836 _Texte += "#\n# Interpolations des champs\n" ;
839 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
841 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
843 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
845 //===============================================================================
846 // Tous les champs sont a interpoler
847 void HomardDriver::TexteFieldInterpAll( )
849 MESSAGE("TexteFieldInterpAll");
851 _Texte += "CCChaTou oui\n" ;
853 //===============================================================================
854 // Ecrit les caracteristiques de chaque interpolation sous la forme :
855 // CCChaNom 1 "DEPL" ! Nom du 1er champ a interpoler
856 // CCChaTIn 1 0 ! Mode d'interpolation : automatique
857 // CCChaNom 2 "VOLUME" ! Nom du 2nd champ a interpoler
858 // CCChaTIn 2 1 ! Mode d'interpolation : une variable extensive
859 // CCChaPdT 2 14 ! Pas de temps 14
860 // CCChaNuO 2 14 ! Numero d'ordre 14
863 // NumeChamp : numero d'ordre du champ a interpoler
864 // FieldName : nom du champ
865 // TypeInterp : type d'interpolation
866 // TimeStep : pas de temps retenu (>0 si pas de precision)
867 // Rank : numero d'ordre retenu
869 void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank)
871 MESSAGE("TexteFieldInterpNameType, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName<<", TypeInterp = "<<TypeInterp);
872 MESSAGE("TexteFieldInterpNameType, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
873 // Numero d'ordre du champ a interpoler
874 std::stringstream saux1 ;
876 std::string saux = saux1.str() ;
878 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
879 // Type d'interpolation pour le champ
880 _Texte +="CCChaTIn " + saux + " " + TypeInterp + "\n" ;
885 std::stringstream saux1 ;
887 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
890 std::stringstream saux1 ;
892 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
896 //===============================================================================
897 // F. Les options avancees
898 //===============================================================================
899 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput )
901 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", LevelOutput ="<<LevelOutput);
905 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
906 _Texte += "TypeElem ignore_pyra\n" ;
910 _Texte += "# Niveaux extremes\n" ;
911 { std::stringstream saux1 ;
913 _Texte += "NiveauMa " + saux1.str() + "\n" ;
918 _Texte += "# Diametre minimal\n" ;
919 { std::stringstream saux1 ;
921 _Texte += "DiametMi " + saux1.str() + "\n" ;
927 { _Texte += "# Raffinement" ; }
929 { _Texte += "# Deraffinement" ; }
930 _Texte += " des regions sans indicateur\n" ;
931 { std::stringstream saux1 ;
933 _Texte += "AdapInit " + saux1.str() + "\n" ;
936 if ( LevelOutput != 0 )
938 _Texte += "# Sortie des niveaux de raffinement\n" ;
939 _Texte += "NCNiveau NIVEAU\n" ;
942 //===============================================================================
944 //===============================================================================
945 void HomardDriver::TexteInfoCompute( int MessInfo )
947 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
951 _Texte += "# Messages d'informations\n" ;
952 { std::stringstream saux1 ;
954 _Texte += "MessInfo " + saux1.str() + "\n" ;
958 //===============================================================================
959 void HomardDriver::CreeFichier( )
962 if ( _siter != _siterp1 )
963 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
965 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
967 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
968 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
972 //===============================================================================
973 // Creation du fichier de donnees pour l'information
974 //===============================================================================
975 void HomardDriver::CreeFichierDonn( )
978 MESSAGE("CreeFichierDonn");
979 _NomFichierDonn = "info.donn" ;
985 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
986 if (Fic.is_open() == true) { Fic << data << std::endl ; }
990 //===============================================================================
991 int HomardDriver::ExecuteHomard(int option)
993 MESSAGE("ExecuteHomard, avec option = "<<option);
994 std::string commande ;
996 // Copie des Fichiers HOMARD
997 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
998 codret = system(commande.c_str()) ;
1000 // Execution de HOMARD
1003 commande = _HOMARD_Exec.c_str() ;
1004 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1005 codret = system(commande.c_str());
1006 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1007 _NomFichierDonn = "" ;