diff --git a/libsrc/include/nginterface_v2.hpp b/libsrc/include/nginterface_v2.hpp index 809b41fb..2c437276 100644 --- a/libsrc/include/nginterface_v2.hpp +++ b/libsrc/include/nginterface_v2.hpp @@ -111,6 +111,40 @@ namespace netgen public: Ng_Vertices vertices; }; + + + + template <> + class Ng_Node<2> + { + class Ng_Vertices + { + public: + int nv; + const int * ptr; + + int Size() const { return nv; } + int operator[] (int i) const { return ptr[i]-1; } + }; + + class Ng_Edges + { + public: + int ned; + const int * ptr; + + int Size() const { return ned; } + int operator[] (int i) const { return ptr[i]-1; } + }; + + + public: + Ng_Vertices vertices; + Ng_Edges edges; + }; + + + template DLL_HEADER Ng_Node Ng_GetNode (int nr); diff --git a/libsrc/meshing/topology.hpp b/libsrc/meshing/topology.hpp index 9fec5cd6..92e7c182 100644 --- a/libsrc/meshing/topology.hpp +++ b/libsrc/meshing/topology.hpp @@ -87,6 +87,7 @@ public: void GetFaceVertices (int fnr, int * vertices) const; void GetEdgeVertices (int enr, int & v1, int & v2) const; const int * GetEdgeVerticesPtr (int enr) const { return &edge2vert[enr][0]; } + const int * GetFaceVerticesPtr (int fnr) const { return &face2vert[fnr][0]; } void GetFaceEdges (int fnr, Array & edges, bool withorientation = false) const; ELEMENT_TYPE GetFaceType (int fnr) const; diff --git a/ng/nginterface_v2.cpp b/ng/nginterface_v2.cpp index 3be2a8f9..ac9701df 100644 --- a/ng/nginterface_v2.cpp +++ b/ng/nginterface_v2.cpp @@ -263,4 +263,13 @@ namespace netgen } + + template <> DLL_HEADER Ng_Node<2> Ng_GetNode<2> (int nr) + { + Ng_Node<2> node; + node.vertices.ptr = mesh->GetTopology().GetFaceVerticesPtr(nr); + node.vertices.nv = (node.vertices.ptr[3] == 0) ? 3 : 4; + return node; + } + }