1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2015 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( )
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);
118 MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
119 MESSAGE("TexteMaillage, apres = "<<apres);
122 if ( apres < 1 ) { saux = "__" ; }
124 _Texte += "# Maillages Med " + saux + "\n" ;
125 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
126 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
129 //===============================================================================
130 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
132 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
134 if ( apres < 1 ) { saux = "__" ; }
135 else { saux = "P1" ; }
137 _Texte += "# Maillage HOMARD " + liter + "\n" ;
138 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
141 //===============================================================================
142 // C. Le pilotage de l'adaptation
143 //===============================================================================
144 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
146 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
147 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
149 // Type de conformite
156 saux = "NON_CONFORME_1_ARETE" ;
161 saux = "CONFORME_BOITES" ;
171 saux = "NON_CONFORME" ;
176 saux = "NON_CONFORME_1_NOEUD" ;
181 saux = "NON_CONFORME_INDICATEUR" ;
185 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
187 // Type de raffinement/deraffinement
189 if ( TypeAdap == -1 )
193 saux = "TypeRaff uniforme\n" ;
197 saux = "TypeRaff non\n" ;
201 saux += "TypeDera uniforme" ;
205 saux += "TypeDera non" ;
212 saux = "TypeRaff libre\n" ;
216 saux = "TypeRaff non\n" ;
220 saux += "TypeDera libre" ;
224 saux += "TypeDera non" ;
227 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
229 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
231 //===============================================================================
232 void HomardDriver::TexteCompo( int NumeComp, const std::string NompCompo)
234 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NompCompo = "<<NompCompo);
235 _Texte +="CCCoChaI \"" + NompCompo + "\"\n" ;
237 //===============================================================================
238 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 )
240 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
241 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
243 std::string saux, saux2 ;
246 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
247 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
248 // Attention a mettre le bon signe a ZoneTypeHOMARD :
249 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
250 // <0 signifie que l'on deraffinera
253 if ( ZoneType >= 11 && ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
254 else if ( ZoneType >= 31 && ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
255 else if ( ZoneType >= 61 && ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
256 else { ZoneTypeHOMARD = ZoneType ; }
258 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
260 std::stringstream saux1 ;
262 saux = "#\n# Zone numero " + saux1.str() + "\n" ;
264 { std::stringstream saux1 ;
265 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
266 saux += "ZoRaType " + saux1.str() + "\n" ;
271 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
272 // Y Homard <=> Y Salome
274 saux += "#Rectangle\n" ;
275 { std::stringstream saux1 ;
276 saux1 << NumeZone << " " << x0 ;
277 saux += "ZoRaXmin " + saux1.str() + "\n" ;
279 { std::stringstream saux1 ;
280 saux1 << NumeZone << " " << x1 ;
281 saux += "ZoRaXmax " + saux1.str() + "\n" ;
283 { std::stringstream saux1 ;
284 saux1 << NumeZone << " " << x2 ;
285 saux += "ZoRaYmin " + saux1.str() + "\n" ;
287 { std::stringstream saux1 ;
288 saux1 << NumeZone << " " << x3 ;
289 saux += "ZoRaYmax " + saux1.str() + "\n" ;
293 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
294 // Y Homard <=> Z Salome
296 saux += "#Rectangle\n" ;
297 { std::stringstream saux1 ;
298 saux1 << NumeZone << " " << x2 ;
299 saux += "ZoRaXmin " + saux1.str() + "\n" ;
301 { std::stringstream saux1 ;
302 saux1 << NumeZone << " " << x3 ;
303 saux += "ZoRaXmax " + saux1.str() + "\n" ;
305 { std::stringstream saux1 ;
306 saux1 << NumeZone << " " << x4 ;
307 saux += "ZoRaYmin " + saux1.str() + "\n" ;
309 { std::stringstream saux1 ;
310 saux1 << NumeZone << " " << x5 ;
311 saux += "ZoRaYmax " + saux1.str() + "\n" ;
315 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
316 // Y Homard <=> Z Salome
318 saux += "#Rectangle\n" ;
319 { std::stringstream saux1 ;
320 saux1 << NumeZone << " " << x0 ;
321 saux += "ZoRaXmin " + saux1.str() + "\n" ;
323 { std::stringstream saux1 ;
324 saux1 << NumeZone << " " << x1 ;
325 saux += "ZoRaXmax " + saux1.str() + "\n" ;
327 { std::stringstream saux1 ;
328 saux1 << NumeZone << " " << x4 ;
329 saux += "ZoRaYmin " + saux1.str() + "\n" ;
331 { std::stringstream saux1 ;
332 saux1 << NumeZone << " " << x5 ;
333 saux += "ZoRaYmax " + saux1.str() + "\n" ;
337 // Cas du parallelepipede
339 else if ( ZoneType == 2 )
341 saux += "# Boite\n" ;
342 { std::stringstream saux1 ;
343 saux1 << NumeZone << " " << x0 ;
344 saux += "ZoRaXmin " + saux1.str() + "\n" ;
346 { std::stringstream saux1 ;
347 saux1 << NumeZone << " " << x1 ;
348 saux += "ZoRaXmax " + saux1.str() + "\n" ;
350 { std::stringstream saux1 ;
351 saux1 << NumeZone << " " << x2 ;
352 saux += "ZoRaYmin " + saux1.str() + "\n" ;
354 { std::stringstream saux1 ;
355 saux1 << NumeZone << " " << x3 ;
356 saux += "ZoRaYmax " + saux1.str() + "\n" ;
358 { std::stringstream saux1 ;
359 saux1 << NumeZone << " " << x4 ;
360 saux += "ZoRaZmin " + saux1.str() + "\n" ;
362 { std::stringstream saux1 ;
363 saux1 << NumeZone << " " << x5 ;
364 saux += "ZoRaZmax " + saux1.str() + "\n" ;
370 else if ( ZoneType == 31 || ZoneType == 61 )
372 saux += "# Sphere\n" ;
373 { std::stringstream saux1 ;
374 saux1 << NumeZone << " " << x0 ;
375 saux += "ZoRaXCen " + saux1.str() + "\n" ;
377 { std::stringstream saux1 ;
378 saux1 << NumeZone << " " << x1 ;
379 saux += "ZoRaYCen " + saux1.str() + "\n" ;
381 { std::stringstream saux1 ;
382 saux1 << NumeZone << " " << x6 ;
383 saux2 = saux1.str() ;
384 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
385 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
387 if ( ZoneType == 61 )
388 { std::stringstream saux1 ;
389 saux1 << NumeZone << " " << x8 ;
390 saux += "ZoRaRayI " + saux1.str() + "\n" ;
393 else if ( ZoneType == 32 || ZoneType == 62 )
395 saux += "# Sphere\n" ;
396 { std::stringstream saux1 ;
397 saux1 << NumeZone << " " << x1 ;
398 saux += "ZoRaXCen " + saux1.str() + "\n" ;
400 { std::stringstream saux1 ;
401 saux1 << NumeZone << " " << x2 ;
402 saux += "ZoRaYCen " + saux1.str() + "\n" ;
404 { std::stringstream saux1 ;
405 saux1 << NumeZone << " " << x6 ;
406 saux2 = saux1.str() ;
407 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
408 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
410 if ( ZoneType == 62 )
411 { std::stringstream saux1 ;
412 saux1 << NumeZone << " " << x8 ;
413 saux += "ZoRaRayI " + saux1.str() + "\n" ;
416 else if ( ZoneType == 33 || ZoneType == 63 )
418 saux += "# Sphere\n" ;
419 { std::stringstream saux1 ;
420 saux1 << NumeZone << " " << x0 ;
421 saux += "ZoRaXCen " + saux1.str() + "\n" ;
423 { std::stringstream saux1 ;
424 saux1 << NumeZone << " " << x2 ;
425 saux += "ZoRaYCen " + saux1.str() + "\n" ;
427 { std::stringstream saux1 ;
428 saux1 << NumeZone << " " << x6 ;
429 saux2 = saux1.str() ;
430 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
431 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
433 if ( ZoneType == 63 )
434 { std::stringstream saux1 ;
435 saux1 << NumeZone << " " << x8 ;
436 saux += "ZoRaRayI " + saux1.str() + "\n" ;
442 else if ( ZoneType == 4 )
444 saux += "# Sphere\n" ;
445 { std::stringstream saux1 ;
446 saux1 << NumeZone << " " << x0 ;
447 saux += "ZoRaXCen " + saux1.str() + "\n" ;
449 { std::stringstream saux1 ;
450 saux1 << NumeZone << " " << x1 ;
451 saux += "ZoRaYCen " + saux1.str() + "\n" ;
453 { std::stringstream saux1 ;
454 saux1 << NumeZone << " " << x2 ;
455 saux += "ZoRaZCen " + saux1.str() + "\n" ;
457 { std::stringstream saux1 ;
458 saux1 << NumeZone << " " << x3 ;
459 saux += "ZoRaRayo " + saux1.str() + "\n" ;
463 // Cas du cylindre ou du tuyau
465 else if ( ZoneType == 5 || ZoneType == 7 )
467 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
468 else { saux += "# Tuyau\n" ; }
469 { std::stringstream saux1 ;
470 saux1 << NumeZone << " " << x0 ;
471 saux += "ZoRaXBas " + saux1.str() + "\n" ;
473 { std::stringstream saux1 ;
474 saux1 << NumeZone << " " << x1 ;
475 saux += "ZoRaYBas " + saux1.str() + "\n" ;
477 { std::stringstream saux1 ;
478 saux1 << NumeZone << " " << x2 ;
479 saux += "ZoRaZBas " + saux1.str() + "\n" ;
481 { std::stringstream saux1 ;
482 saux1 << NumeZone << " " << x3 ;
483 saux += "ZoRaXAxe " + saux1.str() + "\n" ;
485 { std::stringstream saux1 ;
486 saux1 << NumeZone << " " << x4 ;
487 saux += "ZoRaYAxe " + saux1.str() + "\n" ;
489 { std::stringstream saux1 ;
490 saux1 << NumeZone << " " << x5 ;
491 saux += "ZoRaZAxe " + saux1.str() + "\n" ;
493 { std::stringstream saux1 ;
494 saux1 << NumeZone << " " << x6 ;
495 saux2 = saux1.str() ;
496 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
497 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
499 { std::stringstream saux1 ;
500 saux1 << NumeZone << " " << x7 ;
501 saux += "ZoRaHaut " + saux1.str() + "\n" ;
504 { std::stringstream saux1 ;
505 saux1 << NumeZone << " " << x8 ;
506 saux += "ZoRaRayI " + saux1.str() + "\n" ;
510 _Texte += saux + "#\n" ;
512 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
514 //===============================================================================
515 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
516 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
517 int UsField, int UsCmpI )
519 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
520 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
522 std::string saux, saux2 ;
525 _Texte += "# Champ d'indicateurs\n" ;
526 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
527 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
529 // Cas ou on prend le dernier pas de temps
530 if ( TimeStep == -2 )
531 { _Texte += "CCNumPTI Last\n" ; }
532 // Cas avec pas de temps
533 else if ( TimeStep >= 0 )
536 std::stringstream saux1 ;
538 saux2 = saux1.str() ;
539 _Texte += "CCNumPTI " + saux2 + "\n" ;
543 std::stringstream saux1 ;
545 saux2 = saux1.str() ;
546 _Texte += "CCNumOrI " + saux2 + "\n" ;
561 std::stringstream saux1 ;
563 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
577 std::stringstream saux1 ;
579 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
584 { saux = "MAILLE" ; }
589 _Texte += "CCModeFI " + saux + "\n" ;
596 { saux = "INFINI" ; }
598 { saux = "RELATIF" ; }
601 _Texte += "CCUsCmpI " + saux + "\n" ;
604 //===============================================================================
605 void HomardDriver::TexteGroup( const std::string GroupName )
607 MESSAGE("TexteGroup, GroupName = "<<GroupName);
609 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
612 //===============================================================================
614 //===============================================================================
615 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
617 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
619 // Type de suivi de frontiere
621 std::stringstream saux1 ;
622 saux1 << BoundaryOption ;
623 std::string saux = saux1.str() ;
624 _Texte += "SuivFron " + saux + "\n" ;
627 //===============================================================================
628 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
630 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
631 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
633 _Texte += "#\n# Frontiere discrete\n" ;
634 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
635 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
638 //===============================================================================
639 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
641 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
643 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
646 //===============================================================================
647 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 )
649 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
650 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
651 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
652 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
654 std::string saux, saux2 ;
658 std::stringstream saux1 ;
659 saux1 << NumeBoundary ;
660 saux2 = saux1.str() ;
661 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
662 if ( BoundaryType == 1 )
663 { saux += "# Cylindre\n" ; }
664 if ( BoundaryType == 2 )
665 { saux += "# Sphere\n" ; }
666 if ( BoundaryType == 3 || BoundaryType == 4 )
667 { saux += "# Cone\n" ; }
668 if ( BoundaryType == 5 )
669 { saux += "# Tore\n" ; }
671 // Le nom de la frontiere
673 { std::stringstream saux1 ;
674 saux1 << NumeBoundary ;
675 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
680 { std::stringstream saux1 ;
681 saux1 << NumeBoundary << " " << BoundaryType ;
682 saux += "FAType " + saux1.str() + "\n" ;
687 if ( BoundaryType == 1 )
689 { std::stringstream saux1 ;
690 saux1 << NumeBoundary << " " << x0 ;
691 saux2 = saux1.str() ;
692 saux += "FAXCen " + saux1.str() + "\n" ;
694 { std::stringstream saux1 ;
695 saux1 << NumeBoundary << " " << x1 ;
696 saux += "FAYCen " + saux1.str() + "\n" ;
698 { std::stringstream saux1 ;
699 saux1 << NumeBoundary << " " << x2 ;
700 saux += "FAZCen " + saux1.str() + "\n" ;
702 { std::stringstream saux1 ;
703 saux1 << NumeBoundary << " " << x3 ;
704 saux += "FAXAxe " + saux1.str() + "\n" ;
706 { std::stringstream saux1 ;
707 saux1 << NumeBoundary << " " << x4 ;
708 saux += "FAYAxe " + saux1.str() + "\n" ;
710 { std::stringstream saux1 ;
711 saux1 << NumeBoundary << " " << x5 ;
712 saux += "FAZAxe " + saux1.str() + "\n" ;
714 { std::stringstream saux1 ;
715 saux1 << NumeBoundary << " " << x6 ;
716 saux += "FARayon " + saux1.str() + "\n" ;
722 else if ( BoundaryType == 2 )
724 { std::stringstream saux1 ;
725 saux1 << NumeBoundary << " " << x0 ;
726 saux += "FAXCen " + saux1.str() + "\n" ;
728 { std::stringstream saux1 ;
729 saux1 << NumeBoundary << " " << x1 ;
730 saux += "FAYCen " + saux1.str() + "\n" ;
732 { std::stringstream saux1 ;
733 saux1 << NumeBoundary << " " << x2 ;
734 saux += "FAZCen " + saux1.str() + "\n" ;
736 { std::stringstream saux1 ;
737 saux1 << NumeBoundary << " " << x3 ;
738 saux += "FARayon " + saux1.str() + "\n" ;
742 // Cas du cone defini par un axe et un angle
744 if ( BoundaryType == 3 )
746 { std::stringstream saux1 ;
747 saux1 << NumeBoundary << " " << x0 ;
748 saux += "FAXAxe " + saux1.str() + "\n" ;
750 { std::stringstream saux1 ;
751 saux1 << NumeBoundary << " " << x1 ;
752 saux += "FAYAxe " + saux1.str() + "\n" ;
754 { std::stringstream saux1 ;
755 saux1 << NumeBoundary << " " << x2 ;
756 saux += "FAZAxe " + saux1.str() + "\n" ;
758 { std::stringstream saux1 ;
759 saux1 << NumeBoundary << " " << x3 ;
760 saux += "FAAngle " + saux1.str() + "\n" ;
762 { std::stringstream saux1 ;
763 saux1 << NumeBoundary << " " << x4 ;
764 saux += "FAXCen " + saux1.str() + "\n" ;
766 { std::stringstream saux1 ;
767 saux1 << NumeBoundary << " " << x5 ;
768 saux += "FAYCen " + saux1.str() + "\n" ;
770 { std::stringstream saux1 ;
771 saux1 << NumeBoundary << " " << x6 ;
772 saux += "FAZCen " + saux1.str() + "\n" ;
776 // Cas du cone defini par les 2 rayons
778 if ( BoundaryType == 4 )
780 { std::stringstream saux1 ;
781 saux1 << NumeBoundary << " " << x0 ;
782 saux += "FAXCen " + saux1.str() + "\n" ;
784 { std::stringstream saux1 ;
785 saux1 << NumeBoundary << " " << x1 ;
786 saux += "FAYCen " + saux1.str() + "\n" ;
788 { std::stringstream saux1 ;
789 saux1 << NumeBoundary << " " << x2 ;
790 saux += "FAZCen " + saux1.str() + "\n" ;
792 { std::stringstream saux1 ;
793 saux1 << NumeBoundary << " " << x3 ;
794 saux += "FARayon " + saux1.str() + "\n" ;
796 { std::stringstream saux1 ;
797 saux1 << NumeBoundary << " " << x4 ;
798 saux += "FAXCen2 " + saux1.str() + "\n" ;
800 { std::stringstream saux1 ;
801 saux1 << NumeBoundary << " " << x5 ;
802 saux += "FAYCen2 " + saux1.str() + "\n" ;
804 { std::stringstream saux1 ;
805 saux1 << NumeBoundary << " " << x6 ;
806 saux += "FAZCen2 " + saux1.str() + "\n" ;
808 { std::stringstream saux1 ;
809 saux1 << NumeBoundary << " " << x7 ;
810 saux += "FARayon2 " + saux1.str() + "\n" ;
816 if ( BoundaryType == 5 )
818 { std::stringstream saux1 ;
819 saux1 << NumeBoundary << " " << x0 ;
820 saux2 = saux1.str() ;
821 saux += "FAXCen " + saux1.str() + "\n" ;
823 { std::stringstream saux1 ;
824 saux1 << NumeBoundary << " " << x1 ;
825 saux += "FAYCen " + saux1.str() + "\n" ;
827 { std::stringstream saux1 ;
828 saux1 << NumeBoundary << " " << x2 ;
829 saux += "FAZCen " + saux1.str() + "\n" ;
831 { std::stringstream saux1 ;
832 saux1 << NumeBoundary << " " << x3 ;
833 saux += "FAXAxe " + saux1.str() + "\n" ;
835 { std::stringstream saux1 ;
836 saux1 << NumeBoundary << " " << x4 ;
837 saux += "FAYAxe " + saux1.str() + "\n" ;
839 { std::stringstream saux1 ;
840 saux1 << NumeBoundary << " " << x5 ;
841 saux += "FAZAxe " + saux1.str() + "\n" ;
843 { std::stringstream saux1 ;
844 saux1 << NumeBoundary << " " << x6 ;
845 saux += "FARayon " + saux1.str() + "\n" ;
847 { std::stringstream saux1 ;
848 saux1 << NumeBoundary << " " << x7 ;
849 saux += "FARayon2 " + saux1.str() + "\n" ;
853 _Texte += saux + "#\n" ;
856 //===============================================================================
857 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
859 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
860 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
861 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
865 std::string saux, saux2 ;
866 std::stringstream saux1 ;
867 saux1 << NumeBoundary ;
868 saux2 = saux1.str() ;
869 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
871 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
872 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
874 _Texte += saux + "#\n" ;
877 //===============================================================================
878 // E. Les interpolations
879 //===============================================================================
880 // Les fichiers d'entree et de sortie des champs a interpoler
881 void HomardDriver::TexteFieldInterp( const std::string FieldFile, const std::string MeshFile )
883 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
885 _Texte += "#\n# Interpolations des champs\n" ;
888 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
890 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
892 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
894 //===============================================================================
895 // Tous les champs sont a interpoler
896 void HomardDriver::TexteFieldInterpAll( )
898 MESSAGE("TexteFieldInterpAll");
900 _Texte += "CCChaTou oui\n" ;
902 //===============================================================================
903 // Ecrit les caracteristiques de chaque interpolation sous la forme :
904 // CCChaNom 1 "DEPL" ! Nom du 1er champ a interpoler
905 // CCChaTIn 1 0 ! Mode d'interpolation : automatique
906 // CCChaNom 2 "VOLUME" ! Nom du 2nd champ a interpoler
907 // CCChaTIn 2 1 ! Mode d'interpolation : une variable extensive
908 // CCChaPdT 2 14 ! Pas de temps 14
909 // CCChaNuO 2 14 ! Numero d'ordre 14
912 // NumeChamp : numero d'ordre du champ a interpoler
913 // FieldName : nom du champ
914 // TypeInterp : type d'interpolation
915 // TimeStep : pas de temps retenu (>0 si pas de precision)
916 // Rank : numero d'ordre retenu
918 void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank)
920 MESSAGE("TexteFieldInterpNameType, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName<<", TypeInterp = "<<TypeInterp);
921 MESSAGE("TexteFieldInterpNameType, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
922 // Numero d'ordre du champ a interpoler
923 std::stringstream saux1 ;
925 std::string saux = saux1.str() ;
927 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
928 // Type d'interpolation pour le champ
929 _Texte +="CCChaTIn " + saux + " " + TypeInterp + "\n" ;
934 std::stringstream saux1 ;
936 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
939 std::stringstream saux1 ;
941 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
945 //===============================================================================
946 // F. Les options avancees
947 //===============================================================================
948 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
950 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
954 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
955 _Texte += "TypeElem ignore_pyra\n" ;
959 _Texte += "# Niveaux extremes\n" ;
960 { std::stringstream saux1 ;
962 _Texte += "NiveauMa " + saux1.str() + "\n" ;
967 _Texte += "# Diametre minimal\n" ;
968 { std::stringstream saux1 ;
970 _Texte += "DiametMi " + saux1.str() + "\n" ;
976 { _Texte += "# Raffinement" ; }
978 { _Texte += "# Deraffinement" ; }
979 _Texte += " des regions sans indicateur\n" ;
980 { std::stringstream saux1 ;
982 _Texte += "AdapInit " + saux1.str() + "\n" ;
985 if ( ExtraOutput % 2 == 0 )
987 _Texte += "# Sortie des niveaux de raffinement\n" ;
988 _Texte += "NCNiveau NIVEAU\n" ;
990 if ( ExtraOutput % 3 == 0 )
992 _Texte += "# Sortie des qualités des mailles\n" ;
993 _Texte += "NCQualit QUAL\n" ;
995 if ( ExtraOutput % 5 == 0 )
997 _Texte += "# Sortie des diamètres des mailles\n" ;
998 _Texte += "NCDiamet DIAM\n" ;
1000 if ( ExtraOutput % 7 == 0 )
1002 _Texte += "# Sortie des parents des mailles\n" ;
1003 _Texte += "NCParent PARENT\n" ;
1006 //===============================================================================
1008 //===============================================================================
1009 void HomardDriver::TexteInfoCompute( int MessInfo )
1011 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
1013 if ( MessInfo != 0 )
1015 _Texte += "# Messages d'informations\n" ;
1016 { std::stringstream saux1 ;
1018 _Texte += "MessInfo " + saux1.str() + "\n" ;
1022 //===============================================================================
1023 void HomardDriver::CreeFichier( )
1026 if ( _siter != _siterp1 )
1027 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
1029 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
1031 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
1032 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
1036 //===============================================================================
1037 // Creation du fichier de donnees pour l'information
1038 //===============================================================================
1039 void HomardDriver::CreeFichierDonn( )
1042 MESSAGE("CreeFichierDonn");
1043 _NomFichierDonn = "info.donn" ;
1049 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1050 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1054 //===============================================================================
1055 int HomardDriver::ExecuteHomard(int option)
1057 MESSAGE("ExecuteHomard, avec option = "<<option);
1058 std::string commande ;
1060 // Copie des Fichiers HOMARD
1061 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1062 codret = system(commande.c_str()) ;
1064 // Execution de HOMARD
1067 commande = _HOMARD_Exec.c_str() ;
1068 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1069 codret = system(commande.c_str());
1070 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1071 _NomFichierDonn = "" ;