From df71d00d2197a3c69d357cebca3664cf010bd19a Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Tue, 20 Mar 2018 19:14:07 +0100 Subject: [PATCH] GetParent*() functions in nginterface_v2 --- libsrc/include/nginterface_v2.hpp | 4 +++ libsrc/interface/nginterface_v2.cpp | 45 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/libsrc/include/nginterface_v2.hpp b/libsrc/include/nginterface_v2.hpp index e5e26442..795dd909 100644 --- a/libsrc/include/nginterface_v2.hpp +++ b/libsrc/include/nginterface_v2.hpp @@ -280,6 +280,10 @@ namespace netgen void (*taskmanager)(function) = &DummyTaskManager2, void (*tracer)(string, bool) = &DummyTracer2); + void GetParentNodes (int ni, int * parents) const; + int GetParentElement (int ei) const; + int GetParentSElement (int ei) const; + // Find element of point, returns local coordinates template diff --git a/libsrc/interface/nginterface_v2.cpp b/libsrc/interface/nginterface_v2.cpp index 37454db0..c23e5194 100644 --- a/libsrc/interface/nginterface_v2.cpp +++ b/libsrc/interface/nginterface_v2.cpp @@ -667,6 +667,51 @@ namespace netgen } + void Ngx_Mesh :: GetParentNodes (int ni, int * parents) const + { + ni++; + if (ni <= mesh->mlbetweennodes.Size()) + { + parents[0] = mesh->mlbetweennodes.Get(ni).I1()-1; + parents[1] = mesh->mlbetweennodes.Get(ni).I2()-1; + } + else + parents[0] = parents[1] = -1; + } + + + int Ngx_Mesh :: GetParentElement (int ei) const + { + ei++; + if (mesh->GetDimension() == 3) + { + if (ei <= mesh->mlparentelement.Size()) + return mesh->mlparentelement.Get(ei)-1; + } + else + { + if (ei <= mesh->mlparentsurfaceelement.Size()) + return mesh->mlparentsurfaceelement.Get(ei)-1; + } + return -1; + } + + + int Ngx_Mesh :: GetParentSElement (int ei) const + { + ei++; + if (mesh->GetDimension() == 3) + { + if (ei <= mesh->mlparentsurfaceelement.Size()) + return mesh->mlparentsurfaceelement.Get(ei)-1; + } + else + { + return -1; + } + return -1; + } +