mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
GetElement returns Facet-Array. Since for 1D these are point numbers, and point numbers are (still) 1-based, we have to return also the base
This commit is contained in:
parent
240a132078
commit
619f9ff47f
@ -78,10 +78,11 @@ namespace netgen
|
||||
{
|
||||
public:
|
||||
size_t num;
|
||||
int base;
|
||||
const int * ptr;
|
||||
|
||||
size_t Size() const { return num; }
|
||||
int operator[] (size_t i) const { return ptr[i]; }
|
||||
int operator[] (size_t i) const { return ptr[i]-base; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -96,15 +96,14 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (size_t nr) const
|
||||
if (mesh->GetDimension() == 2)
|
||||
{
|
||||
ret.facets.num = 1;
|
||||
ret.facets.base = 0;
|
||||
ret.facets.ptr = (int*)ret.edges.ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.facets.num = 0;
|
||||
ret.facets.ptr = nullptr;
|
||||
// not working as long as vertices are 1-based
|
||||
// ret.facets.num = 2;
|
||||
// ret.facets.ptr = (int*)&(el[0]);
|
||||
ret.facets.num = 2;
|
||||
ret.facets.base = 1;
|
||||
ret.facets.ptr = (int*)&(el[0]);
|
||||
}
|
||||
|
||||
// ret.is_curved = mesh->GetCurvedElements().IsSegmentCurved(nr);
|
||||
@ -142,11 +141,13 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (size_t nr) const
|
||||
if (mesh->GetDimension() == 3)
|
||||
{
|
||||
ret.facets.num = ret.faces.num;
|
||||
ret.facets.base = 0;
|
||||
ret.facets.ptr = (int*)ret.faces.ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.facets.num = ret.edges.num;
|
||||
ret.facets.base = 0;
|
||||
ret.facets.ptr = (int*)ret.edges.ptr;
|
||||
}
|
||||
ret.is_curved = el.IsCurved();
|
||||
@ -176,6 +177,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<3> (size_t nr) const
|
||||
ret.faces.ptr = (T_FACE2*)mesh->GetTopology().GetElementFacesPtr (nr);
|
||||
|
||||
ret.facets.num = ret.faces.num;
|
||||
ret.facets.base = 0;
|
||||
ret.facets.ptr = (int*)ret.faces.ptr;
|
||||
|
||||
ret.is_curved = el.IsCurved();
|
||||
|
Loading…
Reference in New Issue
Block a user