GetParent*() functions in nginterface_v2

This commit is contained in:
Matthias Hochsteger 2018-03-20 19:14:07 +01:00
parent b151c9d7da
commit df71d00d21
2 changed files with 49 additions and 0 deletions

View File

@ -280,6 +280,10 @@ namespace netgen
void (*taskmanager)(function<void(int,int)>) = &DummyTaskManager2, void (*taskmanager)(function<void(int,int)>) = &DummyTaskManager2,
void (*tracer)(string, bool) = &DummyTracer2); 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 // Find element of point, returns local coordinates
template <int DIM> template <int DIM>

View File

@ -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;
}