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 //=============================================================================
314 //=============================================================================
316 * default constructor:
317 * Par defaut, l'adaptation est conforme, sans suivi de frontiere
319 //=============================================================================
320 HOMARD_Cas::HOMARD_Cas():
323 MESSAGE("HOMARD_Cas");
325 //=============================================================================
326 HOMARD_Cas::~HOMARD_Cas()
327 //=============================================================================
329 MESSAGE("~HOMARD_Cas");
331 //=============================================================================
332 //=============================================================================
334 //=============================================================================
335 //=============================================================================
336 std::string HOMARD_Cas::GetDumpPython() const
338 std::ostringstream aScript;
339 // Suivi de frontieres
340 std::list<std::string>::const_iterator it = _ListBoundaryGroup.begin();
341 while (it != _ListBoundaryGroup.end()) {
342 aScript << "smeshhomard.AddBoundaryGroup(\"" << *it << "\", \"";
344 aScript << *it << "\")\n";
348 return aScript.str();
350 //=============================================================================
351 //=============================================================================
353 //=============================================================================
354 //=============================================================================
355 int HOMARD_Cas::SetDirName( const char* NomDir )
358 // On vérifie qu'aucun calcul n'a eu lieu pour ce cas
359 if ( _ListIter.size() > 1 ) { erreur = 1 ; }
361 if ( CHDIR(NomDir) == 0 ) {
362 _NomDir = std::string( NomDir );
366 if ( mkdir(NomDir, S_IRWXU|S_IRGRP|S_IXGRP) == 0 )
368 if ( _mkdir(NomDir) == 0 )
371 if ( CHDIR(NomDir) == 0 ) { _NomDir = std::string( NomDir ); }
372 else { erreur = 2 ; }
374 else { erreur = 2 ; }
378 //=============================================================================
379 std::string HOMARD_Cas::GetDirName() const
384 // La boite englobante
386 //=============================================================================
387 void HOMARD_Cas::SetBoundingBox( const std::vector<double>& extremas )
390 _Boite.resize( extremas.size() );
391 for ( unsigned int i = 0; i < extremas.size(); i++ )
392 _Boite[i] = extremas[i];
394 //=============================================================================
395 const std::vector<double>& HOMARD_Cas::GetBoundingBox() const
402 //=============================================================================
403 void HOMARD_Cas::AddGroup( const char* Group )
405 _ListGroup.push_back(Group);
407 //=============================================================================
408 void HOMARD_Cas::SetGroups( const std::list<std::string>& ListGroup )
411 std::list<std::string>::const_iterator it = ListGroup.begin();
412 while(it != ListGroup.end())
414 _ListGroup.push_back((*it++));
417 //=============================================================================
418 const std::list<std::string>& HOMARD_Cas::GetGroups() const
422 //=============================================================================
423 void HOMARD_Cas::SupprGroups()
430 //=============================================================================
431 void HOMARD_Cas::AddBoundary( const char* Boundary )
433 // MESSAGE ( ". HOMARD_Cas::AddBoundary : Boundary = " << Boundary );
434 const char* Group = "";
435 AddBoundaryGroup( Boundary, Group );
437 //=============================================================================
438 void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
440 // MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Boundary = " << Boundary );
441 // MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Group = " << Group );
442 _ListBoundaryGroup.push_back( Boundary );
443 _ListBoundaryGroup.push_back( Group );
445 //=============================================================================
446 const std::list<std::string>& HOMARD_Cas::GetBoundaryGroup() const
448 return _ListBoundaryGroup;
450 //=============================================================================
451 void HOMARD_Cas::SupprBoundaryGroup()
453 _ListBoundaryGroup.clear();
455 //=============================================================================
456 //=============================================================================
457 // Liens avec les autres structures
458 //=============================================================================
459 //=============================================================================
460 void HOMARD_Cas::AddIteration( const char* NomIteration )
462 _ListIter.push_back( std::string( NomIteration ) );
465 //=============================================================================
466 //=============================================================================
467 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
468 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
469 _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ),
470 _Texte( "" ), _bLu( false )
472 MESSAGE("siter = "<<siter<<", siterp1 = "<<siterp1);
473 // Le repertoire ou se trouve l'executable HOMARD
476 if ( getenv("HOMARD_ROOT_DIR") != NULL ) { dir = getenv("HOMARD_ROOT_DIR") ; }
477 dir += "/bin/salome";
478 MESSAGE("dir ="<<dir);
479 // L'executable HOMARD
480 std::string executable = "homard";
481 MESSAGE("executable ="<<executable);
482 // Memorisation du nom complet de l'executable HOMARD
483 _HOMARD_Exec = dir + "/" + executable ;
484 MESSAGE("==> _HOMARD_Exec ="<<_HOMARD_Exec) ;
489 //=============================================================================
490 //=============================================================================
491 HomardDriver::~HomardDriver()
494 //===============================================================================
496 //===============================================================================
497 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
499 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
501 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
502 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
503 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
504 _Texte += "Langue \"" + Langue + "\"\n" ;
507 //===============================================================================
508 void HomardDriver::TexteAdap()
510 MESSAGE("TexteAdap");
512 _Texte += "Action homa\n";
513 _Texte += "CCAssoci med\n";
514 _Texte += "ModeHOMA 1\n";
515 _Texte += "NumeIter " + _siter + "\n";
518 //===============================================================================
519 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
521 MESSAGE("TexteInfo: TypeBila ="<<TypeBila<<", NumeIter ="<<NumeIter);
523 _Texte += "ModeHOMA 2\n" ;
524 std::stringstream saux1 ;
526 std::string saux2 = saux1.str() ;
527 _Texte += "TypeBila " + saux2 + "\n" ;
530 _Texte += "NumeIter 0\n" ;
531 _Texte += "Action info_av\n" ;
532 _Texte += "CCAssoci med\n" ;
536 _Texte += "NumeIter " + _siter + "\n" ;
537 _Texte += "Action info_ap\n" ;
538 _Texte += "CCAssoci homard\n" ;
543 //===============================================================================
544 void HomardDriver::TexteMajCoords( int NumeIter )
546 MESSAGE("TexteMajCoords: NumeIter ="<<NumeIter);
548 _Texte += "ModeHOMA 5\n" ;
549 _Texte += "NumeIter " + _siterp1 + "\n" ;
550 _Texte += "Action homa\n" ;
551 _Texte += "CCAssoci med\n" ;
552 _Texte += "EcriFiHO N_SANS_FRONTIERE\n" ;
556 //===============================================================================
557 // B. Les maillages en entree et en sortie
558 //===============================================================================
559 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
561 MESSAGE("TexteMaillage, NomMesh = "<<NomMesh);
562 MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
563 MESSAGE("TexteMaillage, apres = "<<apres);
566 if ( apres < 1 ) { saux = "__" ; }
568 _Texte += "# Maillages Med " + saux + "\n" ;
569 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
570 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
573 //===============================================================================
574 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
576 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
578 if ( apres < 1 ) { saux = "__" ; }
579 else { saux = "P1" ; }
581 _Texte += "# Maillage HOMARD " + liter + "\n" ;
582 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
585 //===============================================================================
586 // C. Le pilotage de l'adaptation
587 //===============================================================================
588 void HomardDriver::TexteConfRaffDera( int ConfType )
590 MESSAGE("TexteConfRaffDera, ConfType = " << ConfType);
592 // Type de conformite
599 saux = "NON_CONFORME_1_ARETE" ;
604 saux = "CONFORME_BOITES" ;
614 saux = "NON_CONFORME" ;
619 saux = "NON_CONFORME_1_NOEUD" ;
624 saux = "NON_CONFORME_INDICATEUR" ;
628 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
630 // Type de raffinement/deraffinement
632 saux = "TypeRaff uniforme\n" ;
633 saux += "TypeDera non" ;
634 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
636 //===============================================================================
638 //===============================================================================
639 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
641 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
643 // Type de suivi de frontiere
645 std::stringstream saux1 ;
646 saux1 << BoundaryOption ;
647 std::string saux = saux1.str() ;
648 _Texte += "SuivFron " + saux + "\n" ;
650 }//===============================================================================
651 void HomardDriver::TexteBoundaryCAOGr( const std::string GroupName )
653 MESSAGE("TexteBoundaryCAOGr, GroupName = "<<GroupName);
655 _Texte += "GrFroCAO \"" + GroupName + "\"\n" ;
659 //===============================================================================
660 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
662 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
663 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
665 _Texte += "#\n# Frontiere discrete\n" ;
666 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
667 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
670 //===============================================================================
671 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
673 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
675 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
678 //===============================================================================
679 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 )
681 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
682 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
683 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
684 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
686 std::string saux, saux2 ;
690 std::stringstream saux1 ;
691 saux1 << NumeBoundary ;
692 saux2 = saux1.str() ;
693 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
694 if ( BoundaryType == 1 )
695 { saux += "# Cylindre\n" ; }
696 if ( BoundaryType == 2 )
697 { saux += "# Sphere\n" ; }
698 if ( BoundaryType == 3 || BoundaryType == 4 )
699 { saux += "# Cone\n" ; }
700 if ( BoundaryType == 5 )
701 { saux += "# Tore\n" ; }
703 // Le nom de la frontiere
705 { std::stringstream saux1 ;
706 saux1 << NumeBoundary ;
707 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
712 { std::stringstream saux1 ;
713 saux1 << NumeBoundary << " " << BoundaryType ;
714 saux += "FAType " + saux1.str() + "\n" ;
719 if ( BoundaryType == 1 )
721 { std::stringstream saux1 ;
722 saux1 << NumeBoundary << " " << x0 ;
723 saux2 = saux1.str() ;
724 saux += "FAXCen " + saux1.str() + "\n" ;
726 { std::stringstream saux1 ;
727 saux1 << NumeBoundary << " " << x1 ;
728 saux += "FAYCen " + saux1.str() + "\n" ;
730 { std::stringstream saux1 ;
731 saux1 << NumeBoundary << " " << x2 ;
732 saux += "FAZCen " + saux1.str() + "\n" ;
734 { std::stringstream saux1 ;
735 saux1 << NumeBoundary << " " << x3 ;
736 saux += "FAXAxe " + saux1.str() + "\n" ;
738 { std::stringstream saux1 ;
739 saux1 << NumeBoundary << " " << x4 ;
740 saux += "FAYAxe " + saux1.str() + "\n" ;
742 { std::stringstream saux1 ;
743 saux1 << NumeBoundary << " " << x5 ;
744 saux += "FAZAxe " + saux1.str() + "\n" ;
746 { std::stringstream saux1 ;
747 saux1 << NumeBoundary << " " << x6 ;
748 saux += "FARayon " + saux1.str() + "\n" ;
754 else if ( BoundaryType == 2 )
756 { std::stringstream saux1 ;
757 saux1 << NumeBoundary << " " << x0 ;
758 saux += "FAXCen " + saux1.str() + "\n" ;
760 { std::stringstream saux1 ;
761 saux1 << NumeBoundary << " " << x1 ;
762 saux += "FAYCen " + saux1.str() + "\n" ;
764 { std::stringstream saux1 ;
765 saux1 << NumeBoundary << " " << x2 ;
766 saux += "FAZCen " + saux1.str() + "\n" ;
768 { std::stringstream saux1 ;
769 saux1 << NumeBoundary << " " << x3 ;
770 saux += "FARayon " + saux1.str() + "\n" ;
774 // Cas du cone defini par un axe et un angle
776 if ( BoundaryType == 3 )
778 { std::stringstream saux1 ;
779 saux1 << NumeBoundary << " " << x0 ;
780 saux += "FAXAxe " + saux1.str() + "\n" ;
782 { std::stringstream saux1 ;
783 saux1 << NumeBoundary << " " << x1 ;
784 saux += "FAYAxe " + saux1.str() + "\n" ;
786 { std::stringstream saux1 ;
787 saux1 << NumeBoundary << " " << x2 ;
788 saux += "FAZAxe " + saux1.str() + "\n" ;
790 { std::stringstream saux1 ;
791 saux1 << NumeBoundary << " " << x3 ;
792 saux += "FAAngle " + saux1.str() + "\n" ;
794 { std::stringstream saux1 ;
795 saux1 << NumeBoundary << " " << x4 ;
796 saux += "FAXCen " + saux1.str() + "\n" ;
798 { std::stringstream saux1 ;
799 saux1 << NumeBoundary << " " << x5 ;
800 saux += "FAYCen " + saux1.str() + "\n" ;
802 { std::stringstream saux1 ;
803 saux1 << NumeBoundary << " " << x6 ;
804 saux += "FAZCen " + saux1.str() + "\n" ;
808 // Cas du cone defini par les 2 rayons
810 if ( BoundaryType == 4 )
812 { std::stringstream saux1 ;
813 saux1 << NumeBoundary << " " << x0 ;
814 saux += "FAXCen " + saux1.str() + "\n" ;
816 { std::stringstream saux1 ;
817 saux1 << NumeBoundary << " " << x1 ;
818 saux += "FAYCen " + saux1.str() + "\n" ;
820 { std::stringstream saux1 ;
821 saux1 << NumeBoundary << " " << x2 ;
822 saux += "FAZCen " + saux1.str() + "\n" ;
824 { std::stringstream saux1 ;
825 saux1 << NumeBoundary << " " << x3 ;
826 saux += "FARayon " + saux1.str() + "\n" ;
828 { std::stringstream saux1 ;
829 saux1 << NumeBoundary << " " << x4 ;
830 saux += "FAXCen2 " + saux1.str() + "\n" ;
832 { std::stringstream saux1 ;
833 saux1 << NumeBoundary << " " << x5 ;
834 saux += "FAYCen2 " + saux1.str() + "\n" ;
836 { std::stringstream saux1 ;
837 saux1 << NumeBoundary << " " << x6 ;
838 saux += "FAZCen2 " + saux1.str() + "\n" ;
840 { std::stringstream saux1 ;
841 saux1 << NumeBoundary << " " << x7 ;
842 saux += "FARayon2 " + saux1.str() + "\n" ;
848 if ( BoundaryType == 5 )
850 { std::stringstream saux1 ;
851 saux1 << NumeBoundary << " " << x0 ;
852 saux2 = saux1.str() ;
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 += "FAXAxe " + saux1.str() + "\n" ;
867 { std::stringstream saux1 ;
868 saux1 << NumeBoundary << " " << x4 ;
869 saux += "FAYAxe " + saux1.str() + "\n" ;
871 { std::stringstream saux1 ;
872 saux1 << NumeBoundary << " " << x5 ;
873 saux += "FAZAxe " + saux1.str() + "\n" ;
875 { std::stringstream saux1 ;
876 saux1 << NumeBoundary << " " << x6 ;
877 saux += "FARayon " + saux1.str() + "\n" ;
879 { std::stringstream saux1 ;
880 saux1 << NumeBoundary << " " << x7 ;
881 saux += "FARayon2 " + saux1.str() + "\n" ;
885 _Texte += saux + "#\n" ;
888 //===============================================================================
889 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
891 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
892 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
893 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
897 std::string saux, saux2 ;
898 std::stringstream saux1 ;
899 saux1 << NumeBoundary ;
900 saux2 = saux1.str() ;
901 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
903 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
904 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
906 _Texte += saux + "#\n" ;
909 //===============================================================================
910 // F. Les options avancees
911 //===============================================================================
912 void HomardDriver::TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
914 MESSAGE("TexteAdvanced, NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<
915 ", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
919 _Texte += "# Niveaux extremes\n" ;
920 { std::stringstream saux1 ;
922 _Texte += "NiveauMa " + saux1.str() + "\n" ;
927 _Texte += "# Diametre minimal\n" ;
928 { std::stringstream saux1 ;
930 _Texte += "DiametMi " + saux1.str() + "\n" ;
936 { _Texte += "# Raffinement" ; }
938 { _Texte += "# Deraffinement" ; }
939 _Texte += " des regions sans indicateur\n" ;
940 { std::stringstream saux1 ;
942 _Texte += "AdapInit " + saux1.str() + "\n" ;
945 if ( ExtraOutput % 2 == 0 )
947 _Texte += "# Sortie des niveaux de raffinement\n" ;
948 _Texte += "NCNiveau NIVEAU\n" ;
950 if ( ExtraOutput % 3 == 0 )
952 _Texte += "# Sortie des qualités des mailles\n" ;
953 _Texte += "NCQualit QUAL\n" ;
955 if ( ExtraOutput % 5 == 0 )
957 _Texte += "# Sortie des diamètres des mailles\n" ;
958 _Texte += "NCDiamet DIAM\n" ;
960 if ( ExtraOutput % 7 == 0 )
962 _Texte += "# Sortie des parents des mailles\n" ;
963 _Texte += "NCParent PARENT\n" ;
965 if ( ExtraOutput % 11 == 0 )
967 _Texte += "# Volumes voisins par recollement\n" ;
968 _Texte += "NCVoisRc Voisin-Recollement\n" ;
971 //===============================================================================
973 //===============================================================================
974 void HomardDriver::TexteInfoCompute( int MessInfo )
976 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
980 _Texte += "# Messages d'informations\n" ;
981 { std::stringstream saux1 ;
983 _Texte += "MessInfo " + saux1.str() + "\n" ;
987 //===============================================================================
988 void HomardDriver::CreeFichier( )
991 if ( _modeHOMARD == 1 )
992 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
993 else if ( _modeHOMARD == 2 )
994 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
995 else if ( _modeHOMARD == 5 )
996 { _NomFichierConf = _NomFichierConfBase + ".majc" ; }
998 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
999 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
1003 //===============================================================================
1004 // Creation du fichier de donnees pour l'information
1005 //===============================================================================
1006 void HomardDriver::CreeFichierDonn( )
1009 MESSAGE("CreeFichierDonn");
1010 _NomFichierDonn = "info.donn" ;
1016 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1017 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1021 //===============================================================================
1022 int HomardDriver::ExecuteHomard()
1024 MESSAGE("ExecuteHomard");
1025 std::string commande ;
1027 // Copie des Fichiers HOMARD
1028 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1029 codret = system(commande.c_str()) ;
1031 // Execution de HOMARD
1034 commande = _HOMARD_Exec.c_str() ;
1035 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1036 codret = system(commande.c_str());
1037 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1038 _NomFichierDonn = "" ;
1043 //=============================================================================
1044 //=============================================================================
1045 HOMARD_Gen::HOMARD_Gen()
1047 MESSAGE("HOMARD_Gen");
1050 //=============================================================================
1051 //=============================================================================
1052 HOMARD_Gen::~HOMARD_Gen()
1054 MESSAGE("~HOMARD_Gen");
1056 //=============================================================================
1058 //=============================================================================
1060 * default constructor:
1062 //=============================================================================
1063 HOMARD_Iteration::HOMARD_Iteration():
1074 MESSAGE("HOMARD_Iteration");
1076 //=============================================================================
1080 //=============================================================================
1081 HOMARD_Iteration::~HOMARD_Iteration()
1083 MESSAGE("~HOMARD_Iteration");
1085 //=============================================================================
1086 //=============================================================================
1088 //=============================================================================
1089 //=============================================================================
1090 void HOMARD_Iteration::SetName( const char* Name )
1092 _Name = std::string( Name );
1094 //=============================================================================
1095 std::string HOMARD_Iteration::GetName() const
1099 //=============================================================================
1100 //=============================================================================
1102 //=============================================================================
1103 //=============================================================================
1104 void HOMARD_Iteration::SetDirNameLoc( const char* NomDir )
1106 _NomDir = std::string( NomDir );
1108 //=============================================================================
1109 std::string HOMARD_Iteration::GetDirNameLoc() const
1113 //=============================================================================
1114 void HOMARD_Iteration::SetNumber( int NumIter )
1118 //=============================================================================
1119 int HOMARD_Iteration::GetNumber() const
1123 //=============================================================================
1124 void HOMARD_Iteration::SetState( int etat )
1128 //=============================================================================
1129 int HOMARD_Iteration::GetState() const
1133 //=============================================================================
1134 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
1136 _NomMesh = std::string( NomMesh );
1138 //=============================================================================
1139 std::string HOMARD_Iteration::GetMeshName() const
1143 //=============================================================================
1144 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
1146 _MeshFile = std::string( MeshFile );
1148 //=============================================================================
1149 std::string HOMARD_Iteration::GetMeshFile() const
1153 //=============================================================================
1154 void HOMARD_Iteration::SetLogFile( const char* LogFile )
1156 _LogFile = std::string( LogFile );
1158 //=============================================================================
1159 std::string HOMARD_Iteration::GetLogFile() const
1163 //=============================================================================
1164 void HOMARD_Iteration::SetFileInfo( const char* FileInfo )
1166 _FileInfo = std::string( FileInfo );
1168 //=============================================================================
1169 std::string HOMARD_Iteration::GetFileInfo() const
1173 //=============================================================================
1174 void HOMARD_Iteration::SetInfoCompute( int MessInfo )
1176 _MessInfo = MessInfo;
1178 //=============================================================================
1179 int HOMARD_Iteration::GetInfoCompute() const
1184 } // namespace SMESHHOMARDImpl /end/