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" ;
79 ////=============================================================================
80 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
82 MESSAGE("TexteMaillage, NomMesh ="<<NomMesh<<", MeshFile ="<<MeshFile);
85 if ( apres < 1 ) { saux = "__" ; }
87 _Texte += "# Maillages Med " + saux + "\n" ;
88 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
89 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
92 ////=============================================================================
93 void HomardDriver::TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera )
95 MESSAGE("TexteConfRaffDera, ConfType ="<<ConfType);
96 MESSAGE("TexteConfRaffDera, TypeAdap ="<<TypeAdap<<", TypeRaff ="<<TypeRaff<<", TypeDera ="<<TypeDera);
110 saux = "non_conforme_1_noeud" ;
115 saux = "non_conforme_1_arete" ;
120 saux = "non_conforme_indicateur" ;
124 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
126 // Type de raffinement/deraffinement
128 if ( TypeAdap == -1 )
132 saux = "TypeRaff uniforme\n" ;
136 saux = "TypeRaff non\n" ;
140 saux += "TypeDera uniforme" ;
144 saux += "TypeDera non" ;
151 saux = "TypeRaff libre\n" ;
155 saux = "TypeRaff non\n" ;
159 saux += "TypeDera libre" ;
163 saux += "TypeDera non" ;
166 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
168 // MESSAGE("A la fin de HomardDriver::TexteConfRaffDera, _Texte ="<<_Texte);
170 ////=============================================================================
171 void HomardDriver::TexteCompo( int NumeComp, const std::string NompCompo)
173 MESSAGE("TexteCompo, NumeComp = "<<NumeComp<<", NompCompo = "<<NompCompo);
174 _Texte +="CCCoChaI \"" + NompCompo + "\"\n" ;
177 ////=============================================================================
178 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 )
180 MESSAGE("TexteZone, NumeZone = "<<NumeZone<<", ZoneType = "<<ZoneType<<", TypeUse = "<<TypeUse);
181 MESSAGE("TexteZone, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
183 std::string saux, saux2 ;
186 // On convertit le type de zone au sens du module HOMARD dans Salome, ZoneType, dans le
187 // type au sens de l'executable HOMARD, ZoneTypeHOMARD
188 // Attention a mettre le bon signe a ZoneTypeHOMARD :
189 // >0 signifie que l'on raffinera les mailles contenues dans la zone,
190 // <0 signifie que l'on deraffinera
193 if ( ZoneType >= 11 and ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; }
194 else if ( ZoneType >= 31 and ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; }
195 else if ( ZoneType >= 61 and ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; }
196 else { ZoneTypeHOMARD = ZoneType ; }
198 if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; }
200 std::stringstream saux1 ;
202 saux2 = saux1.str() ;
203 saux = "#\n# Zone numero " + saux2 + "\n" ;
205 { std::stringstream saux1 ;
206 saux1 << NumeZone << " " << ZoneTypeHOMARD ;
207 saux2 = saux1.str() ;
208 saux += "ZoRaType " + saux2 + "\n" ;
213 if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome
214 // Y Homard <=> Y Salome
216 saux += "#Rectangle\n" ;
217 { std::stringstream saux1 ;
218 saux1 << NumeZone << " " << x0 ;
219 saux2 = saux1.str() ;
220 saux += "ZoRaXmin " + saux2 + "\n" ;
222 { std::stringstream saux1 ;
223 saux1 << NumeZone << " " << x1 ;
224 saux2 = saux1.str() ;
225 saux += "ZoRaXmax " + saux2 + "\n" ;
227 { std::stringstream saux1 ;
228 saux1 << NumeZone << " " << x2 ;
229 saux2 = saux1.str() ;
230 saux += "ZoRaYmin " + saux2 + "\n" ;
232 { std::stringstream saux1 ;
233 saux1 << NumeZone << " " << x3 ;
234 saux2 = saux1.str() ;
235 saux += "ZoRaYmax " + saux2 + "\n" ;
239 else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome
240 // Y Homard <=> Z Salome
242 saux += "#Rectangle\n" ;
243 { std::stringstream saux1 ;
244 saux1 << NumeZone << " " << x2 ;
245 saux2 = saux1.str() ;
246 saux += "ZoRaXmin " + saux2 + "\n" ;
248 { std::stringstream saux1 ;
249 saux1 << NumeZone << " " << x3 ;
250 saux2 = saux1.str() ;
251 saux += "ZoRaXmax " + saux2 + "\n" ;
253 { std::stringstream saux1 ;
254 saux1 << NumeZone << " " << x4 ;
255 saux2 = saux1.str() ;
256 saux += "ZoRaYmin " + saux2 + "\n" ;
258 { std::stringstream saux1 ;
259 saux1 << NumeZone << " " << x5 ;
260 saux2 = saux1.str() ;
261 saux += "ZoRaYmax " + saux2 + "\n" ;
265 else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome
266 // Y Homard <=> Z Salome
268 saux += "#Rectangle\n" ;
269 { std::stringstream saux1 ;
270 saux1 << NumeZone << " " << x0 ;
271 saux2 = saux1.str() ;
272 saux += "ZoRaXmin " + saux2 + "\n" ;
274 { std::stringstream saux1 ;
275 saux1 << NumeZone << " " << x1 ;
276 saux2 = saux1.str() ;
277 saux += "ZoRaXmax " + saux2 + "\n" ;
279 { std::stringstream saux1 ;
280 saux1 << NumeZone << " " << x4 ;
281 saux2 = saux1.str() ;
282 saux += "ZoRaYmin " + saux2 + "\n" ;
284 { std::stringstream saux1 ;
285 saux1 << NumeZone << " " << x5 ;
286 saux2 = saux1.str() ;
287 saux += "ZoRaYmax " + saux2 + "\n" ;
291 // Cas du parallelepipede
293 else if ( ZoneType == 2 )
295 saux += "# Boite\n" ;
296 { std::stringstream saux1 ;
297 saux1 << NumeZone << " " << x0 ;
298 saux2 = saux1.str() ;
299 saux += "ZoRaXmin " + saux2 + "\n" ;
301 { std::stringstream saux1 ;
302 saux1 << NumeZone << " " << x1 ;
303 saux2 = saux1.str() ;
304 saux += "ZoRaXmax " + saux2 + "\n" ;
306 { std::stringstream saux1 ;
307 saux1 << NumeZone << " " << x2 ;
308 saux2 = saux1.str() ;
309 saux += "ZoRaYmin " + saux2 + "\n" ;
311 { std::stringstream saux1 ;
312 saux1 << NumeZone << " " << x3 ;
313 saux2 = saux1.str() ;
314 saux += "ZoRaYmax " + saux2 + "\n" ;
316 { std::stringstream saux1 ;
317 saux1 << NumeZone << " " << x4 ;
318 saux2 = saux1.str() ;
319 saux += "ZoRaZmin " + saux2 + "\n" ;
321 { std::stringstream saux1 ;
322 saux1 << NumeZone << " " << x5 ;
323 saux2 = saux1.str() ;
324 saux += "ZoRaZmax " + saux2 + "\n" ;
330 else if ( ZoneType == 31 or ZoneType == 61 )
332 saux += "# Sphere\n" ;
333 { std::stringstream saux1 ;
334 saux1 << NumeZone << " " << x0 ;
335 saux2 = saux1.str() ;
336 saux += "ZoRaXCen " + saux2 + "\n" ;
338 { std::stringstream saux1 ;
339 saux1 << NumeZone << " " << x1 ;
340 saux2 = saux1.str() ;
341 saux += "ZoRaYCen " + saux2 + "\n" ;
343 { std::stringstream saux1 ;
344 saux1 << NumeZone << " " << x6 ;
345 saux2 = saux1.str() ;
346 if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
347 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
349 if ( ZoneType == 61 )
350 { std::stringstream saux1 ;
351 saux1 << NumeZone << " " << x8 ;
352 saux2 = saux1.str() ;
353 saux += "ZoRaRayI " + saux2 + "\n" ;
356 else if ( ZoneType == 32 or ZoneType == 62 )
358 saux += "# Sphere\n" ;
359 { std::stringstream saux1 ;
360 saux1 << NumeZone << " " << x1 ;
361 saux2 = saux1.str() ;
362 saux += "ZoRaXCen " + saux2 + "\n" ;
364 { std::stringstream saux1 ;
365 saux1 << NumeZone << " " << x2 ;
366 saux2 = saux1.str() ;
367 saux += "ZoRaYCen " + saux2 + "\n" ;
369 { std::stringstream saux1 ;
370 saux1 << NumeZone << " " << x6 ;
371 saux2 = saux1.str() ;
372 if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
373 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
375 if ( ZoneType == 62 )
376 { std::stringstream saux1 ;
377 saux1 << NumeZone << " " << x8 ;
378 saux2 = saux1.str() ;
379 saux += "ZoRaRayI " + saux2 + "\n" ;
382 else if ( ZoneType == 33 or ZoneType == 63 )
384 saux += "# Sphere\n" ;
385 { std::stringstream saux1 ;
386 saux1 << NumeZone << " " << x0 ;
387 saux2 = saux1.str() ;
388 saux += "ZoRaXCen " + saux2 + "\n" ;
390 { std::stringstream saux1 ;
391 saux1 << NumeZone << " " << x2 ;
392 saux2 = saux1.str() ;
393 saux += "ZoRaYCen " + saux2 + "\n" ;
395 { std::stringstream saux1 ;
396 saux1 << NumeZone << " " << x6 ;
397 saux2 = saux1.str() ;
398 if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; }
399 else { saux += "ZoRaRayo " + saux2 + "\n" ; }
401 if ( ZoneType == 63 )
402 { std::stringstream saux1 ;
403 saux1 << NumeZone << " " << x8 ;
404 saux2 = saux1.str() ;
405 saux += "ZoRaRayI " + saux2 + "\n" ;
411 else if ( ZoneType == 4 )
413 saux += "# Sphere\n" ;
414 { std::stringstream saux1 ;
415 saux1 << NumeZone << " " << x0 ;
416 saux2 = saux1.str() ;
417 saux += "ZoRaXCen " + saux2 + "\n" ;
419 { std::stringstream saux1 ;
420 saux1 << NumeZone << " " << x1 ;
421 saux2 = saux1.str() ;
422 saux += "ZoRaYCen " + saux2 + "\n" ;
424 { std::stringstream saux1 ;
425 saux1 << NumeZone << " " << x2 ;
426 saux2 = saux1.str() ;
427 saux += "ZoRaZCen " + saux2 + "\n" ;
429 { std::stringstream saux1 ;
430 saux1 << NumeZone << " " << x3 ;
431 saux2 = saux1.str() ;
432 saux += "ZoRaRayo " + saux2 + "\n" ;
436 // Cas du cylindre ou du tuyau
438 else if ( ZoneType == 5 or ZoneType == 7 )
440 if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; }
441 else { saux += "# Tuyau\n" ; }
442 { std::stringstream saux1 ;
443 saux1 << NumeZone << " " << x0 ;
444 saux2 = saux1.str() ;
445 saux += "ZoRaXBas " + saux2 + "\n" ;
447 { std::stringstream saux1 ;
448 saux1 << NumeZone << " " << x1 ;
449 saux2 = saux1.str() ;
450 saux += "ZoRaYBas " + saux2 + "\n" ;
452 { std::stringstream saux1 ;
453 saux1 << NumeZone << " " << x2 ;
454 saux2 = saux1.str() ;
455 saux += "ZoRaZBas " + saux2 + "\n" ;
457 { std::stringstream saux1 ;
458 saux1 << NumeZone << " " << x3 ;
459 saux2 = saux1.str() ;
460 saux += "ZoRaXAxe " + saux2 + "\n" ;
462 { std::stringstream saux1 ;
463 saux1 << NumeZone << " " << x4 ;
464 saux2 = saux1.str() ;
465 saux += "ZoRaYAxe " + saux2 + "\n" ;
467 { std::stringstream saux1 ;
468 saux1 << NumeZone << " " << x5 ;
469 saux2 = saux1.str() ;
470 saux += "ZoRaZAxe " + saux2 + "\n" ;
472 { std::stringstream saux1 ;
473 saux1 << NumeZone << " " << x6 ;
474 saux2 = saux1.str() ;
475 if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; }
476 else { saux += "ZoRaRayE " + saux2 + "\n" ; }
478 { std::stringstream saux1 ;
479 saux1 << NumeZone << " " << x7 ;
480 saux2 = saux1.str() ;
481 saux += "ZoRaHaut " + saux2 + "\n" ;
484 { std::stringstream saux1 ;
485 saux1 << NumeZone << " " << x8 ;
486 saux2 = saux1.str() ;
487 saux += "ZoRaRayI " + saux2 + "\n" ;
491 _Texte += saux + "#\n" ;
493 // MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte);
496 ////=============================================================================
497 void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank,
498 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
499 int UsField, int UsCmpI )
501 MESSAGE("TexteField, FieldName = "<<FieldName<<", FieldFile = "<<FieldFile);
502 MESSAGE("TexteField, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
504 std::string saux, saux2 ;
507 _Texte += "# Champ d'indicateurs\n" ;
508 _Texte += "CCIndica \"" + FieldFile + "\"\n" ;
509 _Texte += "CCNoChaI \"" + FieldName + "\"\n" ;
511 // Cas ou on prend le dernier pas de temps
512 if ( TimeStep == -2 )
513 { _Texte += "CCNumPTI Last\n" ; }
514 // Cas avec pas de temps
515 else if ( TimeStep >= 0 )
518 std::stringstream saux1 ;
520 saux2 = saux1.str() ;
521 _Texte += "CCNumPTI " + saux2 + "\n" ;
524 std::stringstream saux1 ;
526 saux2 = saux1.str() ;
527 _Texte += "CCNumOrI " + saux2 + "\n" ;
542 std::stringstream saux1 ;
544 saux2 = saux1.str() ;
545 _Texte += "Seuil" + saux + " " + saux2 + "\n" ;
559 std::stringstream saux1 ;
561 saux2 = saux1.str() ;
562 _Texte += "Seuil" + saux + " " + saux2 + "\n" ;
567 { saux = "MAILLE" ; }
572 _Texte += "CCModeFI " + saux + "\n" ;
579 { saux = "INFINI" ; }
581 { saux = "V_RELATIVE" ; }
584 _Texte += "CCUsCmpI " + saux + "\n" ;
588 ////=============================================================================
589 void HomardDriver::TexteGroup( const std::string GroupName )
591 MESSAGE("TexteGroup, GroupName = "<<GroupName);
593 _Texte += "CCGroAda \"" + GroupName + "\"\n" ;
596 ////=============================================================================
597 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
599 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
601 // Type de suivi de frontiere
603 std::stringstream saux1 ;
604 saux1 << BoundaryOption ;
605 std::string saux = saux1.str() ;
606 _Texte += "SuivFron " + saux + "\n" ;
609 ////=============================================================================
610 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
612 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
613 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
615 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
616 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
619 ////=============================================================================
620 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
622 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
624 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
627 ////=============================================================================
628 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 )
630 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
631 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
632 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
633 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6);
635 std::string saux, saux2 ;
639 std::stringstream saux1 ;
640 saux1 << NumeBoundary ;
641 saux2 = saux1.str() ;
642 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
643 if ( BoundaryType == 1 )
644 { saux += "# Cylindre\n" ; }
645 if ( BoundaryType == 2 )
646 { saux += "# Sphere\n" ; }
648 // Le nom de la frontiere
650 { std::stringstream saux1 ;
651 saux1 << NumeBoundary ;
652 saux2 = saux1.str() ;
653 saux += "FANom " + saux2 + " \"" + NameBoundary + "\"\n" ;
658 { std::stringstream saux1 ;
659 saux1 << NumeBoundary << " " << BoundaryType ;
660 saux2 = saux1.str() ;
661 saux += "FAType " + saux2 + "\n" ;
666 if ( BoundaryType == 1 )
668 { std::stringstream saux1 ;
669 saux1 << NumeBoundary << " " << x0 ;
670 saux2 = saux1.str() ;
671 saux += "FAXCen " + saux2 + "\n" ;
673 { std::stringstream saux1 ;
674 saux1 << NumeBoundary << " " << x1 ;
675 saux2 = saux1.str() ;
676 saux += "FAYCen " + saux2 + "\n" ;
678 { std::stringstream saux1 ;
679 saux1 << NumeBoundary << " " << x2 ;
680 saux2 = saux1.str() ;
681 saux += "FAZCen " + saux2 + "\n" ;
683 { std::stringstream saux1 ;
684 saux1 << NumeBoundary << " " << x3 ;
685 saux2 = saux1.str() ;
686 saux += "FAXAxe " + saux2 + "\n" ;
688 { std::stringstream saux1 ;
689 saux1 << NumeBoundary << " " << x4 ;
690 saux2 = saux1.str() ;
691 saux += "FAYAxe " + saux2 + "\n" ;
693 { std::stringstream saux1 ;
694 saux1 << NumeBoundary << " " << x5 ;
695 saux2 = saux1.str() ;
696 saux += "FAZAxe " + saux2 + "\n" ;
698 { std::stringstream saux1 ;
699 saux1 << NumeBoundary << " " << x6 ;
700 saux2 = saux1.str() ;
701 saux += "FARayon " + saux2 + "\n" ;
707 else if ( BoundaryType == 2 )
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 += "FARayon " + saux2 + "\n" ;
731 _Texte += saux + "#\n" ;
734 ////=============================================================================
735 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
737 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
738 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
739 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
743 std::string saux, saux2 ;
744 std::stringstream saux1 ;
745 saux1 << NumeBoundary ;
746 saux2 = saux1.str() ;
747 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
749 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
750 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
752 _Texte += saux + "#\n" ;
755 ////=============================================================================
756 void HomardDriver::TexteFieldInterp( int TypeFieldInterp, const std::string FieldFile, const std::string MeshFile, int TimeStep, int Rank )
758 MESSAGE("TexteFieldInterp, TypeFieldInterp = "<<TypeFieldInterp);
759 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
760 MESSAGE("TexteFieldInterp, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
762 // Type d'interpolation
764 _Texte += "# Interpolations des champs\n" ;
765 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
766 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
767 if ( TypeFieldInterp == 1 )
769 _Texte += "CCChaTou oui\n" ;
772 _TimeStep = TimeStep ;
775 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
777 ////=============================================================================
778 void HomardDriver::TexteFieldInterpName( int NumeChamp, const std::string FieldName)
780 MESSAGE("TexteFieldInterpName, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName);
781 std::stringstream saux1 ;
782 saux1 << NumeChamp+1 ;
783 std::string saux = saux1.str() ;
784 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
786 MESSAGE("TexteFieldInterpName, _TimeStep = "<<_TimeStep<<", _Rank = "<<_Rank);
787 if ( _TimeStep >= 0 )
790 std::stringstream saux1 ;
792 std::string saux2 = saux1.str() ;
793 _Texte += "CCChaPdT " + saux + " " + saux2 + "\n" ;
796 std::stringstream saux1 ;
798 std::string saux2 = saux1.str() ;
799 _Texte += "CCChaNuO " + saux + " " + saux2 + "\n" ;
803 ////=============================================================================
804 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput )
806 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit<<", LevelOutput ="<<LevelOutput);
811 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
812 _Texte += "TypeElem ignore_pyra\n" ;
816 _Texte += "# Niveaux extremes\n" ;
817 { std::stringstream saux1 ;
819 std::string saux2 = saux1.str() ;
820 _Texte += "NiveauMa " + saux2 + "\n" ;
825 _Texte += "# Diametre minimal\n" ;
826 { std::stringstream saux1 ;
828 std::string saux2 = saux1.str() ;
829 _Texte += "DiametMi " + saux2 + "\n" ;
835 { _Texte += "# Raffinement" ; }
837 { _Texte += "# Deraffinement" ; }
838 _Texte += " des regions sans indicateur\n" ;
839 { std::stringstream saux1 ;
841 std::string saux2 = saux1.str() ;
842 _Texte += "AdapInit " + saux2 + "\n" ;
845 if ( LevelOutput != 0 )
847 _Texte += "# Sortie des niveaux de raffinement\n" ;
848 _Texte += "NCNiveau NIVEAU\n" ;
852 ////=============================================================================
853 void HomardDriver::CreeFichier( )
856 _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ;
858 std::ofstream FicConf(_NomFichierConf.c_str(), std::ios::out ) ;
859 if (FicConf.is_open() == true)
861 FicConf << _Texte << std::endl ;
867 ////=============================================================================
868 int HomardDriver::ExecuteHomard()
870 // Copie des Fichiers HOMARD
871 std::string commande= "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
872 system(commande.c_str());
874 MESSAGE("ExecuteHomard");
875 int codret = system(_HOMARD_Exec.c_str()) ;
878 // GERALD -- QMESSAGE BOX
879 MESSAGE ( "Erreur en executant HOMARD : " << codret );
880 // ASSERT("Erreur en executant HOMARD" == 0);