1 // HOMARD HOMARD : implementaion of HOMARD idl descriptions
3 // Copyright (C) 2011 CEA/DEN, EDF R&D
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : HOMARD_Boundary.cxx
22 // Author : Paul RASCLE, EDF
25 #include "HOMARD_Boundary.hxx"
26 #include "utilities.h"
28 //=============================================================================
30 * default constructor:
32 //=============================================================================
33 HOMARD_Boundary::HOMARD_Boundary():
34 _NomBoundary( "" ),_BoundaryType( 1 ),
35 _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ),
36 _Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ),
37 _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ),
38 _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 )
40 MESSAGE("HOMARD_Boundary");
43 //=============================================================================
44 HOMARD_Boundary::~HOMARD_Boundary()
46 MESSAGE("~HOMARD_Boundary");
49 //=============================================================================
50 void HOMARD_Boundary::SetName( const char* NomBoundary )
52 MESSAGE("SetName = "<<NomBoundary);
53 _NomBoundary = std::string( NomBoundary );
56 //=============================================================================
57 std::string HOMARD_Boundary::GetName() const
62 //=============================================================================
63 std::string HOMARD_Boundary::GetDumpPython() const
65 std::ostringstream aScript;
66 aScript << "\n# Creation of the ";
67 if ( _BoundaryType == 0 ) { aScript << "discrete boundary " << _NomBoundary << "\n";}
68 if ( _BoundaryType == 1 ) { aScript << "cylinder " << _NomBoundary << "\n";}
69 if ( _BoundaryType == 2 ) { aScript << "sphere " << _NomBoundary << "\n"; }
71 aScript << "\t" << _NomBoundary << " = homard.CreateBoundary('" << _NomBoundary ;
72 aScript << "', " << _BoundaryType << ")\n";
74 switch (_BoundaryType)
78 aScript << "\t" <<_NomBoundary << ".SetMeshFile('";
79 aScript << _MeshFile << "')\n";
80 aScript << "\t" <<_NomBoundary << ".SetMeshName('";
81 aScript << _MeshName << "')\n";
87 aScript << "\t" << _NomBoundary << ".SetCylinder(" ;
88 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n";
94 aScript << "\t" << _NomBoundary << ".SetSphere(" ;
95 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n";
100 return aScript.str();
104 //=============================================================================
105 void HOMARD_Boundary::SetBoundaryType( int BoundaryType )
107 MESSAGE("SetBoundaryType = "<<BoundaryType);
108 _BoundaryType = BoundaryType;
111 //=============================================================================
112 int HOMARD_Boundary::GetBoundaryType() const
114 return _BoundaryType;
117 //=============================================================================
118 void HOMARD_Boundary::SetMeshFile( const char* MeshFile )
120 _MeshFile = std::string( MeshFile );
122 //=============================================================================
123 std::string HOMARD_Boundary::GetMeshFile() const
127 //=============================================================================
128 void HOMARD_Boundary::SetMeshName( const char* MeshName )
130 _MeshName = std::string( MeshName );
132 //=============================================================================
133 std::string HOMARD_Boundary::GetMeshName() const
137 //======================================================================
138 void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 )
140 _Xincr = X0; _Yincr = X1; _Zincr = X2;
142 //=======================================================================================
143 void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2,
144 double X3, double X4, double X5, double X6 )
146 _Xcentre = X0; _Ycentre = X1;
147 _Zcentre = X2; _Xaxe = X3;
148 _Yaxe = X4; _Zaxe = X5;
152 //======================================================================
153 void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 )
155 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
159 //=======================================================================================
160 std::vector<double> HOMARD_Boundary::GetLimit() const
162 std::vector<double> mesLimit;
163 mesLimit.push_back( _Xincr );
164 mesLimit.push_back( _Yincr );
165 mesLimit.push_back( _Zincr );
169 //=======================================================================================
170 std::vector<double> HOMARD_Boundary::GetCylinder() const
172 std::vector<double> mesCoor;
173 mesCoor.push_back( _Xcentre );
174 mesCoor.push_back( _Ycentre );
175 mesCoor.push_back( _Zcentre );
176 mesCoor.push_back( _Xaxe );
177 mesCoor.push_back( _Yaxe );
178 mesCoor.push_back( _Zaxe );
179 mesCoor.push_back( _rayon );
183 //=======================================================================================
184 std::vector<double> HOMARD_Boundary::GetSphere() const
186 std::vector<double> mesCoor;
187 mesCoor.push_back( _Xcentre );
188 mesCoor.push_back( _Ycentre );
189 mesCoor.push_back( _Zcentre );
190 mesCoor.push_back( _rayon );
193 //=============================================================================
196 //=============================================================================
197 void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation )
199 _NomCasCreation = std::string( NomCasCreation );
202 //=============================================================================
205 //=============================================================================
206 const std::list<std::string>& HOMARD_Boundary::GetGroups() const
208 return _ListGroupSelected;
210 //=============================================================================
211 void HOMARD_Boundary::SetGroups( const std::list<std::string>& ListGroup )
213 _ListGroupSelected.clear();
214 std::list<std::string>::const_iterator it = ListGroup.begin();
215 while(it != ListGroup.end())
216 _ListGroupSelected.push_back((*it++));
218 //=============================================================================
219 void HOMARD_Boundary::AddGroup( const char* Group)
221 _ListGroupSelected.push_back(Group);
224 //=============================================================================
227 //=============================================================================
228 std::string HOMARD_Boundary::GetCaseCreation() const
230 return _NomCasCreation;
232 //=============================================================================