2 #include "HEXABLOCK.hxx"
7 #include "hexa_base.hxx"
8 #include "HexEltBase.hxx"
9 #include "HexGroups.hxx"
11 #include "HexElements_impl.hxx"
13 #include "HexVertex_impl.hxx"
14 #include "HexEdge_impl.hxx"
15 #include "HexQuad_impl.hxx"
16 #include "HexHexa_impl.hxx"
17 #include "HexGroup_impl.hxx"
19 Group_impl::Group_impl( HEXA_NS::Group *ptrCpp ):_group_cpp(ptrCpp)
23 HEXA_NS::Group* Group_impl::GetImpl() throw (SALOME::SALOME_Exception)
28 char* Group_impl::getName() throw (SALOME::SALOME_Exception)
30 _group_cpp->getName();
33 void Group_impl::setName(const char* name) throw (SALOME::SALOME_Exception)
35 _group_cpp->setName( name );
39 GroupKind Group_impl::getKind() throw (SALOME::SALOME_Exception)
41 HEXA_NS::EnumGroup k = _group_cpp->getKind();
44 case HEXA_NS::HexaCell: return HEXA_GROUP;
45 case HEXA_NS::QuadCell: return QUAD_GROUP;
46 case HEXA_NS::EdgeCell: return EDGE_GROUP;
47 case HEXA_NS::HexaNode: return HEXANODE_GROUP;
48 case HEXA_NS::QuadNode: return QUADNODE_GROUP;
49 case HEXA_NS::EdgeNode: return EDGENODE_GROUP;
50 case HEXA_NS::Vertex_Node: return VERTEXNODE_GROUP;
51 default : ASSERT(false);
56 ::CORBA::Long Group_impl::addElement(Element_ptr eIn) throw (SALOME::SALOME_Exception)
59 Vertex_impl* vInServant = ::DownCast<Vertex_impl*>( eIn );
60 Edge_impl* eInServant = ::DownCast<Edge_impl*>( eIn );
61 Quad_impl* qInServant = ::DownCast<Quad_impl*>( eIn );
62 Hexa_impl* hInServant = ::DownCast<Hexa_impl*>( eIn );
64 ASSERT( vInServant or eInServant or qInServant or hInServant );
65 HEXA_NS::EltBase* e = NULL;
67 e = vInServant->GetImpl();
68 } else if ( eInServant ) {
69 e = eInServant->GetImpl();
70 } else if ( qInServant ) {
71 e = qInServant->GetImpl();
72 } else if ( hInServant ) {
73 e = hInServant->GetImpl();
75 ok = _group_cpp->addElement(e);
81 ::CORBA::Long Group_impl::countElement() throw (SALOME::SALOME_Exception)
83 return _group_cpp->countElement();
87 Element_ptr Group_impl::getElement(::CORBA::Long index) throw (SALOME::SALOME_Exception)
89 HEXA_NS::EltBase* elt = _group_cpp->getElement(index);
91 HEXA_NS::Vertex* v = dynamic_cast<HEXA_NS::Vertex*>(elt);
92 HEXA_NS::Edge* e = dynamic_cast<HEXA_NS::Edge*>(elt);
93 HEXA_NS::Quad* q = dynamic_cast<HEXA_NS::Quad*>(elt);
94 HEXA_NS::Hexa* h = dynamic_cast<HEXA_NS::Hexa*>(elt);
96 ASSERT( v or e or q or h );
99 Vertex_impl* servantCorba = new Vertex_impl(v);
100 return servantCorba->_this();
102 Edge_impl* servantCorba = new Edge_impl(e);
103 return servantCorba->_this();
105 Quad_impl* servantCorba = new Quad_impl(q);
106 return servantCorba->_this();
108 Hexa_impl* servantCorba = new Hexa_impl(h);
109 return servantCorba->_this();
111 return Element::_nil();
116 ::CORBA::Long Group_impl::removeElement(::CORBA::Long index) throw (SALOME::SALOME_Exception)
118 return _group_cpp->removeElement(index);
121 void Group_impl::clearElement() throw (SALOME::SALOME_Exception)
123 _group_cpp->clearElement();