1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2016 CEA/DEN, EDF R&D
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // Pilote l'ecriture du fichier de configuration pour lancer l'execution de HOMARD
30 #include "HomardDriver.hxx"
31 #include "Utils_SALOME_Exception.hxx"
32 #include "utilities.h"
34 //=============================================================================
35 //=============================================================================
36 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
37 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
38 _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ),
39 _Texte( "" ), _bLu( false )
41 MESSAGE("siter = "<<siter<<", siterp1 = "<<siterp1);
42 // Le repertoire ou se trouve l'executable HOMARD
44 if ( getenv("HOMARD_REP_EXE_PRIVATE") != NULL ) { dir = getenv("HOMARD_REP_EXE_PRIVATE") ; }
45 else { dir = getenv("HOMARD_REP_EXE") ; }
46 MESSAGE("dir ="<<dir);
47 // L'executable HOMARD
48 std::string executable ;
49 if ( getenv("HOMARD_EXE_PRIVATE") != NULL ) { executable = getenv("HOMARD_EXE_PRIVATE") ; }
50 else { executable = getenv("HOMARD_EXE") ; }
51 MESSAGE("executable ="<<executable);
52 // Memorisation du nom complet de l'executable HOMARD
53 _HOMARD_Exec = dir + "/" + executable ;
54 MESSAGE("==> _HOMARD_Exec ="<<_HOMARD_Exec) ;
59 //=============================================================================
60 //=============================================================================
61 HomardDriver::~HomardDriver()
64 //===============================================================================
66 //===============================================================================
67 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
69 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
71 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
72 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
73 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
74 _Texte += "Langue \"" + Langue + "\"\n" ;
77 //===============================================================================
78 void HomardDriver::TexteAdap( int ExtType )
82 _Texte += "Action homa\n" ;
83 if ( ExtType == 0 ) { _Texte += "CCAssoci med\n" ; }
84 else if ( ExtType == 1 ) { _Texte += "CCAssoci saturne\n" ; }
85 else { _Texte += "CCAssoci saturne_2d\n" ; }
86 _Texte += "ModeHOMA 1\n" ;
87 _Texte += "NumeIter " + _siter + "\n" ;
90 //===============================================================================
91 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
93 MESSAGE("TexteInit, TypeBila ="<<TypeBila);
95 _Texte += "ModeHOMA 2\n" ;
96 std::stringstream saux1 ;
98 std::string saux2 = saux1.str() ;
99 _Texte += "TypeBila " + saux2 + "\n" ;
102 _Texte += "NumeIter 0\n" ;
103 _Texte += "Action info_av\n" ;
104 _Texte += "CCAssoci med\n" ;
108 _Texte += "NumeIter " + _siter + "\n" ;
109 _Texte += "Action info_ap\n" ;
110 _Texte += "CCAssoci homard\n" ;
114 //===============================================================================
115 // B. Les maillages en entree et en sortie
116 //===============================================================================
117 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
119 MESSAGE("TexteMaillage, NomMesh = "<<NomMesh);
120 MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
121 MESSAGE("TexteMaillage, apres = "<<apres);
124 if ( apres < 1 ) { saux = "__" ; }
126 _Texte += "# Maillages Med " + saux + "\n" ;
127 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
128 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
131 //===============================================================================
132 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
134 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
136 if ( apres < 1 ) { saux = "__" ; }
137 else { saux = "P1" ; }
139 _Texte += "# Maillage HOMARD " + liter + "\n" ;
140 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
143 //===============================================================================
144 // C. Le pilotage de l'adaptation
145 //===============================================================================
146 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
148 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
149 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
151 // Type de conformite
158 saux = "NON_CONFORME_1_ARETE" ;
163 saux = "CONFORME_BOITES" ;
173 saux = "NON_CONFORME" ;
178 saux = "NON_CONFORME_1_NOEUD" ;
183 saux = "NON_CONFORME_INDICATEUR" ;
187 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
189 // Type de raffinement/deraffinement
191 if ( TypeAdap == -1 )
195 saux = "TypeRaff uniforme\n" ;
199 saux = "TypeRaff non\n" ;
203 saux += "TypeDera uniforme" ;
207 saux += "TypeDera non" ;
214 saux = "TypeRaff libre\n" ;
218 saux = "TypeRaff non\n" ;
222 saux += "TypeDera libre" ;
226 saux += "TypeDera non" ;
229 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
231 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
233 //===============================================================================
234 void HomardDriver::TexteCompo( int NumeComp, const std::string NomCompo)
236 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NomCompo = "<<NomCompo);
237 _Texte +="CCCoChaI \"" + NomCompo + "\"\n" ;
239 //===============================================================================
240 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 )
242 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
243 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
245 std::string saux, saux2 ;
248 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
249 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
250 // Attention a mettre le bon signe a ZoneTypeHOMARD :
251 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
252 // <0 signifie que l'on deraffinera
255 if ( ZoneType >= 11 && ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
256 else if ( ZoneType >= 31 && ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
257 else if ( ZoneType >= 61 && ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
258 else { ZoneTypeHOMARD = ZoneType ; }
260 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
262 std::stringstream saux1 ;
264 saux = "#\n# Zone numero " + saux1.str() + "\n" ;
266 { std::stringstream saux1 ;
267 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
268 saux += "ZoRaType " + saux1.str() + "\n" ;
273 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
274 // Y Homard <=> Y Salome
276 saux += "#Rectangle\n" ;
277 { std::stringstream saux1 ;
278 saux1 << NumeZone << " " << x0 ;
279 saux += "ZoRaXmin " + saux1.str() + "\n" ;
281 { std::stringstream saux1 ;
282 saux1 << NumeZone << " " << x1 ;
283 saux += "ZoRaXmax " + saux1.str() + "\n" ;
285 { std::stringstream saux1 ;
286 saux1 << NumeZone << " " << x2 ;
287 saux += "ZoRaYmin " + saux1.str() + "\n" ;
289 { std::stringstream saux1 ;
290 saux1 << NumeZone << " " << x3 ;
291 saux += "ZoRaYmax " + saux1.str() + "\n" ;
295 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
296 // Y Homard <=> Z Salome
298 saux += "#Rectangle\n" ;
299 { std::stringstream saux1 ;
300 saux1 << NumeZone << " " << x2 ;
301 saux += "ZoRaXmin " + saux1.str() + "\n" ;
303 { std::stringstream saux1 ;
304 saux1 << NumeZone << " " << x3 ;
305 saux += "ZoRaXmax " + saux1.str() + "\n" ;
307 { std::stringstream saux1 ;
308 saux1 << NumeZone << " " << x4 ;
309 saux += "ZoRaYmin " + saux1.str() + "\n" ;
311 { std::stringstream saux1 ;
312 saux1 << NumeZone << " " << x5 ;
313 saux += "ZoRaYmax " + saux1.str() + "\n" ;
317 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
318 // Y Homard <=> Z Salome
320 saux += "#Rectangle\n" ;
321 { std::stringstream saux1 ;
322 saux1 << NumeZone << " " << x0 ;
323 saux += "ZoRaXmin " + saux1.str() + "\n" ;
325 { std::stringstream saux1 ;
326 saux1 << NumeZone << " " << x1 ;
327 saux += "ZoRaXmax " + saux1.str() + "\n" ;
329 { std::stringstream saux1 ;
330 saux1 << NumeZone << " " << x4 ;
331 saux += "ZoRaYmin " + saux1.str() + "\n" ;
333 { std::stringstream saux1 ;
334 saux1 << NumeZone << " " << x5 ;
335 saux += "ZoRaYmax " + saux1.str() + "\n" ;
339 // Cas du parallelepipede
341 else if ( ZoneType == 2 )
343 saux += "# Boite\n" ;
344 { std::stringstream saux1 ;
345 saux1 << NumeZone << " " << x0 ;
346 saux += "ZoRaXmin " + saux1.str() + "\n" ;
348 { std::stringstream saux1 ;
349 saux1 << NumeZone << " " << x1 ;
350 saux += "ZoRaXmax " + saux1.str() + "\n" ;
352 { std::stringstream saux1 ;
353 saux1 << NumeZone << " " << x2 ;
354 saux += "ZoRaYmin " + saux1.str() + "\n" ;
356 { std::stringstream saux1 ;
357 saux1 << NumeZone << " " << x3 ;
358 saux += "ZoRaYmax " + saux1.str() + "\n" ;
360 { std::stringstream saux1 ;
361 saux1 << NumeZone << " " << x4 ;
362 saux += "ZoRaZmin " + saux1.str() + "\n" ;
364 { std::stringstream saux1 ;
365 saux1 << NumeZone << " " << x5 ;
366 saux += "ZoRaZmax " + saux1.str() + "\n" ;
372 else if ( ZoneType == 31 || ZoneType == 61 )
374 saux += "# Sphere\n" ;
375 { std::stringstream saux1 ;
376 saux1 << NumeZone << " " << x0 ;
377 saux += "ZoRaXCen " + saux1.str() + "\n" ;
379 { std::stringstream saux1 ;
380 saux1 << NumeZone << " " << x1 ;
381 saux += "ZoRaYCen " + saux1.str() + "\n" ;
383 { std::stringstream saux1 ;
384 saux1 << NumeZone << " " << x6 ;
385 saux2 = saux1.str() ;
386 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
387 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
389 if ( ZoneType == 61 )
390 { std::stringstream saux1 ;
391 saux1 << NumeZone << " " << x8 ;
392 saux += "ZoRaRayI " + saux1.str() + "\n" ;
395 else if ( ZoneType == 32 || ZoneType == 62 )
397 saux += "# Sphere\n" ;
398 { std::stringstream saux1 ;
399 saux1 << NumeZone << " " << x1 ;
400 saux += "ZoRaXCen " + saux1.str() + "\n" ;
402 { std::stringstream saux1 ;
403 saux1 << NumeZone << " " << x2 ;
404 saux += "ZoRaYCen " + saux1.str() + "\n" ;
406 { std::stringstream saux1 ;
407 saux1 << NumeZone << " " << x6 ;
408 saux2 = saux1.str() ;
409 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
410 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
412 if ( ZoneType == 62 )
413 { std::stringstream saux1 ;
414 saux1 << NumeZone << " " << x8 ;
415 saux += "ZoRaRayI " + saux1.str() + "\n" ;
418 else if ( ZoneType == 33 || ZoneType == 63 )
420 saux += "# Sphere\n" ;
421 { std::stringstream saux1 ;
422 saux1 << NumeZone << " " << x0 ;
423 saux += "ZoRaXCen " + saux1.str() + "\n" ;
425 { std::stringstream saux1 ;
426 saux1 << NumeZone << " " << x2 ;
427 saux += "ZoRaYCen " + saux1.str() + "\n" ;
429 { std::stringstream saux1 ;
430 saux1 << NumeZone << " " << x6 ;
431 saux2 = saux1.str() ;
432 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
433 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
435 if ( ZoneType == 63 )
436 { std::stringstream saux1 ;
437 saux1 << NumeZone << " " << x8 ;
438 saux += "ZoRaRayI " + saux1.str() + "\n" ;
444 else if ( ZoneType == 4 )
446 saux += "# Sphere\n" ;
447 { std::stringstream saux1 ;
448 saux1 << NumeZone << " " << x0 ;
449 saux += "ZoRaXCen " + saux1.str() + "\n" ;
451 { std::stringstream saux1 ;
452 saux1 << NumeZone << " " << x1 ;
453 saux += "ZoRaYCen " + saux1.str() + "\n" ;
455 { std::stringstream saux1 ;
456 saux1 << NumeZone << " " << x2 ;
457 saux += "ZoRaZCen " + saux1.str() + "\n" ;
459 { std::stringstream saux1 ;
460 saux1 << NumeZone << " " << x3 ;
461 saux += "ZoRaRayo " + saux1.str() + "\n" ;
465 // Cas du cylindre ou du tuyau
467 else if ( ZoneType == 5 || ZoneType == 7 )
469 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
470 else { saux += "# Tuyau\n" ; }
471 { std::stringstream saux1 ;
472 saux1 << NumeZone << " " << x0 ;
473 saux += "ZoRaXBas " + saux1.str() + "\n" ;
475 { std::stringstream saux1 ;
476 saux1 << NumeZone << " " << x1 ;
477 saux += "ZoRaYBas " + saux1.str() + "\n" ;
479 { std::stringstream saux1 ;
480 saux1 << NumeZone << " " << x2 ;
481 saux += "ZoRaZBas " + saux1.str() + "\n" ;
483 { std::stringstream saux1 ;
484 saux1 << NumeZone << " " << x3 ;
485 saux += "ZoRaXAxe " + saux1.str() + "\n" ;
487 { std::stringstream saux1 ;
488 saux1 << NumeZone << " " << x4 ;
489 saux += "ZoRaYAxe " + saux1.str() + "\n" ;
491 { std::stringstream saux1 ;
492 saux1 << NumeZone << " " << x5 ;
493 saux += "ZoRaZAxe " + saux1.str() + "\n" ;
495 { std::stringstream saux1 ;
496 saux1 << NumeZone << " " << x6 ;
497 saux2 = saux1.str() ;
498 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
499 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
501 { std::stringstream saux1 ;
502 saux1 << NumeZone << " " << x7 ;
503 saux += "ZoRaHaut " + saux1.str() + "\n" ;
506 { std::stringstream saux1 ;
507 saux1 << NumeZone << " " << x8 ;
508 saux += "ZoRaRayI " + saux1.str() + "\n" ;
512 _Texte += saux + "#\n" ;
514 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
516 //===============================================================================
517 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
518 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
519 int UsField, int UsCmpI )
521 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
522 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
524 std::string saux, saux2 ;
527 _Texte += "# Champ d'indicateurs\n" ;
528 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
529 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
531 // Cas ou on prend le dernier pas de temps
532 if ( TimeStep == -2 )
533 { _Texte += "CCNumPTI Last\n" ; }
534 // Cas avec pas de temps
535 else if ( TimeStep >= 0 )
538 std::stringstream saux1 ;
540 saux2 = saux1.str() ;
541 _Texte += "CCNumPTI " + saux2 + "\n" ;
545 std::stringstream saux1 ;
547 saux2 = saux1.str() ;
548 _Texte += "CCNumOrI " + saux2 + "\n" ;
563 std::stringstream saux1 ;
565 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
579 std::stringstream saux1 ;
581 _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ;
586 { saux = "MAILLE" ; }
591 _Texte += "CCModeFI " + saux + "\n" ;
598 { saux = "INFINI" ; }
600 { saux = "RELATIF" ; }
603 _Texte += "CCUsCmpI " + saux + "\n" ;
606 //===============================================================================
607 void HomardDriver::TexteGroup( const std::string GroupName )
609 MESSAGE("TexteGroup, GroupName = "<<GroupName);
611 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
614 //===============================================================================
616 //===============================================================================
617 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
619 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
621 // Type de suivi de frontiere
623 std::stringstream saux1 ;
624 saux1 << BoundaryOption ;
625 std::string saux = saux1.str() ;
626 _Texte += "SuivFron " + saux + "\n" ;
629 //===============================================================================
630 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
632 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
633 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
635 _Texte += "#\n# Frontiere discrete\n" ;
636 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
637 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
640 //===============================================================================
641 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
643 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
645 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
648 //===============================================================================
649 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 )
651 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
652 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
653 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
654 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
656 std::string saux, saux2 ;
660 std::stringstream saux1 ;
661 saux1 << NumeBoundary ;
662 saux2 = saux1.str() ;
663 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
664 if ( BoundaryType == 1 )
665 { saux += "# Cylindre\n" ; }
666 if ( BoundaryType == 2 )
667 { saux += "# Sphere\n" ; }
668 if ( BoundaryType == 3 || BoundaryType == 4 )
669 { saux += "# Cone\n" ; }
670 if ( BoundaryType == 5 )
671 { saux += "# Tore\n" ; }
673 // Le nom de la frontiere
675 { std::stringstream saux1 ;
676 saux1 << NumeBoundary ;
677 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
682 { std::stringstream saux1 ;
683 saux1 << NumeBoundary << " " << BoundaryType ;
684 saux += "FAType " + saux1.str() + "\n" ;
689 if ( BoundaryType == 1 )
691 { std::stringstream saux1 ;
692 saux1 << NumeBoundary << " " << x0 ;
693 saux2 = saux1.str() ;
694 saux += "FAXCen " + saux1.str() + "\n" ;
696 { std::stringstream saux1 ;
697 saux1 << NumeBoundary << " " << x1 ;
698 saux += "FAYCen " + saux1.str() + "\n" ;
700 { std::stringstream saux1 ;
701 saux1 << NumeBoundary << " " << x2 ;
702 saux += "FAZCen " + saux1.str() + "\n" ;
704 { std::stringstream saux1 ;
705 saux1 << NumeBoundary << " " << x3 ;
706 saux += "FAXAxe " + saux1.str() + "\n" ;
708 { std::stringstream saux1 ;
709 saux1 << NumeBoundary << " " << x4 ;
710 saux += "FAYAxe " + saux1.str() + "\n" ;
712 { std::stringstream saux1 ;
713 saux1 << NumeBoundary << " " << x5 ;
714 saux += "FAZAxe " + saux1.str() + "\n" ;
716 { std::stringstream saux1 ;
717 saux1 << NumeBoundary << " " << x6 ;
718 saux += "FARayon " + saux1.str() + "\n" ;
724 else if ( BoundaryType == 2 )
726 { std::stringstream saux1 ;
727 saux1 << NumeBoundary << " " << x0 ;
728 saux += "FAXCen " + saux1.str() + "\n" ;
730 { std::stringstream saux1 ;
731 saux1 << NumeBoundary << " " << x1 ;
732 saux += "FAYCen " + saux1.str() + "\n" ;
734 { std::stringstream saux1 ;
735 saux1 << NumeBoundary << " " << x2 ;
736 saux += "FAZCen " + saux1.str() + "\n" ;
738 { std::stringstream saux1 ;
739 saux1 << NumeBoundary << " " << x3 ;
740 saux += "FARayon " + saux1.str() + "\n" ;
744 // Cas du cone defini par un axe et un angle
746 if ( BoundaryType == 3 )
748 { std::stringstream saux1 ;
749 saux1 << NumeBoundary << " " << x0 ;
750 saux += "FAXAxe " + saux1.str() + "\n" ;
752 { std::stringstream saux1 ;
753 saux1 << NumeBoundary << " " << x1 ;
754 saux += "FAYAxe " + saux1.str() + "\n" ;
756 { std::stringstream saux1 ;
757 saux1 << NumeBoundary << " " << x2 ;
758 saux += "FAZAxe " + saux1.str() + "\n" ;
760 { std::stringstream saux1 ;
761 saux1 << NumeBoundary << " " << x3 ;
762 saux += "FAAngle " + saux1.str() + "\n" ;
764 { std::stringstream saux1 ;
765 saux1 << NumeBoundary << " " << x4 ;
766 saux += "FAXCen " + saux1.str() + "\n" ;
768 { std::stringstream saux1 ;
769 saux1 << NumeBoundary << " " << x5 ;
770 saux += "FAYCen " + saux1.str() + "\n" ;
772 { std::stringstream saux1 ;
773 saux1 << NumeBoundary << " " << x6 ;
774 saux += "FAZCen " + saux1.str() + "\n" ;
778 // Cas du cone defini par les 2 rayons
780 if ( BoundaryType == 4 )
782 { std::stringstream saux1 ;
783 saux1 << NumeBoundary << " " << x0 ;
784 saux += "FAXCen " + saux1.str() + "\n" ;
786 { std::stringstream saux1 ;
787 saux1 << NumeBoundary << " " << x1 ;
788 saux += "FAYCen " + saux1.str() + "\n" ;
790 { std::stringstream saux1 ;
791 saux1 << NumeBoundary << " " << x2 ;
792 saux += "FAZCen " + saux1.str() + "\n" ;
794 { std::stringstream saux1 ;
795 saux1 << NumeBoundary << " " << x3 ;
796 saux += "FARayon " + saux1.str() + "\n" ;
798 { std::stringstream saux1 ;
799 saux1 << NumeBoundary << " " << x4 ;
800 saux += "FAXCen2 " + saux1.str() + "\n" ;
802 { std::stringstream saux1 ;
803 saux1 << NumeBoundary << " " << x5 ;
804 saux += "FAYCen2 " + saux1.str() + "\n" ;
806 { std::stringstream saux1 ;
807 saux1 << NumeBoundary << " " << x6 ;
808 saux += "FAZCen2 " + saux1.str() + "\n" ;
810 { std::stringstream saux1 ;
811 saux1 << NumeBoundary << " " << x7 ;
812 saux += "FARayon2 " + saux1.str() + "\n" ;
818 if ( BoundaryType == 5 )
820 { std::stringstream saux1 ;
821 saux1 << NumeBoundary << " " << x0 ;
822 saux2 = saux1.str() ;
823 saux += "FAXCen " + saux1.str() + "\n" ;
825 { std::stringstream saux1 ;
826 saux1 << NumeBoundary << " " << x1 ;
827 saux += "FAYCen " + saux1.str() + "\n" ;
829 { std::stringstream saux1 ;
830 saux1 << NumeBoundary << " " << x2 ;
831 saux += "FAZCen " + saux1.str() + "\n" ;
833 { std::stringstream saux1 ;
834 saux1 << NumeBoundary << " " << x3 ;
835 saux += "FAXAxe " + saux1.str() + "\n" ;
837 { std::stringstream saux1 ;
838 saux1 << NumeBoundary << " " << x4 ;
839 saux += "FAYAxe " + saux1.str() + "\n" ;
841 { std::stringstream saux1 ;
842 saux1 << NumeBoundary << " " << x5 ;
843 saux += "FAZAxe " + saux1.str() + "\n" ;
845 { std::stringstream saux1 ;
846 saux1 << NumeBoundary << " " << x6 ;
847 saux += "FARayon " + saux1.str() + "\n" ;
849 { std::stringstream saux1 ;
850 saux1 << NumeBoundary << " " << x7 ;
851 saux += "FARayon2 " + saux1.str() + "\n" ;
855 _Texte += saux + "#\n" ;
858 //===============================================================================
859 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
861 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
862 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
863 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
867 std::string saux, saux2 ;
868 std::stringstream saux1 ;
869 saux1 << NumeBoundary ;
870 saux2 = saux1.str() ;
871 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
873 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
874 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
876 _Texte += saux + "#\n" ;
879 //===============================================================================
880 // E. Les interpolations
881 //===============================================================================
882 // Les fichiers d'entree et de sortie des champs a interpoler
883 void HomardDriver::TexteFieldInterp( const std::string FieldFile, const std::string MeshFile )
885 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
887 _Texte += "#\n# Interpolations des champs\n" ;
890 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
892 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
894 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
896 //===============================================================================
897 // Tous les champs sont a interpoler
898 void HomardDriver::TexteFieldInterpAll( )
900 MESSAGE("TexteFieldInterpAll");
902 _Texte += "CCChaTou oui\n" ;
904 //===============================================================================
905 // Ecrit les caracteristiques de chaque interpolation sous la forme :
906 // CCChaNom 1 "DEPL" ! Nom du 1er champ a interpoler
907 // CCChaTIn 1 0 ! Mode d'interpolation : automatique
908 // CCChaNom 2 "VOLUME" ! Nom du 2nd champ a interpoler
909 // CCChaTIn 2 1 ! Mode d'interpolation : une variable extensive
910 // CCChaPdT 2 14 ! Pas de temps 14
911 // CCChaNuO 2 14 ! Numero d'ordre 14
914 // NumeChamp : numero d'ordre du champ a interpoler
915 // FieldName : nom du champ
916 // TypeInterp : type d'interpolation
917 // TimeStep : pas de temps retenu (>0 si pas de precision)
918 // Rank : numero d'ordre retenu
920 void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank)
922 MESSAGE("TexteFieldInterpNameType, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName<<", TypeInterp = "<<TypeInterp);
923 MESSAGE("TexteFieldInterpNameType, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
924 // Numero d'ordre du champ a interpoler
925 std::stringstream saux1 ;
927 std::string saux = saux1.str() ;
929 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
930 // Type d'interpolation pour le champ
931 _Texte +="CCChaTIn " + saux + " " + TypeInterp + "\n" ;
936 std::stringstream saux1 ;
938 _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ;
941 std::stringstream saux1 ;
943 _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ;
947 //===============================================================================
948 // F. Les options avancees
949 //===============================================================================
950 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
952 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
956 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
957 _Texte += "TypeElem ignore_pyra\n" ;
961 _Texte += "# Niveaux extremes\n" ;
962 { std::stringstream saux1 ;
964 _Texte += "NiveauMa " + saux1.str() + "\n" ;
969 _Texte += "# Diametre minimal\n" ;
970 { std::stringstream saux1 ;
972 _Texte += "DiametMi " + saux1.str() + "\n" ;
978 { _Texte += "# Raffinement" ; }
980 { _Texte += "# Deraffinement" ; }
981 _Texte += " des regions sans indicateur\n" ;
982 { std::stringstream saux1 ;
984 _Texte += "AdapInit " + saux1.str() + "\n" ;
987 if ( ExtraOutput % 2 == 0 )
989 _Texte += "# Sortie des niveaux de raffinement\n" ;
990 _Texte += "NCNiveau NIVEAU\n" ;
992 if ( ExtraOutput % 3 == 0 )
994 _Texte += "# Sortie des qualités des mailles\n" ;
995 _Texte += "NCQualit QUAL\n" ;
997 if ( ExtraOutput % 5 == 0 )
999 _Texte += "# Sortie des diamètres des mailles\n" ;
1000 _Texte += "NCDiamet DIAM\n" ;
1002 if ( ExtraOutput % 7 == 0 )
1004 _Texte += "# Sortie des parents des mailles\n" ;
1005 _Texte += "NCParent PARENT\n" ;
1007 if ( ExtraOutput % 11 == 0 )
1009 _Texte += "# Volumes voisins par recollement\n" ;
1010 _Texte += "NCVoisRc Voisin-Recollement\n" ;
1013 //===============================================================================
1015 //===============================================================================
1016 void HomardDriver::TexteInfoCompute( int MessInfo )
1018 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
1020 if ( MessInfo != 0 )
1022 _Texte += "# Messages d'informations\n" ;
1023 { std::stringstream saux1 ;
1025 _Texte += "MessInfo " + saux1.str() + "\n" ;
1029 //===============================================================================
1030 void HomardDriver::CreeFichier( )
1033 if ( _siter != _siterp1 )
1034 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
1036 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
1038 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
1039 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
1043 //===============================================================================
1044 // Creation du fichier de donnees pour l'information
1045 //===============================================================================
1046 void HomardDriver::CreeFichierDonn( )
1049 MESSAGE("CreeFichierDonn");
1050 _NomFichierDonn = "info.donn" ;
1056 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1057 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1061 //===============================================================================
1062 int HomardDriver::ExecuteHomard(int option)
1064 MESSAGE("ExecuteHomard, avec option = "<<option);
1065 std::string commande ;
1067 // Copie des Fichiers HOMARD
1068 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1069 codret = system(commande.c_str()) ;
1071 // Execution de HOMARD
1074 commande = _HOMARD_Exec.c_str() ;
1075 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1076 codret = system(commande.c_str());
1077 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1078 _NomFichierDonn = "" ;