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 MESSAGE("siter = "<<siter<<", siterp1 = "<<siterp1);
40 // Le repertoire ou se trouve l'executable HOMARD
42 if ( getenv("HOMARD_REP_EXE_PRIVATE") != NULL ) { dir = getenv("HOMARD_REP_EXE_PRIVATE") ; }
43 else { dir = getenv("HOMARD_REP_EXE") ; }
44 MESSAGE("dir ="<<dir);
45 // L'executable HOMARD
46 std::string executable ;
47 if ( getenv("HOMARD_EXE_PRIVATE") != NULL ) { executable = getenv("HOMARD_EXE_PRIVATE") ; }
48 else { executable = getenv("HOMARD_EXE") ; }
49 MESSAGE("executable ="<<executable);
50 // Memorisation du nom complet de l'executable HOMARD
51 _HOMARD_Exec = dir + "/" + executable ;
52 MESSAGE("==> _HOMARD_Exec ="<<_HOMARD_Exec) ;
57 //=============================================================================
58 //=============================================================================
59 HomardDriver::~HomardDriver()
62 //===============================================================================
63 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
65 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
67 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
68 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
69 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
70 _Texte += "Langue \"" + Langue + "\"\n" ;
73 //===============================================================================
74 void HomardDriver::TexteAdap( )
78 _Texte += "Action homa\n" ;
79 _Texte += "CCAssoci med\n" ;
80 _Texte += "ModeHOMA 1\n" ;
81 _Texte += "NumeIter " + _siter + "\n" ;
84 //===============================================================================
85 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
87 MESSAGE("TexteInit, TypeBila ="<<TypeBila);
89 _Texte += "ModeHOMA 2\n" ;
90 std::stringstream saux1 ;
92 std::string saux2 = saux1.str() ;
93 _Texte += "TypeBila " + saux2 + "\n" ;
96 _Texte += "NumeIter 0\n" ;
97 _Texte += "Action info_av\n" ;
98 _Texte += "CCAssoci med\n" ;
102 _Texte += "NumeIter " + _siter + "\n" ;
103 _Texte += "Action info_ap\n" ;
104 _Texte += "CCAssoci homard\n" ;
109 //===============================================================================
110 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
112 MESSAGE("TexteMaillage, NomMesh ="<<NomMesh<<", MeshFile ="<<MeshFile<<", apres ="<<apres);
115 if ( apres < 1 ) { saux = "__" ; }
117 _Texte += "# Maillages Med " + saux + "\n" ;
118 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
119 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
122 //===============================================================================
123 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
125 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
127 if ( apres < 1 ) { saux = "__" ; }
128 else { saux = "P1" ; }
130 _Texte += "# Maillage HOMARD " + liter + "\n" ;
131 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
134 //===============================================================================
135 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
137 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
138 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
140 // Type de conformite
152 saux = "non_conforme_1_noeud" ;
157 saux = "non_conforme_1_arete" ;
162 saux = "non_conforme_indicateur" ;
166 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
168 // Type de raffinement/deraffinement
170 if ( TypeAdap == -1 )
174 saux = "TypeRaff uniforme\n" ;
178 saux = "TypeRaff non\n" ;
182 saux += "TypeDera uniforme" ;
186 saux += "TypeDera non" ;
193 saux = "TypeRaff libre\n" ;
197 saux = "TypeRaff non\n" ;
201 saux += "TypeDera libre" ;
205 saux += "TypeDera non" ;
208 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
210 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
212 //===============================================================================
213 void HomardDriver::TexteCompo( int NumeComp, const std::string NompCompo)
215 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NompCompo = "<<NompCompo);
216 _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);
536 //===============================================================================
537 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
538 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
539 int UsField, int UsCmpI )
541 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
542 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
544 std::string saux, saux2 ;
547 _Texte += "# Champ d'indicateurs\n" ;
548 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
549 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
551 // Cas ou on prend le dernier pas de temps
552 if ( TimeStep == -2 )
553 { _Texte += "CCNumPTI Last\n" ; }
554 // Cas avec pas de temps
555 else if ( TimeStep >= 0 )
558 std::stringstream saux1 ;
560 saux2 = saux1.str() ;
561 _Texte += "CCNumPTI " + saux2 + "\n" ;
564 std::stringstream saux1 ;
566 saux2 = saux1.str() ;
567 _Texte += "CCNumOrI " + saux2 + "\n" ;
582 std::stringstream saux1 ;
584 saux2 = saux1.str() ;
585 _Texte += "Seuil" + saux + " " + saux2 + "\n" ;
599 std::stringstream saux1 ;
601 saux2 = saux1.str() ;
602 _Texte += "Seuil" + saux + " " + saux2 + "\n" ;
607 { saux = "MAILLE" ; }
612 _Texte += "CCModeFI " + saux + "\n" ;
619 { saux = "INFINI" ; }
621 { saux = "V_RELATIVE" ; }
624 _Texte += "CCUsCmpI " + saux + "\n" ;
627 //===============================================================================
628 void HomardDriver::TexteGroup( const std::string GroupName )
630 MESSAGE("TexteGroup, GroupName = "<<GroupName);
632 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
635 //===============================================================================
636 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
638 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
640 // Type de suivi de frontiere
642 std::stringstream saux1 ;
643 saux1 << BoundaryOption ;
644 std::string saux = saux1.str() ;
645 _Texte += "SuivFron " + saux + "\n" ;
648 //===============================================================================
649 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
651 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
652 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
654 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
655 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
658 //===============================================================================
659 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
661 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
663 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
666 //===============================================================================
667 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 )
669 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
670 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
671 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
672 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
674 std::string saux, saux2 ;
678 std::stringstream saux1 ;
679 saux1 << NumeBoundary ;
680 saux2 = saux1.str() ;
681 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
682 if ( BoundaryType == 1 )
683 { saux += "# Cylindre\n" ; }
684 if ( BoundaryType == 2 )
685 { saux += "# Sphere\n" ; }
686 if ( BoundaryType == 3 or BoundaryType == 4 )
687 { saux += "# Cone\n" ; }
689 // Le nom de la frontiere
691 { std::stringstream saux1 ;
692 saux1 << NumeBoundary ;
693 saux2 = saux1.str() ;
694 saux += "FANom " + saux2 + " \"" + NameBoundary + "\"\n" ;
699 { std::stringstream saux1 ;
700 saux1 << NumeBoundary << " " << BoundaryType ;
701 saux2 = saux1.str() ;
702 saux += "FAType " + saux2 + "\n" ;
707 if ( BoundaryType == 1 )
709 { std::stringstream saux1 ;
710 saux1 << NumeBoundary << " " << x0 ;
711 saux2 = saux1.str() ;
712 saux += "FAXCen " + saux2 + "\n" ;
714 { std::stringstream saux1 ;
715 saux1 << NumeBoundary << " " << x1 ;
716 saux2 = saux1.str() ;
717 saux += "FAYCen " + saux2 + "\n" ;
719 { std::stringstream saux1 ;
720 saux1 << NumeBoundary << " " << x2 ;
721 saux2 = saux1.str() ;
722 saux += "FAZCen " + saux2 + "\n" ;
724 { std::stringstream saux1 ;
725 saux1 << NumeBoundary << " " << x3 ;
726 saux2 = saux1.str() ;
727 saux += "FAXAxe " + saux2 + "\n" ;
729 { std::stringstream saux1 ;
730 saux1 << NumeBoundary << " " << x4 ;
731 saux2 = saux1.str() ;
732 saux += "FAYAxe " + saux2 + "\n" ;
734 { std::stringstream saux1 ;
735 saux1 << NumeBoundary << " " << x5 ;
736 saux2 = saux1.str() ;
737 saux += "FAZAxe " + saux2 + "\n" ;
739 { std::stringstream saux1 ;
740 saux1 << NumeBoundary << " " << x6 ;
741 saux2 = saux1.str() ;
742 saux += "FARayon " + saux2 + "\n" ;
748 else if ( BoundaryType == 2 )
750 { std::stringstream saux1 ;
751 saux1 << NumeBoundary << " " << x0 ;
752 saux2 = saux1.str() ;
753 saux += "FAXCen " + saux2 + "\n" ;
755 { std::stringstream saux1 ;
756 saux1 << NumeBoundary << " " << x1 ;
757 saux2 = saux1.str() ;
758 saux += "FAYCen " + saux2 + "\n" ;
760 { std::stringstream saux1 ;
761 saux1 << NumeBoundary << " " << x2 ;
762 saux2 = saux1.str() ;
763 saux += "FAZCen " + saux2 + "\n" ;
765 { std::stringstream saux1 ;
766 saux1 << NumeBoundary << " " << x3 ;
767 saux2 = saux1.str() ;
768 saux += "FARayon " + saux2 + "\n" ;
772 // Cas du cone defini par un axe et un angle
774 if ( BoundaryType == 3 )
776 { std::stringstream saux1 ;
777 saux1 << NumeBoundary << " " << x0 ;
778 saux2 = saux1.str() ;
779 saux += "FAXAxe " + saux2 + "\n" ;
781 { std::stringstream saux1 ;
782 saux1 << NumeBoundary << " " << x1 ;
783 saux2 = saux1.str() ;
784 saux += "FAYAxe " + saux2 + "\n" ;
786 { std::stringstream saux1 ;
787 saux1 << NumeBoundary << " " << x2 ;
788 saux2 = saux1.str() ;
789 saux += "FAZAxe " + saux2 + "\n" ;
791 { std::stringstream saux1 ;
792 saux1 << NumeBoundary << " " << x3 ;
793 saux2 = saux1.str() ;
794 saux += "FAAngle " + saux2 + "\n" ;
796 { std::stringstream saux1 ;
797 saux1 << NumeBoundary << " " << x4 ;
798 saux2 = saux1.str() ;
799 saux += "FAXCen " + saux2 + "\n" ;
801 { std::stringstream saux1 ;
802 saux1 << NumeBoundary << " " << x5 ;
803 saux2 = saux1.str() ;
804 saux += "FAYCen " + saux2 + "\n" ;
806 { std::stringstream saux1 ;
807 saux1 << NumeBoundary << " " << x6 ;
808 saux2 = saux1.str() ;
809 saux += "FAZCen " + saux2 + "\n" ;
813 // Cas du cone defini par les 2 rayons
815 if ( BoundaryType == 4 )
817 { std::stringstream saux1 ;
818 saux1 << NumeBoundary << " " << x0 ;
819 saux2 = saux1.str() ;
820 saux += "FAXCen " + saux2 + "\n" ;
822 { std::stringstream saux1 ;
823 saux1 << NumeBoundary << " " << x1 ;
824 saux2 = saux1.str() ;
825 saux += "FAYCen " + saux2 + "\n" ;
827 { std::stringstream saux1 ;
828 saux1 << NumeBoundary << " " << x2 ;
829 saux2 = saux1.str() ;
830 saux += "FAZCen " + saux2 + "\n" ;
832 { std::stringstream saux1 ;
833 saux1 << NumeBoundary << " " << x3 ;
834 saux2 = saux1.str() ;
835 saux += "FARayon " + saux2 + "\n" ;
837 { std::stringstream saux1 ;
838 saux1 << NumeBoundary << " " << x4 ;
839 saux2 = saux1.str() ;
840 saux += "FAXCen2 " + saux2 + "\n" ;
842 { std::stringstream saux1 ;
843 saux1 << NumeBoundary << " " << x5 ;
844 saux2 = saux1.str() ;
845 saux += "FAYCen2 " + saux2 + "\n" ;
847 { std::stringstream saux1 ;
848 saux1 << NumeBoundary << " " << x6 ;
849 saux2 = saux1.str() ;
850 saux += "FAZCen2 " + saux2 + "\n" ;
852 { std::stringstream saux1 ;
853 saux1 << NumeBoundary << " " << x7 ;
854 saux2 = saux1.str() ;
855 saux += "FARayon2 " + saux2 + "\n" ;
859 _Texte += saux + "#\n" ;
862 //===============================================================================
863 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
865 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
866 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
867 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
871 std::string saux, saux2 ;
872 std::stringstream saux1 ;
873 saux1 << NumeBoundary ;
874 saux2 = saux1.str() ;
875 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
877 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
878 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
880 _Texte += saux + "#\n" ;
883 //===============================================================================
884 void HomardDriver::TexteFieldInterp( int TypeFieldInterp, const std::string FieldFile, const std::string MeshFile, int TimeStep, int Rank )
886 MESSAGE("TexteFieldInterp, TypeFieldInterp = "<<TypeFieldInterp);
887 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
888 MESSAGE("TexteFieldInterp, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
890 // Type d'interpolation
892 _Texte += "# Interpolations des champs\n" ;
893 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
894 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
895 if ( TypeFieldInterp == 1 )
897 _Texte += "CCChaTou oui\n" ;
900 _TimeStep = TimeStep ;
903 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
905 //===============================================================================
906 void HomardDriver::TexteFieldInterpName( int NumeChamp, const std::string FieldName)
908 MESSAGE("TexteFieldInterpName, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName);
909 std::stringstream saux1 ;
910 saux1 << NumeChamp+1 ;
911 std::string saux = saux1.str() ;
912 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
914 MESSAGE("TexteFieldInterpName, _TimeStep = "<<_TimeStep<<", _Rank = "<<_Rank);
915 if ( _TimeStep >= 0 )
918 std::stringstream saux1 ;
920 std::string saux2 = saux1.str() ;
921 _Texte += "CCChaPdT " + saux + " " + saux2 + "\n" ;
924 std::stringstream saux1 ;
926 std::string saux2 = saux1.str() ;
927 _Texte += "CCChaNuO " + saux + " " + saux2 + "\n" ;
931 //===============================================================================
932 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput )
934 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", LevelOutput ="<<LevelOutput);
938 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
939 _Texte += "TypeElem ignore_pyra\n" ;
943 _Texte += "# Niveaux extremes\n" ;
944 { std::stringstream saux1 ;
946 std::string saux2 = saux1.str() ;
947 _Texte += "NiveauMa " + saux2 + "\n" ;
952 _Texte += "# Diametre minimal\n" ;
953 { std::stringstream saux1 ;
955 std::string saux2 = saux1.str() ;
956 _Texte += "DiametMi " + saux2 + "\n" ;
962 { _Texte += "# Raffinement" ; }
964 { _Texte += "# Deraffinement" ; }
965 _Texte += " des regions sans indicateur\n" ;
966 { std::stringstream saux1 ;
968 std::string saux2 = saux1.str() ;
969 _Texte += "AdapInit " + saux2 + "\n" ;
972 if ( LevelOutput != 0 )
974 _Texte += "# Sortie des niveaux de raffinement\n" ;
975 _Texte += "NCNiveau NIVEAU\n" ;
978 //===============================================================================
979 void HomardDriver::TexteInfoCompute( int MessInfo )
981 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
985 _Texte += "# Messages d'informations\n" ;
986 { std::stringstream saux1 ;
988 std::string saux2 = saux1.str() ;
989 _Texte += "MessInfo " + saux2 + "\n" ;
993 //===============================================================================
994 void HomardDriver::CreeFichier( )
997 if ( _siter != _siterp1 )
998 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
1000 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
1002 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
1003 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
1007 //===============================================================================
1008 // Creation du fichier de donnees pour l'information
1009 //===============================================================================
1010 void HomardDriver::CreeFichierDonn( )
1013 MESSAGE("CreeFichierDonn");
1014 _NomFichierDonn = "info.donn" ;
1020 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1021 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1025 //===============================================================================
1026 int HomardDriver::ExecuteHomard(int option)
1028 MESSAGE("ExecuteHomard, avec option = "<<option);
1029 std::string commande ;
1031 // Copie des Fichiers HOMARD
1032 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1033 codret = system(commande.c_str()) ;
1035 // Execution de HOMARD
1038 commande = _HOMARD_Exec.c_str() ;
1039 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1040 codret = system(commande.c_str());
1041 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1042 _NomFichierDonn = "" ;