1 // HOMARD HOMARD : implementaion of HOMARD idl descriptions
3 // Copyright (C) 2011-2012 CEA/DEN, EDF R&D
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 #include "Utils_SALOME_Exception.hxx"
27 #include "utilities.h"
28 #include "HomardDriver.hxx"
30 //=============================================================================
31 //=============================================================================
32 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
33 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
34 _NomFichierConf( "" ), _siter( "" ), _siterp1( "" ),
35 _Texte( "" ), _bLu( false )
37 // Memorisation du nom complet de l'executable HOMARD
38 char* dirchar; char* execchar;
40 std::string executable;
41 if ( !(dirchar = getenv("HOMARD_REP_EXE_PRIVATE")) )
42 { dirchar = getenv("HOMARD_REP_EXE") ; }
43 dir = std::string(dirchar);
44 MESSAGE("HomardDriver, dirchar ="<<dirchar<<", dir ="<<dir);
45 if ( !(execchar = getenv("HOMARD_EXE_PRIVATE")) )
46 { execchar = getenv("HOMARD_EXE"); }
47 executable = std::string(execchar);
48 MESSAGE("HomardDriver, execchar ="<<execchar<<", executable ="<<executable);
49 _HOMARD_Exec = dir + "/" + executable ;
50 MESSAGE("HomardDriver, _HOMARD_Exec ="<<_HOMARD_Exec);
56 //=============================================================================
57 //=============================================================================
58 HomardDriver::~HomardDriver()
62 ////=============================================================================
63 void HomardDriver::TexteInit( const std::string DirCompute, const std::string DirComputePa, const std::string MessFile )
65 MESSAGE("TexteInit, MessFile ="<<MessFile<<", DirCompute ="<<DirCompute<<", DirComputePa ="<<DirComputePa);
67 _Texte = "Action homa\n" ;
68 _Texte += "CCAssoci med\n" ;
69 _Texte += "ModeHOMA 1\n" ;
70 _Texte += "NumeIter " + _siter + "\n" ;
71 _Texte += "ListeStd \"" + MessFile + "\"\n" ;
72 _Texte += "# Maillages HOMARD \n" ;
73 _Texte += "HOMaiN__ Mai" + _siter + " \"" + DirComputePa + "/maill." + _siter + ".hom.med\"\n" ;
74 _Texte += "HOMaiNP1 Mai" + _siterp1 + " \"" + DirCompute + "/maill." + _siterp1 + ".hom.med\"\n" ;
75 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
76 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
80 ////=============================================================================
81 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
83 MESSAGE("TexteMaillage, NomMesh ="<<NomMesh<<", MeshFile ="<<MeshFile);
86 if ( apres < 1 ) { saux = "__" ; }
88 _Texte += "# Maillages Med " + saux + "\n" ;
89 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
90 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
93 ////=============================================================================
94 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
96 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
97 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
111 saux = "non_conforme_1_noeud" ;
116 saux = "non_conforme_1_arete" ;
121 saux = "non_conforme_indicateur" ;
125 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
127 // Type de raffinement/deraffinement
129 if ( TypeAdap == -1 )
133 saux = "TypeRaff uniforme\n" ;
137 saux = "TypeRaff non\n" ;
141 saux += "TypeDera uniforme" ;
145 saux += "TypeDera non" ;
152 saux = "TypeRaff libre\n" ;
156 saux = "TypeRaff non\n" ;
160 saux += "TypeDera libre" ;
164 saux += "TypeDera non" ;
167 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
169 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
171 ////=============================================================================
172 void HomardDriver::TexteCompo( int NumeComp, const std::string NompCompo)
174 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NompCompo = "<<NompCompo);
175 _Texte +="CCCoChaI \"" + NompCompo + "\"\n" ;
178 ////=============================================================================
179 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 )
181 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
182 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
184 std::string saux, saux2 ;
187 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
188 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
189 // Attention a mettre le bon signe a ZoneTypeHOMARD :
190 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
191 // <0 signifie que l'on deraffinera
194 if ( ZoneType >= 11 and ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
195 else if ( ZoneType >= 31 and ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
196 else if ( ZoneType >= 61 and ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
197 else { ZoneTypeHOMARD = ZoneType ; }
199 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
201 std::stringstream saux1 ;
203 saux2 = saux1.str() ;
204 saux = "#\n# Zone numero " + saux2 + "\n" ;
206 { std::stringstream saux1 ;
207 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
208 saux2 = saux1.str() ;
209 saux += "ZoRaType " + saux2 + "\n" ;
214 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
215 // Y Homard <=> Y Salome
217 saux += "#Rectangle\n" ;
218 { std::stringstream saux1 ;
219 saux1 << NumeZone << " " << x0 ;
220 saux2 = saux1.str() ;
221 saux += "ZoRaXmin " + saux2 + "\n" ;
223 { std::stringstream saux1 ;
224 saux1 << NumeZone << " " << x1 ;
225 saux2 = saux1.str() ;
226 saux += "ZoRaXmax " + saux2 + "\n" ;
228 { std::stringstream saux1 ;
229 saux1 << NumeZone << " " << x2 ;
230 saux2 = saux1.str() ;
231 saux += "ZoRaYmin " + saux2 + "\n" ;
233 { std::stringstream saux1 ;
234 saux1 << NumeZone << " " << x3 ;
235 saux2 = saux1.str() ;
236 saux += "ZoRaYmax " + saux2 + "\n" ;
240 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
241 // Y Homard <=> Z Salome
243 saux += "#Rectangle\n" ;
244 { std::stringstream saux1 ;
245 saux1 << NumeZone << " " << x2 ;
246 saux2 = saux1.str() ;
247 saux += "ZoRaXmin " + saux2 + "\n" ;
249 { std::stringstream saux1 ;
250 saux1 << NumeZone << " " << x3 ;
251 saux2 = saux1.str() ;
252 saux += "ZoRaXmax " + saux2 + "\n" ;
254 { std::stringstream saux1 ;
255 saux1 << NumeZone << " " << x4 ;
256 saux2 = saux1.str() ;
257 saux += "ZoRaYmin " + saux2 + "\n" ;
259 { std::stringstream saux1 ;
260 saux1 << NumeZone << " " << x5 ;
261 saux2 = saux1.str() ;
262 saux += "ZoRaYmax " + saux2 + "\n" ;
266 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
267 // Y Homard <=> Z Salome
269 saux += "#Rectangle\n" ;
270 { std::stringstream saux1 ;
271 saux1 << NumeZone << " " << x0 ;
272 saux2 = saux1.str() ;
273 saux += "ZoRaXmin " + saux2 + "\n" ;
275 { std::stringstream saux1 ;
276 saux1 << NumeZone << " " << x1 ;
277 saux2 = saux1.str() ;
278 saux += "ZoRaXmax " + saux2 + "\n" ;
280 { std::stringstream saux1 ;
281 saux1 << NumeZone << " " << x4 ;
282 saux2 = saux1.str() ;
283 saux += "ZoRaYmin " + saux2 + "\n" ;
285 { std::stringstream saux1 ;
286 saux1 << NumeZone << " " << x5 ;
287 saux2 = saux1.str() ;
288 saux += "ZoRaYmax " + saux2 + "\n" ;
292 // Cas du parallelepipede
294 else if ( ZoneType == 2 )
296 saux += "# Boite\n" ;
297 { std::stringstream saux1 ;
298 saux1 << NumeZone << " " << x0 ;
299 saux2 = saux1.str() ;
300 saux += "ZoRaXmin " + saux2 + "\n" ;
302 { std::stringstream saux1 ;
303 saux1 << NumeZone << " " << x1 ;
304 saux2 = saux1.str() ;
305 saux += "ZoRaXmax " + saux2 + "\n" ;
307 { std::stringstream saux1 ;
308 saux1 << NumeZone << " " << x2 ;
309 saux2 = saux1.str() ;
310 saux += "ZoRaYmin " + saux2 + "\n" ;
312 { std::stringstream saux1 ;
313 saux1 << NumeZone << " " << x3 ;
314 saux2 = saux1.str() ;
315 saux += "ZoRaYmax " + saux2 + "\n" ;
317 { std::stringstream saux1 ;
318 saux1 << NumeZone << " " << x4 ;
319 saux2 = saux1.str() ;
320 saux += "ZoRaZmin " + saux2 + "\n" ;
322 { std::stringstream saux1 ;
323 saux1 << NumeZone << " " << x5 ;
324 saux2 = saux1.str() ;
325 saux += "ZoRaZmax " + saux2 + "\n" ;
331 else if ( ZoneType == 31 or ZoneType == 61 )
333 saux += "# Sphere\n" ;
334 { std::stringstream saux1 ;
335 saux1 << NumeZone << " " << x0 ;
336 saux2 = saux1.str() ;
337 saux += "ZoRaXCen " + saux2 + "\n" ;
339 { std::stringstream saux1 ;
340 saux1 << NumeZone << " " << x1 ;
341 saux2 = saux1.str() ;
342 saux += "ZoRaYCen " + saux2 + "\n" ;
344 { std::stringstream saux1 ;
345 saux1 << NumeZone << " " << x6 ;
346 saux2 = saux1.str() ;
347 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
348 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
350 if ( ZoneType == 61 )
351 { std::stringstream saux1 ;
352 saux1 << NumeZone << " " << x8 ;
353 saux2 = saux1.str() ;
354 saux += "ZoRaRayI " + saux2 + "\n" ;
357 else if ( ZoneType == 32 or ZoneType == 62 )
359 saux += "# Sphere\n" ;
360 { std::stringstream saux1 ;
361 saux1 << NumeZone << " " << x1 ;
362 saux2 = saux1.str() ;
363 saux += "ZoRaXCen " + saux2 + "\n" ;
365 { std::stringstream saux1 ;
366 saux1 << NumeZone << " " << x2 ;
367 saux2 = saux1.str() ;
368 saux += "ZoRaYCen " + saux2 + "\n" ;
370 { std::stringstream saux1 ;
371 saux1 << NumeZone << " " << x6 ;
372 saux2 = saux1.str() ;
373 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
374 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
376 if ( ZoneType == 62 )
377 { std::stringstream saux1 ;
378 saux1 << NumeZone << " " << x8 ;
379 saux2 = saux1.str() ;
380 saux += "ZoRaRayI " + saux2 + "\n" ;
383 else if ( ZoneType == 33 or ZoneType == 63 )
385 saux += "# Sphere\n" ;
386 { std::stringstream saux1 ;
387 saux1 << NumeZone << " " << x0 ;
388 saux2 = saux1.str() ;
389 saux += "ZoRaXCen " + saux2 + "\n" ;
391 { std::stringstream saux1 ;
392 saux1 << NumeZone << " " << x2 ;
393 saux2 = saux1.str() ;
394 saux += "ZoRaYCen " + saux2 + "\n" ;
396 { std::stringstream saux1 ;
397 saux1 << NumeZone << " " << x6 ;
398 saux2 = saux1.str() ;
399 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
400 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
402 if ( ZoneType == 63 )
403 { std::stringstream saux1 ;
404 saux1 << NumeZone << " " << x8 ;
405 saux2 = saux1.str() ;
406 saux += "ZoRaRayI " + saux2 + "\n" ;
412 else if ( ZoneType == 4 )
414 saux += "# Sphere\n" ;
415 { std::stringstream saux1 ;
416 saux1 << NumeZone << " " << x0 ;
417 saux2 = saux1.str() ;
418 saux += "ZoRaXCen " + saux2 + "\n" ;
420 { std::stringstream saux1 ;
421 saux1 << NumeZone << " " << x1 ;
422 saux2 = saux1.str() ;
423 saux += "ZoRaYCen " + saux2 + "\n" ;
425 { std::stringstream saux1 ;
426 saux1 << NumeZone << " " << x2 ;
427 saux2 = saux1.str() ;
428 saux += "ZoRaZCen " + saux2 + "\n" ;
430 { std::stringstream saux1 ;
431 saux1 << NumeZone << " " << x3 ;
432 saux2 = saux1.str() ;
433 saux += "ZoRaRayo " + saux2 + "\n" ;
437 // Cas du cylindre ou du tuyau
439 else if ( ZoneType == 5 or ZoneType == 7 )
441 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
442 else { saux += "# Tuyau\n" ; }
443 { std::stringstream saux1 ;
444 saux1 << NumeZone << " " << x0 ;
445 saux2 = saux1.str() ;
446 saux += "ZoRaXBas " + saux2 + "\n" ;
448 { std::stringstream saux1 ;
449 saux1 << NumeZone << " " << x1 ;
450 saux2 = saux1.str() ;
451 saux += "ZoRaYBas " + saux2 + "\n" ;
453 { std::stringstream saux1 ;
454 saux1 << NumeZone << " " << x2 ;
455 saux2 = saux1.str() ;
456 saux += "ZoRaZBas " + saux2 + "\n" ;
458 { std::stringstream saux1 ;
459 saux1 << NumeZone << " " << x3 ;
460 saux2 = saux1.str() ;
461 saux += "ZoRaXAxe " + saux2 + "\n" ;
463 { std::stringstream saux1 ;
464 saux1 << NumeZone << " " << x4 ;
465 saux2 = saux1.str() ;
466 saux += "ZoRaYAxe " + saux2 + "\n" ;
468 { std::stringstream saux1 ;
469 saux1 << NumeZone << " " << x5 ;
470 saux2 = saux1.str() ;
471 saux += "ZoRaZAxe " + saux2 + "\n" ;
473 { std::stringstream saux1 ;
474 saux1 << NumeZone << " " << x6 ;
475 saux2 = saux1.str() ;
476 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
477 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
479 { std::stringstream saux1 ;
480 saux1 << NumeZone << " " << x7 ;
481 saux2 = saux1.str() ;
482 saux += "ZoRaHaut " + saux2 + "\n" ;
485 { std::stringstream saux1 ;
486 saux1 << NumeZone << " " << x8 ;
487 saux2 = saux1.str() ;
488 saux += "ZoRaRayI " + saux2 + "\n" ;
492 _Texte += saux + "#\n" ;
494 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
497 ////=============================================================================
498 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
499 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
500 int UsField, int UsCmpI )
502 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
503 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
505 std::string saux, saux2 ;
508 _Texte += "# Champ d'indicateurs\n" ;
509 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
510 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
512 // Cas ou on prend le dernier pas de temps
513 if ( TimeStep == -2 )
514 { _Texte += "CCNumPTI Last\n" ; }
515 // Cas avec pas de temps
516 else if ( TimeStep >= 0 )
519 std::stringstream saux1 ;
521 saux2 = saux1.str() ;
522 _Texte += "CCNumPTI " + saux2 + "\n" ;
525 std::stringstream saux1 ;
527 saux2 = saux1.str() ;
528 _Texte += "CCNumOrI " + saux2 + "\n" ;
543 std::stringstream saux1 ;
545 saux2 = saux1.str() ;
546 _Texte += "Seuil" + saux + " " + saux2 + "\n" ;
560 std::stringstream saux1 ;
562 saux2 = saux1.str() ;
563 _Texte += "Seuil" + saux + " " + saux2 + "\n" ;
568 { saux = "MAILLE" ; }
573 _Texte += "CCModeFI " + saux + "\n" ;
580 { saux = "INFINI" ; }
582 { saux = "V_RELATIVE" ; }
585 _Texte += "CCUsCmpI " + saux + "\n" ;
589 ////=============================================================================
590 void HomardDriver::TexteGroup( const std::string GroupName )
592 MESSAGE("TexteGroup, GroupName = "<<GroupName);
594 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
597 ////=============================================================================
598 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
600 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
602 // Type de suivi de frontiere
604 std::stringstream saux1 ;
605 saux1 << BoundaryOption ;
606 std::string saux = saux1.str() ;
607 _Texte += "SuivFron " + saux + "\n" ;
610 ////=============================================================================
611 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
613 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
614 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
616 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
617 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
620 ////=============================================================================
621 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
623 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
625 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
628 ////=============================================================================
629 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 )
631 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
632 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
633 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
634 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6);
636 std::string saux, saux2 ;
640 std::stringstream saux1 ;
641 saux1 << NumeBoundary ;
642 saux2 = saux1.str() ;
643 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
644 if ( BoundaryType == 1 )
645 { saux += "# Cylindre\n" ; }
646 if ( BoundaryType == 2 )
647 { saux += "# Sphere\n" ; }
649 // Le nom de la frontiere
651 { std::stringstream saux1 ;
652 saux1 << NumeBoundary ;
653 saux2 = saux1.str() ;
654 saux += "FANom " + saux2 + " \"" + NameBoundary + "\"\n" ;
659 { std::stringstream saux1 ;
660 saux1 << NumeBoundary << " " << BoundaryType ;
661 saux2 = saux1.str() ;
662 saux += "FAType " + saux2 + "\n" ;
667 if ( BoundaryType == 1 )
669 { std::stringstream saux1 ;
670 saux1 << NumeBoundary << " " << x0 ;
671 saux2 = saux1.str() ;
672 saux += "FAXCen " + saux2 + "\n" ;
674 { std::stringstream saux1 ;
675 saux1 << NumeBoundary << " " << x1 ;
676 saux2 = saux1.str() ;
677 saux += "FAYCen " + saux2 + "\n" ;
679 { std::stringstream saux1 ;
680 saux1 << NumeBoundary << " " << x2 ;
681 saux2 = saux1.str() ;
682 saux += "FAZCen " + saux2 + "\n" ;
684 { std::stringstream saux1 ;
685 saux1 << NumeBoundary << " " << x3 ;
686 saux2 = saux1.str() ;
687 saux += "FAXAxe " + saux2 + "\n" ;
689 { std::stringstream saux1 ;
690 saux1 << NumeBoundary << " " << x4 ;
691 saux2 = saux1.str() ;
692 saux += "FAYAxe " + saux2 + "\n" ;
694 { std::stringstream saux1 ;
695 saux1 << NumeBoundary << " " << x5 ;
696 saux2 = saux1.str() ;
697 saux += "FAZAxe " + saux2 + "\n" ;
699 { std::stringstream saux1 ;
700 saux1 << NumeBoundary << " " << x6 ;
701 saux2 = saux1.str() ;
702 saux += "FARayon " + saux2 + "\n" ;
708 else if ( BoundaryType == 2 )
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 += "FARayon " + saux2 + "\n" ;
732 _Texte += saux + "#\n" ;
735 ////=============================================================================
736 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
738 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
739 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
740 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
744 std::string saux, saux2 ;
745 std::stringstream saux1 ;
746 saux1 << NumeBoundary ;
747 saux2 = saux1.str() ;
748 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
750 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
751 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
753 _Texte += saux + "#\n" ;
756 ////=============================================================================
757 void HomardDriver::TexteFieldInterp( int TypeFieldInterp, const std::string FieldFile, const std::string MeshFile, int TimeStep, int Rank )
759 MESSAGE("TexteFieldInterp, TypeFieldInterp = "<<TypeFieldInterp);
760 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
761 MESSAGE("TexteFieldInterp, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
763 // Type d'interpolation
765 _Texte += "# Interpolations des champs\n" ;
766 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
767 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
768 if ( TypeFieldInterp == 1 )
770 _Texte += "CCChaTou oui\n" ;
773 _TimeStep = TimeStep ;
776 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
778 ////=============================================================================
779 void HomardDriver::TexteFieldInterpName( int NumeChamp, const std::string FieldName)
781 MESSAGE("TexteFieldInterpName, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName);
782 std::stringstream saux1 ;
783 saux1 << NumeChamp+1 ;
784 std::string saux = saux1.str() ;
785 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
787 MESSAGE("TexteFieldInterpName, _TimeStep = "<<_TimeStep<<", _Rank = "<<_Rank);
788 if ( _TimeStep >= 0 )
791 std::stringstream saux1 ;
793 std::string saux2 = saux1.str() ;
794 _Texte += "CCChaPdT " + saux + " " + saux2 + "\n" ;
797 std::stringstream saux1 ;
799 std::string saux2 = saux1.str() ;
800 _Texte += "CCChaNuO " + saux + " " + saux2 + "\n" ;
804 ////=============================================================================
805 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput )
807 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", LevelOutput ="<<LevelOutput);
812 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
813 _Texte += "TypeElem ignore_pyra\n" ;
817 _Texte += "# Niveaux extremes\n" ;
818 { std::stringstream saux1 ;
820 std::string saux2 = saux1.str() ;
821 _Texte += "NiveauMa " + saux2 + "\n" ;
826 _Texte += "# Diametre minimal\n" ;
827 { std::stringstream saux1 ;
829 std::string saux2 = saux1.str() ;
830 _Texte += "DiametMi " + saux2 + "\n" ;
836 { _Texte += "# Raffinement" ; }
838 { _Texte += "# Deraffinement" ; }
839 _Texte += " des regions sans indicateur\n" ;
840 { std::stringstream saux1 ;
842 std::string saux2 = saux1.str() ;
843 _Texte += "AdapInit " + saux2 + "\n" ;
846 if ( LevelOutput != 0 )
848 _Texte += "# Sortie des niveaux de raffinement\n" ;
849 _Texte += "NCNiveau NIVEAU\n" ;
853 ////=============================================================================
854 void HomardDriver::CreeFichier( )
857 _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ;
859 std::ofstream FicConf(_NomFichierConf.c_str(), std::ios::out ) ;
860 if (FicConf.is_open() == true)
862 FicConf << _Texte << std::endl ;
868 ////=============================================================================
869 int HomardDriver::ExecuteHomard()
871 // Copie des Fichiers HOMARD
872 std::string commande= "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
873 system(commande.c_str());
875 MESSAGE("ExecuteHomard");
876 int codret = system(_HOMARD_Exec.c_str()) ;
879 // GERALD -- QMESSAGE BOX
880 MESSAGE ( "Erreur en executant HOMARD : " << codret );
881 // ASSERT("Erreur en executant HOMARD" == 0);