1 // Copyright (C) 2011 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "HOMARD_Boundary_i.hxx"
21 #include "HOMARD_Gen_i.hxx"
22 #include "HOMARD_Boundary.hxx"
23 #include "HOMARD_DriverTools.hxx"
25 #include "utilities.h"
27 //=============================================================================
29 * standard constructor
31 //=============================================================================
32 HOMARD_Boundary_i::HOMARD_Boundary_i()
34 MESSAGE( "Default constructor, not for use" );
38 //=============================================================================
40 * standard constructor
42 //=============================================================================
43 HOMARD_Boundary_i::HOMARD_Boundary_i( CORBA::ORB_ptr orb,
44 HOMARD::HOMARD_Gen_var engine )
46 MESSAGE( "HOMARD_Boundary_i" );
49 myHomardBoundary = new ::HOMARD_Boundary();
50 ASSERT( myHomardBoundary );
52 //=============================================================================
56 //=============================================================================
58 HOMARD_Boundary_i::~HOMARD_Boundary_i()
62 //=============================================================================
65 //=============================================================================
66 void HOMARD_Boundary_i::SetName( const char* NomBoundary )
68 ASSERT( myHomardBoundary );
69 myHomardBoundary->SetName( NomBoundary );
72 //=============================================================================
73 char* HOMARD_Boundary_i::GetName()
75 ASSERT( myHomardBoundary );
76 return CORBA::string_dup( myHomardBoundary->GetName().c_str() );
79 //=============================================================================
80 char* HOMARD_Boundary_i::GetDumpPython()
82 ASSERT( myHomardBoundary );
83 return CORBA::string_dup( myHomardBoundary->GetDumpPython().c_str() );
87 //=============================================================================
88 void HOMARD_Boundary_i::SetBoundaryType( CORBA::Long BoundaryType )
90 ASSERT( myHomardBoundary );
91 myHomardBoundary->SetBoundaryType( BoundaryType );
94 //=============================================================================
95 CORBA::Long HOMARD_Boundary_i::GetBoundaryType()
97 ASSERT( myHomardBoundary );
98 return CORBA::Long( myHomardBoundary->GetBoundaryType() );
101 //=============================================================================
102 void HOMARD_Boundary_i::SetMeshFile( const char* MeshFile )
104 ASSERT( myHomardBoundary );
105 myHomardBoundary->SetMeshFile( MeshFile );
106 _gen_i->PublishResultInSmesh(MeshFile, 0);
108 //=============================================================================
109 char* HOMARD_Boundary_i::GetMeshFile()
111 ASSERT( myHomardBoundary );
112 return CORBA::string_dup( myHomardBoundary->GetMeshFile().c_str() );
115 //=============================================================================
116 void HOMARD_Boundary_i::SetMeshName( const char* MeshName )
118 ASSERT( myHomardBoundary );
119 myHomardBoundary->SetMeshName( MeshName );
122 //=============================================================================
123 char* HOMARD_Boundary_i::GetMeshName()
125 ASSERT( myHomardBoundary );
126 return CORBA::string_dup( myHomardBoundary->GetMeshName().c_str() );
130 //=============================================================================
131 void HOMARD_Boundary_i::SetCylinder( double X0, double X1, double X2, double X3, double X4, double X5, double X6 )
133 ASSERT( myHomardBoundary );
134 myHomardBoundary->SetCylinder( X0, X1, X2, X3, X4, X5, X6 );
136 //=============================================================================
137 void HOMARD_Boundary_i::SetSphere( double Xcentre, double Ycentre, double ZCentre, double rayon )
139 ASSERT( myHomardBoundary );
140 myHomardBoundary->SetSphere( Xcentre, Ycentre, ZCentre, rayon );
143 //=============================================================================
144 HOMARD::double_array* HOMARD_Boundary_i::GetCoords()
146 ASSERT( myHomardBoundary );
147 HOMARD::double_array_var aResult = new HOMARD::double_array();
148 std::vector<double> mesCoor = myHomardBoundary->GetCoords();
149 aResult->length( mesCoor .size() );
150 std::vector<double>::const_iterator it;
152 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
153 aResult[i++] = (*it);
154 return aResult._retn();
157 //=============================================================================
158 void HOMARD_Boundary_i::SetLimit( double Xincr, double Yincr, double Zincr )
160 ASSERT( myHomardBoundary );
161 myHomardBoundary->SetLimit( Xincr, Yincr, Zincr );
164 //=============================================================================
165 HOMARD::double_array* HOMARD_Boundary_i::GetLimit()
167 ASSERT( myHomardBoundary );
168 HOMARD::double_array_var aResult = new HOMARD::double_array();
169 std::vector<double> mesCoor = myHomardBoundary->GetLimit();
170 aResult->length( mesCoor .size() );
171 std::vector<double>::const_iterator it;
173 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
174 aResult[i++] = (*it);
175 return aResult._retn();
177 //=============================================================================
180 //=============================================================================
181 void HOMARD_Boundary_i::SetCaseCreation( const char* NomCaseCreation )
183 ASSERT( myHomardBoundary );
184 myHomardBoundary->SetCaseCreation( NomCaseCreation );
187 //=============================================================================
188 char* HOMARD_Boundary_i::GetCaseCreation()
190 ASSERT( myHomardBoundary );
191 return CORBA::string_dup( myHomardBoundary->GetCaseCreation().c_str() );
193 //=============================================================================
194 void HOMARD_Boundary_i::AddGroup( const char* Group)
196 ASSERT( myHomardBoundary );
197 myHomardBoundary->AddGroup( Group );
199 //=============================================================================
200 void HOMARD_Boundary_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
202 ASSERT( myHomardBoundary );
203 std::list<std::string> ListString;
204 for ( int i = 0; i < ListGroup.length(); i++ )
206 ListString.push_back(std::string(ListGroup[i]));
208 myHomardBoundary->SetGroups( ListString );
210 //=============================================================================
211 HOMARD::ListGroupType* HOMARD_Boundary_i::GetGroups()
213 ASSERT( myHomardBoundary );
214 const std::list<std::string>& ListString = myHomardBoundary->GetGroups();
215 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
216 aResult->length( ListString.size() );
217 std::list<std::string>::const_iterator it;
219 for ( it = ListString.begin(); it != ListString.end(); it++ )
221 aResult[i++] = CORBA::string_dup( (*it).c_str() );
223 return aResult._retn();
228 //=============================================================================
229 std::string HOMARD_Boundary_i::Dump() const
231 return HOMARD::Dump( *myHomardBoundary );
234 //=============================================================================
235 bool HOMARD_Boundary_i::Restore( const std::string& stream )
237 return HOMARD::Restore( *myHomardBoundary, stream );