1 // HOMARD HOMARD : implementaion of HOMARD idl descriptions
3 // Copyright (C) 2011-2013 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
26 // L'ordre de description des fonctions est le meme dans tous les fichiers
27 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
28 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
29 // 2. Les caracteristiques
30 // 3. Le lien avec les autres structures
32 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
34 #include "HOMARD_Boundary.hxx"
35 #include "utilities.h"
37 //=============================================================================
39 * default constructor:
41 //=============================================================================
42 HOMARD_Boundary::HOMARD_Boundary():
43 _Name( "" ),_Type( 1 ),
44 _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ),
45 _Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ),
46 _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ),
47 _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 )
49 MESSAGE("HOMARD_Boundary");
52 //=============================================================================
53 HOMARD_Boundary::~HOMARD_Boundary()
55 MESSAGE("~HOMARD_Boundary");
57 //=============================================================================
58 //=============================================================================
60 //=============================================================================
61 //=============================================================================
62 void HOMARD_Boundary::SetName( const char* Name )
64 _Name = std::string( Name );
66 //=============================================================================
67 std::string HOMARD_Boundary::GetName() const
71 //=============================================================================
72 std::string HOMARD_Boundary::GetDumpPython() const
74 std::ostringstream aScript;
75 aScript << "\n# Creation of the ";
81 aScript << "discrete boundary " << _Name << "\n";
82 aScript << "\t" << _Name << " = homard.CreateBoundaryDi(\"" << _Name << "\", ";
83 aScript << "\"" << _MeshName << "\", ";
84 aScript << "\"" << _MeshFile << "\")\n";
89 aScript << "cylinder " << _Name << "\n";
90 aScript << "\t" << _Name << " = homard.CreateBoundaryCylinder(\"" << _Name << "\", ";
91 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n";
96 aScript << "sphere " << _Name << "\n";
97 aScript << "\t" << _Name << " = homard.CreateBoundarySphere(\"" << _Name << "\", ";
98 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n";
103 aScript << "cone " << _Name << "\n";
104 aScript << "\t" << _Name << " = homard.CreateBoundaryConeA(\"" << _Name << "\", ";
105 aScript << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Angle << ", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ")\n";
110 aScript << "cone " << _Name << "\n";
111 aScript << "\t" << _Name << " = homard.CreateBoundaryConeR(\"" << _Name << "\", ";
112 aScript << _Xcentre1 << ", " << _Ycentre1 << ", " << _Zcentre1 << ", " << _Rayon1 << ", " << _Xcentre2 << ", " << _Ycentre2 << ", " << _Zcentre2 << ", " << _Rayon2 << ")\n";
117 return aScript.str();
119 //=============================================================================
120 //=============================================================================
122 //=============================================================================
123 //=============================================================================
124 void HOMARD_Boundary::SetType( int Type )
128 //=============================================================================
129 int HOMARD_Boundary::GetType() const
133 //=============================================================================
134 void HOMARD_Boundary::SetMeshName( const char* MeshName )
136 _MeshName = std::string( MeshName );
138 //=============================================================================
139 std::string HOMARD_Boundary::GetMeshName() const
143 //=============================================================================
144 void HOMARD_Boundary::SetMeshFile( const char* MeshFile )
146 _MeshFile = std::string( MeshFile );
148 //=============================================================================
149 std::string HOMARD_Boundary::GetMeshFile() const
153 //=======================================================================================
154 void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2,
155 double X3, double X4, double X5, double X6 )
157 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
158 _Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
161 //======================================================================
162 void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 )
164 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
167 //======================================================================
168 void HOMARD_Boundary::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
169 double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2)
171 _Xcentre1 = Xcentre1; _Ycentre1 = Ycentre1; _Zcentre1 = Zcentre1;
173 _Xcentre2 = Xcentre2; _Ycentre2 = Ycentre2; _Zcentre2 = Zcentre2;
176 //======================================================================
177 void HOMARD_Boundary::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
178 double Xcentre, double Ycentre, double Zcentre)
180 _Xaxe = Xaxe; _Yaxe = Yaxe; _Zaxe = Zaxe;
182 _Xcentre = Xcentre; _Ycentre = Ycentre; _Zcentre = Zcentre;
184 //=======================================================================================
185 std::vector<double> HOMARD_Boundary::GetCoords() const
187 std::vector<double> mesCoor;
194 mesCoor.push_back( _Xcentre );
195 mesCoor.push_back( _Ycentre );
196 mesCoor.push_back( _Zcentre );
197 mesCoor.push_back( _Xaxe );
198 mesCoor.push_back( _Yaxe );
199 mesCoor.push_back( _Zaxe );
200 mesCoor.push_back( _rayon );
206 mesCoor.push_back( _Xcentre );
207 mesCoor.push_back( _Ycentre );
208 mesCoor.push_back( _Zcentre );
209 mesCoor.push_back( _rayon );
212 // Cone defini par un axe et un angle
215 mesCoor.push_back( _Xaxe );
216 mesCoor.push_back( _Yaxe );
217 mesCoor.push_back( _Zaxe );
218 mesCoor.push_back( _Angle );
219 mesCoor.push_back( _Xcentre );
220 mesCoor.push_back( _Ycentre );
221 mesCoor.push_back( _Zcentre );
224 // Cone defini par les 2 rayons
227 mesCoor.push_back( _Xcentre1 );
228 mesCoor.push_back( _Ycentre1 );
229 mesCoor.push_back( _Zcentre1 );
230 mesCoor.push_back( _Rayon1 );
231 mesCoor.push_back( _Xcentre2 );
232 mesCoor.push_back( _Ycentre2 );
233 mesCoor.push_back( _Zcentre2 );
234 mesCoor.push_back( _Rayon2 );
237 ASSERT ( _Type == -1 ) ;
241 //======================================================================
242 void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 )
244 _Xincr = X0; _Yincr = X1; _Zincr = X2;
246 //=======================================================================================
247 std::vector<double> HOMARD_Boundary::GetLimit() const
249 std::vector<double> mesLimit;
250 mesLimit.push_back( _Xincr );
251 mesLimit.push_back( _Yincr );
252 mesLimit.push_back( _Zincr );
255 //=============================================================================
256 void HOMARD_Boundary::AddGroup( const char* Group)
258 _ListGroupSelected.push_back(Group);
260 //=============================================================================
261 void HOMARD_Boundary::SetGroups( const std::list<std::string>& ListGroup )
263 _ListGroupSelected.clear();
264 std::list<std::string>::const_iterator it = ListGroup.begin();
265 while(it != ListGroup.end())
266 _ListGroupSelected.push_back((*it++));
268 //=============================================================================
269 const std::list<std::string>& HOMARD_Boundary::GetGroups() const
271 return _ListGroupSelected;
273 //=============================================================================
274 //=============================================================================
275 // Liens avec les autres structures
276 //=============================================================================
277 //=============================================================================
278 void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation )
280 _NomCasCreation = std::string( NomCasCreation );
282 //=============================================================================
283 std::string HOMARD_Boundary::GetCaseCreation() const
285 return _NomCasCreation;
287 //=============================================================================