1 // SMESH HOMARD : implementation of SMESHHOMARD idl descriptions
3 // Copyright (C) 2011-2021 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 #include "SMESH_Homard.hxx"
24 #include <Utils_SALOME_Exception.hxx>
25 #include <utilities.h>
38 // La gestion des repertoires
47 namespace SMESHHOMARDImpl
50 //=============================================================================
52 * default constructor:
54 //=============================================================================
55 HOMARD_Boundary::HOMARD_Boundary():
56 _Name( "" ),_Type( 1 ),
57 _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ),
58 _Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ),
59 _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ),
60 _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 )
62 MESSAGE("HOMARD_Boundary");
65 //=============================================================================
66 HOMARD_Boundary::~HOMARD_Boundary()
68 MESSAGE("~HOMARD_Boundary");
70 //=============================================================================
71 //=============================================================================
73 //=============================================================================
74 //=============================================================================
75 void HOMARD_Boundary::SetName( const char* Name )
77 _Name = std::string( Name );
79 //=============================================================================
80 std::string HOMARD_Boundary::GetName() const
84 //=============================================================================
85 std::string HOMARD_Boundary::GetDumpPython() const
87 std::ostringstream aScript;
91 aScript << _Name << " = smeshhomard.CreateBoundaryCAO(\"" << _Name << "\", ";
92 aScript << "\"" << _DataFile << "\")\n";
97 aScript << _Name << " = smeshhomard.CreateBoundaryDi(\"" << _Name << "\", ";
98 aScript << "\"" << _MeshName << "\", ";
99 aScript << "\"" << _DataFile << "\")\n";
104 aScript << _Name << " = smeshhomard.CreateBoundaryCylinder(\"" << _Name << "\", ";
105 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n";
110 aScript << _Name << " = smeshhomard.CreateBoundarySphere(\"" << _Name << "\", ";
111 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n";
116 aScript << _Name << " = smeshhomard.CreateBoundaryConeA(\"" << _Name << "\", ";
117 aScript << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Angle << ", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ")\n";
122 aScript << _Name << " = smeshhomard.CreateBoundaryConeR(\"" << _Name << "\", ";
123 aScript << _Xcentre1 << ", " << _Ycentre1 << ", " << _Zcentre1 << ", " << _Rayon1 << ", " << _Xcentre2 << ", " << _Ycentre2 << ", " << _Zcentre2 << ", " << _Rayon2 << ")\n";
128 aScript << _Name << " = smeshhomard.CreateBoundaryTorus(\"" << _Name << "\", ";
129 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon1 << ", " << _Rayon2 << ")\n";
134 return aScript.str();
136 //=============================================================================
137 //=============================================================================
139 //=============================================================================
140 //=============================================================================
141 void HOMARD_Boundary::SetType( int Type )
145 //=============================================================================
146 int HOMARD_Boundary::GetType() const
150 //=============================================================================
151 void HOMARD_Boundary::SetMeshName( const char* MeshName )
153 _MeshName = std::string( MeshName );
155 //=============================================================================
156 std::string HOMARD_Boundary::GetMeshName() const
160 //=============================================================================
161 void HOMARD_Boundary::SetDataFile( const char* DataFile )
163 _DataFile = std::string( DataFile );
165 //=============================================================================
166 std::string HOMARD_Boundary::GetDataFile() const
170 //=======================================================================================
171 void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2,
172 double X3, double X4, double X5, double X6 )
174 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
175 _Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
178 //======================================================================
179 void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 )
181 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
184 //======================================================================
185 void HOMARD_Boundary::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
186 double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2)
188 _Xcentre1 = Xcentre1; _Ycentre1 = Ycentre1; _Zcentre1 = Zcentre1;
190 _Xcentre2 = Xcentre2; _Ycentre2 = Ycentre2; _Zcentre2 = Zcentre2;
193 //======================================================================
194 void HOMARD_Boundary::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
195 double Xcentre, double Ycentre, double Zcentre)
197 _Xaxe = Xaxe; _Yaxe = Yaxe; _Zaxe = Zaxe;
199 _Xcentre = Xcentre; _Ycentre = Ycentre; _Zcentre = Zcentre;
201 //=======================================================================================
202 void HOMARD_Boundary::SetTorus( double X0, double X1, double X2,
203 double X3, double X4, double X5, double X6, double X7 )
205 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
206 _Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
210 //=======================================================================================
211 std::vector<double> HOMARD_Boundary::GetCoords() const
213 std::vector<double> mesCoor;
219 mesCoor.push_back( _Xcentre );
220 mesCoor.push_back( _Ycentre );
221 mesCoor.push_back( _Zcentre );
222 mesCoor.push_back( _Xaxe );
223 mesCoor.push_back( _Yaxe );
224 mesCoor.push_back( _Zaxe );
225 mesCoor.push_back( _rayon );
231 mesCoor.push_back( _Xcentre );
232 mesCoor.push_back( _Ycentre );
233 mesCoor.push_back( _Zcentre );
234 mesCoor.push_back( _rayon );
237 // Cone defini par un axe et un angle
240 mesCoor.push_back( _Xaxe );
241 mesCoor.push_back( _Yaxe );
242 mesCoor.push_back( _Zaxe );
243 mesCoor.push_back( _Angle );
244 mesCoor.push_back( _Xcentre );
245 mesCoor.push_back( _Ycentre );
246 mesCoor.push_back( _Zcentre );
249 // Cone defini par les 2 rayons
252 mesCoor.push_back( _Xcentre1 );
253 mesCoor.push_back( _Ycentre1 );
254 mesCoor.push_back( _Zcentre1 );
255 mesCoor.push_back( _Rayon1 );
256 mesCoor.push_back( _Xcentre2 );
257 mesCoor.push_back( _Ycentre2 );
258 mesCoor.push_back( _Zcentre2 );
259 mesCoor.push_back( _Rayon2 );
265 mesCoor.push_back( _Xcentre );
266 mesCoor.push_back( _Ycentre );
267 mesCoor.push_back( _Zcentre );
268 mesCoor.push_back( _Xaxe );
269 mesCoor.push_back( _Yaxe );
270 mesCoor.push_back( _Zaxe );
271 mesCoor.push_back( _Rayon1 );
272 mesCoor.push_back( _Rayon2 );
280 //======================================================================
281 void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 )
283 _Xincr = X0; _Yincr = X1; _Zincr = X2;
285 //=======================================================================================
286 std::vector<double> HOMARD_Boundary::GetLimit() const
288 std::vector<double> mesLimit;
289 mesLimit.push_back( _Xincr );
290 mesLimit.push_back( _Yincr );
291 mesLimit.push_back( _Zincr );
294 //=============================================================================
295 void HOMARD_Boundary::AddGroup( const char* Group)
297 _ListGroupSelected.push_back(Group);
299 //=============================================================================
300 void HOMARD_Boundary::SetGroups( const std::list<std::string>& ListGroup )
302 _ListGroupSelected.clear();
303 std::list<std::string>::const_iterator it = ListGroup.begin();
304 while(it != ListGroup.end())
305 _ListGroupSelected.push_back((*it++));
307 //=============================================================================
308 const std::list<std::string>& HOMARD_Boundary::GetGroups() const
310 return _ListGroupSelected;
312 //=============================================================================
313 //=============================================================================
314 // Liens avec les autres structures
315 //=============================================================================
316 //=============================================================================
317 void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation )
319 _NomCasCreation = std::string( NomCasCreation );
321 //=============================================================================
322 std::string HOMARD_Boundary::GetCaseCreation() const
324 return _NomCasCreation;
326 //=============================================================================
328 //=============================================================================
330 * default constructor:
331 * Par defaut, l'adaptation est conforme, sans suivi de frontiere
333 //=============================================================================
334 HOMARD_Cas::HOMARD_Cas():
335 _Name(""), _NomDir("/tmp"), _ConfType(0)
337 MESSAGE("HOMARD_Cas");
339 //=============================================================================
340 HOMARD_Cas::~HOMARD_Cas()
341 //=============================================================================
343 MESSAGE("~HOMARD_Cas");
345 //=============================================================================
346 //=============================================================================
348 //=============================================================================
349 //=============================================================================
350 void HOMARD_Cas::SetName( const char* Name )
352 _Name = std::string( Name );
354 //=============================================================================
355 std::string HOMARD_Cas::GetName() const
359 //=============================================================================
360 std::string HOMARD_Cas::GetDumpPython() const
362 std::ostringstream aScript;
363 //aScript << _Name << ".SetDirName(\"" << _NomDir << "\")\n";
364 aScript << _Name << ".SetConfType(" << _ConfType << ")\n";
365 // Suivi de frontieres
366 std::list<std::string>::const_iterator it = _ListBoundaryGroup.begin();
367 while (it != _ListBoundaryGroup.end()) {
368 aScript << _Name << ".AddBoundaryGroup(\"" << *it << "\", \"";
370 aScript << *it << "\")\n";
374 return aScript.str();
376 //=============================================================================
377 //=============================================================================
379 //=============================================================================
380 //=============================================================================
381 int HOMARD_Cas::SetDirName( const char* NomDir )
384 // On vérifie qu'aucun calcul n'a eu lieu pour ce cas
385 if ( _ListIter.size() > 1 ) { erreur = 1 ; }
387 if ( CHDIR(NomDir) == 0 ) {
388 _NomDir = std::string( NomDir );
392 if ( mkdir(NomDir, S_IRWXU|S_IRGRP|S_IXGRP) == 0 )
394 if ( _mkdir(NomDir) == 0 )
397 if ( CHDIR(NomDir) == 0 ) { _NomDir = std::string( NomDir ); }
398 else { erreur = 2 ; }
400 else { erreur = 2 ; }
404 //=============================================================================
405 std::string HOMARD_Cas::GetDirName() const
410 // Le type de conformite ou non conformite
412 //=============================================================================
413 void HOMARD_Cas::SetConfType( int Conftype )
415 _ConfType = Conftype;
417 //=============================================================================
418 const int HOMARD_Cas::GetConfType() const
423 // La boite englobante
425 //=============================================================================
426 void HOMARD_Cas::SetBoundingBox( const std::vector<double>& extremas )
429 _Boite.resize( extremas.size() );
430 for ( unsigned int i = 0; i < extremas.size(); i++ )
431 _Boite[i] = extremas[i];
433 //=============================================================================
434 const std::vector<double>& HOMARD_Cas::GetBoundingBox() const
441 //=============================================================================
442 void HOMARD_Cas::AddGroup( const char* Group )
444 _ListGroup.push_back(Group);
446 //=============================================================================
447 void HOMARD_Cas::SetGroups( const std::list<std::string>& ListGroup )
450 std::list<std::string>::const_iterator it = ListGroup.begin();
451 while(it != ListGroup.end())
453 _ListGroup.push_back((*it++));
456 //=============================================================================
457 const std::list<std::string>& HOMARD_Cas::GetGroups() const
461 //=============================================================================
462 void HOMARD_Cas::SupprGroups()
469 //=============================================================================
470 void HOMARD_Cas::AddBoundary( const char* Boundary )
472 // MESSAGE ( ". HOMARD_Cas::AddBoundary : Boundary = " << Boundary );
473 const char* Group = "";
474 AddBoundaryGroup( Boundary, Group );
476 //=============================================================================
477 void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
479 // MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Boundary = " << Boundary );
480 // MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Group = " << Group );
481 _ListBoundaryGroup.push_back( Boundary );
482 _ListBoundaryGroup.push_back( Group );
484 //=============================================================================
485 const std::list<std::string>& HOMARD_Cas::GetBoundaryGroup() const
487 return _ListBoundaryGroup;
489 //=============================================================================
490 void HOMARD_Cas::SupprBoundaryGroup()
492 _ListBoundaryGroup.clear();
494 //=============================================================================
495 //=============================================================================
496 // Liens avec les autres structures
497 //=============================================================================
498 //=============================================================================
499 void HOMARD_Cas::AddIteration( const char* NomIteration )
501 _ListIter.push_back( std::string( NomIteration ) );
504 //=============================================================================
505 //=============================================================================
506 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
507 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
508 _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ),
509 _Texte( "" ), _bLu( false )
511 MESSAGE("siter = "<<siter<<", siterp1 = "<<siterp1);
512 // Le repertoire ou se trouve l'executable HOMARD
515 if ( getenv("HOMARD_ROOT_DIR") != NULL ) { dir = getenv("HOMARD_ROOT_DIR") ; }
516 dir += "/bin/salome";
517 MESSAGE("dir ="<<dir);
518 // L'executable HOMARD
519 std::string executable = "homard";
520 MESSAGE("executable ="<<executable);
521 // Memorisation du nom complet de l'executable HOMARD
522 _HOMARD_Exec = dir + "/" + executable ;
523 MESSAGE("==> _HOMARD_Exec ="<<_HOMARD_Exec) ;
528 //=============================================================================
529 //=============================================================================
530 HomardDriver::~HomardDriver()
533 //===============================================================================
535 //===============================================================================
536 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
538 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
540 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
541 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
542 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
543 _Texte += "Langue \"" + Langue + "\"\n" ;
546 //===============================================================================
547 void HomardDriver::TexteAdap()
549 MESSAGE("TexteAdap");
551 _Texte += "Action homa\n";
552 _Texte += "CCAssoci med\n";
553 _Texte += "ModeHOMA 1\n";
554 _Texte += "NumeIter " + _siter + "\n";
557 //===============================================================================
558 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
560 MESSAGE("TexteInfo: TypeBila ="<<TypeBila<<", NumeIter ="<<NumeIter);
562 _Texte += "ModeHOMA 2\n" ;
563 std::stringstream saux1 ;
565 std::string saux2 = saux1.str() ;
566 _Texte += "TypeBila " + saux2 + "\n" ;
569 _Texte += "NumeIter 0\n" ;
570 _Texte += "Action info_av\n" ;
571 _Texte += "CCAssoci med\n" ;
575 _Texte += "NumeIter " + _siter + "\n" ;
576 _Texte += "Action info_ap\n" ;
577 _Texte += "CCAssoci homard\n" ;
582 //===============================================================================
583 void HomardDriver::TexteMajCoords( int NumeIter )
585 MESSAGE("TexteMajCoords: NumeIter ="<<NumeIter);
587 _Texte += "ModeHOMA 5\n" ;
588 _Texte += "NumeIter " + _siterp1 + "\n" ;
589 _Texte += "Action homa\n" ;
590 _Texte += "CCAssoci med\n" ;
591 _Texte += "EcriFiHO N_SANS_FRONTIERE\n" ;
595 //===============================================================================
596 // B. Les maillages en entree et en sortie
597 //===============================================================================
598 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
600 MESSAGE("TexteMaillage, NomMesh = "<<NomMesh);
601 MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
602 MESSAGE("TexteMaillage, apres = "<<apres);
605 if ( apres < 1 ) { saux = "__" ; }
607 _Texte += "# Maillages Med " + saux + "\n" ;
608 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
609 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
612 //===============================================================================
613 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
615 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
617 if ( apres < 1 ) { saux = "__" ; }
618 else { saux = "P1" ; }
620 _Texte += "# Maillage HOMARD " + liter + "\n" ;
621 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
624 //===============================================================================
625 // C. Le pilotage de l'adaptation
626 //===============================================================================
627 void HomardDriver::TexteConfRaffDera( int ConfType )
629 MESSAGE("TexteConfRaffDera, ConfType = " << ConfType);
631 // Type de conformite
638 saux = "NON_CONFORME_1_ARETE" ;
643 saux = "CONFORME_BOITES" ;
653 saux = "NON_CONFORME" ;
658 saux = "NON_CONFORME_1_NOEUD" ;
663 saux = "NON_CONFORME_INDICATEUR" ;
667 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
669 // Type de raffinement/deraffinement
671 saux = "TypeRaff uniforme\n" ;
672 saux += "TypeDera non" ;
673 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
675 //===============================================================================
677 //===============================================================================
678 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
680 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
682 // Type de suivi de frontiere
684 std::stringstream saux1 ;
685 saux1 << BoundaryOption ;
686 std::string saux = saux1.str() ;
687 _Texte += "SuivFron " + saux + "\n" ;
689 }//===============================================================================
690 void HomardDriver::TexteBoundaryCAOGr( const std::string GroupName )
692 MESSAGE("TexteBoundaryCAOGr, GroupName = "<<GroupName);
694 _Texte += "GrFroCAO \"" + GroupName + "\"\n" ;
698 //===============================================================================
699 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
701 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
702 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
704 _Texte += "#\n# Frontiere discrete\n" ;
705 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
706 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
709 //===============================================================================
710 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
712 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
714 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
717 //===============================================================================
718 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 )
720 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
721 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
722 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
723 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
725 std::string saux, saux2 ;
729 std::stringstream saux1 ;
730 saux1 << NumeBoundary ;
731 saux2 = saux1.str() ;
732 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
733 if ( BoundaryType == 1 )
734 { saux += "# Cylindre\n" ; }
735 if ( BoundaryType == 2 )
736 { saux += "# Sphere\n" ; }
737 if ( BoundaryType == 3 || BoundaryType == 4 )
738 { saux += "# Cone\n" ; }
739 if ( BoundaryType == 5 )
740 { saux += "# Tore\n" ; }
742 // Le nom de la frontiere
744 { std::stringstream saux1 ;
745 saux1 << NumeBoundary ;
746 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
751 { std::stringstream saux1 ;
752 saux1 << NumeBoundary << " " << BoundaryType ;
753 saux += "FAType " + saux1.str() + "\n" ;
758 if ( BoundaryType == 1 )
760 { std::stringstream saux1 ;
761 saux1 << NumeBoundary << " " << x0 ;
762 saux2 = saux1.str() ;
763 saux += "FAXCen " + saux1.str() + "\n" ;
765 { std::stringstream saux1 ;
766 saux1 << NumeBoundary << " " << x1 ;
767 saux += "FAYCen " + saux1.str() + "\n" ;
769 { std::stringstream saux1 ;
770 saux1 << NumeBoundary << " " << x2 ;
771 saux += "FAZCen " + saux1.str() + "\n" ;
773 { std::stringstream saux1 ;
774 saux1 << NumeBoundary << " " << x3 ;
775 saux += "FAXAxe " + saux1.str() + "\n" ;
777 { std::stringstream saux1 ;
778 saux1 << NumeBoundary << " " << x4 ;
779 saux += "FAYAxe " + saux1.str() + "\n" ;
781 { std::stringstream saux1 ;
782 saux1 << NumeBoundary << " " << x5 ;
783 saux += "FAZAxe " + saux1.str() + "\n" ;
785 { std::stringstream saux1 ;
786 saux1 << NumeBoundary << " " << x6 ;
787 saux += "FARayon " + saux1.str() + "\n" ;
793 else if ( BoundaryType == 2 )
795 { std::stringstream saux1 ;
796 saux1 << NumeBoundary << " " << x0 ;
797 saux += "FAXCen " + saux1.str() + "\n" ;
799 { std::stringstream saux1 ;
800 saux1 << NumeBoundary << " " << x1 ;
801 saux += "FAYCen " + saux1.str() + "\n" ;
803 { std::stringstream saux1 ;
804 saux1 << NumeBoundary << " " << x2 ;
805 saux += "FAZCen " + saux1.str() + "\n" ;
807 { std::stringstream saux1 ;
808 saux1 << NumeBoundary << " " << x3 ;
809 saux += "FARayon " + saux1.str() + "\n" ;
813 // Cas du cone defini par un axe et un angle
815 if ( BoundaryType == 3 )
817 { std::stringstream saux1 ;
818 saux1 << NumeBoundary << " " << x0 ;
819 saux += "FAXAxe " + saux1.str() + "\n" ;
821 { std::stringstream saux1 ;
822 saux1 << NumeBoundary << " " << x1 ;
823 saux += "FAYAxe " + saux1.str() + "\n" ;
825 { std::stringstream saux1 ;
826 saux1 << NumeBoundary << " " << x2 ;
827 saux += "FAZAxe " + saux1.str() + "\n" ;
829 { std::stringstream saux1 ;
830 saux1 << NumeBoundary << " " << x3 ;
831 saux += "FAAngle " + saux1.str() + "\n" ;
833 { std::stringstream saux1 ;
834 saux1 << NumeBoundary << " " << x4 ;
835 saux += "FAXCen " + saux1.str() + "\n" ;
837 { std::stringstream saux1 ;
838 saux1 << NumeBoundary << " " << x5 ;
839 saux += "FAYCen " + saux1.str() + "\n" ;
841 { std::stringstream saux1 ;
842 saux1 << NumeBoundary << " " << x6 ;
843 saux += "FAZCen " + saux1.str() + "\n" ;
847 // Cas du cone defini par les 2 rayons
849 if ( BoundaryType == 4 )
851 { std::stringstream saux1 ;
852 saux1 << NumeBoundary << " " << x0 ;
853 saux += "FAXCen " + saux1.str() + "\n" ;
855 { std::stringstream saux1 ;
856 saux1 << NumeBoundary << " " << x1 ;
857 saux += "FAYCen " + saux1.str() + "\n" ;
859 { std::stringstream saux1 ;
860 saux1 << NumeBoundary << " " << x2 ;
861 saux += "FAZCen " + saux1.str() + "\n" ;
863 { std::stringstream saux1 ;
864 saux1 << NumeBoundary << " " << x3 ;
865 saux += "FARayon " + saux1.str() + "\n" ;
867 { std::stringstream saux1 ;
868 saux1 << NumeBoundary << " " << x4 ;
869 saux += "FAXCen2 " + saux1.str() + "\n" ;
871 { std::stringstream saux1 ;
872 saux1 << NumeBoundary << " " << x5 ;
873 saux += "FAYCen2 " + saux1.str() + "\n" ;
875 { std::stringstream saux1 ;
876 saux1 << NumeBoundary << " " << x6 ;
877 saux += "FAZCen2 " + saux1.str() + "\n" ;
879 { std::stringstream saux1 ;
880 saux1 << NumeBoundary << " " << x7 ;
881 saux += "FARayon2 " + saux1.str() + "\n" ;
887 if ( BoundaryType == 5 )
889 { std::stringstream saux1 ;
890 saux1 << NumeBoundary << " " << x0 ;
891 saux2 = saux1.str() ;
892 saux += "FAXCen " + saux1.str() + "\n" ;
894 { std::stringstream saux1 ;
895 saux1 << NumeBoundary << " " << x1 ;
896 saux += "FAYCen " + saux1.str() + "\n" ;
898 { std::stringstream saux1 ;
899 saux1 << NumeBoundary << " " << x2 ;
900 saux += "FAZCen " + saux1.str() + "\n" ;
902 { std::stringstream saux1 ;
903 saux1 << NumeBoundary << " " << x3 ;
904 saux += "FAXAxe " + saux1.str() + "\n" ;
906 { std::stringstream saux1 ;
907 saux1 << NumeBoundary << " " << x4 ;
908 saux += "FAYAxe " + saux1.str() + "\n" ;
910 { std::stringstream saux1 ;
911 saux1 << NumeBoundary << " " << x5 ;
912 saux += "FAZAxe " + saux1.str() + "\n" ;
914 { std::stringstream saux1 ;
915 saux1 << NumeBoundary << " " << x6 ;
916 saux += "FARayon " + saux1.str() + "\n" ;
918 { std::stringstream saux1 ;
919 saux1 << NumeBoundary << " " << x7 ;
920 saux += "FARayon2 " + saux1.str() + "\n" ;
924 _Texte += saux + "#\n" ;
927 //===============================================================================
928 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
930 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
931 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
932 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
936 std::string saux, saux2 ;
937 std::stringstream saux1 ;
938 saux1 << NumeBoundary ;
939 saux2 = saux1.str() ;
940 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
942 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
943 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
945 _Texte += saux + "#\n" ;
948 //===============================================================================
949 // F. Les options avancees
950 //===============================================================================
951 void HomardDriver::TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
953 MESSAGE("TexteAdvanced, NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<
954 ", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
958 _Texte += "# Niveaux extremes\n" ;
959 { std::stringstream saux1 ;
961 _Texte += "NiveauMa " + saux1.str() + "\n" ;
966 _Texte += "# Diametre minimal\n" ;
967 { std::stringstream saux1 ;
969 _Texte += "DiametMi " + saux1.str() + "\n" ;
975 { _Texte += "# Raffinement" ; }
977 { _Texte += "# Deraffinement" ; }
978 _Texte += " des regions sans indicateur\n" ;
979 { std::stringstream saux1 ;
981 _Texte += "AdapInit " + saux1.str() + "\n" ;
984 if ( ExtraOutput % 2 == 0 )
986 _Texte += "# Sortie des niveaux de raffinement\n" ;
987 _Texte += "NCNiveau NIVEAU\n" ;
989 if ( ExtraOutput % 3 == 0 )
991 _Texte += "# Sortie des qualités des mailles\n" ;
992 _Texte += "NCQualit QUAL\n" ;
994 if ( ExtraOutput % 5 == 0 )
996 _Texte += "# Sortie des diamètres des mailles\n" ;
997 _Texte += "NCDiamet DIAM\n" ;
999 if ( ExtraOutput % 7 == 0 )
1001 _Texte += "# Sortie des parents des mailles\n" ;
1002 _Texte += "NCParent PARENT\n" ;
1004 if ( ExtraOutput % 11 == 0 )
1006 _Texte += "# Volumes voisins par recollement\n" ;
1007 _Texte += "NCVoisRc Voisin-Recollement\n" ;
1010 //===============================================================================
1012 //===============================================================================
1013 void HomardDriver::TexteInfoCompute( int MessInfo )
1015 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
1017 if ( MessInfo != 0 )
1019 _Texte += "# Messages d'informations\n" ;
1020 { std::stringstream saux1 ;
1022 _Texte += "MessInfo " + saux1.str() + "\n" ;
1026 //===============================================================================
1027 void HomardDriver::CreeFichier( )
1030 if ( _modeHOMARD == 1 )
1031 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
1032 else if ( _modeHOMARD == 2 )
1033 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
1034 else if ( _modeHOMARD == 5 )
1035 { _NomFichierConf = _NomFichierConfBase + ".majc" ; }
1037 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
1038 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
1042 //===============================================================================
1043 // Creation du fichier de donnees pour l'information
1044 //===============================================================================
1045 void HomardDriver::CreeFichierDonn( )
1048 MESSAGE("CreeFichierDonn");
1049 _NomFichierDonn = "info.donn" ;
1055 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1056 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1060 //===============================================================================
1061 int HomardDriver::ExecuteHomard()
1063 MESSAGE("ExecuteHomard");
1064 std::string commande ;
1066 // Copie des Fichiers HOMARD
1067 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1068 codret = system(commande.c_str()) ;
1070 // Execution de HOMARD
1073 commande = _HOMARD_Exec.c_str() ;
1074 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1075 codret = system(commande.c_str());
1076 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1077 _NomFichierDonn = "" ;
1082 //=============================================================================
1083 //=============================================================================
1084 HOMARD_Gen::HOMARD_Gen()
1086 MESSAGE("HOMARD_Gen");
1089 //=============================================================================
1090 //=============================================================================
1091 HOMARD_Gen::~HOMARD_Gen()
1093 MESSAGE("~HOMARD_Gen");
1095 //=============================================================================
1097 //=============================================================================
1099 * default constructor:
1101 //=============================================================================
1102 HOMARD_Iteration::HOMARD_Iteration():
1113 MESSAGE("HOMARD_Iteration");
1115 //=============================================================================
1119 //=============================================================================
1120 HOMARD_Iteration::~HOMARD_Iteration()
1122 MESSAGE("~HOMARD_Iteration");
1124 //=============================================================================
1125 //=============================================================================
1127 //=============================================================================
1128 //=============================================================================
1129 void HOMARD_Iteration::SetName( const char* Name )
1131 _Name = std::string( Name );
1133 //=============================================================================
1134 std::string HOMARD_Iteration::GetName() const
1138 //=============================================================================
1139 //=============================================================================
1141 //=============================================================================
1142 //=============================================================================
1143 void HOMARD_Iteration::SetDirNameLoc( const char* NomDir )
1145 _NomDir = std::string( NomDir );
1147 //=============================================================================
1148 std::string HOMARD_Iteration::GetDirNameLoc() const
1152 //=============================================================================
1153 void HOMARD_Iteration::SetNumber( int NumIter )
1157 //=============================================================================
1158 int HOMARD_Iteration::GetNumber() const
1162 //=============================================================================
1163 void HOMARD_Iteration::SetState( int etat )
1167 //=============================================================================
1168 int HOMARD_Iteration::GetState() const
1172 //=============================================================================
1173 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
1175 _NomMesh = std::string( NomMesh );
1177 //=============================================================================
1178 std::string HOMARD_Iteration::GetMeshName() const
1182 //=============================================================================
1183 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
1185 _MeshFile = std::string( MeshFile );
1187 //=============================================================================
1188 std::string HOMARD_Iteration::GetMeshFile() const
1192 //=============================================================================
1193 void HOMARD_Iteration::SetLogFile( const char* LogFile )
1195 _LogFile = std::string( LogFile );
1197 //=============================================================================
1198 std::string HOMARD_Iteration::GetLogFile() const
1202 //=============================================================================
1203 void HOMARD_Iteration::SetFileInfo( const char* FileInfo )
1205 _FileInfo = std::string( FileInfo );
1207 //=============================================================================
1208 std::string HOMARD_Iteration::GetFileInfo() const
1212 //=============================================================================
1213 void HOMARD_Iteration::SetInfoCompute( int MessInfo )
1215 _MessInfo = MessInfo;
1217 //=============================================================================
1218 int HOMARD_Iteration::GetInfoCompute() const
1223 } // namespace SMESHHOMARDImpl /end/