diff --git a/libsrc/include/nginterface_v2.hpp b/libsrc/include/nginterface_v2.hpp index b1c8373a..69045016 100644 --- a/libsrc/include/nginterface_v2.hpp +++ b/libsrc/include/nginterface_v2.hpp @@ -116,6 +116,7 @@ namespace netgen public: Ng_Elements elements; + Ng_Elements bnd_elements; }; diff --git a/libsrc/include/nginterface_v2_impl.hpp b/libsrc/include/nginterface_v2_impl.hpp index 8f4395c0..f677aae7 100644 --- a/libsrc/include/nginterface_v2_impl.hpp +++ b/libsrc/include/nginterface_v2_impl.hpp @@ -135,3 +135,82 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<3> (int nr) const ret.is_curved = el.IsCurved(); return ret; } + + + + + + + + + + +template <> NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetNNodes<1> () +{ + return mesh->GetTopology().GetNEdges(); +} + +template <> NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetNNodes<2> () +{ + return mesh->GetTopology().GetNFaces(); +} + +template <> NGX_INLINE DLL_HEADER const Ng_Node<0> Ngx_Mesh :: GetNode<0> (int vnr) const +{ + Ng_Node<0> node; + vnr++; + switch (mesh->GetDimension()) + { + case 3: + { + FlatArray ia = mesh->GetTopology().GetVertexElements(vnr); + node.elements.ne = ia.Size(); + node.elements.ptr = (int*)&ia[0]; + + FlatArray bia = mesh->GetTopology().GetVertexSurfaceElements(vnr); + node.bnd_elements.ne = bia.Size(); + node.bnd_elements.ptr = (int*)&bia[0]; + break; + } + case 2: + { + FlatArray ia = mesh->GetTopology().GetVertexSurfaceElements(vnr); + node.elements.ne = ia.Size(); + node.elements.ptr = (int*)&ia[0]; + + FlatArray bia = mesh->GetTopology().GetVertexSegments(vnr); + node.bnd_elements.ne = bia.Size(); + node.bnd_elements.ptr = (int*)&bia[0]; + break; + } + case 1: + { + FlatArray ia = mesh->GetTopology().GetVertexSegments(vnr); + node.elements.ne = ia.Size(); + node.elements.ptr = (int*)&ia[0]; + + node.bnd_elements.ne = 1; // nothing useful ... + node.bnd_elements.ptr = nullptr; + break; + } + default: + ; + } + return node; +} + +template <> NGX_INLINE DLL_HEADER const Ng_Node<1> Ngx_Mesh :: GetNode<1> (int nr) const +{ + Ng_Node<1> node; + node.vertices.ptr = mesh->GetTopology().GetEdgeVerticesPtr(nr); + return node; +} + +template <> NGX_INLINE DLL_HEADER const Ng_Node<2> Ngx_Mesh :: GetNode<2> (int nr) const +{ + Ng_Node<2> node; + node.vertices.ptr = mesh->GetTopology().GetFaceVerticesPtr(nr); + node.vertices.nv = (node.vertices.ptr[3] == 0) ? 3 : 4; + return node; +} + diff --git a/libsrc/interface/nginterface_v2.cpp b/libsrc/interface/nginterface_v2.cpp index d8556baa..b1070839 100644 --- a/libsrc/interface/nginterface_v2.cpp +++ b/libsrc/interface/nginterface_v2.cpp @@ -601,67 +601,6 @@ namespace netgen - - template <> DLL_HEADER int Ngx_Mesh :: GetNNodes<1> () - { - return mesh->GetTopology().GetNEdges(); - } - - template <> DLL_HEADER int Ngx_Mesh :: GetNNodes<2> () - { - return mesh->GetTopology().GetNFaces(); - } - - template <> DLL_HEADER const Ng_Node<0> Ngx_Mesh :: GetNode<0> (int vnr) const - { - Ng_Node<0> node; - vnr++; - switch (mesh->GetDimension()) - { - case 3: - { - FlatArray ia = mesh->GetTopology().GetVertexElements(vnr); - node.elements.ne = ia.Size(); - node.elements.ptr = (int*)&ia[0]; - break; - } - case 2: - { - FlatArray ia = mesh->GetTopology().GetVertexSurfaceElements(vnr); - node.elements.ne = ia.Size(); - node.elements.ptr = (int*)&ia[0]; - break; - } - case 1: - { - FlatArray ia = mesh->GetTopology().GetVertexSegments(vnr); - node.elements.ne = ia.Size(); - node.elements.ptr = (int*)&ia[0]; - break; - } - default: - ; - } - return node; - } - - - template <> DLL_HEADER const Ng_Node<1> Ngx_Mesh :: GetNode<1> (int nr) const - { - Ng_Node<1> node; - node.vertices.ptr = mesh->GetTopology().GetEdgeVerticesPtr(nr); - return node; - } - - template <> DLL_HEADER const Ng_Node<2> Ngx_Mesh :: GetNode<2> (int nr) const - { - Ng_Node<2> node; - node.vertices.ptr = mesh->GetTopology().GetFaceVerticesPtr(nr); - node.vertices.nv = (node.vertices.ptr[3] == 0) ? 3 : 4; - return node; - } - - template <> DLL_HEADER int Ngx_Mesh :: FindElementOfPoint <1> (double * hp, double * lami, diff --git a/libsrc/meshing/topology.cpp b/libsrc/meshing/topology.cpp index 83cec174..266f7dbe 100644 --- a/libsrc/meshing/topology.cpp +++ b/libsrc/meshing/topology.cpp @@ -1664,7 +1664,7 @@ namespace netgen } } - + /* FlatArray MeshTopology :: GetVertexElements (int vnr) const { if (vert2element) @@ -1685,7 +1685,7 @@ namespace netgen return (*vert2segment)[vnr]; return FlatArray (0,0); } - + */ void MeshTopology :: GetVertexSurfaceElements( int vnr, Array & elements ) const diff --git a/libsrc/meshing/topology.hpp b/libsrc/meshing/topology.hpp index dd63bb3c..8890c0e8 100644 --- a/libsrc/meshing/topology.hpp +++ b/libsrc/meshing/topology.hpp @@ -133,13 +133,15 @@ public: int GetFace2SurfaceElement (int fnr) const { return face2surfel[fnr-1]; } void GetVertexElements (int vnr, Array & elements) const; - FlatArray GetVertexElements (int vnr) const; + FlatArray GetVertexElements (int vnr) const + { return (*vert2element)[vnr]; } void GetVertexSurfaceElements( int vnr, Array& elements ) const; - FlatArray GetVertexSurfaceElements (int vnr) const; - - FlatArray GetVertexSegments (int vnr) const; + FlatArray GetVertexSurfaceElements (int vnr) const + { return (*vert2surfelement)[vnr]; } + FlatArray GetVertexSegments (int vnr) const + { return (*vert2segment)[vnr]; } int GetVerticesEdge ( int v1, int v2) const; void GetSegmentVolumeElements ( int segnr, Array & els ) const;