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")
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 // Suivi de frontieres
364 std::list<std::string>::const_iterator it = _ListBoundaryGroup.begin();
365 while (it != _ListBoundaryGroup.end()) {
366 aScript << "smeshhomard.AddBoundaryGroup(\"" << *it << "\", \"";
368 aScript << *it << "\")\n";
372 return aScript.str();
374 //=============================================================================
375 //=============================================================================
377 //=============================================================================
378 //=============================================================================
379 int HOMARD_Cas::SetDirName( const char* NomDir )
382 // On vérifie qu'aucun calcul n'a eu lieu pour ce cas
383 if ( _ListIter.size() > 1 ) { erreur = 1 ; }
385 if ( CHDIR(NomDir) == 0 ) {
386 _NomDir = std::string( NomDir );
390 if ( mkdir(NomDir, S_IRWXU|S_IRGRP|S_IXGRP) == 0 )
392 if ( _mkdir(NomDir) == 0 )
395 if ( CHDIR(NomDir) == 0 ) { _NomDir = std::string( NomDir ); }
396 else { erreur = 2 ; }
398 else { erreur = 2 ; }
402 //=============================================================================
403 std::string HOMARD_Cas::GetDirName() const
408 // La boite englobante
410 //=============================================================================
411 void HOMARD_Cas::SetBoundingBox( const std::vector<double>& extremas )
414 _Boite.resize( extremas.size() );
415 for ( unsigned int i = 0; i < extremas.size(); i++ )
416 _Boite[i] = extremas[i];
418 //=============================================================================
419 const std::vector<double>& HOMARD_Cas::GetBoundingBox() const
426 //=============================================================================
427 void HOMARD_Cas::AddGroup( const char* Group )
429 _ListGroup.push_back(Group);
431 //=============================================================================
432 void HOMARD_Cas::SetGroups( const std::list<std::string>& ListGroup )
435 std::list<std::string>::const_iterator it = ListGroup.begin();
436 while(it != ListGroup.end())
438 _ListGroup.push_back((*it++));
441 //=============================================================================
442 const std::list<std::string>& HOMARD_Cas::GetGroups() const
446 //=============================================================================
447 void HOMARD_Cas::SupprGroups()
454 //=============================================================================
455 void HOMARD_Cas::AddBoundary( const char* Boundary )
457 // MESSAGE ( ". HOMARD_Cas::AddBoundary : Boundary = " << Boundary );
458 const char* Group = "";
459 AddBoundaryGroup( Boundary, Group );
461 //=============================================================================
462 void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
464 // MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Boundary = " << Boundary );
465 // MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Group = " << Group );
466 _ListBoundaryGroup.push_back( Boundary );
467 _ListBoundaryGroup.push_back( Group );
469 //=============================================================================
470 const std::list<std::string>& HOMARD_Cas::GetBoundaryGroup() const
472 return _ListBoundaryGroup;
474 //=============================================================================
475 void HOMARD_Cas::SupprBoundaryGroup()
477 _ListBoundaryGroup.clear();
479 //=============================================================================
480 //=============================================================================
481 // Liens avec les autres structures
482 //=============================================================================
483 //=============================================================================
484 void HOMARD_Cas::AddIteration( const char* NomIteration )
486 _ListIter.push_back( std::string( NomIteration ) );
489 //=============================================================================
490 //=============================================================================
491 HomardDriver::HomardDriver(const std::string siter, const std::string siterp1):
492 _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ),
493 _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ),
494 _Texte( "" ), _bLu( false )
496 MESSAGE("siter = "<<siter<<", siterp1 = "<<siterp1);
497 // Le repertoire ou se trouve l'executable HOMARD
500 if ( getenv("HOMARD_ROOT_DIR") != NULL ) { dir = getenv("HOMARD_ROOT_DIR") ; }
501 dir += "/bin/salome";
502 MESSAGE("dir ="<<dir);
503 // L'executable HOMARD
504 std::string executable = "homard";
505 MESSAGE("executable ="<<executable);
506 // Memorisation du nom complet de l'executable HOMARD
507 _HOMARD_Exec = dir + "/" + executable ;
508 MESSAGE("==> _HOMARD_Exec ="<<_HOMARD_Exec) ;
513 //=============================================================================
514 //=============================================================================
515 HomardDriver::~HomardDriver()
518 //===============================================================================
520 //===============================================================================
521 void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue )
523 MESSAGE("TexteInit, DirCompute ="<<DirCompute<<", LogFile ="<<LogFile);
525 _Texte = "ListeStd \"" + LogFile + "\"\n" ;
526 _Texte += "RepeTrav \"" + DirCompute + "\"\n" ;
527 _Texte += "RepeInfo \"" + DirCompute + "\"\n" ;
528 _Texte += "Langue \"" + Langue + "\"\n" ;
531 //===============================================================================
532 void HomardDriver::TexteAdap()
534 MESSAGE("TexteAdap");
536 _Texte += "Action homa\n";
537 _Texte += "CCAssoci med\n";
538 _Texte += "ModeHOMA 1\n";
539 _Texte += "NumeIter " + _siter + "\n";
542 //===============================================================================
543 void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
545 MESSAGE("TexteInfo: TypeBila ="<<TypeBila<<", NumeIter ="<<NumeIter);
547 _Texte += "ModeHOMA 2\n" ;
548 std::stringstream saux1 ;
550 std::string saux2 = saux1.str() ;
551 _Texte += "TypeBila " + saux2 + "\n" ;
554 _Texte += "NumeIter 0\n" ;
555 _Texte += "Action info_av\n" ;
556 _Texte += "CCAssoci med\n" ;
560 _Texte += "NumeIter " + _siter + "\n" ;
561 _Texte += "Action info_ap\n" ;
562 _Texte += "CCAssoci homard\n" ;
567 //===============================================================================
568 void HomardDriver::TexteMajCoords( int NumeIter )
570 MESSAGE("TexteMajCoords: NumeIter ="<<NumeIter);
572 _Texte += "ModeHOMA 5\n" ;
573 _Texte += "NumeIter " + _siterp1 + "\n" ;
574 _Texte += "Action homa\n" ;
575 _Texte += "CCAssoci med\n" ;
576 _Texte += "EcriFiHO N_SANS_FRONTIERE\n" ;
580 //===============================================================================
581 // B. Les maillages en entree et en sortie
582 //===============================================================================
583 void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres )
585 MESSAGE("TexteMaillage, NomMesh = "<<NomMesh);
586 MESSAGE("TexteMaillage, MeshFile = "<<MeshFile);
587 MESSAGE("TexteMaillage, apres = "<<apres);
590 if ( apres < 1 ) { saux = "__" ; }
592 _Texte += "# Maillages Med " + saux + "\n" ;
593 _Texte += "CCNoMN" + saux + " \"" + NomMesh + "\"\n" ;
594 _Texte += "CCMaiN" + saux + " \"" + MeshFile + "\"\n" ;
597 //===============================================================================
598 void HomardDriver::TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres )
600 MESSAGE("TexteMaillageHOMARD, Dir ="<<Dir<<", liter ="<<liter<<", apres ="<<apres);
602 if ( apres < 1 ) { saux = "__" ; }
603 else { saux = "P1" ; }
605 _Texte += "# Maillage HOMARD " + liter + "\n" ;
606 _Texte += "HOMaiN" + saux + " Mai" + liter + " \"" + Dir + "/maill." + liter + ".hom.med\"\n" ;
609 //===============================================================================
610 // C. Le pilotage de l'adaptation
611 //===============================================================================
612 void HomardDriver::TexteConfRaffDera( int ConfType )
614 MESSAGE("TexteConfRaffDera, ConfType = " << ConfType);
616 // Type de conformite
623 saux = "NON_CONFORME_1_ARETE" ;
628 saux = "CONFORME_BOITES" ;
638 saux = "NON_CONFORME" ;
643 saux = "NON_CONFORME_1_NOEUD" ;
648 saux = "NON_CONFORME_INDICATEUR" ;
652 _Texte += "# Type de conformite\nTypeConf " + saux + "\n" ;
654 // Type de raffinement/deraffinement
656 saux = "TypeRaff uniforme\n" ;
657 saux += "TypeDera non" ;
658 _Texte += "# Type de raffinement/deraffinement\n" + saux + "\n" ;
660 //===============================================================================
662 //===============================================================================
663 void HomardDriver::TexteBoundaryOption( int BoundaryOption )
665 MESSAGE("TexteBoundaryOption, BoundaryOption = "<<BoundaryOption);
667 // Type de suivi de frontiere
669 std::stringstream saux1 ;
670 saux1 << BoundaryOption ;
671 std::string saux = saux1.str() ;
672 _Texte += "SuivFron " + saux + "\n" ;
674 }//===============================================================================
675 void HomardDriver::TexteBoundaryCAOGr( const std::string GroupName )
677 MESSAGE("TexteBoundaryCAOGr, GroupName = "<<GroupName);
679 _Texte += "GrFroCAO \"" + GroupName + "\"\n" ;
683 //===============================================================================
684 void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
686 MESSAGE("TexteBoundaryDi, MeshName = "<<MeshName);
687 MESSAGE("TexteBoundaryDi, MeshFile = "<<MeshFile);
689 _Texte += "#\n# Frontiere discrete\n" ;
690 _Texte += "CCNoMFro \"" + MeshName + "\"\n" ;
691 _Texte += "CCFronti \"" + MeshFile + "\"\n" ;
694 //===============================================================================
695 void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
697 MESSAGE("TexteBoundaryDiGr, GroupName = "<<GroupName);
699 _Texte += "CCGroFro \"" + GroupName + "\"\n" ;
702 //===============================================================================
703 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 )
705 MESSAGE("TexteBoundaryAn, NameBoundary = "<<NameBoundary);
706 // MESSAGE("TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
707 MESSAGE("TexteBoundaryAn, BoundaryType = "<<BoundaryType);
708 // MESSAGE("TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6","<<x7);
710 std::string saux, saux2 ;
714 std::stringstream saux1 ;
715 saux1 << NumeBoundary ;
716 saux2 = saux1.str() ;
717 saux = "#\n# Frontiere numero " + saux2 + "\n" ;
718 if ( BoundaryType == 1 )
719 { saux += "# Cylindre\n" ; }
720 if ( BoundaryType == 2 )
721 { saux += "# Sphere\n" ; }
722 if ( BoundaryType == 3 || BoundaryType == 4 )
723 { saux += "# Cone\n" ; }
724 if ( BoundaryType == 5 )
725 { saux += "# Tore\n" ; }
727 // Le nom de la frontiere
729 { std::stringstream saux1 ;
730 saux1 << NumeBoundary ;
731 saux += "FANom " + saux1.str() + " \"" + NameBoundary + "\"\n" ;
736 { std::stringstream saux1 ;
737 saux1 << NumeBoundary << " " << BoundaryType ;
738 saux += "FAType " + saux1.str() + "\n" ;
743 if ( BoundaryType == 1 )
745 { std::stringstream saux1 ;
746 saux1 << NumeBoundary << " " << x0 ;
747 saux2 = saux1.str() ;
748 saux += "FAXCen " + saux1.str() + "\n" ;
750 { std::stringstream saux1 ;
751 saux1 << NumeBoundary << " " << x1 ;
752 saux += "FAYCen " + saux1.str() + "\n" ;
754 { std::stringstream saux1 ;
755 saux1 << NumeBoundary << " " << x2 ;
756 saux += "FAZCen " + saux1.str() + "\n" ;
758 { std::stringstream saux1 ;
759 saux1 << NumeBoundary << " " << x3 ;
760 saux += "FAXAxe " + saux1.str() + "\n" ;
762 { std::stringstream saux1 ;
763 saux1 << NumeBoundary << " " << x4 ;
764 saux += "FAYAxe " + saux1.str() + "\n" ;
766 { std::stringstream saux1 ;
767 saux1 << NumeBoundary << " " << x5 ;
768 saux += "FAZAxe " + saux1.str() + "\n" ;
770 { std::stringstream saux1 ;
771 saux1 << NumeBoundary << " " << x6 ;
772 saux += "FARayon " + saux1.str() + "\n" ;
778 else if ( BoundaryType == 2 )
780 { std::stringstream saux1 ;
781 saux1 << NumeBoundary << " " << x0 ;
782 saux += "FAXCen " + saux1.str() + "\n" ;
784 { std::stringstream saux1 ;
785 saux1 << NumeBoundary << " " << x1 ;
786 saux += "FAYCen " + saux1.str() + "\n" ;
788 { std::stringstream saux1 ;
789 saux1 << NumeBoundary << " " << x2 ;
790 saux += "FAZCen " + saux1.str() + "\n" ;
792 { std::stringstream saux1 ;
793 saux1 << NumeBoundary << " " << x3 ;
794 saux += "FARayon " + saux1.str() + "\n" ;
798 // Cas du cone defini par un axe et un angle
800 if ( BoundaryType == 3 )
802 { std::stringstream saux1 ;
803 saux1 << NumeBoundary << " " << x0 ;
804 saux += "FAXAxe " + saux1.str() + "\n" ;
806 { std::stringstream saux1 ;
807 saux1 << NumeBoundary << " " << x1 ;
808 saux += "FAYAxe " + saux1.str() + "\n" ;
810 { std::stringstream saux1 ;
811 saux1 << NumeBoundary << " " << x2 ;
812 saux += "FAZAxe " + saux1.str() + "\n" ;
814 { std::stringstream saux1 ;
815 saux1 << NumeBoundary << " " << x3 ;
816 saux += "FAAngle " + saux1.str() + "\n" ;
818 { std::stringstream saux1 ;
819 saux1 << NumeBoundary << " " << x4 ;
820 saux += "FAXCen " + saux1.str() + "\n" ;
822 { std::stringstream saux1 ;
823 saux1 << NumeBoundary << " " << x5 ;
824 saux += "FAYCen " + saux1.str() + "\n" ;
826 { std::stringstream saux1 ;
827 saux1 << NumeBoundary << " " << x6 ;
828 saux += "FAZCen " + saux1.str() + "\n" ;
832 // Cas du cone defini par les 2 rayons
834 if ( BoundaryType == 4 )
836 { std::stringstream saux1 ;
837 saux1 << NumeBoundary << " " << x0 ;
838 saux += "FAXCen " + saux1.str() + "\n" ;
840 { std::stringstream saux1 ;
841 saux1 << NumeBoundary << " " << x1 ;
842 saux += "FAYCen " + saux1.str() + "\n" ;
844 { std::stringstream saux1 ;
845 saux1 << NumeBoundary << " " << x2 ;
846 saux += "FAZCen " + saux1.str() + "\n" ;
848 { std::stringstream saux1 ;
849 saux1 << NumeBoundary << " " << x3 ;
850 saux += "FARayon " + saux1.str() + "\n" ;
852 { std::stringstream saux1 ;
853 saux1 << NumeBoundary << " " << x4 ;
854 saux += "FAXCen2 " + saux1.str() + "\n" ;
856 { std::stringstream saux1 ;
857 saux1 << NumeBoundary << " " << x5 ;
858 saux += "FAYCen2 " + saux1.str() + "\n" ;
860 { std::stringstream saux1 ;
861 saux1 << NumeBoundary << " " << x6 ;
862 saux += "FAZCen2 " + saux1.str() + "\n" ;
864 { std::stringstream saux1 ;
865 saux1 << NumeBoundary << " " << x7 ;
866 saux += "FARayon2 " + saux1.str() + "\n" ;
872 if ( BoundaryType == 5 )
874 { std::stringstream saux1 ;
875 saux1 << NumeBoundary << " " << x0 ;
876 saux2 = saux1.str() ;
877 saux += "FAXCen " + saux1.str() + "\n" ;
879 { std::stringstream saux1 ;
880 saux1 << NumeBoundary << " " << x1 ;
881 saux += "FAYCen " + saux1.str() + "\n" ;
883 { std::stringstream saux1 ;
884 saux1 << NumeBoundary << " " << x2 ;
885 saux += "FAZCen " + saux1.str() + "\n" ;
887 { std::stringstream saux1 ;
888 saux1 << NumeBoundary << " " << x3 ;
889 saux += "FAXAxe " + saux1.str() + "\n" ;
891 { std::stringstream saux1 ;
892 saux1 << NumeBoundary << " " << x4 ;
893 saux += "FAYAxe " + saux1.str() + "\n" ;
895 { std::stringstream saux1 ;
896 saux1 << NumeBoundary << " " << x5 ;
897 saux += "FAZAxe " + saux1.str() + "\n" ;
899 { std::stringstream saux1 ;
900 saux1 << NumeBoundary << " " << x6 ;
901 saux += "FARayon " + saux1.str() + "\n" ;
903 { std::stringstream saux1 ;
904 saux1 << NumeBoundary << " " << x7 ;
905 saux += "FARayon2 " + saux1.str() + "\n" ;
909 _Texte += saux + "#\n" ;
912 //===============================================================================
913 void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
915 MESSAGE("TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
916 // MESSAGE("TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
917 // MESSAGE("TexteBoundaryAnGr, GroupName = "<<GroupName);
921 std::string saux, saux2 ;
922 std::stringstream saux1 ;
923 saux1 << NumeBoundary ;
924 saux2 = saux1.str() ;
925 saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
927 saux += "FGNomFro " + saux2 + " \"" + NameBoundary + "\"\n" ;
928 saux += "FGNomGro " + saux2 + " \"" + GroupName + "\"\n" ;
930 _Texte += saux + "#\n" ;
933 //===============================================================================
934 // F. Les options avancees
935 //===============================================================================
936 void HomardDriver::TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int ExtraOutput )
938 MESSAGE("TexteAdvanced, NivMax ="<<NivMax<<", DiamMin ="<<DiamMin<<
939 ", AdapInit ="<<AdapInit<<", ExtraOutput ="<<ExtraOutput);
943 _Texte += "# Niveaux extremes\n" ;
944 { std::stringstream saux1 ;
946 _Texte += "NiveauMa " + saux1.str() + "\n" ;
951 _Texte += "# Diametre minimal\n" ;
952 { std::stringstream saux1 ;
954 _Texte += "DiametMi " + saux1.str() + "\n" ;
960 { _Texte += "# Raffinement" ; }
962 { _Texte += "# Deraffinement" ; }
963 _Texte += " des regions sans indicateur\n" ;
964 { std::stringstream saux1 ;
966 _Texte += "AdapInit " + saux1.str() + "\n" ;
969 if ( ExtraOutput % 2 == 0 )
971 _Texte += "# Sortie des niveaux de raffinement\n" ;
972 _Texte += "NCNiveau NIVEAU\n" ;
974 if ( ExtraOutput % 3 == 0 )
976 _Texte += "# Sortie des qualités des mailles\n" ;
977 _Texte += "NCQualit QUAL\n" ;
979 if ( ExtraOutput % 5 == 0 )
981 _Texte += "# Sortie des diamètres des mailles\n" ;
982 _Texte += "NCDiamet DIAM\n" ;
984 if ( ExtraOutput % 7 == 0 )
986 _Texte += "# Sortie des parents des mailles\n" ;
987 _Texte += "NCParent PARENT\n" ;
989 if ( ExtraOutput % 11 == 0 )
991 _Texte += "# Volumes voisins par recollement\n" ;
992 _Texte += "NCVoisRc Voisin-Recollement\n" ;
995 //===============================================================================
997 //===============================================================================
998 void HomardDriver::TexteInfoCompute( int MessInfo )
1000 MESSAGE("TexteAdvanced, MessInfo ="<<MessInfo);
1002 if ( MessInfo != 0 )
1004 _Texte += "# Messages d'informations\n" ;
1005 { std::stringstream saux1 ;
1007 _Texte += "MessInfo " + saux1.str() + "\n" ;
1011 //===============================================================================
1012 void HomardDriver::CreeFichier( )
1015 if ( _modeHOMARD == 1 )
1016 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
1017 else if ( _modeHOMARD == 2 )
1018 { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
1019 else if ( _modeHOMARD == 5 )
1020 { _NomFichierConf = _NomFichierConfBase + ".majc" ; }
1022 std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
1023 if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
1027 //===============================================================================
1028 // Creation du fichier de donnees pour l'information
1029 //===============================================================================
1030 void HomardDriver::CreeFichierDonn( )
1033 MESSAGE("CreeFichierDonn");
1034 _NomFichierDonn = "info.donn" ;
1040 std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ;
1041 if (Fic.is_open() == true) { Fic << data << std::endl ; }
1045 //===============================================================================
1046 int HomardDriver::ExecuteHomard()
1048 MESSAGE("ExecuteHomard");
1049 std::string commande ;
1051 // Copie des Fichiers HOMARD
1052 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ;
1053 codret = system(commande.c_str()) ;
1055 // Execution de HOMARD
1058 commande = _HOMARD_Exec.c_str() ;
1059 if ( _NomFichierDonn != "" ) { commande += " < " + _NomFichierDonn ; }
1060 codret = system(commande.c_str());
1061 if ( codret != 0) { MESSAGE ( "Erreur en executant HOMARD : " << codret ); };
1062 _NomFichierDonn = "" ;
1067 //=============================================================================
1068 //=============================================================================
1069 HOMARD_Gen::HOMARD_Gen()
1071 MESSAGE("HOMARD_Gen");
1074 //=============================================================================
1075 //=============================================================================
1076 HOMARD_Gen::~HOMARD_Gen()
1078 MESSAGE("~HOMARD_Gen");
1080 //=============================================================================
1082 //=============================================================================
1084 * default constructor:
1086 //=============================================================================
1087 HOMARD_Iteration::HOMARD_Iteration():
1098 MESSAGE("HOMARD_Iteration");
1100 //=============================================================================
1104 //=============================================================================
1105 HOMARD_Iteration::~HOMARD_Iteration()
1107 MESSAGE("~HOMARD_Iteration");
1109 //=============================================================================
1110 //=============================================================================
1112 //=============================================================================
1113 //=============================================================================
1114 void HOMARD_Iteration::SetName( const char* Name )
1116 _Name = std::string( Name );
1118 //=============================================================================
1119 std::string HOMARD_Iteration::GetName() const
1123 //=============================================================================
1124 //=============================================================================
1126 //=============================================================================
1127 //=============================================================================
1128 void HOMARD_Iteration::SetDirNameLoc( const char* NomDir )
1130 _NomDir = std::string( NomDir );
1132 //=============================================================================
1133 std::string HOMARD_Iteration::GetDirNameLoc() const
1137 //=============================================================================
1138 void HOMARD_Iteration::SetNumber( int NumIter )
1142 //=============================================================================
1143 int HOMARD_Iteration::GetNumber() const
1147 //=============================================================================
1148 void HOMARD_Iteration::SetState( int etat )
1152 //=============================================================================
1153 int HOMARD_Iteration::GetState() const
1157 //=============================================================================
1158 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
1160 _NomMesh = std::string( NomMesh );
1162 //=============================================================================
1163 std::string HOMARD_Iteration::GetMeshName() const
1167 //=============================================================================
1168 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
1170 _MeshFile = std::string( MeshFile );
1172 //=============================================================================
1173 std::string HOMARD_Iteration::GetMeshFile() const
1177 //=============================================================================
1178 void HOMARD_Iteration::SetLogFile( const char* LogFile )
1180 _LogFile = std::string( LogFile );
1182 //=============================================================================
1183 std::string HOMARD_Iteration::GetLogFile() const
1187 //=============================================================================
1188 void HOMARD_Iteration::SetFileInfo( const char* FileInfo )
1190 _FileInfo = std::string( FileInfo );
1192 //=============================================================================
1193 std::string HOMARD_Iteration::GetFileInfo() const
1197 //=============================================================================
1198 void HOMARD_Iteration::SetInfoCompute( int MessInfo )
1200 _MessInfo = MessInfo;
1202 //=============================================================================
1203 int HOMARD_Iteration::GetInfoCompute() const
1208 } // namespace SMESHHOMARDImpl /end/