diff --git a/libsrc/meshing/basegeom.cpp b/libsrc/meshing/basegeom.cpp index 7dc12a35..4868b5a0 100644 --- a/libsrc/meshing/basegeom.cpp +++ b/libsrc/meshing/basegeom.cpp @@ -126,12 +126,6 @@ namespace netgen return 0; } - const Refinement & NetgenGeometry :: GetRefinement () const - { - return *new Refinement(*this); - } - - void NetgenGeometry :: Save (string filename) const { throw NgException("Cannot save geometry - no geometry available"); diff --git a/libsrc/meshing/basegeom.hpp b/libsrc/meshing/basegeom.hpp index 50eeffb4..221e875b 100644 --- a/libsrc/meshing/basegeom.hpp +++ b/libsrc/meshing/basegeom.hpp @@ -15,12 +15,20 @@ namespace netgen class DLL_HEADER NetgenGeometry { + unique_ptr ref; public: + NetgenGeometry() + { + ref = make_unique(*this); + } virtual ~NetgenGeometry () { ; } virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam); - virtual const Refinement & GetRefinement () const; + virtual const Refinement & GetRefinement () const + { + return *ref; + } virtual void DoArchive(Archive&) { throw NgException("DoArchive not implemented for " + Demangle(typeid(*this).name())); }