1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2014 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<<", 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 = "RELATIF" ; }
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" ; }
660 if ( BoundaryType == 5 )
661 { saux += "# Tore\n" ; }
663 // Le nom de la frontiere
665 { std::stringstream saux1 ;
666 saux1 << NumeBoundary ;
667 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
672 { std::stringstream saux1 ;
673 saux1 << NumeBoundary << " " << BoundaryType ;
674 saux += "FAType " + saux1.str() + "\n" ;
679 if ( BoundaryType == 1 )
681 { std::stringstream saux1 ;
682 saux1 << NumeBoundary << " " << x0 ;
683 saux2 = saux1.str() ;
684 saux += "FAXCen " + saux1.str() + "\n" ;
686 { std::stringstream saux1 ;
687 saux1 << NumeBoundary << " " << x1 ;
688 saux += "FAYCen " + saux1.str() + "\n" ;
690 { std::stringstream saux1 ;
691 saux1 << NumeBoundary << " " << x2 ;
692 saux += "FAZCen " + saux1.str() + "\n" ;
694 { std::stringstream saux1 ;
695 saux1 << NumeBoundary << " " << x3 ;
696 saux += "FAXAxe " + saux1.str() + "\n" ;
698 { std::stringstream saux1 ;
699 saux1 << NumeBoundary << " " << x4 ;
700 saux += "FAYAxe " + saux1.str() + "\n" ;
702 { std::stringstream saux1 ;
703 saux1 << NumeBoundary << " " << x5 ;
704 saux += "FAZAxe " + saux1.str() + "\n" ;
706 { std::stringstream saux1 ;
707 saux1 << NumeBoundary << " " << x6 ;
708 saux += "FARayon " + saux1.str() + "\n" ;
714 else if ( BoundaryType == 2 )
716 { std::stringstream saux1 ;
717 saux1 << NumeBoundary << " " << x0 ;
718 saux += "FAXCen " + saux1.str() + "\n" ;
720 { std::stringstream saux1 ;
721 saux1 << NumeBoundary << " " << x1 ;
722 saux += "FAYCen " + saux1.str() + "\n" ;
724 { std::stringstream saux1 ;
725 saux1 << NumeBoundary << " " << x2 ;
726 saux += "FAZCen " + saux1.str() + "\n" ;
728 { std::stringstream saux1 ;
729 saux1 << NumeBoundary << " " << x3 ;
730 saux += "FARayon " + saux1.str() + "\n" ;
734 // Cas du cone defini par un axe et un angle
736 if ( BoundaryType == 3 )
738 { std::stringstream saux1 ;
739 saux1 << NumeBoundary << " " << x0 ;
740 saux += "FAXAxe " + saux1.str() + "\n" ;
742 { std::stringstream saux1 ;
743 saux1 << NumeBoundary << " " << x1 ;
744 saux += "FAYAxe " + saux1.str() + "\n" ;
746 { std::stringstream saux1 ;
747 saux1 << NumeBoundary << " " << x2 ;
748 saux += "FAZAxe " + saux1.str() + "\n" ;
750 { std::stringstream saux1 ;
751 saux1 << NumeBoundary << " " << x3 ;
752 saux += "FAAngle " + saux1.str() + "\n" ;
754 { std::stringstream saux1 ;
755 saux1 << NumeBoundary << " " << x4 ;
756 saux += "FAXCen " + saux1.str() + "\n" ;
758 { std::stringstream saux1 ;
759 saux1 << NumeBoundary << " " << x5 ;
760 saux += "FAYCen " + saux1.str() + "\n" ;
762 { std::stringstream saux1 ;
763 saux1 << NumeBoundary << " " << x6 ;
764 saux += "FAZCen " + saux1.str() + "\n" ;
768 // Cas du cone defini par les 2 rayons
770 if ( BoundaryType == 4 )
772 { std::stringstream saux1 ;
773 saux1 << NumeBoundary << " " << x0 ;
774 saux += "FAXCen " + saux1.str() + "\n" ;
776 { std::stringstream saux1 ;
777 saux1 << NumeBoundary << " " << x1 ;
778 saux += "FAYCen " + saux1.str() + "\n" ;
780 { std::stringstream saux1 ;
781 saux1 << NumeBoundary << " " << x2 ;
782 saux += "FAZCen " + saux1.str() + "\n" ;
784 { std::stringstream saux1 ;
785 saux1 << NumeBoundary << " " << x3 ;
786 saux += "FARayon " + saux1.str() + "\n" ;
788 { std::stringstream saux1 ;
789 saux1 << NumeBoundary << " " << x4 ;
790 saux += "FAXCen2 " + saux1.str() + "\n" ;
792 { std::stringstream saux1 ;
793 saux1 << NumeBoundary << " " << x5 ;
794 saux += "FAYCen2 " + saux1.str() + "\n" ;
796 { std::stringstream saux1 ;
797 saux1 << NumeBoundary << " " << x6 ;
798 saux += "FAZCen2 " + saux1.str() + "\n" ;
800 { std::stringstream saux1 ;
801 saux1 << NumeBoundary << " " << x7 ;
802 saux += "FARayon2 " + saux1.str() + "\n" ;
808 if ( BoundaryType == 5 )
810 { std::stringstream saux1 ;
811 saux1 << NumeBoundary << " " << x0 ;
812 saux2 = saux1.str() ;
813 saux += "FAXCen " + saux1.str() + "\n" ;
815 { std::stringstream saux1 ;
816 saux1 << NumeBoundary << " " << x1 ;
817 saux += "FAYCen " + saux1.str() + "\n" ;
819 { std::stringstream saux1 ;
820 saux1 << NumeBoundary << " " << x2 ;
821 saux += "FAZCen " + saux1.str() + "\n" ;
823 { std::stringstream saux1 ;
824 saux1 << NumeBoundary << " " << x3 ;
825 saux += "FAXAxe " + saux1.str() + "\n" ;
827 { std::stringstream saux1 ;
828 saux1 << NumeBoundary << " " << x4 ;
829 saux += "FAYAxe " + saux1.str() + "\n" ;
831 { std::stringstream saux1 ;
832 saux1 << NumeBoundary << " " << x5 ;
833 saux += "FAZAxe " + saux1.str() + "\n" ;
835 { std::stringstream saux1 ;
836 saux1 << NumeBoundary << " " << x6 ;
837 saux += "FARayon " + saux1.str() + "\n" ;
839 { std::stringstream saux1 ;
840 saux1 << NumeBoundary << " " << x7 ;
841 saux += "FARayon2 " + saux1.str() + "\n" ;
845 _Texte += saux + "#\n" ;
848 //===============================================================================
849 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
851 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
852 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
853 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
857 std::string saux, saux2 ;
858 std::stringstream saux1 ;
859 saux1 << NumeBoundary ;
860 saux2 = saux1.str() ;
861 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
863 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
864 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
866 _Texte += saux + "#\n" ;
869 //===============================================================================
870 // E. Les interpolations
871 //===============================================================================
872 // Les fichiers d'entree et de sortie des champs a interpoler
873 void HomardDriver::TexteFieldInterp( const std::string FieldFile, const std::string MeshFile )
875 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
877 _Texte += "#\n# Interpolations des champs\n" ;
880 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
882 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
884 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
886 //===============================================================================
887 // Tous les champs sont a interpoler
888 void HomardDriver::TexteFieldInterpAll( )
890 MESSAGE("TexteFieldInterpAll");
892 _Texte += "CCChaTou oui\n" ;
894 //===============================================================================
895 // Ecrit les caracteristiques de chaque interpolation sous la forme :
896 // CCChaNom 1 "DEPL" ! Nom du 1er champ a interpoler
897 // CCChaTIn 1 0 ! Mode d'interpolation : automatique
898 // CCChaNom 2 "VOLUME" ! Nom du 2nd champ a interpoler
899 // CCChaTIn 2 1 ! Mode d'interpolation : une variable extensive
900 // CCChaPdT 2 14 ! Pas de temps 14
901 // CCChaNuO 2 14 ! Numero d'ordre 14
904 // NumeChamp : numero d'ordre du champ a interpoler
905 // FieldName : nom du champ
906 // TypeInterp : type d'interpolation
907 // TimeStep : pas de temps retenu (>0 si pas de precision)
908 // Rank : numero d'ordre retenu
910 void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank)
912 MESSAGE("TexteFieldInterpNameType, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName<<", TypeInterp = "<<TypeInterp);
913 MESSAGE("TexteFieldInterpNameType, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
914 // Numero d'ordre du champ a interpoler
915 std::stringstream saux1 ;
917 std::string saux = saux1.str() ;
919 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
920 // Type d'interpolation pour le champ
921 _Texte +="CCChaTIn " + saux + " " + TypeInterp + "\n" ;
926 std::stringstream saux1 ;
928 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
931 std::stringstream saux1 ;
933 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
937 //===============================================================================
938 // F. Les options avancees
939 //===============================================================================
940 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput )
942 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", LevelOutput ="<<LevelOutput);
946 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
947 _Texte += "TypeElem ignore_pyra\n" ;
951 _Texte += "# Niveaux extremes\n" ;
952 { std::stringstream saux1 ;
954 _Texte += "NiveauMa " + saux1.str() + "\n" ;
959 _Texte += "# Diametre minimal\n" ;
960 { std::stringstream saux1 ;
962 _Texte += "DiametMi " + saux1.str() + "\n" ;
968 { _Texte += "# Raffinement" ; }
970 { _Texte += "# Deraffinement" ; }
971 _Texte += " des regions sans indicateur\n" ;
972 { std::stringstream saux1 ;
974 _Texte += "AdapInit " + saux1.str() + "\n" ;
977 if ( LevelOutput != 0 )
979 _Texte += "# Sortie des niveaux de raffinement\n" ;
980 _Texte += "NCNiveau NIVEAU\n" ;
983 //===============================================================================
985 //===============================================================================
986 void HomardDriver::TexteInfoCompute( int MessInfo )
988 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
992 _Texte += "# Messages d'informations\n" ;
993 { std::stringstream saux1 ;
995 _Texte += "MessInfo " + saux1.str() + "\n" ;
999 //===============================================================================
1000 void HomardDriver::CreeFichier( )
1003 if ( _siter != _siterp1 )
1004 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
1006 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
1008 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
1009 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
1013 //===============================================================================
1014 // Creation du fichier de donnees pour l'information
1015 //===============================================================================
1016 void HomardDriver::CreeFichierDonn( )
1019 MESSAGE("CreeFichierDonn");
1020 _NomFichierDonn = "info.donn" ;
1026 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1027 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1031 //===============================================================================
1032 int HomardDriver::ExecuteHomard(int option)
1034 MESSAGE("ExecuteHomard, avec option = "<<option);
1035 std::string commande ;
1037 // Copie des Fichiers HOMARD
1038 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1039 codret = system(commande.c_str()) ;
1041 // Execution de HOMARD
1044 commande = _HOMARD_Exec.c_str() ;
1045 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1046 codret = system(commande.c_str());
1047 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1048 _NomFichierDonn = "" ;