GetFaceEdges in new mesh-interface (without global ptr)

This commit is contained in:
Joachim Schöberl 2019-01-12 14:18:56 +01:00
parent dbb7989363
commit 523b8c086c
2 changed files with 28 additions and 3 deletions

View File

@ -44,6 +44,19 @@ namespace netgen
size_t Size() const { return s; }
T * Release() { T * hd = data; data = nullptr; return hd; }
};
template <typename T, int S>
class Ng_BufferMS
{
size_t s;
T data[S];
public:
Ng_BufferMS (size_t as) : s(as) { ; }
size_t Size() const { return s; }
T & operator[] (size_t i) { return data[i]; }
T operator[] (size_t i) const { return data[i]; }
};
class Ng_Element
{
@ -185,6 +198,7 @@ namespace netgen
int operator[] (size_t i) const { return ptr[i]-POINTINDEX_BASE; }
};
/*
class Ng_Edges
{
public:
@ -194,11 +208,11 @@ namespace netgen
size_t Size() const { return ned; }
int operator[] (size_t i) const { return ptr[i]-1; }
};
*/
public:
Ng_Vertices vertices;
Ng_Edges edges;
// Ng_Edges edges;
int surface_el; // -1 if face not on surface
};
@ -282,7 +296,8 @@ namespace netgen
template <int DIM>
const Ng_Node<DIM> GetNode (int nr) const;
Ng_BufferMS<int,4> GetFaceEdges (int fnr) const;
template <int DIM>
int GetNNodes ();

View File

@ -717,6 +717,16 @@ namespace netgen
return mesh->GetIdentifications().GetType(idnr+1);
}
Ng_BufferMS<int,4> Ngx_Mesh::GetFaceEdges (int fnr) const
{
const MeshTopology & topology = mesh->GetTopology();
ArrayMem<int,4> ia;
topology.GetFaceEdges (fnr+1, ia);
Ng_BufferMS<int,4> res(ia.Size());
for (size_t i = 0; i < ia.Size(); i++)
res[i] = ia[i]-1;
return res;
}