1 // Copyright (C) 2011-2012 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_Hypothesis_i.hxx"
21 #include "HOMARD_Gen_i.hxx"
22 #include "HOMARD_Hypothesis.hxx"
23 #include "HOMARD_DriverTools.hxx"
25 #include "utilities.h"
27 //=============================================================================
29 * standard constructor
31 //=============================================================================
32 HOMARD_Hypothesis_i::HOMARD_Hypothesis_i()
34 MESSAGE( "Default constructor, not for use" );
38 //=============================================================================
40 * standard constructor
42 //=============================================================================
43 HOMARD_Hypothesis_i::HOMARD_Hypothesis_i( CORBA::ORB_ptr orb,
44 HOMARD::HOMARD_Gen_var engine )
46 MESSAGE( "standard constructor" );
49 myHomardHypothesis = new ::HOMARD_Hypothesis();
50 ASSERT( myHomardHypothesis );
53 //=============================================================================
57 //=============================================================================
58 HOMARD_Hypothesis_i::~HOMARD_Hypothesis_i()
62 //=============================================================================
65 //=============================================================================
66 void HOMARD_Hypothesis_i::SetName( const char* NomHypothesis )
68 ASSERT( myHomardHypothesis );
69 myHomardHypothesis->SetName( NomHypothesis );
72 //=============================================================================
73 char* HOMARD_Hypothesis_i::GetName()
75 ASSERT( myHomardHypothesis );
76 return CORBA::string_dup( myHomardHypothesis->GetName().c_str() );
78 //=============================================================================
81 //=============================================================================
82 void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation )
84 ASSERT( myHomardHypothesis );
85 myHomardHypothesis->SetCaseCreation( NomCaseCreation );
88 //=============================================================================
89 char* HOMARD_Hypothesis_i::GetCaseCreation()
91 ASSERT( myHomardHypothesis );
92 return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() );
94 //=============================================================================
95 char* HOMARD_Hypothesis_i::GetDumpPython()
97 ASSERT( myHomardHypothesis );
98 return CORBA::string_dup( myHomardHypothesis->GetDumpPython().c_str() );
101 //=============================================================================
104 //=============================================================================
105 void HOMARD_Hypothesis_i::SetAdapRefinUnRef( CORBA::Long TypeAdap,CORBA::Long TypeRaff, CORBA::Long TypeDera )
107 ASSERT( myHomardHypothesis );
108 myHomardHypothesis->SetAdapType( TypeAdap );
109 myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
112 //=============================================================================
113 HOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef()
115 ASSERT( myHomardHypothesis );
116 HOMARD::listeTypes_var aResult = new HOMARD::listeTypes;
117 aResult->length( 3 );
118 aResult[0] = CORBA::Long( myHomardHypothesis->GetAdapType() );
119 aResult[1] = CORBA::Long( myHomardHypothesis->GetRefinType() );
120 aResult[2] = CORBA::Long( myHomardHypothesis->GetUnRefType() );
121 return aResult._retn();
123 //=============================================================================
124 CORBA::Long HOMARD_Hypothesis_i::GetAdapType()
126 ASSERT( myHomardHypothesis );
127 return CORBA::Long( myHomardHypothesis->GetAdapType() );
129 //=============================================================================
130 CORBA::Long HOMARD_Hypothesis_i::GetRefinType()
132 ASSERT( myHomardHypothesis );
133 return CORBA::Long( myHomardHypothesis->GetRefinType() );
135 //=============================================================================
136 CORBA::Long HOMARD_Hypothesis_i::GetUnRefType()
138 ASSERT( myHomardHypothesis );
139 return CORBA::Long( myHomardHypothesis->GetUnRefType() );
142 //=============================================================================
145 //=============================================================================
146 void HOMARD_Hypothesis_i::SetField( const char* FieldName )
148 myHomardHypothesis->SetField( FieldName );
150 //=============================================================================
151 void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR )
153 myHomardHypothesis->SetRefinThr( TypeThR, ThreshR );
155 //=============================================================================
156 void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC )
158 myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC );
160 //=============================================================================
161 void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI )
163 myHomardHypothesis->SetUseComp( UsCmpI );
165 //=============================================================================
166 void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField )
168 myHomardHypothesis->SetUseField( UsField );
171 //=============================================================================
172 HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField()
174 ASSERT(myHomardHypothesis);
175 HOMARD::InfosHypo* aInfosHypo = new HOMARD::InfosHypo();
176 aInfosHypo->FieldName = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
177 aInfosHypo->TypeThR = CORBA::Long( myHomardHypothesis->GetRefinThrType() );
178 aInfosHypo->ThreshR = CORBA::Double( myHomardHypothesis->GetThreshR() );
179 aInfosHypo->TypeThC = CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
180 aInfosHypo->ThreshC = CORBA::Double( myHomardHypothesis->GetThreshC() );
181 aInfosHypo->UsField = CORBA::Long( myHomardHypothesis->GetUseField() );
182 aInfosHypo->UsCmpI = CORBA::Long( myHomardHypothesis->GetUseCompI() );
185 //=============================================================================
186 char* HOMARD_Hypothesis_i::GetFieldName()
188 ASSERT( myHomardHypothesis );
189 return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
191 //=============================================================================
192 CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType()
194 ASSERT( myHomardHypothesis );
195 return CORBA::Long( myHomardHypothesis->GetRefinThrType() );
197 //=============================================================================
198 CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType()
200 ASSERT( myHomardHypothesis );
201 return CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
206 //=============================================================================
207 void HOMARD_Hypothesis_i::AddIteration( const char* NomIteration )
209 ASSERT(myHomardHypothesis);
210 myHomardHypothesis->AddIteration( NomIteration );
213 //=============================================================================
214 void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
216 ASSERT( myHomardHypothesis );
217 myHomardHypothesis->AddZone( NomZone, TypeUse );
219 //=============================================================================
220 void HOMARD_Hypothesis_i::SupprZone (const char * NomZone)
222 ASSERT(myHomardHypothesis);
223 myHomardHypothesis->SupprZone( NomZone);
225 //=============================================================================
226 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
228 ASSERT(myHomardHypothesis);
229 const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
230 HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
231 aResult->length( ListString.size() );
232 std::list<std::string>::const_iterator it;
234 for ( it = ListString.begin(); it != ListString.end(); it++ )
236 aResult[i++] = CORBA::string_dup( (*it).c_str() );
238 return aResult._retn();
241 //=============================================================================
242 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
244 ASSERT(myHomardHypothesis);
245 const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
246 HOMARD::listeIters_var aResult = new HOMARD::listeIters;
247 aResult->length( ListString.size() );
248 std::list<std::string>::const_iterator it;
250 for ( it = ListString.begin(); it != ListString.end(); it++ )
252 aResult[i++] = CORBA::string_dup( (*it).c_str() );
254 return aResult._retn();
257 //=============================================================================
258 void HOMARD_Hypothesis_i::AddComp( const char* NomComposant )
260 ASSERT( myHomardHypothesis );
261 myHomardHypothesis->AddComp( NomComposant );
264 //=============================================================================
265 void HOMARD_Hypothesis_i::SupprComp()
267 ASSERT( myHomardHypothesis );
268 myHomardHypothesis->SupprComp();
271 //=============================================================================
272 HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetListComp()
274 ASSERT( myHomardHypothesis );
275 const std::list<std::string>& ListString = myHomardHypothesis->GetListComp();
276 HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo;
277 aResult->length( ListString.size() );
278 std::list<std::string>::const_iterator it;
280 for ( it = ListString.begin(); it != ListString.end(); it++ )
282 aResult[i++] = CORBA::string_dup( (*it).c_str() );
284 return aResult._retn();
286 //=============================================================================
287 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
289 ASSERT( myHomardHypothesis );
290 myHomardHypothesis->AddGroup( Group );
292 //=============================================================================
293 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
295 ASSERT( myHomardHypothesis );
296 std::list<std::string> ListString;
297 for ( int i = 0; i < ListGroup.length(); i++ )
299 ListString.push_back(std::string(ListGroup[i]));
301 myHomardHypothesis->SetGroups( ListString );
303 //=============================================================================
304 HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups()
306 ASSERT( myHomardHypothesis );
307 const std::list<std::string>& ListString = myHomardHypothesis->GetGroups();
308 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
309 aResult->length( ListString.size() );
310 std::list<std::string>::const_iterator it;
312 for ( it = ListString.begin(); it != ListString.end(); it++ )
314 aResult[i++] = CORBA::string_dup( (*it).c_str() );
316 return aResult._retn();
318 //=============================================================================
321 //=============================================================================
322 void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp )
324 ASSERT( myHomardHypothesis );
325 myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp );
327 //=============================================================================
328 CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
330 ASSERT( myHomardHypothesis );
331 return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() );
333 //=============================================================================
334 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
336 ASSERT( myHomardHypothesis );
337 myHomardHypothesis->AddFieldInterp( FieldInterp );
340 //=============================================================================
341 void HOMARD_Hypothesis_i::SupprFieldInterp()
343 ASSERT( myHomardHypothesis );
344 myHomardHypothesis->SupprFieldInterp();
347 //=============================================================================
348 HOMARD::listFieldInterpHypo* HOMARD_Hypothesis_i::GetListFieldInterp()
350 ASSERT( myHomardHypothesis );
351 const std::list<std::string>& ListString = myHomardHypothesis->GetListFieldInterp();
352 HOMARD::listFieldInterpHypo_var aResult = new HOMARD::listFieldInterpHypo;
353 aResult->length( ListString.size() );
354 std::list<std::string>::const_iterator it;
356 for ( it = ListString.begin(); it != ListString.end(); it++ )
358 aResult[i++] = CORBA::string_dup( (*it).c_str() );
360 return aResult._retn();
362 //=============================================================================
363 void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax )
365 ASSERT( myHomardHypothesis );
366 myHomardHypothesis->SetNivMax( NivMax );
368 //=============================================================================
369 CORBA::Long HOMARD_Hypothesis_i::GetNivMax()
371 ASSERT( myHomardHypothesis );
372 return myHomardHypothesis->GetNivMax();
374 //=============================================================================
375 void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin )
377 ASSERT( myHomardHypothesis );
378 myHomardHypothesis->SetDiamMin( DiamMin );
380 //=============================================================================
381 CORBA::Double HOMARD_Hypothesis_i::GetDiamMin()
383 ASSERT( myHomardHypothesis );
384 return myHomardHypothesis->GetDiamMin();
386 //=============================================================================
387 void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit )
389 ASSERT( myHomardHypothesis );
390 myHomardHypothesis->SetAdapInit( AdapInit );
392 //=============================================================================
393 CORBA::Long HOMARD_Hypothesis_i::GetAdapInit()
395 ASSERT( myHomardHypothesis );
396 return myHomardHypothesis->GetAdapInit();
399 //=============================================================================
400 std::string HOMARD_Hypothesis_i::Dump() const
402 return HOMARD::Dump( *myHomardHypothesis );
405 //=============================================================================
406 bool HOMARD_Hypothesis_i::Restore( const std::string& stream )
408 return HOMARD::Restore( *myHomardHypothesis, stream );