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_Cas_i.hxx"
21 #include "HOMARD_Gen_i.hxx"
22 #include "HOMARD_Cas.hxx"
23 #include "HOMARD_DriverTools.hxx"
25 #include "utilities.h"
28 //=============================================================================
30 * standard constructor
32 //=============================================================================
33 HOMARD_Cas_i::HOMARD_Cas_i()
35 MESSAGE( "Default constructor, not for use" );
39 //=============================================================================
41 * standard constructor
43 //=============================================================================
44 HOMARD_Cas_i::HOMARD_Cas_i( CORBA::ORB_ptr orb,
45 HOMARD::HOMARD_Gen_var engine )
47 MESSAGE( "HOMARD_Cas_i" );
50 myHomardCas = new ::HOMARD_Cas();
51 ASSERT( myHomardCas );
54 //=============================================================================
58 //=============================================================================
59 HOMARD_Cas_i::~HOMARD_Cas_i()
63 //=============================================================================
66 //=============================================================================
67 void HOMARD_Cas_i::SetDirName( const char* NomDir )
69 ASSERT( myHomardCas );
70 myHomardCas->SetDirName( NomDir );
73 //=============================================================================
76 //=============================================================================
77 void HOMARD_Cas_i::SetName( const char* NomCas )
79 ASSERT( myHomardCas );
80 myHomardCas->SetName( NomCas );
83 //=============================================================================
86 //=============================================================================
87 char* HOMARD_Cas_i::GetName()
89 ASSERT( myHomardCas );
90 return CORBA::string_dup( myHomardCas->GetName().c_str() );
93 //=============================================================================
96 //=============================================================================
97 char* HOMARD_Cas_i::GetDumpPython()
99 ASSERT( myHomardCas );
100 return CORBA::string_dup( myHomardCas->GetDumpPython().c_str() );
103 //=============================================================================
104 char* HOMARD_Cas_i::GetDirName()
106 ASSERT( myHomardCas );
107 return CORBA::string_dup( myHomardCas->GetDirName().c_str() );
110 //=============================================================================
111 void HOMARD_Cas_i::SetConfType( CORBA::Long ConfType )
113 ASSERT( myHomardCas );
114 myHomardCas->SetConfType( ConfType );
116 //=============================================================================
117 CORBA::Long HOMARD_Cas_i::GetNumber()
119 ASSERT( myHomardCas );
120 return myHomardCas->GetNumber();
123 //=============================================================================
124 CORBA::Long HOMARD_Cas_i::GetConfType()
126 ASSERT( myHomardCas );
127 return myHomardCas->GetConfType();
130 //=============================================================================
131 void HOMARD_Cas_i::AddIteration( const char* NomIteration )
133 ASSERT( myHomardCas );
134 myHomardCas->AddIteration( NomIteration );
137 //=============================================================================
138 char* HOMARD_Cas_i::GetIter0Name()
140 ASSERT( myHomardCas );
141 return CORBA::string_dup( myHomardCas->GetIter0Name().c_str() );
143 //=============================================================================
144 HOMARD::extrema* HOMARD_Cas_i::GetBoundingBox()
146 ASSERT(myHomardCas );
147 HOMARD::extrema_var aResult = new HOMARD::extrema();
148 std::vector<double> LesExtremes = myHomardCas->GetBoundingBox();
149 ASSERT( LesExtremes.size() == 10 );
150 aResult->length( 10 );
151 for ( int i = 0; i < LesExtremes.size(); i++ )
153 aResult[i] = LesExtremes[i];
155 return aResult._retn();
157 //=============================================================================
158 void HOMARD_Cas_i::SetBoundingBox( const HOMARD::extrema& LesExtrema )
160 ASSERT( myHomardCas );
161 std::vector<double> VExtrema;
162 ASSERT( LesExtrema.length() == 10 );
163 VExtrema.resize( LesExtrema.length() );
164 for ( int i = 0; i < LesExtrema.length(); i++ )
166 VExtrema[i] = LesExtrema[i];
169 myHomardCas->SetBoundingBox( VExtrema );
171 //=============================================================================
172 void HOMARD_Cas_i::AddGroup( const char* Group)
174 ASSERT( myHomardCas );
175 myHomardCas->AddGroup( Group );
177 //=============================================================================
178 void HOMARD_Cas_i::SetGroups( const HOMARD::ListGroupType& ListGroup )
180 ASSERT( myHomardCas );
181 std::list<std::string> ListString ;
182 for ( int i = 0; i < ListGroup.length(); i++ )
184 ListString.push_back(std::string(ListGroup[i]));
187 myHomardCas->SetGroups( ListString );
189 //=============================================================================
190 HOMARD::ListGroupType* HOMARD_Cas_i::GetGroups()
192 ASSERT(myHomardCas );
193 const std::list<std::string>& ListString = myHomardCas->GetGroups();
194 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType();
195 aResult->length( ListString.size() );
196 std::list<std::string>::const_iterator it;
198 for ( it = ListString.begin(); it != ListString.end(); it++ )
200 aResult[i++] = CORBA::string_dup( (*it).c_str() );
202 return aResult._retn();
205 //=============================================================================
206 void HOMARD_Cas_i::AddBoundaryGroup( const char* Boundary, const char* Group)
208 MESSAGE ("Dans AddBoundaryGroup");
209 ASSERT( myHomardCas );
210 myHomardCas->AddBoundaryGroup( Boundary, Group );
212 //=============================================================================
213 HOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup()
215 MESSAGE ("Dans GetBoundaryGroup");
216 ASSERT(myHomardCas );
217 const std::list<std::string>& ListString = myHomardCas->GetBoundaryGroup();
218 HOMARD::ListBoundaryGroupType_var aResult = new HOMARD::ListBoundaryGroupType();
219 aResult->length( ListString.size() );
220 std::list<std::string>::const_iterator it;
222 for ( it = ListString.begin(); it != ListString.end(); it++ )
224 aResult[i++] = CORBA::string_dup( (*it).c_str() );
226 return aResult._retn();
228 //=============================================================================
229 void HOMARD_Cas_i::SetNivMax( CORBA::Long NivMax )
231 ASSERT( myHomardCas );
232 myHomardCas->SetNivMax( NivMax );
234 //=============================================================================
235 CORBA::Long HOMARD_Cas_i::GetNivMax()
237 ASSERT( myHomardCas );
238 return myHomardCas->GetNivMax();
240 //=============================================================================
241 void HOMARD_Cas_i::SetDiamMin( CORBA::Double DiamMin )
243 ASSERT( myHomardCas );
244 myHomardCas->SetDiamMin( DiamMin );
246 //=============================================================================
247 CORBA::Double HOMARD_Cas_i::GetDiamMin()
249 ASSERT( myHomardCas );
250 return myHomardCas->GetDiamMin();
253 //=============================================================================
254 std::string HOMARD_Cas_i::Dump() const
256 return HOMARD::Dump( *myHomardCas );
259 //=============================================================================
260 bool HOMARD_Cas_i::Restore( const std::string& stream )
262 return HOMARD::Restore( *myHomardCas, stream );