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
24 // #include <string.h>
28 #include "Utils_SALOME_Exception.hxx"
29 #include "utilities.h"
30 #include "HomardDriver.hxx"
32 //=============================================================================
33 //=============================================================================
34 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
35 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
36 _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ),
37 _Texte( "" ), _bLu( false )
39 // Memorisation du nom complet de l'executable HOMARD
40 char* dirchar; char* execchar;
42 std::string executable;
43 if ( !(dirchar = getenv("HOMARD_REP_EXE_PRIVATE")) )
44 { dirchar = getenv("HOMARD_REP_EXE") ; }
45 dir = std::string(dirchar);
46 MESSAGE("HomardDriver, dirchar ="<<dirchar<<", dir ="<<dir);
47 if ( !(execchar = getenv("HOMARD_EXE_PRIVATE")) )
48 { execchar = getenv("HOMARD_EXE"); }
49 executable = std::string(execchar);
50 MESSAGE("HomardDriver, execchar ="<<execchar<<", executable ="<<executable);
51 _HOMARD_Exec = dir + "/" + executable ;
52 MESSAGE("HomardDriver, _HOMARD_Exec ="<<_HOMARD_Exec);
58 //=============================================================================
59 //=============================================================================
60 HomardDriver::~HomardDriver()
63 //===============================================================================
64 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
66 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
68 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
69 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
70 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
71 _Texte += "Langue \"" + Langue + "\"\n" ;
74 //===============================================================================
75 void HomardDriver::TexteAdap( )
79 _Texte += "Action homa\n" ;
80 _Texte += "CCAssoci med\n" ;
81 _Texte += "ModeHOMA 1\n" ;
82 _Texte += "NumeIter " + _siter + "\n" ;
85 //===============================================================================
86 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
88 MESSAGE("TexteInit, TypeBila ="<<TypeBila);
90 _Texte += "ModeHOMA 2\n" ;
91 std::stringstream saux1 ;
93 std::string saux2 = saux1.str() ;
94 _Texte += "TypeBila " + saux2 + "\n" ;
97 _Texte += "NumeIter 0\n" ;
98 _Texte += "Action info_av\n" ;
99 _Texte += "CCAssoci med\n" ;
103 _Texte += "NumeIter " + _siter + "\n" ;
104 _Texte += "Action info_ap\n" ;
105 _Texte += "CCAssoci homard\n" ;
110 //===============================================================================
111 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
113 MESSAGE("TexteMaillage, NomMesh ="<<NomMesh<<", MeshFile ="<<MeshFile<<", apres ="<<apres);
116 if ( apres < 1 ) { saux = "__" ; }
118 _Texte += "# Maillages Med " + saux + "\n" ;
119 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
120 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
123 //===============================================================================
124 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
126 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
128 if ( apres < 1 ) { saux = "__" ; }
129 else { saux = "P1" ; }
131 _Texte += "# Maillage HOMARD " + liter + "\n" ;
132 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
135 //===============================================================================
136 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
138 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
139 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
141 // Type de conformite
153 saux = "non_conforme_1_noeud" ;
158 saux = "non_conforme_1_arete" ;
163 saux = "non_conforme_indicateur" ;
167 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
169 // Type de raffinement/deraffinement
171 if ( TypeAdap == -1 )
175 saux = "TypeRaff uniforme\n" ;
179 saux = "TypeRaff non\n" ;
183 saux += "TypeDera uniforme" ;
187 saux += "TypeDera non" ;
194 saux = "TypeRaff libre\n" ;
198 saux = "TypeRaff non\n" ;
202 saux += "TypeDera libre" ;
206 saux += "TypeDera non" ;
209 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
211 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
213 //===============================================================================
214 void HomardDriver::TexteCompo( int NumeComp, const std::string NompCompo)
216 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NompCompo = "<<NompCompo);
217 _Texte +="CCCoChaI \"" + NompCompo + "\"\n" ;
219 //===============================================================================
220 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 )
222 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
223 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
225 std::string saux, saux2 ;
228 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
229 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
230 // Attention a mettre le bon signe a ZoneTypeHOMARD :
231 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
232 // <0 signifie que l'on deraffinera
235 if ( ZoneType >= 11 and ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
236 else if ( ZoneType >= 31 and ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
237 else if ( ZoneType >= 61 and ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
238 else { ZoneTypeHOMARD = ZoneType ; }
240 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
242 std::stringstream saux1 ;
244 saux2 = saux1.str() ;
245 saux = "#\n# Zone numero " + saux2 + "\n" ;
247 { std::stringstream saux1 ;
248 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
249 saux2 = saux1.str() ;
250 saux += "ZoRaType " + saux2 + "\n" ;
255 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
256 // Y Homard <=> Y Salome
258 saux += "#Rectangle\n" ;
259 { std::stringstream saux1 ;
260 saux1 << NumeZone << " " << x0 ;
261 saux2 = saux1.str() ;
262 saux += "ZoRaXmin " + saux2 + "\n" ;
264 { std::stringstream saux1 ;
265 saux1 << NumeZone << " " << x1 ;
266 saux2 = saux1.str() ;
267 saux += "ZoRaXmax " + saux2 + "\n" ;
269 { std::stringstream saux1 ;
270 saux1 << NumeZone << " " << x2 ;
271 saux2 = saux1.str() ;
272 saux += "ZoRaYmin " + saux2 + "\n" ;
274 { std::stringstream saux1 ;
275 saux1 << NumeZone << " " << x3 ;
276 saux2 = saux1.str() ;
277 saux += "ZoRaYmax " + saux2 + "\n" ;
281 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
282 // Y Homard <=> Z Salome
284 saux += "#Rectangle\n" ;
285 { std::stringstream saux1 ;
286 saux1 << NumeZone << " " << x2 ;
287 saux2 = saux1.str() ;
288 saux += "ZoRaXmin " + saux2 + "\n" ;
290 { std::stringstream saux1 ;
291 saux1 << NumeZone << " " << x3 ;
292 saux2 = saux1.str() ;
293 saux += "ZoRaXmax " + saux2 + "\n" ;
295 { std::stringstream saux1 ;
296 saux1 << NumeZone << " " << x4 ;
297 saux2 = saux1.str() ;
298 saux += "ZoRaYmin " + saux2 + "\n" ;
300 { std::stringstream saux1 ;
301 saux1 << NumeZone << " " << x5 ;
302 saux2 = saux1.str() ;
303 saux += "ZoRaYmax " + saux2 + "\n" ;
307 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
308 // Y Homard <=> Z Salome
310 saux += "#Rectangle\n" ;
311 { std::stringstream saux1 ;
312 saux1 << NumeZone << " " << x0 ;
313 saux2 = saux1.str() ;
314 saux += "ZoRaXmin " + saux2 + "\n" ;
316 { std::stringstream saux1 ;
317 saux1 << NumeZone << " " << x1 ;
318 saux2 = saux1.str() ;
319 saux += "ZoRaXmax " + saux2 + "\n" ;
321 { std::stringstream saux1 ;
322 saux1 << NumeZone << " " << x4 ;
323 saux2 = saux1.str() ;
324 saux += "ZoRaYmin " + saux2 + "\n" ;
326 { std::stringstream saux1 ;
327 saux1 << NumeZone << " " << x5 ;
328 saux2 = saux1.str() ;
329 saux += "ZoRaYmax " + saux2 + "\n" ;
333 // Cas du parallelepipede
335 else if ( ZoneType == 2 )
337 saux += "# Boite\n" ;
338 { std::stringstream saux1 ;
339 saux1 << NumeZone << " " << x0 ;
340 saux2 = saux1.str() ;
341 saux += "ZoRaXmin " + saux2 + "\n" ;
343 { std::stringstream saux1 ;
344 saux1 << NumeZone << " " << x1 ;
345 saux2 = saux1.str() ;
346 saux += "ZoRaXmax " + saux2 + "\n" ;
348 { std::stringstream saux1 ;
349 saux1 << NumeZone << " " << x2 ;
350 saux2 = saux1.str() ;
351 saux += "ZoRaYmin " + saux2 + "\n" ;
353 { std::stringstream saux1 ;
354 saux1 << NumeZone << " " << x3 ;
355 saux2 = saux1.str() ;
356 saux += "ZoRaYmax " + saux2 + "\n" ;
358 { std::stringstream saux1 ;
359 saux1 << NumeZone << " " << x4 ;
360 saux2 = saux1.str() ;
361 saux += "ZoRaZmin " + saux2 + "\n" ;
363 { std::stringstream saux1 ;
364 saux1 << NumeZone << " " << x5 ;
365 saux2 = saux1.str() ;
366 saux += "ZoRaZmax " + saux2 + "\n" ;
372 else if ( ZoneType == 31 or ZoneType == 61 )
374 saux += "# Sphere\n" ;
375 { std::stringstream saux1 ;
376 saux1 << NumeZone << " " << x0 ;
377 saux2 = saux1.str() ;
378 saux += "ZoRaXCen " + saux2 + "\n" ;
380 { std::stringstream saux1 ;
381 saux1 << NumeZone << " " << x1 ;
382 saux2 = saux1.str() ;
383 saux += "ZoRaYCen " + saux2 + "\n" ;
385 { std::stringstream saux1 ;
386 saux1 << NumeZone << " " << x6 ;
387 saux2 = saux1.str() ;
388 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
389 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
391 if ( ZoneType == 61 )
392 { std::stringstream saux1 ;
393 saux1 << NumeZone << " " << x8 ;
394 saux2 = saux1.str() ;
395 saux += "ZoRaRayI " + saux2 + "\n" ;
398 else if ( ZoneType == 32 or ZoneType == 62 )
400 saux += "# Sphere\n" ;
401 { std::stringstream saux1 ;
402 saux1 << NumeZone << " " << x1 ;
403 saux2 = saux1.str() ;
404 saux += "ZoRaXCen " + saux2 + "\n" ;
406 { std::stringstream saux1 ;
407 saux1 << NumeZone << " " << x2 ;
408 saux2 = saux1.str() ;
409 saux += "ZoRaYCen " + saux2 + "\n" ;
411 { std::stringstream saux1 ;
412 saux1 << NumeZone << " " << x6 ;
413 saux2 = saux1.str() ;
414 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
415 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
417 if ( ZoneType == 62 )
418 { std::stringstream saux1 ;
419 saux1 << NumeZone << " " << x8 ;
420 saux2 = saux1.str() ;
421 saux += "ZoRaRayI " + saux2 + "\n" ;
424 else if ( ZoneType == 33 or ZoneType == 63 )
426 saux += "# Sphere\n" ;
427 { std::stringstream saux1 ;
428 saux1 << NumeZone << " " << x0 ;
429 saux2 = saux1.str() ;
430 saux += "ZoRaXCen " + saux2 + "\n" ;
432 { std::stringstream saux1 ;
433 saux1 << NumeZone << " " << x2 ;
434 saux2 = saux1.str() ;
435 saux += "ZoRaYCen " + saux2 + "\n" ;
437 { std::stringstream saux1 ;
438 saux1 << NumeZone << " " << x6 ;
439 saux2 = saux1.str() ;
440 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
441 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
443 if ( ZoneType == 63 )
444 { std::stringstream saux1 ;
445 saux1 << NumeZone << " " << x8 ;
446 saux2 = saux1.str() ;
447 saux += "ZoRaRayI " + saux2 + "\n" ;
453 else if ( ZoneType == 4 )
455 saux += "# Sphere\n" ;
456 { std::stringstream saux1 ;
457 saux1 << NumeZone << " " << x0 ;
458 saux2 = saux1.str() ;
459 saux += "ZoRaXCen " + saux2 + "\n" ;
461 { std::stringstream saux1 ;
462 saux1 << NumeZone << " " << x1 ;
463 saux2 = saux1.str() ;
464 saux += "ZoRaYCen " + saux2 + "\n" ;
466 { std::stringstream saux1 ;
467 saux1 << NumeZone << " " << x2 ;
468 saux2 = saux1.str() ;
469 saux += "ZoRaZCen " + saux2 + "\n" ;
471 { std::stringstream saux1 ;
472 saux1 << NumeZone << " " << x3 ;
473 saux2 = saux1.str() ;
474 saux += "ZoRaRayo " + saux2 + "\n" ;
478 // Cas du cylindre ou du tuyau
480 else if ( ZoneType == 5 or ZoneType == 7 )
482 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
483 else { saux += "# Tuyau\n" ; }
484 { std::stringstream saux1 ;
485 saux1 << NumeZone << " " << x0 ;
486 saux2 = saux1.str() ;
487 saux += "ZoRaXBas " + saux2 + "\n" ;
489 { std::stringstream saux1 ;
490 saux1 << NumeZone << " " << x1 ;
491 saux2 = saux1.str() ;
492 saux += "ZoRaYBas " + saux2 + "\n" ;
494 { std::stringstream saux1 ;
495 saux1 << NumeZone << " " << x2 ;
496 saux2 = saux1.str() ;
497 saux += "ZoRaZBas " + saux2 + "\n" ;
499 { std::stringstream saux1 ;
500 saux1 << NumeZone << " " << x3 ;
501 saux2 = saux1.str() ;
502 saux += "ZoRaXAxe " + saux2 + "\n" ;
504 { std::stringstream saux1 ;
505 saux1 << NumeZone << " " << x4 ;
506 saux2 = saux1.str() ;
507 saux += "ZoRaYAxe " + saux2 + "\n" ;
509 { std::stringstream saux1 ;
510 saux1 << NumeZone << " " << x5 ;
511 saux2 = saux1.str() ;
512 saux += "ZoRaZAxe " + saux2 + "\n" ;
514 { std::stringstream saux1 ;
515 saux1 << NumeZone << " " << x6 ;
516 saux2 = saux1.str() ;
517 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
518 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
520 { std::stringstream saux1 ;
521 saux1 << NumeZone << " " << x7 ;
522 saux2 = saux1.str() ;
523 saux += "ZoRaHaut " + saux2 + "\n" ;
526 { std::stringstream saux1 ;
527 saux1 << NumeZone << " " << x8 ;
528 saux2 = saux1.str() ;
529 saux += "ZoRaRayI " + saux2 + "\n" ;
533 _Texte += saux + "#\n" ;
535 // 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" ;
628 //===============================================================================
629 void HomardDriver::TexteGroup( const std::string GroupName )
631 MESSAGE("TexteGroup, GroupName = "<<GroupName);
633 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
636 //===============================================================================
637 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
639 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
641 // Type de suivi de frontiere
643 std::stringstream saux1 ;
644 saux1 << BoundaryOption ;
645 std::string saux = saux1.str() ;
646 _Texte += "SuivFron " + saux + "\n" ;
649 //===============================================================================
650 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
652 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
653 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
655 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
656 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
659 //===============================================================================
660 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
662 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
664 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
667 //===============================================================================
668 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 )
670 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
671 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
672 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
673 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
675 std::string saux, saux2 ;
679 std::stringstream saux1 ;
680 saux1 << NumeBoundary ;
681 saux2 = saux1.str() ;
682 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
683 if ( BoundaryType == 1 )
684 { saux += "# Cylindre\n" ; }
685 if ( BoundaryType == 2 )
686 { saux += "# Sphere\n" ; }
687 if ( BoundaryType == 3 or BoundaryType == 4 )
688 { saux += "# Cone\n" ; }
690 // Le nom de la frontiere
692 { std::stringstream saux1 ;
693 saux1 << NumeBoundary ;
694 saux2 = saux1.str() ;
695 saux += "FANom " + saux2 + " \"" + NameBoundary + "\"\n" ;
700 { std::stringstream saux1 ;
701 saux1 << NumeBoundary << " " << BoundaryType ;
702 saux2 = saux1.str() ;
703 saux += "FAType " + saux2 + "\n" ;
708 if ( BoundaryType == 1 )
710 { std::stringstream saux1 ;
711 saux1 << NumeBoundary << " " << x0 ;
712 saux2 = saux1.str() ;
713 saux += "FAXCen " + saux2 + "\n" ;
715 { std::stringstream saux1 ;
716 saux1 << NumeBoundary << " " << x1 ;
717 saux2 = saux1.str() ;
718 saux += "FAYCen " + saux2 + "\n" ;
720 { std::stringstream saux1 ;
721 saux1 << NumeBoundary << " " << x2 ;
722 saux2 = saux1.str() ;
723 saux += "FAZCen " + saux2 + "\n" ;
725 { std::stringstream saux1 ;
726 saux1 << NumeBoundary << " " << x3 ;
727 saux2 = saux1.str() ;
728 saux += "FAXAxe " + saux2 + "\n" ;
730 { std::stringstream saux1 ;
731 saux1 << NumeBoundary << " " << x4 ;
732 saux2 = saux1.str() ;
733 saux += "FAYAxe " + saux2 + "\n" ;
735 { std::stringstream saux1 ;
736 saux1 << NumeBoundary << " " << x5 ;
737 saux2 = saux1.str() ;
738 saux += "FAZAxe " + saux2 + "\n" ;
740 { std::stringstream saux1 ;
741 saux1 << NumeBoundary << " " << x6 ;
742 saux2 = saux1.str() ;
743 saux += "FARayon " + saux2 + "\n" ;
749 else if ( BoundaryType == 2 )
751 { std::stringstream saux1 ;
752 saux1 << NumeBoundary << " " << x0 ;
753 saux2 = saux1.str() ;
754 saux += "FAXCen " + saux2 + "\n" ;
756 { std::stringstream saux1 ;
757 saux1 << NumeBoundary << " " << x1 ;
758 saux2 = saux1.str() ;
759 saux += "FAYCen " + saux2 + "\n" ;
761 { std::stringstream saux1 ;
762 saux1 << NumeBoundary << " " << x2 ;
763 saux2 = saux1.str() ;
764 saux += "FAZCen " + saux2 + "\n" ;
766 { std::stringstream saux1 ;
767 saux1 << NumeBoundary << " " << x3 ;
768 saux2 = saux1.str() ;
769 saux += "FARayon " + saux2 + "\n" ;
773 // Cas du cone defini par un axe et un angle
775 if ( BoundaryType == 3 )
777 { std::stringstream saux1 ;
778 saux1 << NumeBoundary << " " << x0 ;
779 saux2 = saux1.str() ;
780 saux += "FAXAxe " + saux2 + "\n" ;
782 { std::stringstream saux1 ;
783 saux1 << NumeBoundary << " " << x1 ;
784 saux2 = saux1.str() ;
785 saux += "FAYAxe " + saux2 + "\n" ;
787 { std::stringstream saux1 ;
788 saux1 << NumeBoundary << " " << x2 ;
789 saux2 = saux1.str() ;
790 saux += "FAZAxe " + saux2 + "\n" ;
792 { std::stringstream saux1 ;
793 saux1 << NumeBoundary << " " << x3 ;
794 saux2 = saux1.str() ;
795 saux += "FAAngle " + saux2 + "\n" ;
797 { std::stringstream saux1 ;
798 saux1 << NumeBoundary << " " << x4 ;
799 saux2 = saux1.str() ;
800 saux += "FAXCen " + saux2 + "\n" ;
802 { std::stringstream saux1 ;
803 saux1 << NumeBoundary << " " << x5 ;
804 saux2 = saux1.str() ;
805 saux += "FAYCen " + saux2 + "\n" ;
807 { std::stringstream saux1 ;
808 saux1 << NumeBoundary << " " << x6 ;
809 saux2 = saux1.str() ;
810 saux += "FAZCen " + saux2 + "\n" ;
814 // Cas du cone defini par les 2 rayons
816 if ( BoundaryType == 4 )
818 { std::stringstream saux1 ;
819 saux1 << NumeBoundary << " " << x0 ;
820 saux2 = saux1.str() ;
821 saux += "FAXCen " + saux2 + "\n" ;
823 { std::stringstream saux1 ;
824 saux1 << NumeBoundary << " " << x1 ;
825 saux2 = saux1.str() ;
826 saux += "FAYCen " + saux2 + "\n" ;
828 { std::stringstream saux1 ;
829 saux1 << NumeBoundary << " " << x2 ;
830 saux2 = saux1.str() ;
831 saux += "FAZCen " + saux2 + "\n" ;
833 { std::stringstream saux1 ;
834 saux1 << NumeBoundary << " " << x3 ;
835 saux2 = saux1.str() ;
836 saux += "FARayon " + saux2 + "\n" ;
838 { std::stringstream saux1 ;
839 saux1 << NumeBoundary << " " << x4 ;
840 saux2 = saux1.str() ;
841 saux += "FAXCen2" + saux2 + "\n" ;
843 { std::stringstream saux1 ;
844 saux1 << NumeBoundary << " " << x5 ;
845 saux2 = saux1.str() ;
846 saux += "FAYCen2" + saux2 + "\n" ;
848 { std::stringstream saux1 ;
849 saux1 << NumeBoundary << " " << x6 ;
850 saux2 = saux1.str() ;
851 saux += "FAZCen2" + saux2 + "\n" ;
853 { std::stringstream saux1 ;
854 saux1 << NumeBoundary << " " << x7 ;
855 saux2 = saux1.str() ;
856 saux += "FARayon2" + saux2 + "\n" ;
860 _Texte += saux + "#\n" ;
863 //===============================================================================
864 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
866 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
867 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
868 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
872 std::string saux, saux2 ;
873 std::stringstream saux1 ;
874 saux1 << NumeBoundary ;
875 saux2 = saux1.str() ;
876 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
878 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
879 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
881 _Texte += saux + "#\n" ;
884 //===============================================================================
885 void HomardDriver::TexteFieldInterp( int TypeFieldInterp, const std::string FieldFile, const std::string MeshFile, int TimeStep, int Rank )
887 MESSAGE("TexteFieldInterp, TypeFieldInterp = "<<TypeFieldInterp);
888 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
889 MESSAGE("TexteFieldInterp, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
891 // Type d'interpolation
893 _Texte += "# Interpolations des champs\n" ;
894 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
895 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
896 if ( TypeFieldInterp == 1 )
898 _Texte += "CCChaTou oui\n" ;
901 _TimeStep = TimeStep ;
904 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
906 //===============================================================================
907 void HomardDriver::TexteFieldInterpName( int NumeChamp, const std::string FieldName)
909 MESSAGE("TexteFieldInterpName, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName);
910 std::stringstream saux1 ;
911 saux1 << NumeChamp+1 ;
912 std::string saux = saux1.str() ;
913 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
915 MESSAGE("TexteFieldInterpName, _TimeStep = "<<_TimeStep<<", _Rank = "<<_Rank);
916 if ( _TimeStep >= 0 )
919 std::stringstream saux1 ;
921 std::string saux2 = saux1.str() ;
922 _Texte += "CCChaPdT " + saux + " " + saux2 + "\n" ;
925 std::stringstream saux1 ;
927 std::string saux2 = saux1.str() ;
928 _Texte += "CCChaNuO " + saux + " " + saux2 + "\n" ;
932 //===============================================================================
933 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput )
935 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", LevelOutput ="<<LevelOutput);
940 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
941 _Texte += "TypeElem ignore_pyra\n" ;
945 _Texte += "# Niveaux extremes\n" ;
946 { std::stringstream saux1 ;
948 std::string saux2 = saux1.str() ;
949 _Texte += "NiveauMa " + saux2 + "\n" ;
954 _Texte += "# Diametre minimal\n" ;
955 { std::stringstream saux1 ;
957 std::string saux2 = saux1.str() ;
958 _Texte += "DiametMi " + saux2 + "\n" ;
964 { _Texte += "# Raffinement" ; }
966 { _Texte += "# Deraffinement" ; }
967 _Texte += " des regions sans indicateur\n" ;
968 { std::stringstream saux1 ;
970 std::string saux2 = saux1.str() ;
971 _Texte += "AdapInit " + saux2 + "\n" ;
974 if ( LevelOutput != 0 )
976 _Texte += "# Sortie des niveaux de raffinement\n" ;
977 _Texte += "NCNiveau NIVEAU\n" ;
980 //===============================================================================
981 void HomardDriver::CreeFichier( )
984 if ( _siter != _siterp1 )
985 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
987 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
989 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
990 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
994 //===============================================================================
995 // Creation du fichier de donnees pour l'information
996 //===============================================================================
997 void HomardDriver::CreeFichierDonn( )
1000 MESSAGE("CreeFichierDonn");
1001 _NomFichierDonn = "info.donn" ;
1007 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1008 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1012 //===============================================================================
1013 int HomardDriver::ExecuteHomard(int option)
1015 MESSAGE("ExecuteHomard, avec option = "<<option);
1016 std::string commande ;
1018 // Copie des Fichiers HOMARD
1019 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1020 codret = system(commande.c_str()) ;
1022 // Execution de HOMARD
1025 commande = _HOMARD_Exec.c_str() ;
1026 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1027 codret = system(commande.c_str());
1028 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1029 _NomFichierDonn = "" ;