1 #include "HOMARD_Cas_i.hxx"
2 #include "HOMARD_Gen_i.hxx"
3 #include "HOMARD_Cas.hxx"
4 #include "HOMARD_DriverTools.hxx"
9 //=============================================================================
11 * standard constructor
13 //=============================================================================
14 HOMARD_Cas_i::HOMARD_Cas_i()
16 MESSAGE( "Default constructor, not for use" );
20 //=============================================================================
22 * standard constructor
24 //=============================================================================
25 HOMARD_Cas_i::HOMARD_Cas_i( CORBA::ORB_ptr orb,
26 HOMARD::HOMARD_Gen_var engine )
28 MESSAGE( "HOMARD_Cas_i" );
31 myHomardCas = new ::HOMARD_Cas();
32 ASSERT( myHomardCas );
35 //=============================================================================
39 //=============================================================================
40 HOMARD_Cas_i::~HOMARD_Cas_i()
44 //=============================================================================
47 //=============================================================================
48 void HOMARD_Cas_i::SetDirName( const char* NomDir )
50 ASSERT( myHomardCas );
51 myHomardCas->SetDirName( NomDir );
54 //=============================================================================
57 //=============================================================================
58 void HOMARD_Cas_i::SetName( const char* NomCas )
60 ASSERT( myHomardCas );
61 myHomardCas->SetName( NomCas );
64 //=============================================================================
67 //=============================================================================
68 char* HOMARD_Cas_i::GetName()
70 ASSERT( myHomardCas );
71 return CORBA::string_dup( myHomardCas->GetName().c_str() );
74 //=============================================================================
77 //=============================================================================
78 char* HOMARD_Cas_i::GetDumpPython()
80 ASSERT( myHomardCas );
81 return CORBA::string_dup( myHomardCas->GetDumpPython().c_str() );
84 //=============================================================================
85 char* HOMARD_Cas_i::GetDirName()
87 ASSERT( myHomardCas );
88 return CORBA::string_dup( myHomardCas->GetDirName().c_str() );
91 //=============================================================================
92 void HOMARD_Cas_i::SetConfType( CORBA::Long ConfType )
94 ASSERT( myHomardCas );
95 myHomardCas->SetConfType( ConfType );
97 //=============================================================================
98 CORBA::Long HOMARD_Cas_i::GetNumber()
100 ASSERT( myHomardCas );
101 return myHomardCas->GetNumber();
104 //=============================================================================
105 CORBA::Long HOMARD_Cas_i::GetConfType()
107 ASSERT( myHomardCas );
108 return myHomardCas->GetConfType();
111 //=============================================================================
112 void HOMARD_Cas_i::AddIteration( const char* NomIteration )
114 ASSERT( myHomardCas );
115 myHomardCas->AddIteration( NomIteration );
118 //=============================================================================
119 char* HOMARD_Cas_i::GetIter0Name()
121 ASSERT( myHomardCas );
122 return CORBA::string_dup( myHomardCas->GetIter0Name().c_str() );
124 //=============================================================================
125 HOMARD::extrema* HOMARD_Cas_i::GetBoundingBox()
127 ASSERT(myHomardCas );
128 HOMARD::extrema_var aResult = new HOMARD::extrema();
129 std::vector<double> LesExtremes = myHomardCas->GetBoundingBox();
130 ASSERT( LesExtremes.size() == 10 );
131 aResult->length( 10 );
132 for ( int i = 0; i < LesExtremes.size(); i++ )
134 aResult[i] = LesExtremes[i];
136 return aResult._retn();
138 //=============================================================================
139 void HOMARD_Cas_i::SetBoundingBox( const HOMARD::extrema& LesExtrema )
141 ASSERT( myHomardCas );
142 std::vector<double> VExtrema;
143 ASSERT( LesExtrema.length() == 10 );
144 VExtrema.resize( LesExtrema.length() );
145 for ( int i = 0; i < LesExtrema.length(); i++ )
147 VExtrema[i] = LesExtrema[i];
150 myHomardCas->SetBoundingBox( VExtrema );
152 //=============================================================================
153 void HOMARD_Cas_i::AddGroup( const char* Group)
155 ASSERT( myHomardCas );
156 myHomardCas->AddGroup( Group );
158 //=============================================================================
159 void HOMARD_Cas_i::SetGroups( const HOMARD::ListGroupType& ListGroup )
161 ASSERT( myHomardCas );
162 std::list<std::string> ListString ;
163 for ( int i = 0; i < ListGroup.length(); i++ )
165 ListString.push_back(std::string(ListGroup[i]));
168 myHomardCas->SetGroups( ListString );
170 //=============================================================================
171 HOMARD::ListGroupType* HOMARD_Cas_i::GetGroups()
173 ASSERT(myHomardCas );
174 const std::list<std::string>& ListString = myHomardCas->GetGroups();
175 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType();
176 aResult->length( ListString.size() );
177 std::list<std::string>::const_iterator it;
179 for ( it = ListString.begin(); it != ListString.end(); it++ )
181 aResult[i++] = CORBA::string_dup( (*it).c_str() );
183 return aResult._retn();
186 //=============================================================================
187 void HOMARD_Cas_i::AddBoundaryGroup( const char* Boundary, const char* Group)
189 MESSAGE ("Dans AddBoundaryGroup");
190 ASSERT( myHomardCas );
191 myHomardCas->AddBoundaryGroup( Boundary, Group );
193 //=============================================================================
194 HOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup()
196 MESSAGE ("Dans GetBoundaryGroup");
197 ASSERT(myHomardCas );
198 const std::list<std::string>& ListString = myHomardCas->GetBoundaryGroup();
199 HOMARD::ListBoundaryGroupType_var aResult = new HOMARD::ListBoundaryGroupType();
200 aResult->length( ListString.size() );
201 std::list<std::string>::const_iterator it;
203 for ( it = ListString.begin(); it != ListString.end(); it++ )
205 aResult[i++] = CORBA::string_dup( (*it).c_str() );
207 return aResult._retn();
210 //=============================================================================
211 std::string HOMARD_Cas_i::Dump() const
213 return HOMARD::Dump( *myHomardCas );
216 //=============================================================================
217 bool HOMARD_Cas_i::Restore( const std::string& stream )
219 return HOMARD::Restore( *myHomardCas, stream );