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" ;
540 std::stringstream saux1 ;
542 saux2 = saux1.str() ;
543 _Texte += "Seuil" + saux + " " + saux2 + "\n" ;
555 std::stringstream saux1 ;
557 saux2 = saux1.str() ;
558 _Texte += "Seuil" + saux + " " + saux2 + "\n" ;
563 { saux = "MAILLE" ; }
568 _Texte += "CCModeFI " + saux + "\n" ;
575 { saux = "INFINI" ; }
577 { saux = "V_RELATIVE" ; }
580 _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 )
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);
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" ; }
644 // Le nom de la frontiere
646 { std::stringstream saux1 ;
647 saux1 << NumeBoundary ;
648 saux2 = saux1.str() ;
649 saux += "FANom " + saux2 + " \"" + NameBoundary + "\"\n" ;
654 { std::stringstream saux1 ;
655 saux1 << NumeBoundary << " " << BoundaryType ;
656 saux2 = saux1.str() ;
657 saux += "FAType " + saux2 + "\n" ;
662 if ( BoundaryType == 1 )
664 { std::stringstream saux1 ;
665 saux1 << NumeBoundary << " " << x0 ;
666 saux2 = saux1.str() ;
667 saux += "FAXCen " + saux2 + "\n" ;
669 { std::stringstream saux1 ;
670 saux1 << NumeBoundary << " " << x1 ;
671 saux2 = saux1.str() ;
672 saux += "FAYCen " + saux2 + "\n" ;
674 { std::stringstream saux1 ;
675 saux1 << NumeBoundary << " " << x2 ;
676 saux2 = saux1.str() ;
677 saux += "FAZCen " + saux2 + "\n" ;
679 { std::stringstream saux1 ;
680 saux1 << NumeBoundary << " " << x3 ;
681 saux2 = saux1.str() ;
682 saux += "FAXAxe " + saux2 + "\n" ;
684 { std::stringstream saux1 ;
685 saux1 << NumeBoundary << " " << x4 ;
686 saux2 = saux1.str() ;
687 saux += "FAYAxe " + saux2 + "\n" ;
689 { std::stringstream saux1 ;
690 saux1 << NumeBoundary << " " << x5 ;
691 saux2 = saux1.str() ;
692 saux += "FAZAxe " + saux2 + "\n" ;
694 { std::stringstream saux1 ;
695 saux1 << NumeBoundary << " " << x6 ;
696 saux2 = saux1.str() ;
697 saux += "FARayon " + saux2 + "\n" ;
703 else if ( BoundaryType == 2 )
705 { std::stringstream saux1 ;
706 saux1 << NumeBoundary << " " << x0 ;
707 saux2 = saux1.str() ;
708 saux += "FAXCen " + saux2 + "\n" ;
710 { std::stringstream saux1 ;
711 saux1 << NumeBoundary << " " << x1 ;
712 saux2 = saux1.str() ;
713 saux += "FAYCen " + saux2 + "\n" ;
715 { std::stringstream saux1 ;
716 saux1 << NumeBoundary << " " << x2 ;
717 saux2 = saux1.str() ;
718 saux += "FAZCen " + saux2 + "\n" ;
720 { std::stringstream saux1 ;
721 saux1 << NumeBoundary << " " << x3 ;
722 saux2 = saux1.str() ;
723 saux += "FARayon " + saux2 + "\n" ;
727 _Texte += saux + "#\n" ;
730 ////=============================================================================
731 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
733 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
734 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
735 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
739 std::string saux, saux2 ;
740 std::stringstream saux1 ;
741 saux1 << NumeBoundary ;
742 saux2 = saux1.str() ;
743 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
745 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
746 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
748 _Texte += saux + "#\n" ;
751 ////=============================================================================
752 void HomardDriver::TexteFieldInterp( int TypeFieldInterp, const std::string FieldFile, const std::string MeshFile, int TimeStep, int Rank )
754 MESSAGE("TexteFieldInterp, TypeFieldInterp = "<<TypeFieldInterp);
755 MESSAGE("TexteFieldInterp, FieldFile = "<<FieldFile<<", MeshFile = "<<MeshFile);
756 MESSAGE("TexteFieldInterp, TimeStep = "<<TimeStep<<", Rank = "<<Rank);
758 // Type d'interpolation
760 _Texte += "# Interpolations des champs\n" ;
761 _Texte += "CCSolN__ \"" + FieldFile + "\"\n" ;
762 _Texte += "CCSolNP1 \"" + MeshFile + "\"\n" ;
763 if ( TypeFieldInterp == 1 )
765 _Texte += "CCChaTou oui\n" ;
768 _TimeStep = TimeStep ;
771 // std::cerr << "A la fin de TexteFieldInterp _Texte ="<<_Texte << std::endl;
773 ////=============================================================================
774 void HomardDriver::TexteFieldInterpName( int NumeChamp, const std::string FieldName)
776 MESSAGE("TexteFieldInterpName, NumeChamp = "<<NumeChamp<<", FieldName = "<<FieldName);
777 std::stringstream saux1 ;
778 saux1 << NumeChamp+1 ;
779 std::string saux = saux1.str() ;
780 _Texte +="CCChaNom " + saux + " \"" + FieldName + "\"\n" ;
782 MESSAGE("TexteFieldInterpName, _TimeStep = "<<_TimeStep<<", _Rank = "<<_Rank);
783 if ( _TimeStep >= 0 )
786 std::stringstream saux1 ;
788 std::string saux2 = saux1.str() ;
789 _Texte += "CCChaPdT " + saux + " " + saux2 + "\n" ;
792 std::stringstream saux1 ;
794 std::string saux2 = saux1.str() ;
795 _Texte += "CCChaNuO " + saux + " " + saux2 + "\n" ;
799 ////=============================================================================
800 void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit )
802 MESSAGE("TexteAdvanced, Pyram ="<<Pyram<<", NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<", AdapInit ="<<AdapInit);
807 _Texte += "# Autorisation de pyramides dans le maillage initial\n" ;
808 _Texte += "TypeElem ignore_pyra\n" ;
812 _Texte += "# Niveaux extremes\n" ;
813 { std::stringstream saux1 ;
815 std::string saux2 = saux1.str() ;
816 _Texte += "NiveauMa " + saux2 + "\n" ;
821 _Texte += "# Diametre minimal\n" ;
822 { std::stringstream saux1 ;
824 std::string saux2 = saux1.str() ;
825 _Texte += "DiametMi " + saux2 + "\n" ;
831 { _Texte += "# Raffinement" ; }
833 { _Texte += "# Deraffinement" ; }
834 _Texte += " des regions sans indicateur\n" ;
835 { std::stringstream saux1 ;
837 std::string saux2 = saux1.str() ;
838 _Texte += "AdapInit " + saux2 + "\n" ;
843 ////=============================================================================
844 void HomardDriver::CreeFichier( )
847 _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ;
849 std::ofstream FicConf(_NomFichierConf.c_str(), std::ios::out ) ;
850 if (FicConf.is_open() == true)
852 FicConf << _Texte << std::endl ;
858 ////=============================================================================
859 int HomardDriver::ExecuteHomard()
861 // Copie des Fichiers HOMARD
862 std::string commande= "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
863 system(commande.c_str());
865 MESSAGE("ExecuteHomard");
866 int codret = system(_HOMARD_Exec.c_str()) ;
869 // GERALD -- QMESSAGE BOX
870 MESSAGE ( "Erreur en executant HOMARD : " << codret );
871 // ASSERT("Erreur en executant HOMARD" == 0);