1 // Copyright (C) 2009-2013 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 "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"
29 Elements_impl::Elements_impl( HEXA_NS::Elements *ptrCpp ):_elements_cpp(ptrCpp)
33 HEXA_NS::Elements* Elements_impl::GetImpl()
38 ::CORBA::Long Elements_impl::countVertex() throw (SALOME::SALOME_Exception)
40 ::CORBA::Long n = _elements_cpp->countVertex();
44 ::CORBA::Long Elements_impl::countEdge() throw (SALOME::SALOME_Exception)
46 ::CORBA::Long n = _elements_cpp->countEdge();
50 ::CORBA::Long Elements_impl::countQuad() throw (SALOME::SALOME_Exception)
52 ::CORBA::Long n = _elements_cpp->countQuad();
56 ::CORBA::Long Elements_impl::countHexa() throw (SALOME::SALOME_Exception)
58 ::CORBA::Long n = _elements_cpp->countHexa();
62 ::CORBA::Long Elements_impl::findVertex( Vertex_ptr pIn ) throw (SALOME::SALOME_Exception)
65 Vertex_impl* pInServant = ::DownCast<Vertex_impl*>( pIn );
67 HEXA_NS::Vertex* p = pInServant->GetImpl();
68 n = _elements_cpp->findVertex( p );
74 Vertex_ptr Elements_impl::getVertex(::CORBA::Long n) throw (SALOME::SALOME_Exception)
76 Vertex_ptr result = Vertex::_nil();
78 HEXA_NS::Vertex* v = _elements_cpp->getVertex(n);
80 Vertex_impl* servantCorba = new Vertex_impl(v);
81 result = servantCorba->_this();
86 Edge_ptr Elements_impl::getEdge(::CORBA::Long n) throw (SALOME::SALOME_Exception)
88 Edge_ptr result = Edge::_nil();
90 HEXA_NS::Edge* e = _elements_cpp->getEdge(n);
92 Edge_impl* servantCorba = new Edge_impl(e);
93 result = servantCorba->_this();
98 Quad_ptr Elements_impl::getQuad(::CORBA::Long n) throw (SALOME::SALOME_Exception)
100 Quad_ptr result = Quad::_nil();
102 HEXA_NS::Quad* q = _elements_cpp->getQuad(n);
104 Quad_impl* servantCorba = new Quad_impl(q);
105 result = servantCorba->_this();
110 Hexa_ptr Elements_impl::getHexa(::CORBA::Long n) throw (SALOME::SALOME_Exception)
112 Hexa_ptr result = Hexa::_nil();
114 HEXA_NS::Hexa* h = _elements_cpp->getHexa(n);
116 Hexa_impl* servantCorba = new Hexa_impl(h);
117 result = servantCorba->_this();
123 ::CORBA::Long Elements_impl::saveVtk( const char* fname ) throw (SALOME::SALOME_Exception)
125 ::CORBA::Long ret = _elements_cpp->saveVtk( fname );
130 void Elements_impl::dump() throw (SALOME::SALOME_Exception)
132 _elements_cpp->dump();
136 void Elements_impl::printName() throw (SALOME::SALOME_Exception)
138 _elements_cpp->printName();
141 char* Elements_impl::getName() throw (SALOME::SALOME_Exception)
143 return CORBA::string_dup( _elements_cpp->getName() );
146 // ========================================================= setName
147 void Elements_impl::setName(const char* name)
148 throw (SALOME::SALOME_Exception)
150 _elements_cpp->setName (name);
156 Vertex_ptr Elements_impl::getVertexIJK(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
157 throw (SALOME::SALOME_Exception)
159 Vertex_ptr result = Vertex::_nil();
160 HEXA_NS::Vertex* v = _elements_cpp->getVertexIJK(x, y, z);
162 Vertex_impl* servantCorba = new Vertex_impl(v);
163 result = servantCorba->_this();
169 Edge_ptr Elements_impl::getEdgeI(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
170 throw (SALOME::SALOME_Exception)
172 Edge_ptr result = Edge::_nil();
173 HEXA_NS::Edge* e = _elements_cpp->getEdgeI(x, y, z);
175 Edge_impl* servantCorba = new Edge_impl(e);
176 result = servantCorba->_this();
182 Edge_ptr Elements_impl::getEdgeJ(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
183 throw (SALOME::SALOME_Exception)
185 Edge_ptr result = Edge::_nil();
186 HEXA_NS::Edge* e = _elements_cpp->getEdgeJ(x, y, z);
188 Edge_impl* servantCorba = new Edge_impl(e);
189 result = servantCorba->_this();
195 Edge_ptr Elements_impl::getEdgeK(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
196 throw (SALOME::SALOME_Exception)
198 Edge_ptr result = Edge::_nil();
199 HEXA_NS::Edge* e = _elements_cpp->getEdgeK(x, y, z);
201 Edge_impl* servantCorba = new Edge_impl(e);
202 result = servantCorba->_this();
207 Quad_ptr Elements_impl::getQuadIJ(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
208 throw (SALOME::SALOME_Exception)
210 Quad_ptr result = Quad::_nil();
211 HEXA_NS::Quad* q = _elements_cpp->getQuadIJ(x, y, z);
213 Quad_impl* servantCorba = new Quad_impl(q);
214 result = servantCorba->_this();
220 Quad_ptr Elements_impl::getQuadIK(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
221 throw (SALOME::SALOME_Exception)
223 Quad_ptr result = Quad::_nil();
224 HEXA_NS::Quad* q = _elements_cpp->getQuadIK(x, y, z);
226 Quad_impl* servantCorba = new Quad_impl(q);
227 result = servantCorba->_this();
233 Quad_ptr Elements_impl::getQuadJK(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z)
234 throw (SALOME::SALOME_Exception)
236 Quad_ptr result = Quad::_nil();
237 HEXA_NS::Quad* q = _elements_cpp->getQuadJK(x, y, z);
239 Quad_impl* servantCorba = new Quad_impl(q);
240 result = servantCorba->_this();
246 Hexa_ptr Elements_impl::getHexaIJK(::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) throw (SALOME::SALOME_Exception)
248 Hexa_ptr result = Hexa::_nil();
249 HEXA_NS::Hexa* h = _elements_cpp->getHexaIJK(x, y, z);
251 Hexa_impl* servantCorba = new Hexa_impl(h);
252 result = servantCorba->_this();
257 // ================================================== clearAssociation
258 void Elements_impl::clearAssociation ()
259 throw (SALOME::SALOME_Exception)
261 _elements_cpp->clearAssociation ();
264 // Quad_ptr Elements_impl::getQuad1(EnumCoord dirIn, ::CORBA::Long nx, ::CORBA::Long ny, ::CORBA::Long nz)
265 // throw (SALOME::SALOME_Exception)
267 // Quad_ptr result = Quad::_nil();
270 // // HEXA_NS::EnumCoord k_cpp;
271 // HEXA_NS::EnumCoord dir_cpp;
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;
280 // HEXA_NS::Quad* q = _elements_cpp->getQuad(dir_cpp, nx, ny, nz);
282 // Quad_impl* servantCorba = new Quad_impl(q);
283 // result = servantCorba->_this();
289 // Edge_ptr Elements_impl::getEdge1(EnumCoord dirIn, ::CORBA::Long nx, ::CORBA::Long ny, ::CORBA::Long nz)
290 // throw (SALOME::SALOME_Exception)
292 // Edge_ptr result = Edge::_nil();
295 // // HEXA_NS::EnumCoord k_cpp;
296 // HEXA_NS::EnumCoord dir_cpp;
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;
305 // HEXA_NS::Edge* e = _elements_cpp->getEdge(dir_cpp, nx, ny, nz);
307 // Edge_impl* servantCorba = new Edge_impl(e);
308 // result = servantCorba->_this();