1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2016 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
21 // File : HOMARD_Boundary.cxx
22 // Author : Gerald NICOLAS, 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"
36 #include "utilities.h"
38 //=============================================================================
40 * default constructor:
42 //=============================================================================
43 HOMARD_Boundary::HOMARD_Boundary():
44 _Name( "" ),_Type( 1 ),
45 _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ),
46 _Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ),
47 _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ),
48 _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 )
50 MESSAGE("HOMARD_Boundary");
53 //=============================================================================
54 HOMARD_Boundary::~HOMARD_Boundary()
56 MESSAGE("~HOMARD_Boundary");
58 //=============================================================================
59 //=============================================================================
61 //=============================================================================
62 //=============================================================================
63 void HOMARD_Boundary::SetName( const char* Name )
65 _Name = std::string( Name );
67 //=============================================================================
68 std::string HOMARD_Boundary::GetName() const
72 //=============================================================================
73 std::string HOMARD_Boundary::GetDumpPython() const
75 std::ostringstream aScript;
76 aScript << "\n# Creation of the ";
82 aScript << "discrete boundary " << _Name << "\n";
83 aScript << "\t" << _Name << " = homard.CreateBoundaryDi(\"" << _Name << "\", ";
84 aScript << "\"" << _MeshName << "\", ";
85 aScript << "\"" << _MeshFile << "\")\n";
90 aScript << "cylinder " << _Name << "\n";
91 aScript << "\t" << _Name << " = homard.CreateBoundaryCylinder(\"" << _Name << "\", ";
92 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n";
97 aScript << "sphere " << _Name << "\n";
98 aScript << "\t" << _Name << " = homard.CreateBoundarySphere(\"" << _Name << "\", ";
99 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n";
104 aScript << "cone " << _Name << "\n";
105 aScript << "\t" << _Name << " = homard.CreateBoundaryConeA(\"" << _Name << "\", ";
106 aScript << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Angle << ", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ")\n";
111 aScript << "cone " << _Name << "\n";
112 aScript << "\t" << _Name << " = homard.CreateBoundaryConeR(\"" << _Name << "\", ";
113 aScript << _Xcentre1 << ", " << _Ycentre1 << ", " << _Zcentre1 << ", " << _Rayon1 << ", " << _Xcentre2 << ", " << _Ycentre2 << ", " << _Zcentre2 << ", " << _Rayon2 << ")\n";
118 aScript << "tore " << _Name << "\n";
119 aScript << "\t" << _Name << " = homard.CreateBoundaryTorus(\"" << _Name << "\", ";
120 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon1 << ", " << _Rayon2 << ")\n";
125 return aScript.str();
127 //=============================================================================
128 //=============================================================================
130 //=============================================================================
131 //=============================================================================
132 void HOMARD_Boundary::SetType( int Type )
136 //=============================================================================
137 int HOMARD_Boundary::GetType() const
141 //=============================================================================
142 void HOMARD_Boundary::SetMeshName( const char* MeshName )
144 _MeshName = std::string( MeshName );
146 //=============================================================================
147 std::string HOMARD_Boundary::GetMeshName() const
151 //=============================================================================
152 void HOMARD_Boundary::SetMeshFile( const char* MeshFile )
154 _MeshFile = std::string( MeshFile );
156 //=============================================================================
157 std::string HOMARD_Boundary::GetMeshFile() const
161 //=======================================================================================
162 void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2,
163 double X3, double X4, double X5, double X6 )
165 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
166 _Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
169 //======================================================================
170 void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 )
172 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
175 //======================================================================
176 void HOMARD_Boundary::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
177 double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2)
179 _Xcentre1 = Xcentre1; _Ycentre1 = Ycentre1; _Zcentre1 = Zcentre1;
181 _Xcentre2 = Xcentre2; _Ycentre2 = Ycentre2; _Zcentre2 = Zcentre2;
184 //======================================================================
185 void HOMARD_Boundary::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
186 double Xcentre, double Ycentre, double Zcentre)
188 _Xaxe = Xaxe; _Yaxe = Yaxe; _Zaxe = Zaxe;
190 _Xcentre = Xcentre; _Ycentre = Ycentre; _Zcentre = Zcentre;
192 //=======================================================================================
193 void HOMARD_Boundary::SetTorus( double X0, double X1, double X2,
194 double X3, double X4, double X5, double X6, double X7 )
196 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
197 _Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
201 //=======================================================================================
202 std::vector<double> HOMARD_Boundary::GetCoords() const
204 std::vector<double> mesCoor;
211 mesCoor.push_back( _Xcentre );
212 mesCoor.push_back( _Ycentre );
213 mesCoor.push_back( _Zcentre );
214 mesCoor.push_back( _Xaxe );
215 mesCoor.push_back( _Yaxe );
216 mesCoor.push_back( _Zaxe );
217 mesCoor.push_back( _rayon );
223 mesCoor.push_back( _Xcentre );
224 mesCoor.push_back( _Ycentre );
225 mesCoor.push_back( _Zcentre );
226 mesCoor.push_back( _rayon );
229 // Cone defini par un axe et un angle
232 mesCoor.push_back( _Xaxe );
233 mesCoor.push_back( _Yaxe );
234 mesCoor.push_back( _Zaxe );
235 mesCoor.push_back( _Angle );
236 mesCoor.push_back( _Xcentre );
237 mesCoor.push_back( _Ycentre );
238 mesCoor.push_back( _Zcentre );
241 // Cone defini par les 2 rayons
244 mesCoor.push_back( _Xcentre1 );
245 mesCoor.push_back( _Ycentre1 );
246 mesCoor.push_back( _Zcentre1 );
247 mesCoor.push_back( _Rayon1 );
248 mesCoor.push_back( _Xcentre2 );
249 mesCoor.push_back( _Ycentre2 );
250 mesCoor.push_back( _Zcentre2 );
251 mesCoor.push_back( _Rayon2 );
257 mesCoor.push_back( _Xcentre );
258 mesCoor.push_back( _Ycentre );
259 mesCoor.push_back( _Zcentre );
260 mesCoor.push_back( _Xaxe );
261 mesCoor.push_back( _Yaxe );
262 mesCoor.push_back( _Zaxe );
263 mesCoor.push_back( _Rayon1 );
264 mesCoor.push_back( _Rayon2 );
267 VERIFICATION( (_Type>=1) && (_Type<=5) ) ;
271 //======================================================================
272 void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 )
274 _Xincr = X0; _Yincr = X1; _Zincr = X2;
276 //=======================================================================================
277 std::vector<double> HOMARD_Boundary::GetLimit() const
279 std::vector<double> mesLimit;
280 mesLimit.push_back( _Xincr );
281 mesLimit.push_back( _Yincr );
282 mesLimit.push_back( _Zincr );
285 //=============================================================================
286 void HOMARD_Boundary::AddGroup( const char* Group)
288 _ListGroupSelected.push_back(Group);
290 //=============================================================================
291 void HOMARD_Boundary::SetGroups( const std::list<std::string>& ListGroup )
293 _ListGroupSelected.clear();
294 std::list<std::string>::const_iterator it = ListGroup.begin();
295 while(it != ListGroup.end())
296 _ListGroupSelected.push_back((*it++));
298 //=============================================================================
299 const std::list<std::string>& HOMARD_Boundary::GetGroups() const
301 return _ListGroupSelected;
303 //=============================================================================
304 //=============================================================================
305 // Liens avec les autres structures
306 //=============================================================================
307 //=============================================================================
308 void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation )
310 _NomCasCreation = std::string( NomCasCreation );
312 //=============================================================================
313 std::string HOMARD_Boundary::GetCaseCreation() const
315 return _NomCasCreation;
317 //=============================================================================