From c309c9846f35ffd2547fc8b3472b7e4aeca8f76a Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Thu, 3 Oct 2019 13:52:59 +0200 Subject: [PATCH] store refinement --- libsrc/meshing/basegeom.cpp | 6 ------ libsrc/meshing/basegeom.hpp | 10 +++++++++- 2 files changed, 9 insertions(+), 7 deletions(-) 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())); }