1 // HOMARD HOMARD : implementaion 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
26 #include "Utils_SALOME_Exception.hxx"
27 #include "utilities.h"
28 #include "HomardDriver.hxx"
30 //=============================================================================
31 //=============================================================================
32 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
33 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
34 _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ),
35 _Texte( "" ), _bLu( false )
37 // Memorisation du nom complet de l'executable HOMARD
38 char* dirchar; char* execchar;
40 std::string executable;
41 if ( !(dirchar = getenv("HOMARD_REP_EXE_PRIVATE")) )
42 { dirchar = getenv("HOMARD_REP_EXE") ; }
43 dir = std::string(dirchar);
44 MESSAGE("HomardDriver, dirchar ="<<dirchar<<", dir ="<<dir);
45 if ( !(execchar = getenv("HOMARD_EXE_PRIVATE")) )
46 { execchar = getenv("HOMARD_EXE"); }
47 executable = std::string(execchar);
48 MESSAGE("HomardDriver, execchar ="<<execchar<<", executable ="<<executable);
49 _HOMARD_Exec = dir + "/" + executable ;
50 MESSAGE("HomardDriver, _HOMARD_Exec ="<<_HOMARD_Exec);
56 //=============================================================================
57 //=============================================================================
58 HomardDriver::~HomardDriver()
62 //===============================================================================
63 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile )
65 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
67 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
68 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
69 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
72 //===============================================================================
73 void HomardDriver::TexteAdap( )
77 _Texte += "Action homa\n" ;
78 _Texte += "CCAssoci med\n" ;
79 _Texte += "ModeHOMA 1\n" ;
80 _Texte += "NumeIter " + _siter + "\n" ;
83 //===============================================================================
84 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
86 MESSAGE("TexteInit, TypeBila ="<<TypeBila);
88 _Texte += "ModeHOMA 2\n" ;
89 std::stringstream saux1 ;
91 std::string saux2 = saux1.str() ;
92 _Texte += "TypeBila " + saux2 + "\n" ;
95 _Texte += "NumeIter 0\n" ;
96 _Texte += "Action info_av\n" ;
97 _Texte += "CCAssoci med\n" ;
101 _Texte += "NumeIter " + _siter + "\n" ;
102 _Texte += "Action info_ap\n" ;
103 _Texte += "CCAssoci homard\n" ;
108 //===============================================================================
109 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
111 MESSAGE("TexteMaillage, NomMesh ="<<NomMesh<<", MeshFile ="<<MeshFile<<", apres ="<<apres);
114 if ( apres < 1 ) { saux = "__" ; }
116 _Texte += "# Maillages Med " + saux + "\n" ;
117 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
118 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
121 //===============================================================================
122 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
124 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
126 if ( apres < 1 ) { saux = "__" ; }
127 else { saux = "P1" ; }
129 _Texte += "# Maillage HOMARD " + liter + "\n" ;
130 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
133 //===============================================================================
134 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
136 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
137 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
139 // Type de conformite
151 saux = "non_conforme_1_noeud" ;
156 saux = "non_conforme_1_arete" ;
161 saux = "non_conforme_indicateur" ;
165 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
167 // Type de raffinement/deraffinement
169 if ( TypeAdap == -1 )
173 saux = "TypeRaff uniforme\n" ;
177 saux = "TypeRaff non\n" ;
181 saux += "TypeDera uniforme" ;
185 saux += "TypeDera non" ;
192 saux = "TypeRaff libre\n" ;
196 saux = "TypeRaff non\n" ;
200 saux += "TypeDera libre" ;
204 saux += "TypeDera non" ;
207 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
209 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
211 //===============================================================================
212 void HomardDriver::TexteCompo( int NumeComp, const std::string NompCompo)
214 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NompCompo = "<<NompCompo);
215 _Texte +="CCCoChaI \"" + NompCompo + "\"\n" ;
218 //===============================================================================
219 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 )
221 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
222 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
224 std::string saux, saux2 ;
227 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
228 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
229 // Attention a mettre le bon signe a ZoneTypeHOMARD :
230 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
231 // <0 signifie que l'on deraffinera
234 if ( ZoneType >= 11 and ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
235 else if ( ZoneType >= 31 and ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
236 else if ( ZoneType >= 61 and ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
237 else { ZoneTypeHOMARD = ZoneType ; }
239 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
241 std::stringstream saux1 ;
243 saux2 = saux1.str() ;
244 saux = "#\n# Zone numero " + saux2 + "\n" ;
246 { std::stringstream saux1 ;
247 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
248 saux2 = saux1.str() ;
249 saux += "ZoRaType " + saux2 + "\n" ;
254 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
255 // Y Homard <=> Y Salome
257 saux += "#Rectangle\n" ;
258 { std::stringstream saux1 ;
259 saux1 << NumeZone << " " << x0 ;
260 saux2 = saux1.str() ;
261 saux += "ZoRaXmin " + saux2 + "\n" ;
263 { std::stringstream saux1 ;
264 saux1 << NumeZone << " " << x1 ;
265 saux2 = saux1.str() ;
266 saux += "ZoRaXmax " + saux2 + "\n" ;
268 { std::stringstream saux1 ;
269 saux1 << NumeZone << " " << x2 ;
270 saux2 = saux1.str() ;
271 saux += "ZoRaYmin " + saux2 + "\n" ;
273 { std::stringstream saux1 ;
274 saux1 << NumeZone << " " << x3 ;
275 saux2 = saux1.str() ;
276 saux += "ZoRaYmax " + saux2 + "\n" ;
280 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
281 // Y Homard <=> Z Salome
283 saux += "#Rectangle\n" ;
284 { std::stringstream saux1 ;
285 saux1 << NumeZone << " " << x2 ;
286 saux2 = saux1.str() ;
287 saux += "ZoRaXmin " + saux2 + "\n" ;
289 { std::stringstream saux1 ;
290 saux1 << NumeZone << " " << x3 ;
291 saux2 = saux1.str() ;
292 saux += "ZoRaXmax " + saux2 + "\n" ;
294 { std::stringstream saux1 ;
295 saux1 << NumeZone << " " << x4 ;
296 saux2 = saux1.str() ;
297 saux += "ZoRaYmin " + saux2 + "\n" ;
299 { std::stringstream saux1 ;
300 saux1 << NumeZone << " " << x5 ;
301 saux2 = saux1.str() ;
302 saux += "ZoRaYmax " + saux2 + "\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 saux2 = saux1.str() ;
313 saux += "ZoRaXmin " + saux2 + "\n" ;
315 { std::stringstream saux1 ;
316 saux1 << NumeZone << " " << x1 ;
317 saux2 = saux1.str() ;
318 saux += "ZoRaXmax " + saux2 + "\n" ;
320 { std::stringstream saux1 ;
321 saux1 << NumeZone << " " << x4 ;
322 saux2 = saux1.str() ;
323 saux += "ZoRaYmin " + saux2 + "\n" ;
325 { std::stringstream saux1 ;
326 saux1 << NumeZone << " " << x5 ;
327 saux2 = saux1.str() ;
328 saux += "ZoRaYmax " + saux2 + "\n" ;
332 // Cas du parallelepipede
334 else if ( ZoneType == 2 )
336 saux += "# Boite\n" ;
337 { std::stringstream saux1 ;
338 saux1 << NumeZone << " " << x0 ;
339 saux2 = saux1.str() ;
340 saux += "ZoRaXmin " + saux2 + "\n" ;
342 { std::stringstream saux1 ;
343 saux1 << NumeZone << " " << x1 ;
344 saux2 = saux1.str() ;
345 saux += "ZoRaXmax " + saux2 + "\n" ;
347 { std::stringstream saux1 ;
348 saux1 << NumeZone << " " << x2 ;
349 saux2 = saux1.str() ;
350 saux += "ZoRaYmin " + saux2 + "\n" ;
352 { std::stringstream saux1 ;
353 saux1 << NumeZone << " " << x3 ;
354 saux2 = saux1.str() ;
355 saux += "ZoRaYmax " + saux2 + "\n" ;
357 { std::stringstream saux1 ;
358 saux1 << NumeZone << " " << x4 ;
359 saux2 = saux1.str() ;
360 saux += "ZoRaZmin " + saux2 + "\n" ;
362 { std::stringstream saux1 ;
363 saux1 << NumeZone << " " << x5 ;
364 saux2 = saux1.str() ;
365 saux += "ZoRaZmax " + saux2 + "\n" ;
371 else if ( ZoneType == 31 or ZoneType == 61 )
373 saux += "# Sphere\n" ;
374 { std::stringstream saux1 ;
375 saux1 << NumeZone << " " << x0 ;
376 saux2 = saux1.str() ;
377 saux += "ZoRaXCen " + saux2 + "\n" ;
379 { std::stringstream saux1 ;
380 saux1 << NumeZone << " " << x1 ;
381 saux2 = saux1.str() ;
382 saux += "ZoRaYCen " + saux2 + "\n" ;
384 { std::stringstream saux1 ;
385 saux1 << NumeZone << " " << x6 ;
386 saux2 = saux1.str() ;
387 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
388 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
390 if ( ZoneType == 61 )
391 { std::stringstream saux1 ;
392 saux1 << NumeZone << " " << x8 ;
393 saux2 = saux1.str() ;
394 saux += "ZoRaRayI " + saux2 + "\n" ;
397 else if ( ZoneType == 32 or ZoneType == 62 )
399 saux += "# Sphere\n" ;
400 { std::stringstream saux1 ;
401 saux1 << NumeZone << " " << x1 ;
402 saux2 = saux1.str() ;
403 saux += "ZoRaXCen " + saux2 + "\n" ;
405 { std::stringstream saux1 ;
406 saux1 << NumeZone << " " << x2 ;
407 saux2 = saux1.str() ;
408 saux += "ZoRaYCen " + saux2 + "\n" ;
410 { std::stringstream saux1 ;
411 saux1 << NumeZone << " " << x6 ;
412 saux2 = saux1.str() ;
413 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
414 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
416 if ( ZoneType == 62 )
417 { std::stringstream saux1 ;
418 saux1 << NumeZone << " " << x8 ;
419 saux2 = saux1.str() ;
420 saux += "ZoRaRayI " + saux2 + "\n" ;
423 else if ( ZoneType == 33 or ZoneType == 63 )
425 saux += "# Sphere\n" ;
426 { std::stringstream saux1 ;
427 saux1 << NumeZone << " " << x0 ;
428 saux2 = saux1.str() ;
429 saux += "ZoRaXCen " + saux2 + "\n" ;
431 { std::stringstream saux1 ;
432 saux1 << NumeZone << " " << x2 ;
433 saux2 = saux1.str() ;
434 saux += "ZoRaYCen " + saux2 + "\n" ;
436 { std::stringstream saux1 ;
437 saux1 << NumeZone << " " << x6 ;
438 saux2 = saux1.str() ;
439 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
440 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
442 if ( ZoneType == 63 )
443 { std::stringstream saux1 ;
444 saux1 << NumeZone << " " << x8 ;
445 saux2 = saux1.str() ;
446 saux += "ZoRaRayI " + saux2 + "\n" ;
452 else if ( ZoneType == 4 )
454 saux += "# Sphere\n" ;
455 { std::stringstream saux1 ;
456 saux1 << NumeZone << " " << x0 ;
457 saux2 = saux1.str() ;
458 saux += "ZoRaXCen " + saux2 + "\n" ;
460 { std::stringstream saux1 ;
461 saux1 << NumeZone << " " << x1 ;
462 saux2 = saux1.str() ;
463 saux += "ZoRaYCen " + saux2 + "\n" ;
465 { std::stringstream saux1 ;
466 saux1 << NumeZone << " " << x2 ;
467 saux2 = saux1.str() ;
468 saux += "ZoRaZCen " + saux2 + "\n" ;
470 { std::stringstream saux1 ;
471 saux1 << NumeZone << " " << x3 ;
472 saux2 = saux1.str() ;
473 saux += "ZoRaRayo " + saux2 + "\n" ;
477 // Cas du cylindre ou du tuyau
479 else if ( ZoneType == 5 or ZoneType == 7 )
481 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
482 else { saux += "# Tuyau\n" ; }
483 { std::stringstream saux1 ;
484 saux1 << NumeZone << " " << x0 ;
485 saux2 = saux1.str() ;
486 saux += "ZoRaXBas " + saux2 + "\n" ;
488 { std::stringstream saux1 ;
489 saux1 << NumeZone << " " << x1 ;
490 saux2 = saux1.str() ;
491 saux += "ZoRaYBas " + saux2 + "\n" ;
493 { std::stringstream saux1 ;
494 saux1 << NumeZone << " " << x2 ;
495 saux2 = saux1.str() ;
496 saux += "ZoRaZBas " + saux2 + "\n" ;
498 { std::stringstream saux1 ;
499 saux1 << NumeZone << " " << x3 ;
500 saux2 = saux1.str() ;
501 saux += "ZoRaXAxe " + saux2 + "\n" ;
503 { std::stringstream saux1 ;
504 saux1 << NumeZone << " " << x4 ;
505 saux2 = saux1.str() ;
506 saux += "ZoRaYAxe " + saux2 + "\n" ;
508 { std::stringstream saux1 ;
509 saux1 << NumeZone << " " << x5 ;
510 saux2 = saux1.str() ;
511 saux += "ZoRaZAxe " + saux2 + "\n" ;
513 { std::stringstream saux1 ;
514 saux1 << NumeZone << " " << x6 ;
515 saux2 = saux1.str() ;
516 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
517 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
519 { std::stringstream saux1 ;
520 saux1 << NumeZone << " " << x7 ;
521 saux2 = saux1.str() ;
522 saux += "ZoRaHaut " + saux2 + "\n" ;
525 { std::stringstream saux1 ;
526 saux1 << NumeZone << " " << x8 ;
527 saux2 = saux1.str() ;
528 saux += "ZoRaRayI " + saux2 + "\n" ;
532 _Texte += saux + "#\n" ;
534 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
537 //===============================================================================
538 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
539 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
540 int UsField, int UsCmpI )
542 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
543 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
545 std::string saux, saux2 ;
548 _Texte += "# Champ d'indicateurs\n" ;
549 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
550 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
552 // Cas ou on prend le dernier pas de temps
553 if ( TimeStep == -2 )
554 { _Texte += "CCNumPTI Last\n" ; }
555 // Cas avec pas de temps
556 else if ( TimeStep >= 0 )
559 std::stringstream saux1 ;
561 saux2 = saux1.str() ;
562 _Texte += "CCNumPTI " + saux2 + "\n" ;
565 std::stringstream saux1 ;
567 saux2 = saux1.str() ;
568 _Texte += "CCNumOrI " + saux2 + "\n" ;
583 std::stringstream saux1 ;
585 saux2 = saux1.str() ;
586 _Texte += "Seuil" + saux + " " + saux2 + "\n" ;
600 std::stringstream saux1 ;
602 saux2 = saux1.str() ;
603 _Texte += "Seuil" + saux + " " + saux2 + "\n" ;
608 { saux = "MAILLE" ; }
613 _Texte += "CCModeFI " + saux + "\n" ;
620 { saux = "INFINI" ; }
622 { saux = "V_RELATIVE" ; }
625 _Texte += "CCUsCmpI " + saux + "\n" ;
629 //===============================================================================
630 void HomardDriver::TexteGroup( const std::string GroupName )
632 MESSAGE("TexteGroup, GroupName = "<<GroupName);
634 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
637 //===============================================================================
638 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
640 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
642 // Type de suivi de frontiere
644 std::stringstream saux1 ;
645 saux1 << BoundaryOption ;
646 std::string saux = saux1.str() ;
647 _Texte += "SuivFron " + saux + "\n" ;
650 //===============================================================================
651 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
653 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
654 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
656 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
657 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
660 //===============================================================================
661 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
663 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
665 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
668 //===============================================================================
669 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 )
671 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
672 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
673 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
674 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
676 std::string saux, saux2 ;
680 std::stringstream saux1 ;
681 saux1 << NumeBoundary ;
682 saux2 = saux1.str() ;
683 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
684 if ( BoundaryType == 1 )
685 { saux += "# Cylindre\n" ; }
686 if ( BoundaryType == 2 )
687 { saux += "# Sphere\n" ; }
688 if ( BoundaryType == 3 or BoundaryType == 4 )
689 { saux += "# Cone\n" ; }
691 // Le nom de la frontiere
693 { std::stringstream saux1 ;
694 saux1 << NumeBoundary ;
695 saux2 = saux1.str() ;
696 saux += "FANom " + saux2 + " \"" + NameBoundary + "\"\n" ;
701 { std::stringstream saux1 ;
702 saux1 << NumeBoundary << " " << BoundaryType ;
703 saux2 = saux1.str() ;
704 saux += "FAType " + saux2 + "\n" ;
709 if ( BoundaryType == 1 )
711 { std::stringstream saux1 ;
712 saux1 << NumeBoundary << " " << x0 ;
713 saux2 = saux1.str() ;
714 saux += "FAXCen " + saux2 + "\n" ;
716 { std::stringstream saux1 ;
717 saux1 << NumeBoundary << " " << x1 ;
718 saux2 = saux1.str() ;
719 saux += "FAYCen " + saux2 + "\n" ;
721 { std::stringstream saux1 ;
722 saux1 << NumeBoundary << " " << x2 ;
723 saux2 = saux1.str() ;
724 saux += "FAZCen " + saux2 + "\n" ;
726 { std::stringstream saux1 ;
727 saux1 << NumeBoundary << " " << x3 ;
728 saux2 = saux1.str() ;
729 saux += "FAXAxe " + saux2 + "\n" ;
731 { std::stringstream saux1 ;
732 saux1 << NumeBoundary << " " << x4 ;
733 saux2 = saux1.str() ;
734 saux += "FAYAxe " + saux2 + "\n" ;
736 { std::stringstream saux1 ;
737 saux1 << NumeBoundary << " " << x5 ;
738 saux2 = saux1.str() ;
739 saux += "FAZAxe " + saux2 + "\n" ;
741 { std::stringstream saux1 ;
742 saux1 << NumeBoundary << " " << x6 ;
743 saux2 = saux1.str() ;
744 saux += "FARayon " + saux2 + "\n" ;
750 else if ( BoundaryType == 2 )
752 { std::stringstream saux1 ;
753 saux1 << NumeBoundary << " " << x0 ;
754 saux2 = saux1.str() ;
755 saux += "FAXCen " + saux2 + "\n" ;
757 { std::stringstream saux1 ;
758 saux1 << NumeBoundary << " " << x1 ;
759 saux2 = saux1.str() ;
760 saux += "FAYCen " + saux2 + "\n" ;
762 { std::stringstream saux1 ;
763 saux1 << NumeBoundary << " " << x2 ;
764 saux2 = saux1.str() ;
765 saux += "FAZCen " + saux2 + "\n" ;
767 { std::stringstream saux1 ;
768 saux1 << NumeBoundary << " " << x3 ;
769 saux2 = saux1.str() ;
770 saux += "FARayon " + saux2 + "\n" ;
774 // Cas du cone defini par un axe et un angle
776 if ( BoundaryType == 3 )
778 { std::stringstream saux1 ;
779 saux1 << NumeBoundary << " " << x0 ;
780 saux2 = saux1.str() ;
781 saux += "FAXAxe " + saux2 + "\n" ;
783 { std::stringstream saux1 ;
784 saux1 << NumeBoundary << " " << x1 ;
785 saux2 = saux1.str() ;
786 saux += "FAYAxe " + saux2 + "\n" ;
788 { std::stringstream saux1 ;
789 saux1 << NumeBoundary << " " << x2 ;
790 saux2 = saux1.str() ;
791 saux += "FAZAxe " + saux2 + "\n" ;
793 { std::stringstream saux1 ;
794 saux1 << NumeBoundary << " " << x3 ;
795 saux2 = saux1.str() ;
796 saux += "FAAngle " + saux2 + "\n" ;
798 { std::stringstream saux1 ;
799 saux1 << NumeBoundary << " " << x4 ;
800 saux2 = saux1.str() ;
801 saux += "FAXCen " + saux2 + "\n" ;
803 { std::stringstream saux1 ;
804 saux1 << NumeBoundary << " " << x5 ;
805 saux2 = saux1.str() ;
806 saux += "FAYCen " + saux2 + "\n" ;
808 { std::stringstream saux1 ;
809 saux1 << NumeBoundary << " " << x6 ;
810 saux2 = saux1.str() ;
811 saux += "FAZCen " + saux2 + "\n" ;
815 // Cas du cone defini par les 2 rayons
817 if ( BoundaryType == 4 )
819 { std::stringstream saux1 ;
820 saux1 << NumeBoundary << " " << x0 ;
821 saux2 = saux1.str() ;
822 saux += "FAXCen " + saux2 + "\n" ;
824 { std::stringstream saux1 ;
825 saux1 << NumeBoundary << " " << x1 ;
826 saux2 = saux1.str() ;
827 saux += "FAYCen " + saux2 + "\n" ;
829 { std::stringstream saux1 ;
830 saux1 << NumeBoundary << " " << x2 ;
831 saux2 = saux1.str() ;
832 saux += "FAZCen " + saux2 + "\n" ;
834 { std::stringstream saux1 ;
835 saux1 << NumeBoundary << " " << x3 ;
836 saux2 = saux1.str() ;
837 saux += "FARayon " + saux2 + "\n" ;
839 { std::stringstream saux1 ;
840 saux1 << NumeBoundary << " " << x4 ;
841 saux2 = saux1.str() ;
842 saux += "FAXCen2" + saux2 + "\n" ;
844 { std::stringstream saux1 ;
845 saux1 << NumeBoundary << " " << x5 ;
846 saux2 = saux1.str() ;
847 saux += "FAYCen2" + saux2 + "\n" ;
849 { std::stringstream saux1 ;
850 saux1 << NumeBoundary << " " << x6 ;
851 saux2 = saux1.str() ;
852 saux += "FAZCen2" + saux2 + "\n" ;
854 { std::stringstream saux1 ;
855 saux1 << NumeBoundary << " " << x7 ;
856 saux2 = saux1.str() ;
857 saux += "FARayon2" + saux2 + "\n" ;
861 _Texte += saux + "#\n" ;
864 //===============================================================================
865 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
867 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
868 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
869 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
873 std::string saux, saux2 ;
874 std::stringstream saux1 ;
875 saux1 << NumeBoundary ;
876 saux2 = saux1.str() ;
877 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
879 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
880 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
882 _Texte += saux + "#\n" ;
885 //===============================================================================
886 void HomardDriver::TexteFieldInterp( int TypeFieldInterp, const std::string FieldFile, const std::string MeshFile, int TimeStep, int Rank )
888 MESSAGE("TexteFieldInterp, TypeFieldInterp = "<<TypeFieldInterp);
889 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
890 MESSAGE("TexteFieldInterp, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
892 // Type d'interpolation
894 _Texte += "# Interpolations des champs\n" ;
895 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
896 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
897 if ( TypeFieldInterp == 1 )
899 _Texte += "CCChaTou oui\n" ;
902 _TimeStep = TimeStep ;
905 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
907 //===============================================================================
908 void HomardDriver::TexteFieldInterpName( int NumeChamp, const std::string FieldName)
910 MESSAGE("TexteFieldInterpName, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName);
911 std::stringstream saux1 ;
912 saux1 << NumeChamp+1 ;
913 std::string saux = saux1.str() ;
914 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
916 MESSAGE("TexteFieldInterpName, _TimeStep = "<<_TimeStep<<", _Rank = "<<_Rank);
917 if ( _TimeStep >= 0 )
920 std::stringstream saux1 ;
922 std::string saux2 = saux1.str() ;
923 _Texte += "CCChaPdT " + saux + " " + saux2 + "\n" ;
926 std::stringstream saux1 ;
928 std::string saux2 = saux1.str() ;
929 _Texte += "CCChaNuO " + saux + " " + saux2 + "\n" ;
933 //===============================================================================
934 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput )
936 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", LevelOutput ="<<LevelOutput);
941 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
942 _Texte += "TypeElem ignore_pyra\n" ;
946 _Texte += "# Niveaux extremes\n" ;
947 { std::stringstream saux1 ;
949 std::string saux2 = saux1.str() ;
950 _Texte += "NiveauMa " + saux2 + "\n" ;
955 _Texte += "# Diametre minimal\n" ;
956 { std::stringstream saux1 ;
958 std::string saux2 = saux1.str() ;
959 _Texte += "DiametMi " + saux2 + "\n" ;
965 { _Texte += "# Raffinement" ; }
967 { _Texte += "# Deraffinement" ; }
968 _Texte += " des regions sans indicateur\n" ;
969 { std::stringstream saux1 ;
971 std::string saux2 = saux1.str() ;
972 _Texte += "AdapInit " + saux2 + "\n" ;
975 if ( LevelOutput != 0 )
977 _Texte += "# Sortie des niveaux de raffinement\n" ;
978 _Texte += "NCNiveau NIVEAU\n" ;
982 //===============================================================================
983 void HomardDriver::CreeFichier( )
986 if ( _siter != _siterp1 )
987 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
989 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
991 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
992 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
997 //===============================================================================
998 // Creation du fichier de donnees pour l'information
999 //===============================================================================
1000 void HomardDriver::CreeFichierDonn( )
1003 MESSAGE("CreeFichierDonn");
1004 _NomFichierDonn = "info.donn" ;
1010 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1011 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1016 //===============================================================================
1017 int HomardDriver::ExecuteHomard(int option)
1019 MESSAGE("ExecuteHomard, avec option = "<<option);
1020 std::string commande ;
1022 // Copie des Fichiers HOMARD
1023 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1024 codret = system(commande.c_str()) ;
1026 // Execution de HOMARD
1029 commande = _HOMARD_Exec.c_str() ;
1030 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1031 codret = system(commande.c_str());
1032 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1033 _NomFichierDonn = "" ;