mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 22:20:35 +05:00
GetPeriodicVertices in new interface
This commit is contained in:
parent
9d0ffac0eb
commit
7e8f8dbeb0
@ -394,6 +394,12 @@ namespace netgen
|
||||
Swap (ownmem, a2.ownmem);
|
||||
return *this;
|
||||
}
|
||||
|
||||
T * Release()
|
||||
{
|
||||
ownmem = false;
|
||||
return data;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
@ -30,6 +30,21 @@ namespace netgen
|
||||
int nr; // 0-based
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class Ng_Buffer
|
||||
{
|
||||
size_t s;
|
||||
T * data;
|
||||
public:
|
||||
Ng_Buffer (size_t as, T * adata)
|
||||
: s(as), data(adata) { ; }
|
||||
Ng_Buffer (Ng_Buffer && buffer)
|
||||
: s(buffer.Size()), data(buffer.Release()) { ; }
|
||||
~Ng_Buffer () { delete [] data; }
|
||||
size_t Size() const { return s; }
|
||||
T * Release() { T * hd = data; data = nullptr; return hd; }
|
||||
};
|
||||
|
||||
class Ng_Element
|
||||
{
|
||||
|
||||
@ -285,6 +300,7 @@ namespace netgen
|
||||
int GetParentElement (int ei) const;
|
||||
int GetParentSElement (int ei) const;
|
||||
|
||||
Ng_Buffer<int[2]> GetPeriodicVertices(int idnr) const;
|
||||
|
||||
// Find element of point, returns local coordinates
|
||||
template <int DIM>
|
||||
|
@ -297,5 +297,14 @@ template <> NGX_INLINE DLL_HEADER const Ng_Node<2> Ngx_Mesh :: GetNode<2> (int n
|
||||
}
|
||||
|
||||
|
||||
NGX_INLINE DLL_HEADER Ng_Buffer<int[2]> Ngx_Mesh :: GetPeriodicVertices(int idnr) const
|
||||
{
|
||||
Array<INDEX_2> apairs;
|
||||
mesh->GetIdentifications().GetPairs (idnr, apairs);
|
||||
typedef int ti2[2];
|
||||
return { apairs.Size(), (ti2*)(void*)apairs.Release() };
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline auto Ngx_Mesh :: GetTimeStamp() const { return mesh->GetTimeStamp(); }
|
||||
|
Loading…
Reference in New Issue
Block a user