Salome HOME
First publish of HEXABLOCKcomponant
[modules/hexablock.git] / src / HEXABLOCK_I / HexElements_impl.cxx
1 using namespace std;
2 #include "HEXABLOCK.hxx"
3 #include "hexa_base.hxx"
4 #include "HexElements_impl.hxx"
5 #include "HexVertex_impl.hxx"
6 #include "HexEdge_impl.hxx"
7 #include "HexQuad_impl.hxx"
8 #include "HexHexa_impl.hxx"
9
10
11 Elements_impl::Elements_impl( HEXA_NS::Elements *ptrCpp ):_elements_cpp(ptrCpp)
12 {
13 }
14
15 HEXA_NS::Elements* Elements_impl::GetImpl()
16 {
17   return _elements_cpp;
18 }
19
20 ::CORBA::Long Elements_impl::countVertex() throw (SALOME::SALOME_Exception)
21 {
22   ::CORBA::Long n = _elements_cpp->countVertex();
23   return n;
24 }
25
26 ::CORBA::Long Elements_impl::countEdge() throw (SALOME::SALOME_Exception)
27 {
28   ::CORBA::Long n = _elements_cpp->countEdge();
29   return n;
30 }
31
32 ::CORBA::Long Elements_impl::countQuad() throw (SALOME::SALOME_Exception)
33 {
34   ::CORBA::Long n = _elements_cpp->countQuad();
35   return n;
36 }
37
38 ::CORBA::Long Elements_impl::countHexa() throw (SALOME::SALOME_Exception)
39 {
40   ::CORBA::Long n = _elements_cpp->countHexa();
41   return n;
42 }
43
44 ::CORBA::Long Elements_impl::findVertex( Vertex_ptr pIn ) throw (SALOME::SALOME_Exception)
45 {
46   ::CORBA::Long n;
47   Vertex_impl* pInServant = ::DownCast<Vertex_impl*>( pIn );
48   ASSERT( pInServant );
49   HEXA_NS::Vertex* p = pInServant->GetImpl();
50   n = _elements_cpp->findVertex( p );
51   return n;
52 }
53
54
55
56 Vertex_ptr Elements_impl::getVertex(::CORBA::Long n) throw (SALOME::SALOME_Exception)
57 {
58   Vertex_ptr result  = Vertex::_nil();
59
60   HEXA_NS::Vertex* v = _elements_cpp->getVertex(n);
61   if ( v != NULL ){
62     Vertex_impl* servantCorba = new Vertex_impl(v);
63     result = servantCorba->_this();
64   }
65   return result;
66 }
67
68 Edge_ptr Elements_impl::getEdge(::CORBA::Long n) throw (SALOME::SALOME_Exception)
69 {
70   Edge_ptr result  = Edge::_nil();
71
72   HEXA_NS::Edge* e = _elements_cpp->getEdge(n);
73   if ( e != NULL ){
74     Edge_impl* servantCorba = new Edge_impl(e);
75     result = servantCorba->_this();
76   }
77   return result;
78 }
79
80 Quad_ptr Elements_impl::getQuad(::CORBA::Long n) throw (SALOME::SALOME_Exception)
81 {
82   Quad_ptr result = Quad::_nil();
83
84   HEXA_NS::Quad* q = _elements_cpp->getQuad(n);
85   if ( q != NULL ){
86     Quad_impl* servantCorba = new Quad_impl(q);
87     result = servantCorba->_this();
88   }
89   return result;
90 }
91
92 Hexa_ptr Elements_impl::getHexa(::CORBA::Long n) throw (SALOME::SALOME_Exception)
93 {
94   Hexa_ptr result = Hexa::_nil();
95
96   HEXA_NS::Hexa* h = _elements_cpp->getHexa(n);
97   if ( h != NULL ){
98     Hexa_impl* servantCorba = new Hexa_impl(h);
99     result = servantCorba->_this();
100   }
101   return result;
102 }
103
104
105 ::CORBA::Long Elements_impl::saveVtk( const char* fname ) throw (SALOME::SALOME_Exception)
106 {
107   ::CORBA::Long ret = _elements_cpp->saveVtk( fname );
108   return ret;
109 }
110
111
112 void Elements_impl::dump() throw (SALOME::SALOME_Exception)
113 {
114   _elements_cpp->dump();
115 }
116
117
118 void Elements_impl::printName() throw (SALOME::SALOME_Exception)
119 {
120   _elements_cpp->printName();
121 }
122
123
124
125
126 Vertex_ptr Elements_impl::getVertexIJK(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
127   throw (SALOME::SALOME_Exception)
128 {
129   Vertex_ptr result = Vertex::_nil();
130   HEXA_NS::Vertex* v = _elements_cpp->getVertexIJK(x, y, z);
131   if ( v != NULL ){
132     Vertex_impl* servantCorba = new Vertex_impl(v);
133     result = servantCorba->_this();
134   }
135   return result;
136 }
137
138
139 Edge_ptr Elements_impl::getEdgeI(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
140   throw (SALOME::SALOME_Exception)
141 {
142   Edge_ptr result = Edge::_nil();
143   HEXA_NS::Edge* e = _elements_cpp->getEdgeI(x, y, z);
144   if ( e != NULL ){
145     Edge_impl* servantCorba = new Edge_impl(e);
146     result = servantCorba->_this();
147   }
148   return result;
149 }
150
151
152 Edge_ptr Elements_impl::getEdgeJ(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
153   throw (SALOME::SALOME_Exception)
154 {
155   Edge_ptr result = Edge::_nil();
156   HEXA_NS::Edge* e = _elements_cpp->getEdgeJ(x, y, z);
157   if ( e != NULL ){
158     Edge_impl* servantCorba = new Edge_impl(e);
159     result = servantCorba->_this();
160   }
161   return result;
162 }
163
164
165 Edge_ptr Elements_impl::getEdgeK(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
166   throw (SALOME::SALOME_Exception)
167 {
168   Edge_ptr result = Edge::_nil();
169   HEXA_NS::Edge* e = _elements_cpp->getEdgeK(x, y, z);
170   if ( e != NULL ){
171     Edge_impl* servantCorba = new Edge_impl(e);
172     result = servantCorba->_this();
173   }
174   return result;
175 }
176
177 Quad_ptr Elements_impl::getQuadIJ(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
178   throw (SALOME::SALOME_Exception)
179 {
180   Quad_ptr result = Quad::_nil();
181   HEXA_NS::Quad* q = _elements_cpp->getQuadIJ(x, y, z);
182   if ( q != NULL ){
183     Quad_impl* servantCorba = new Quad_impl(q);
184     result = servantCorba->_this();
185   }
186   return result;
187 }
188
189
190 Quad_ptr Elements_impl::getQuadIK(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
191   throw (SALOME::SALOME_Exception)
192 {
193   Quad_ptr result = Quad::_nil();
194   HEXA_NS::Quad* q = _elements_cpp->getQuadIK(x, y, z);
195   if ( q != NULL ){
196     Quad_impl* servantCorba = new Quad_impl(q);
197     result = servantCorba->_this();
198   }
199   return result;
200 }
201
202
203 Quad_ptr Elements_impl::getQuadJK(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
204   throw (SALOME::SALOME_Exception)
205 {
206   Quad_ptr result = Quad::_nil();
207   HEXA_NS::Quad* q = _elements_cpp->getQuadJK(x, y, z);
208   if ( q != NULL ){
209     Quad_impl* servantCorba = new Quad_impl(q);
210     result = servantCorba->_this();
211   }
212   return result;
213 }
214
215
216 Hexa_ptr Elements_impl::getHexaIJK(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) throw (SALOME::SALOME_Exception)
217 {
218   Hexa_ptr result = Hexa::_nil();
219   HEXA_NS::Hexa* h = _elements_cpp->getHexaIJK(x, y, z);
220   if ( h != NULL ){
221     Hexa_impl* servantCorba = new Hexa_impl(h);
222     result = servantCorba->_this();
223   }
224   return result;
225 }
226
227
228 // Quad_ptr Elements_impl::getQuad1(EnumCoord dirIn, ::CORBA::Long nx, ::CORBA::Long ny, ::CORBA::Long nz)
229 //       throw (SALOME::SALOME_Exception)
230 // {
231 //   Quad_ptr result = Quad::_nil();
232 // 
233 // //   EnumCoord k;
234 // //   HEXA_NS::EnumCoord k_cpp;
235 //   HEXA_NS::EnumCoord dir_cpp;
236 // 
237 //   switch (dirIn) {
238 //     case DIR_X : dir_cpp = HEXA_NS::dir_x; break;
239 //     case DIR_Y : dir_cpp = HEXA_NS::dir_y; break;
240 //     case DIR_Z : dir_cpp = HEXA_NS::dir_z; break;
241 //     case DIM3:   dir_cpp = HEXA_NS::DIM3; break;
242 //   }
243 // 
244 //   HEXA_NS::Quad* q = _elements_cpp->getQuad(dir_cpp, nx, ny, nz);
245 //   if ( q != NULL ){
246 //     Quad_impl* servantCorba = new Quad_impl(q);
247 //     result = servantCorba->_this();
248 //   }
249 // 
250 //   return result;
251 // }
252 // 
253 // Edge_ptr Elements_impl::getEdge1(EnumCoord dirIn, ::CORBA::Long nx, ::CORBA::Long ny, ::CORBA::Long nz)
254 //       throw (SALOME::SALOME_Exception)
255 // {
256 //   Edge_ptr result = Edge::_nil();
257 // 
258 // //   EnumCoord k;
259 // //   HEXA_NS::EnumCoord k_cpp;
260 //   HEXA_NS::EnumCoord dir_cpp;
261 // 
262 //   switch (dirIn) {
263 //     case DIR_X : dir_cpp = HEXA_NS::dir_x; break;
264 //     case DIR_Y : dir_cpp = HEXA_NS::dir_y; break;
265 //     case DIR_Z : dir_cpp = HEXA_NS::dir_z; break;
266 //     case DIM3:   dir_cpp = HEXA_NS::DIM3; break;
267 //   }
268 // 
269 //   HEXA_NS::Edge* e = _elements_cpp->getEdge(dir_cpp, nx, ny, nz);
270 //   if ( e != NULL ){
271 //     Edge_impl* servantCorba = new Edge_impl(e);
272 //     result = servantCorba->_this();
273 //   }
274 // 
275 //   return result;
276 // }
277