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