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
22 // Pilote l'ecriture du fichier de configuration pour lancer l'execution de HOMARD
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 saux = "#\n# Zone numero " + saux1.str() + "\n" ;
245 { std::stringstream saux1 ;
246 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
247 saux += "ZoRaType " + saux1.str() + "\n" ;
252 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
253 // Y Homard <=> Y Salome
255 saux += "#Rectangle\n" ;
256 { std::stringstream saux1 ;
257 saux1 << NumeZone << " " << x0 ;
258 saux += "ZoRaXmin " + saux1.str() + "\n" ;
260 { std::stringstream saux1 ;
261 saux1 << NumeZone << " " << x1 ;
262 saux += "ZoRaXmax " + saux1.str() + "\n" ;
264 { std::stringstream saux1 ;
265 saux1 << NumeZone << " " << x2 ;
266 saux += "ZoRaYmin " + saux1.str() + "\n" ;
268 { std::stringstream saux1 ;
269 saux1 << NumeZone << " " << x3 ;
270 saux += "ZoRaYmax " + saux1.str() + "\n" ;
274 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
275 // Y Homard <=> Z Salome
277 saux += "#Rectangle\n" ;
278 { std::stringstream saux1 ;
279 saux1 << NumeZone << " " << x2 ;
280 saux += "ZoRaXmin " + saux1.str() + "\n" ;
282 { std::stringstream saux1 ;
283 saux1 << NumeZone << " " << x3 ;
284 saux += "ZoRaXmax " + saux1.str() + "\n" ;
286 { std::stringstream saux1 ;
287 saux1 << NumeZone << " " << x4 ;
288 saux += "ZoRaYmin " + saux1.str() + "\n" ;
290 { std::stringstream saux1 ;
291 saux1 << NumeZone << " " << x5 ;
292 saux += "ZoRaYmax " + saux1.str() + "\n" ;
296 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
297 // Y Homard <=> Z Salome
299 saux += "#Rectangle\n" ;
300 { std::stringstream saux1 ;
301 saux1 << NumeZone << " " << x0 ;
302 saux += "ZoRaXmin " + saux1.str() + "\n" ;
304 { std::stringstream saux1 ;
305 saux1 << NumeZone << " " << x1 ;
306 saux += "ZoRaXmax " + saux1.str() + "\n" ;
308 { std::stringstream saux1 ;
309 saux1 << NumeZone << " " << x4 ;
310 saux += "ZoRaYmin " + saux1.str() + "\n" ;
312 { std::stringstream saux1 ;
313 saux1 << NumeZone << " " << x5 ;
314 saux += "ZoRaYmax " + saux1.str() + "\n" ;
318 // Cas du parallelepipede
320 else if ( ZoneType == 2 )
322 saux += "# Boite\n" ;
323 { std::stringstream saux1 ;
324 saux1 << NumeZone << " " << x0 ;
325 saux += "ZoRaXmin " + saux1.str() + "\n" ;
327 { std::stringstream saux1 ;
328 saux1 << NumeZone << " " << x1 ;
329 saux += "ZoRaXmax " + saux1.str() + "\n" ;
331 { std::stringstream saux1 ;
332 saux1 << NumeZone << " " << x2 ;
333 saux += "ZoRaYmin " + saux1.str() + "\n" ;
335 { std::stringstream saux1 ;
336 saux1 << NumeZone << " " << x3 ;
337 saux += "ZoRaYmax " + saux1.str() + "\n" ;
339 { std::stringstream saux1 ;
340 saux1 << NumeZone << " " << x4 ;
341 saux += "ZoRaZmin " + saux1.str() + "\n" ;
343 { std::stringstream saux1 ;
344 saux1 << NumeZone << " " << x5 ;
345 saux += "ZoRaZmax " + saux1.str() + "\n" ;
351 else if ( ZoneType == 31 or ZoneType == 61 )
353 saux += "# Sphere\n" ;
354 { std::stringstream saux1 ;
355 saux1 << NumeZone << " " << x0 ;
356 saux += "ZoRaXCen " + saux1.str() + "\n" ;
358 { std::stringstream saux1 ;
359 saux1 << NumeZone << " " << x1 ;
360 saux += "ZoRaYCen " + saux1.str() + "\n" ;
362 { std::stringstream saux1 ;
363 saux1 << NumeZone << " " << x6 ;
364 saux2 = saux1.str() ;
365 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
366 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
368 if ( ZoneType == 61 )
369 { std::stringstream saux1 ;
370 saux1 << NumeZone << " " << x8 ;
371 saux += "ZoRaRayI " + saux1.str() + "\n" ;
374 else if ( ZoneType == 32 or ZoneType == 62 )
376 saux += "# Sphere\n" ;
377 { std::stringstream saux1 ;
378 saux1 << NumeZone << " " << x1 ;
379 saux += "ZoRaXCen " + saux1.str() + "\n" ;
381 { std::stringstream saux1 ;
382 saux1 << NumeZone << " " << x2 ;
383 saux += "ZoRaYCen " + saux1.str() + "\n" ;
385 { std::stringstream saux1 ;
386 saux1 << NumeZone << " " << x6 ;
387 saux2 = saux1.str() ;
388 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
389 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
391 if ( ZoneType == 62 )
392 { std::stringstream saux1 ;
393 saux1 << NumeZone << " " << x8 ;
394 saux += "ZoRaRayI " + saux1.str() + "\n" ;
397 else if ( ZoneType == 33 or ZoneType == 63 )
399 saux += "# Sphere\n" ;
400 { std::stringstream saux1 ;
401 saux1 << NumeZone << " " << x0 ;
402 saux += "ZoRaXCen " + saux1.str() + "\n" ;
404 { std::stringstream saux1 ;
405 saux1 << NumeZone << " " << x2 ;
406 saux += "ZoRaYCen " + saux1.str() + "\n" ;
408 { std::stringstream saux1 ;
409 saux1 << NumeZone << " " << x6 ;
410 saux2 = saux1.str() ;
411 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
412 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
414 if ( ZoneType == 63 )
415 { std::stringstream saux1 ;
416 saux1 << NumeZone << " " << x8 ;
417 saux += "ZoRaRayI " + saux1.str() + "\n" ;
423 else if ( ZoneType == 4 )
425 saux += "# Sphere\n" ;
426 { std::stringstream saux1 ;
427 saux1 << NumeZone << " " << x0 ;
428 saux += "ZoRaXCen " + saux1.str() + "\n" ;
430 { std::stringstream saux1 ;
431 saux1 << NumeZone << " " << x1 ;
432 saux += "ZoRaYCen " + saux1.str() + "\n" ;
434 { std::stringstream saux1 ;
435 saux1 << NumeZone << " " << x2 ;
436 saux += "ZoRaZCen " + saux1.str() + "\n" ;
438 { std::stringstream saux1 ;
439 saux1 << NumeZone << " " << x3 ;
440 saux += "ZoRaRayo " + saux1.str() + "\n" ;
444 // Cas du cylindre ou du tuyau
446 else if ( ZoneType == 5 or ZoneType == 7 )
448 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
449 else { saux += "# Tuyau\n" ; }
450 { std::stringstream saux1 ;
451 saux1 << NumeZone << " " << x0 ;
452 saux += "ZoRaXBas " + saux1.str() + "\n" ;
454 { std::stringstream saux1 ;
455 saux1 << NumeZone << " " << x1 ;
456 saux += "ZoRaYBas " + saux1.str() + "\n" ;
458 { std::stringstream saux1 ;
459 saux1 << NumeZone << " " << x2 ;
460 saux += "ZoRaZBas " + saux1.str() + "\n" ;
462 { std::stringstream saux1 ;
463 saux1 << NumeZone << " " << x3 ;
464 saux += "ZoRaXAxe " + saux1.str() + "\n" ;
466 { std::stringstream saux1 ;
467 saux1 << NumeZone << " " << x4 ;
468 saux += "ZoRaYAxe " + saux1.str() + "\n" ;
470 { std::stringstream saux1 ;
471 saux1 << NumeZone << " " << x5 ;
472 saux += "ZoRaZAxe " + saux1.str() + "\n" ;
474 { std::stringstream saux1 ;
475 saux1 << NumeZone << " " << x6 ;
476 saux2 = saux1.str() ;
477 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
478 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
480 { std::stringstream saux1 ;
481 saux1 << NumeZone << " " << x7 ;
482 saux += "ZoRaHaut " + saux1.str() + "\n" ;
485 { std::stringstream saux1 ;
486 saux1 << NumeZone << " " << x8 ;
487 saux += "ZoRaRayI " + saux1.str() + "\n" ;
491 _Texte += saux + "#\n" ;
493 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
495 //===============================================================================
496 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
497 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
498 int UsField, int UsCmpI )
500 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
501 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
503 std::string saux, saux2 ;
506 _Texte += "# Champ d'indicateurs\n" ;
507 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
508 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
510 // Cas ou on prend le dernier pas de temps
511 if ( TimeStep == -2 )
512 { _Texte += "CCNumPTI Last\n" ; }
513 // Cas avec pas de temps
514 else if ( TimeStep >= 0 )
517 std::stringstream saux1 ;
519 saux2 = saux1.str() ;
520 _Texte += "CCNumPTI " + saux2 + "\n" ;
523 std::stringstream saux1 ;
525 saux2 = saux1.str() ;
526 _Texte += "CCNumOrI " + saux2 + "\n" ;
541 std::stringstream saux1 ;
543 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
557 std::stringstream saux1 ;
559 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
564 { saux = "MAILLE" ; }
569 _Texte += "CCModeFI " + saux + "\n" ;
576 { saux = "INFINI" ; }
578 { saux = "V_RELATIVE" ; }
581 _Texte += "CCUsCmpI " + saux + "\n" ;
584 //===============================================================================
585 void HomardDriver::TexteGroup( const std::string GroupName )
587 MESSAGE("TexteGroup, GroupName = "<<GroupName);
589 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
592 //===============================================================================
593 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
595 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
597 // Type de suivi de frontiere
599 std::stringstream saux1 ;
600 saux1 << BoundaryOption ;
601 std::string saux = saux1.str() ;
602 _Texte += "SuivFron " + saux + "\n" ;
605 //===============================================================================
606 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
608 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
609 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
611 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
612 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
615 //===============================================================================
616 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
618 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
620 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
623 //===============================================================================
624 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 )
626 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
627 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
628 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
629 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
631 std::string saux, saux2 ;
635 std::stringstream saux1 ;
636 saux1 << NumeBoundary ;
637 saux2 = saux1.str() ;
638 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
639 if ( BoundaryType == 1 )
640 { saux += "# Cylindre\n" ; }
641 if ( BoundaryType == 2 )
642 { saux += "# Sphere\n" ; }
643 if ( BoundaryType == 3 or BoundaryType == 4 )
644 { saux += "# Cone\n" ; }
646 // Le nom de la frontiere
648 { std::stringstream saux1 ;
649 saux1 << NumeBoundary ;
650 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
655 { std::stringstream saux1 ;
656 saux1 << NumeBoundary << " " << BoundaryType ;
657 saux += "FAType " + saux1.str() + "\n" ;
662 if ( BoundaryType == 1 )
664 { std::stringstream saux1 ;
665 saux1 << NumeBoundary << " " << x0 ;
666 saux2 = saux1.str() ;
667 saux += "FAXCen " + saux1.str() + "\n" ;
669 { std::stringstream saux1 ;
670 saux1 << NumeBoundary << " " << x1 ;
671 saux += "FAYCen " + saux1.str() + "\n" ;
673 { std::stringstream saux1 ;
674 saux1 << NumeBoundary << " " << x2 ;
675 saux += "FAZCen " + saux1.str() + "\n" ;
677 { std::stringstream saux1 ;
678 saux1 << NumeBoundary << " " << x3 ;
679 saux += "FAXAxe " + saux1.str() + "\n" ;
681 { std::stringstream saux1 ;
682 saux1 << NumeBoundary << " " << x4 ;
683 saux += "FAYAxe " + saux1.str() + "\n" ;
685 { std::stringstream saux1 ;
686 saux1 << NumeBoundary << " " << x5 ;
687 saux += "FAZAxe " + saux1.str() + "\n" ;
689 { std::stringstream saux1 ;
690 saux1 << NumeBoundary << " " << x6 ;
691 saux += "FARayon " + saux1.str() + "\n" ;
697 else if ( BoundaryType == 2 )
699 { std::stringstream saux1 ;
700 saux1 << NumeBoundary << " " << x0 ;
701 saux += "FAXCen " + saux1.str() + "\n" ;
703 { std::stringstream saux1 ;
704 saux1 << NumeBoundary << " " << x1 ;
705 saux += "FAYCen " + saux1.str() + "\n" ;
707 { std::stringstream saux1 ;
708 saux1 << NumeBoundary << " " << x2 ;
709 saux += "FAZCen " + saux1.str() + "\n" ;
711 { std::stringstream saux1 ;
712 saux1 << NumeBoundary << " " << x3 ;
713 saux += "FARayon " + saux1.str() + "\n" ;
717 // Cas du cone defini par un axe et un angle
719 if ( BoundaryType == 3 )
721 { std::stringstream saux1 ;
722 saux1 << NumeBoundary << " " << x0 ;
723 saux += "FAXAxe " + saux1.str() + "\n" ;
725 { std::stringstream saux1 ;
726 saux1 << NumeBoundary << " " << x1 ;
727 saux += "FAYAxe " + saux1.str() + "\n" ;
729 { std::stringstream saux1 ;
730 saux1 << NumeBoundary << " " << x2 ;
731 saux += "FAZAxe " + saux1.str() + "\n" ;
733 { std::stringstream saux1 ;
734 saux1 << NumeBoundary << " " << x3 ;
735 saux += "FAAngle " + saux1.str() + "\n" ;
737 { std::stringstream saux1 ;
738 saux1 << NumeBoundary << " " << x4 ;
739 saux += "FAXCen " + saux1.str() + "\n" ;
741 { std::stringstream saux1 ;
742 saux1 << NumeBoundary << " " << x5 ;
743 saux += "FAYCen " + saux1.str() + "\n" ;
745 { std::stringstream saux1 ;
746 saux1 << NumeBoundary << " " << x6 ;
747 saux += "FAZCen " + saux1.str() + "\n" ;
751 // Cas du cone defini par les 2 rayons
753 if ( BoundaryType == 4 )
755 { std::stringstream saux1 ;
756 saux1 << NumeBoundary << " " << x0 ;
757 saux += "FAXCen " + saux1.str() + "\n" ;
759 { std::stringstream saux1 ;
760 saux1 << NumeBoundary << " " << x1 ;
761 saux += "FAYCen " + saux1.str() + "\n" ;
763 { std::stringstream saux1 ;
764 saux1 << NumeBoundary << " " << x2 ;
765 saux += "FAZCen " + saux1.str() + "\n" ;
767 { std::stringstream saux1 ;
768 saux1 << NumeBoundary << " " << x3 ;
769 saux += "FARayon " + saux1.str() + "\n" ;
771 { std::stringstream saux1 ;
772 saux1 << NumeBoundary << " " << x4 ;
773 saux += "FAXCen2 " + saux1.str() + "\n" ;
775 { std::stringstream saux1 ;
776 saux1 << NumeBoundary << " " << x5 ;
777 saux += "FAYCen2 " + saux1.str() + "\n" ;
779 { std::stringstream saux1 ;
780 saux1 << NumeBoundary << " " << x6 ;
781 saux += "FAZCen2 " + saux1.str() + "\n" ;
783 { std::stringstream saux1 ;
784 saux1 << NumeBoundary << " " << x7 ;
785 saux += "FARayon2 " + saux1.str() + "\n" ;
789 _Texte += saux + "#\n" ;
792 //===============================================================================
793 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
795 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
796 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
797 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
801 std::string saux, saux2 ;
802 std::stringstream saux1 ;
803 saux1 << NumeBoundary ;
804 saux2 = saux1.str() ;
805 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
807 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
808 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
810 _Texte += saux + "#\n" ;
813 //===============================================================================
814 void HomardDriver::TexteFieldInterp( int TypeFieldInterp, const std::string FieldFile, const std::string MeshFile, int TimeStep, int Rank )
816 MESSAGE("TexteFieldInterp, TypeFieldInterp = "<<TypeFieldInterp);
817 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
818 MESSAGE("TexteFieldInterp, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
820 // Type d'interpolation
822 _Texte += "# Interpolations des champs\n" ;
823 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
824 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
825 if ( TypeFieldInterp == 1 )
827 _Texte += "CCChaTou oui\n" ;
830 _TimeStep = TimeStep ;
833 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
835 //===============================================================================
836 void HomardDriver::TexteFieldInterpName( int NumeChamp, const std::string FieldName)
838 MESSAGE("TexteFieldInterpName, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName);
839 std::stringstream saux1 ;
840 saux1 << NumeChamp+1 ;
841 std::string saux = saux1.str() ;
842 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
844 MESSAGE("TexteFieldInterpName, _TimeStep = "<<_TimeStep<<", _Rank = "<<_Rank);
845 if ( _TimeStep >= 0 )
848 std::stringstream saux1 ;
850 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
853 std::stringstream saux1 ;
855 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
859 //===============================================================================
860 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput )
862 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", LevelOutput ="<<LevelOutput);
866 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
867 _Texte += "TypeElem ignore_pyra\n" ;
871 _Texte += "# Niveaux extremes\n" ;
872 { std::stringstream saux1 ;
874 _Texte += "NiveauMa " + saux1.str() + "\n" ;
879 _Texte += "# Diametre minimal\n" ;
880 { std::stringstream saux1 ;
882 _Texte += "DiametMi " + saux1.str() + "\n" ;
888 { _Texte += "# Raffinement" ; }
890 { _Texte += "# Deraffinement" ; }
891 _Texte += " des regions sans indicateur\n" ;
892 { std::stringstream saux1 ;
894 _Texte += "AdapInit " + saux1.str() + "\n" ;
897 if ( LevelOutput != 0 )
899 _Texte += "# Sortie des niveaux de raffinement\n" ;
900 _Texte += "NCNiveau NIVEAU\n" ;
903 //===============================================================================
904 void HomardDriver::TexteInfoCompute( int MessInfo )
906 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
910 _Texte += "# Messages d'informations\n" ;
911 { std::stringstream saux1 ;
913 _Texte += "MessInfo " + saux1.str() + "\n" ;
917 //===============================================================================
918 void HomardDriver::CreeFichier( )
921 if ( _siter != _siterp1 )
922 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
924 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
926 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
927 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
931 //===============================================================================
932 // Creation du fichier de donnees pour l'information
933 //===============================================================================
934 void HomardDriver::CreeFichierDonn( )
937 MESSAGE("CreeFichierDonn");
938 _NomFichierDonn = "info.donn" ;
944 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
945 if (Fic.is_open() == true) { Fic << data << std::endl ; }
949 //===============================================================================
950 int HomardDriver::ExecuteHomard(int option)
952 MESSAGE("ExecuteHomard, avec option = "<<option);
953 std::string commande ;
955 // Copie des Fichiers HOMARD
956 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
957 codret = system(commande.c_str()) ;
959 // Execution de HOMARD
962 commande = _HOMARD_Exec.c_str() ;
963 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
964 codret = system(commande.c_str());
965 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
966 _NomFichierDonn = "" ;