* Added support for extracting 8 node Quad elements

* Modified the Ng_GetElement_2D function to return also the element type giving it the same base functionality as Ng_GetSurfaceElement, but with the capability of returning the region index too (called matnum)
This commit is contained in:
Philippose Rajan 2010-09-15 20:52:20 +00:00
parent c412992519
commit 3e8f2ab440
2 changed files with 40 additions and 7 deletions

View File

@ -228,7 +228,16 @@ namespace nglib
{ {
case 3: et = NG_TRIG; break; case 3: et = NG_TRIG; break;
case 4: et = NG_QUAD; break; case 4: et = NG_QUAD; break;
case 6: et = NG_TRIG6; break; case 6:
switch (el.GetNV())
{
case 3: et = NG_TRIG6; break;
case 4: et = NG_QUAD6; break;
default:
et = NG_TRIG6; break;
}
break;
case 8: et = NG_QUAD8; break;
default: default:
et = NG_TRIG; break; // for the compiler et = NG_TRIG; break; // for the compiler
} }
@ -377,13 +386,36 @@ namespace nglib
DLL_HEADER void Ng_GetElement_2D (Ng_Mesh * mesh, int num, int * pi, int * matnum) DLL_HEADER Ng_Surface_Element_Type
Ng_GetElement_2D (Ng_Mesh * mesh, int num, int * pi, int * matnum)
{ {
const Element2d & el = ((Mesh*)mesh)->SurfaceElement(num); const Element2d & el = ((Mesh*)mesh)->SurfaceElement(num);
for (int i = 1; i <= 3; i++) for (int i = 1; i <= el.GetNP(); i++)
pi[i-1] = el.PNum(i); pi[i-1] = el.PNum(i);
Ng_Surface_Element_Type et;
switch (el.GetNP())
{
case 3: et = NG_TRIG; break;
case 4: et = NG_QUAD; break;
case 6:
switch (el.GetNV())
{
case 3: et = NG_TRIG6; break;
case 4: et = NG_QUAD6; break;
default:
et = NG_TRIG6; break;
}
break;
case 8: et = NG_QUAD8; break;
default:
et = NG_TRIG; break; // for the compiler
}
if (matnum) if (matnum)
*matnum = el.GetIndex(); *matnum = el.GetIndex();
return et;
} }

View File

@ -40,7 +40,7 @@
#define NG_VOLUME_ELEMENT_MAXPOINTS 10 #define NG_VOLUME_ELEMENT_MAXPOINTS 10
/// Maximum allowed number of nodes per surface element /// Maximum allowed number of nodes per surface element
#define NG_SURFACE_ELEMENT_MAXPOINTS 6 #define NG_SURFACE_ELEMENT_MAXPOINTS 8
@ -67,7 +67,7 @@ typedef void * Ng_OCC_TopTools_IndexedMapOfShape;
// *** Special Enum types used within Netgen *********** // *** Special Enum types used within Netgen ***********
/// Currently implemented surface element types /// Currently implemented surface element types
enum Ng_Surface_Element_Type enum Ng_Surface_Element_Type
{ NG_TRIG = 1, NG_QUAD = 2, NG_TRIG6 = 3 }; { NG_TRIG = 1, NG_QUAD = 2, NG_TRIG6 = 3, NG_QUAD6 = 4, NG_QUAD8 = 5 };
/// Currently implemented volume element types /// Currently implemented volume element types
enum Ng_Volume_Element_Type enum Ng_Volume_Element_Type
@ -532,8 +532,9 @@ DLL_HEADER int Ng_GetNSeg_2D (Ng_Mesh * mesh);
// return point coordinates // return point coordinates
DLL_HEADER void Ng_GetPoint_2D (Ng_Mesh * mesh, int num, double * x); DLL_HEADER void Ng_GetPoint_2D (Ng_Mesh * mesh, int num, double * x);
// return 2d triangles // return 2d elements
DLL_HEADER void Ng_GetElement_2D (Ng_Mesh * mesh, int num, int * pi, int * matnum = NULL); DLL_HEADER Ng_Surface_Element_Type
Ng_GetElement_2D (Ng_Mesh * mesh, int num, int * pi, int * matnum = NULL);
// return 2d boundary segment // return 2d boundary segment
DLL_HEADER void Ng_GetSegment_2D (Ng_Mesh * mesh, int num, int * pi, int * matnum = NULL); DLL_HEADER void Ng_GetSegment_2D (Ng_Mesh * mesh, int num, int * pi, int * matnum = NULL);