getvertexsurfaceelement for 2D/3D

This commit is contained in:
Joachim Schoeberl 2014-06-25 02:15:45 +00:00
parent b06e66cece
commit e0293b1bda

View File

@ -1931,6 +1931,10 @@ int Ng_GetVertex_Elements( int vnr, int* elems )
///// Added by Roman Stainko ....
int Ng_GetVertex_SurfaceElements( int vnr, int* elems )
{
switch (mesh->GetDimension())
{
case 3:
{
const MeshTopology& topology = mesh->GetTopology();
ArrayMem<int,4> indexArray;
@ -1941,6 +1945,17 @@ int Ng_GetVertex_SurfaceElements( int vnr, int* elems )
return indexArray.Size();
}
case 2:
{
int cnt = 0;
for (SegmentIndex i = 0; i < mesh->GetNSeg(); i++)
if ( ((*mesh)[i][0] == vnr) || ((*mesh)[i][1] == vnr) )
elems[cnt++] = i+1;
return cnt;
}
}
return 0;
}
///// Added by Roman Stainko ....
int Ng_GetVertex_NElements( int vnr )
@ -1954,13 +1969,26 @@ int Ng_GetVertex_NElements( int vnr )
///// Added by Roman Stainko ....
int Ng_GetVertex_NSurfaceElements( int vnr )
{
switch (mesh->GetDimension())
{
case 3:
{
const MeshTopology& topology = mesh->GetTopology();
ArrayMem<int,4> indexArray;
topology.GetVertexSurfaceElements( vnr, indexArray );
return indexArray.Size();
}
case 2:
{
int cnt = 0;
for (SegmentIndex i = 0; i < mesh->GetNSeg(); i++)
if ( ((*mesh)[i][0] == vnr) || ((*mesh)[i][1] == vnr) ) cnt++;
return cnt;
}
}
return 0;
}