1 // HOMARD HOMARD : implementaion of HOMARD idl descriptions
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : HOMARD_Boundary.cxx
25 // Author : Paul RASCLE, EDF
28 #include "HOMARD_Boundary.hxx"
29 #include "utilities.h"
31 //=============================================================================
33 * default constructor:
35 //=============================================================================
36 HOMARD_Boundary::HOMARD_Boundary():
37 _NomBoundary( "" ),_BoundaryType( 1 ),
38 _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ),
39 _Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ),
40 _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ),
41 _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 )
43 MESSAGE("HOMARD_Boundary");
46 //=============================================================================
47 HOMARD_Boundary::~HOMARD_Boundary()
49 MESSAGE("~HOMARD_Boundary");
52 //=============================================================================
53 void HOMARD_Boundary::SetName( const char* NomBoundary )
55 MESSAGE("SetName = "<<NomBoundary);
56 _NomBoundary = std::string( NomBoundary );
59 //=============================================================================
60 std::string HOMARD_Boundary::GetName() const
65 //=============================================================================
66 std::string HOMARD_Boundary::GetDumpPython() const
68 std::ostringstream aScript;
69 aScript << "\n# Creation of the ";
70 if ( _BoundaryType == 0 ) { aScript << "discrete boundary " << _NomBoundary << "\n";}
71 if ( _BoundaryType == 1 ) { aScript << "cylinder " << _NomBoundary << "\n";}
72 if ( _BoundaryType == 2 ) { aScript << "sphere " << _NomBoundary << "\n"; }
74 aScript << "\t" << _NomBoundary << " = homard.CreateBoundary('" << _NomBoundary ;
75 aScript << "', " << _BoundaryType << ")\n";
77 switch (_BoundaryType)
81 aScript << "\t" <<_NomBoundary << ".SetMeshFile('";
82 aScript << _MeshFile << "')\n";
83 aScript << "\t" <<_NomBoundary << ".SetMeshName('";
84 aScript << _MeshName << "')\n";
90 aScript << "\t" << _NomBoundary << ".SetCylinder(" ;
91 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n";
97 aScript << "\t" << _NomBoundary << ".SetSphere(" ;
98 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n";
103 return aScript.str();
107 //=============================================================================
108 void HOMARD_Boundary::SetBoundaryType( int BoundaryType )
110 MESSAGE("SetBoundaryType = "<<BoundaryType);
111 _BoundaryType = BoundaryType;
114 //=============================================================================
115 int HOMARD_Boundary::GetBoundaryType() const
117 return _BoundaryType;
120 //=============================================================================
121 void HOMARD_Boundary::SetMeshFile( const char* MeshFile )
123 _MeshFile = std::string( MeshFile );
125 //=============================================================================
126 std::string HOMARD_Boundary::GetMeshFile() const
130 //=============================================================================
131 void HOMARD_Boundary::SetMeshName( const char* MeshName )
133 _MeshName = std::string( MeshName );
135 //=============================================================================
136 std::string HOMARD_Boundary::GetMeshName() const
140 //======================================================================
141 void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 )
143 _Xincr = X0; _Yincr = X1; _Zincr = X2;
145 //=======================================================================================
146 void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2,
147 double X3, double X4, double X5, double X6 )
149 _Xcentre = X0; _Ycentre = X1;
150 _Zcentre = X2; _Xaxe = X3;
151 _Yaxe = X4; _Zaxe = X5;
155 //======================================================================
156 void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 )
158 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
162 //=======================================================================================
163 std::vector<double> HOMARD_Boundary::GetLimit() const
165 std::vector<double> mesLimit;
166 mesLimit.push_back( _Xincr );
167 mesLimit.push_back( _Yincr );
168 mesLimit.push_back( _Zincr );
172 //=======================================================================================
173 std::vector<double> HOMARD_Boundary::GetCylinder() const
175 std::vector<double> mesCoor;
176 mesCoor.push_back( _Xcentre );
177 mesCoor.push_back( _Ycentre );
178 mesCoor.push_back( _Zcentre );
179 mesCoor.push_back( _Xaxe );
180 mesCoor.push_back( _Yaxe );
181 mesCoor.push_back( _Zaxe );
182 mesCoor.push_back( _rayon );
186 //=======================================================================================
187 std::vector<double> HOMARD_Boundary::GetSphere() const
189 std::vector<double> mesCoor;
190 mesCoor.push_back( _Xcentre );
191 mesCoor.push_back( _Ycentre );
192 mesCoor.push_back( _Zcentre );
193 mesCoor.push_back( _rayon );
196 //=============================================================================
199 //=============================================================================
200 void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation )
202 _NomCasCreation = std::string( NomCasCreation );
205 //=============================================================================
208 //=============================================================================
209 const std::list<std::string>& HOMARD_Boundary::GetGroups() const
211 return _ListGroupSelected;
213 //=============================================================================
214 void HOMARD_Boundary::SetGroups( const std::list<std::string>& ListGroup )
216 _ListGroupSelected.clear();
217 std::list<std::string>::const_iterator it = ListGroup.begin();
218 while(it != ListGroup.end())
219 _ListGroupSelected.push_back((*it++));
221 //=============================================================================
222 void HOMARD_Boundary::AddGroup( const char* Group)
224 _ListGroupSelected.push_back(Group);
227 //=============================================================================
230 //=============================================================================
231 std::string HOMARD_Boundary::GetCaseCreation() const
233 return _NomCasCreation;
235 //=============================================================================