Salome HOME
version 5_1_4 HOMARD_SRC
[modules/homard.git] / src / HOMARD_I / HOMARD_Boundary_i.cxx
1 #include "HOMARD_Boundary_i.hxx"
2 #include "HOMARD_Gen_i.hxx"
3 #include "HOMARD_Boundary.hxx"
4 #include "HOMARD_DriverTools.hxx"
5
6 #include "utilities.h"
7
8 //=============================================================================
9 /*!
10  *  standard constructor
11  */
12 //=============================================================================
13 HOMARD_Boundary_i::HOMARD_Boundary_i()
14 {
15   MESSAGE( "Default constructor, not for use" );
16   ASSERT( 0 );
17 }
18
19 //=============================================================================
20 /*!
21  *  standard constructor
22  */
23 //=============================================================================
24 HOMARD_Boundary_i::HOMARD_Boundary_i( CORBA::ORB_ptr orb,
25                               HOMARD::HOMARD_Gen_var engine )
26 {
27   MESSAGE( "HOMARD_Boundary_i" );
28   _gen_i = engine;
29   _orb = orb;
30   myHomardBoundary = new ::HOMARD_Boundary();
31   ASSERT( myHomardBoundary );
32 }
33 //=============================================================================
34 /*!
35  *  standard destructor
36  */
37 //=============================================================================
38
39 HOMARD_Boundary_i::~HOMARD_Boundary_i()
40 {
41 }
42
43 //=============================================================================
44 /*!
45  */
46 //=============================================================================
47 void HOMARD_Boundary_i::SetName( const char* NomBoundary )
48 {
49   ASSERT( myHomardBoundary );
50   myHomardBoundary->SetName( NomBoundary );
51 }
52
53 //=============================================================================
54 char* HOMARD_Boundary_i::GetName()
55 {
56   ASSERT( myHomardBoundary );
57   return CORBA::string_dup( myHomardBoundary->GetName().c_str() );
58 }
59
60 //=============================================================================
61 char* HOMARD_Boundary_i::GetDumpPython()
62 {
63   ASSERT( myHomardBoundary );
64   return CORBA::string_dup( myHomardBoundary->GetDumpPython().c_str() );
65 }
66
67
68 //=============================================================================
69 void HOMARD_Boundary_i::SetBoundaryType( CORBA::Long BoundaryType )
70 {
71   ASSERT( myHomardBoundary );
72   myHomardBoundary->SetBoundaryType( BoundaryType );
73 }
74
75 //=============================================================================
76 CORBA::Long HOMARD_Boundary_i::GetBoundaryType()
77 {
78   ASSERT( myHomardBoundary );
79   return  CORBA::Long( myHomardBoundary->GetBoundaryType() );
80 }
81
82 //=============================================================================
83 void HOMARD_Boundary_i::SetMeshFile( const char* MeshFile )
84 {
85   ASSERT( myHomardBoundary );
86   myHomardBoundary->SetMeshFile( MeshFile );
87   _gen_i->PublishResultInSmesh(MeshFile, 0);
88 }
89 //=============================================================================
90 char* HOMARD_Boundary_i::GetMeshFile()
91 {
92   ASSERT( myHomardBoundary );
93   return CORBA::string_dup( myHomardBoundary->GetMeshFile().c_str() );
94 }
95
96 //=============================================================================
97 void HOMARD_Boundary_i::SetMeshName( const char* MeshName )
98 {
99   ASSERT( myHomardBoundary );
100   myHomardBoundary->SetMeshName( MeshName );
101 }
102
103 //=============================================================================
104 char* HOMARD_Boundary_i::GetMeshName()
105 {
106   ASSERT( myHomardBoundary );
107   return CORBA::string_dup( myHomardBoundary->GetMeshName().c_str() );
108 }
109
110
111 //=============================================================================
112 void HOMARD_Boundary_i::SetCylinder( double X0, double X1, double X2, double X3, double X4, double X5, double X6 )
113 {
114   ASSERT( myHomardBoundary );
115   myHomardBoundary->SetCylinder( X0, X1, X2, X3, X4, X5, X6 );
116 }
117
118 //=============================================================================
119 HOMARD::double_array* HOMARD_Boundary_i::GetCylinder()
120 {
121   ASSERT( myHomardBoundary );
122   HOMARD::double_array_var aResult = new HOMARD::double_array();
123   std::vector<double> mesCoor = myHomardBoundary->GetCylinder();
124   aResult->length( mesCoor .size() );
125   std::vector<double>::const_iterator it;
126   int i = 0;
127   for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
128     aResult[i++] = (*it);
129   return aResult._retn();
130 }
131
132 //=============================================================================
133 void HOMARD_Boundary_i::SetSphere( double Xcentre, double Ycentre, double ZCentre, double rayon )
134 {
135   ASSERT( myHomardBoundary );
136   myHomardBoundary->SetSphere( Xcentre, Ycentre, ZCentre, rayon );
137 }
138
139 //=============================================================================
140 HOMARD::double_array* HOMARD_Boundary_i::GetSphere()
141 {
142   ASSERT( myHomardBoundary );
143   HOMARD::double_array_var aResult = new HOMARD::double_array();
144   std::vector<double> mesCoor = myHomardBoundary->GetSphere();
145   aResult->length( mesCoor .size() );
146   std::vector<double>::const_iterator it;
147   int i = 0;
148   for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
149     aResult[i++] = (*it);
150   return aResult._retn();
151 }
152
153 //=============================================================================
154 void HOMARD_Boundary_i::SetLimit( double Xincr, double Yincr, double Zincr )
155 {
156   ASSERT( myHomardBoundary );
157   myHomardBoundary->SetLimit( Xincr, Yincr, Zincr );
158 }
159
160 //=============================================================================
161 HOMARD::double_array* HOMARD_Boundary_i::GetLimit()
162 {
163   ASSERT( myHomardBoundary );
164   HOMARD::double_array_var aResult = new HOMARD::double_array();
165   std::vector<double> mesCoor = myHomardBoundary->GetLimit();
166   aResult->length( mesCoor .size() );
167   std::vector<double>::const_iterator it;
168   int i = 0;
169   for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
170     aResult[i++] = (*it);
171   return aResult._retn();
172 }
173 //=============================================================================
174 /*!
175  */
176 //=============================================================================
177 void HOMARD_Boundary_i::SetCaseCreation( const char* NomCaseCreation )
178 {
179   ASSERT( myHomardBoundary );
180   myHomardBoundary->SetCaseCreation( NomCaseCreation );
181 }
182
183 //=============================================================================
184 char* HOMARD_Boundary_i::GetCaseCreation()
185 {
186   ASSERT( myHomardBoundary );
187   return CORBA::string_dup( myHomardBoundary->GetCaseCreation().c_str() );
188 }
189 //=============================================================================
190 void HOMARD_Boundary_i::AddGroup( const char* Group)
191 {
192   ASSERT( myHomardBoundary );
193   myHomardBoundary->AddGroup( Group );
194 }
195 //=============================================================================
196 void HOMARD_Boundary_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
197 {
198   ASSERT( myHomardBoundary );
199   std::list<std::string> ListString;
200   for ( int i = 0; i < ListGroup.length(); i++ )
201   {
202       ListString.push_back(std::string(ListGroup[i]));
203   }
204   myHomardBoundary->SetGroups( ListString );
205 }
206 //=============================================================================
207 HOMARD::ListGroupType*  HOMARD_Boundary_i::GetGroups()
208 {
209   ASSERT( myHomardBoundary );
210   const std::list<std::string>& ListString = myHomardBoundary->GetGroups();
211   HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
212   aResult->length( ListString.size() );
213   std::list<std::string>::const_iterator it;
214   int i = 0;
215   for ( it = ListString.begin(); it != ListString.end(); it++ )
216   {
217     aResult[i++] = CORBA::string_dup( (*it).c_str() );
218   }
219   return aResult._retn();
220 }
221
222
223
224 //=============================================================================
225 std::string HOMARD_Boundary_i::Dump() const
226 {
227   return HOMARD::Dump( *myHomardBoundary );
228 }
229
230 //=============================================================================
231 bool HOMARD_Boundary_i::Restore( const std::string& stream )
232 {
233   return HOMARD::Restore( *myHomardBoundary, stream );
234 }