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 ";
68 switch (_BoundaryType)
72 aScript << "discrete boundary " << _NomBoundary << "\n";
73 aScript << "\t" << _NomBoundary << " = homard.CreateBoundaryDi(\"" << _NomBoundary << "\", ";
74 aScript << "\"" << _MeshName << "\", ";
75 aScript << "\"" << _MeshFile << "\")\n";
80 aScript << "cylinder " << _NomBoundary << "\n";
81 aScript << "\t" << _NomBoundary << " = homard.CreateBoundaryCylinder(\"" << _NomBoundary << "\", ";
82 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n";
87 aScript << "sphere" << _NomBoundary << "\n";
88 aScript << "\t" << _NomBoundary << " = homard.CreateBoundarySphere(\"" << _NomBoundary << "\", ";
89 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n";
98 //=============================================================================
99 void HOMARD_Boundary::SetBoundaryType( int BoundaryType )
101 MESSAGE("SetBoundaryType = "<<BoundaryType);
102 _BoundaryType = BoundaryType;
105 //=============================================================================
106 int HOMARD_Boundary::GetBoundaryType() const
108 return _BoundaryType;
111 //=============================================================================
112 void HOMARD_Boundary::SetMeshFile( const char* MeshFile )
114 _MeshFile = std::string( MeshFile );
116 //=============================================================================
117 std::string HOMARD_Boundary::GetMeshFile() const
121 //=============================================================================
122 void HOMARD_Boundary::SetMeshName( const char* MeshName )
124 _MeshName = std::string( MeshName );
126 //=============================================================================
127 std::string HOMARD_Boundary::GetMeshName() const
131 //======================================================================
132 void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 )
134 _Xincr = X0; _Yincr = X1; _Zincr = X2;
136 //=======================================================================================
137 void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2,
138 double X3, double X4, double X5, double X6 )
140 _Xcentre = X0; _Ycentre = X1;
141 _Zcentre = X2; _Xaxe = X3;
142 _Yaxe = X4; _Zaxe = X5;
146 //======================================================================
147 void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 )
149 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
153 //=======================================================================================
154 std::vector<double> HOMARD_Boundary::GetLimit() const
156 std::vector<double> mesLimit;
157 mesLimit.push_back( _Xincr );
158 mesLimit.push_back( _Yincr );
159 mesLimit.push_back( _Zincr );
163 //=======================================================================================
164 std::vector<double> HOMARD_Boundary::GetCoords() const
166 std::vector<double> mesCoor;
168 switch (_BoundaryType)
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 );
185 mesCoor.push_back( _Xcentre );
186 mesCoor.push_back( _Ycentre );
187 mesCoor.push_back( _Zcentre );
188 mesCoor.push_back( _rayon );
191 ASSERT ( _BoundaryType == -1 ) ;
195 //=============================================================================
198 //=============================================================================
199 void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation )
201 _NomCasCreation = std::string( NomCasCreation );
204 //=============================================================================
207 //=============================================================================
208 const std::list<std::string>& HOMARD_Boundary::GetGroups() const
210 return _ListGroupSelected;
212 //=============================================================================
213 void HOMARD_Boundary::SetGroups( const std::list<std::string>& ListGroup )
215 _ListGroupSelected.clear();
216 std::list<std::string>::const_iterator it = ListGroup.begin();
217 while(it != ListGroup.end())
218 _ListGroupSelected.push_back((*it++));
220 //=============================================================================
221 void HOMARD_Boundary::AddGroup( const char* Group)
223 _ListGroupSelected.push_back(Group);
226 //=============================================================================
229 //=============================================================================
230 std::string HOMARD_Boundary::GetCaseCreation() const
232 return _NomCasCreation;
234 //=============================================================================