From 523b8c086c17074b03cd3579b30bec5141d9b4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Sch=C3=B6berl?= Date: Sat, 12 Jan 2019 14:18:56 +0100 Subject: [PATCH] GetFaceEdges in new mesh-interface (without global ptr) --- libsrc/include/nginterface_v2.hpp | 21 ++++++++++++++++++--- libsrc/interface/nginterface_v2.cpp | 10 ++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/libsrc/include/nginterface_v2.hpp b/libsrc/include/nginterface_v2.hpp index 33a596db..116219b4 100644 --- a/libsrc/include/nginterface_v2.hpp +++ b/libsrc/include/nginterface_v2.hpp @@ -44,6 +44,19 @@ namespace netgen size_t Size() const { return s; } T * Release() { T * hd = data; data = nullptr; return hd; } }; + + template + class Ng_BufferMS + { + size_t s; + T data[S]; + public: + Ng_BufferMS (size_t as) : s(as) { ; } + size_t Size() const { return s; } + T & operator[] (size_t i) { return data[i]; } + T operator[] (size_t i) const { return data[i]; } + }; + class Ng_Element { @@ -185,6 +198,7 @@ namespace netgen int operator[] (size_t i) const { return ptr[i]-POINTINDEX_BASE; } }; + /* class Ng_Edges { public: @@ -194,11 +208,11 @@ namespace netgen size_t Size() const { return ned; } int operator[] (size_t i) const { return ptr[i]-1; } }; - + */ public: Ng_Vertices vertices; - Ng_Edges edges; + // Ng_Edges edges; int surface_el; // -1 if face not on surface }; @@ -282,7 +296,8 @@ namespace netgen template const Ng_Node GetNode (int nr) const; - + + Ng_BufferMS GetFaceEdges (int fnr) const; template int GetNNodes (); diff --git a/libsrc/interface/nginterface_v2.cpp b/libsrc/interface/nginterface_v2.cpp index fee63976..cb7fd673 100644 --- a/libsrc/interface/nginterface_v2.cpp +++ b/libsrc/interface/nginterface_v2.cpp @@ -717,6 +717,16 @@ namespace netgen return mesh->GetIdentifications().GetType(idnr+1); } + Ng_BufferMS Ngx_Mesh::GetFaceEdges (int fnr) const + { + const MeshTopology & topology = mesh->GetTopology(); + ArrayMem ia; + topology.GetFaceEdges (fnr+1, ia); + Ng_BufferMS res(ia.Size()); + for (size_t i = 0; i < ia.Size(); i++) + res[i] = ia[i]-1; + return res; + }