diff --git a/libsrc/general/optmem.cpp b/libsrc/general/optmem.cpp index 4d31f987..2fba3043 100644 --- a/libsrc/general/optmem.cpp +++ b/libsrc/general/optmem.cpp @@ -27,8 +27,10 @@ namespace netgen BlockAllocator :: ~BlockAllocator () { + // cout << "****************** delete BlockAllocator " << endl; for (int i = 0; i < bablocks.Size(); i++) delete [] bablocks[i]; + bablocks.SetSize(0); } void * BlockAllocator :: Alloc () diff --git a/libsrc/general/optmem.hpp b/libsrc/general/optmem.hpp index cd55f16e..aaa02dd4 100644 --- a/libsrc/general/optmem.hpp +++ b/libsrc/general/optmem.hpp @@ -48,6 +48,7 @@ public: /// void Free (void * p) { + if (!bablocks.Size()) return; *(void**)p = freelist; freelist = p; } diff --git a/libsrc/include/nginterface_v2.hpp b/libsrc/include/nginterface_v2.hpp index 8ddedc71..0317022f 100644 --- a/libsrc/include/nginterface_v2.hpp +++ b/libsrc/include/nginterface_v2.hpp @@ -167,6 +167,7 @@ namespace netgen void LoadMesh (istream & str); void SaveMesh (ostream & str) const; + void UpdateTopology (); void DoArchive (ngstd::Archive & archive); virtual ~Ngx_Mesh(); diff --git a/libsrc/interface/nginterface_v2.cpp b/libsrc/interface/nginterface_v2.cpp index a46acdf2..8b387131 100644 --- a/libsrc/interface/nginterface_v2.cpp +++ b/libsrc/interface/nginterface_v2.cpp @@ -6,6 +6,7 @@ #include "nginterface.h" #include "nginterface_v2.hpp" +#include namespace netgen { @@ -22,7 +23,11 @@ namespace netgen shared_ptr Ngx_Mesh :: SelectMesh () const { shared_ptr hmesh = netgen::mesh; + netgen::mesh = mesh; + vssolution.SetMesh(mesh); + vsmesh.SetMesh(mesh); + return hmesh; } @@ -80,6 +85,11 @@ namespace netgen } } + void Ngx_Mesh :: UpdateTopology () + { + if (mesh) + mesh -> UpdateTopology(); + } /* diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index 031283b5..a6d62e65 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -47,6 +47,7 @@ namespace netgen Mesh :: ~Mesh() { + // cout << "******************** deleting Mesh **********" << endl; delete lochfunc; delete boundaryedges; delete surfelementht;