mesh interface, deallocation

This commit is contained in:
Joachim Schoeberl 2014-10-19 13:53:57 +00:00
parent 92dbe6aeb0
commit 36803ec256
5 changed files with 15 additions and 0 deletions

View File

@ -27,8 +27,10 @@ namespace netgen
BlockAllocator :: ~BlockAllocator () BlockAllocator :: ~BlockAllocator ()
{ {
// cout << "****************** delete BlockAllocator " << endl;
for (int i = 0; i < bablocks.Size(); i++) for (int i = 0; i < bablocks.Size(); i++)
delete [] bablocks[i]; delete [] bablocks[i];
bablocks.SetSize(0);
} }
void * BlockAllocator :: Alloc () void * BlockAllocator :: Alloc ()

View File

@ -48,6 +48,7 @@ public:
/// ///
void Free (void * p) void Free (void * p)
{ {
if (!bablocks.Size()) return;
*(void**)p = freelist; *(void**)p = freelist;
freelist = p; freelist = p;
} }

View File

@ -167,6 +167,7 @@ namespace netgen
void LoadMesh (istream & str); void LoadMesh (istream & str);
void SaveMesh (ostream & str) const; void SaveMesh (ostream & str) const;
void UpdateTopology ();
void DoArchive (ngstd::Archive & archive); void DoArchive (ngstd::Archive & archive);
virtual ~Ngx_Mesh(); virtual ~Ngx_Mesh();

View File

@ -6,6 +6,7 @@
#include "nginterface.h" #include "nginterface.h"
#include "nginterface_v2.hpp" #include "nginterface_v2.hpp"
#include <visual.hpp>
namespace netgen namespace netgen
{ {
@ -22,7 +23,11 @@ namespace netgen
shared_ptr<Mesh> Ngx_Mesh :: SelectMesh () const shared_ptr<Mesh> Ngx_Mesh :: SelectMesh () const
{ {
shared_ptr<Mesh> hmesh = netgen::mesh; shared_ptr<Mesh> hmesh = netgen::mesh;
netgen::mesh = mesh; netgen::mesh = mesh;
vssolution.SetMesh(mesh);
vsmesh.SetMesh(mesh);
return hmesh; return hmesh;
} }
@ -80,6 +85,11 @@ namespace netgen
} }
} }
void Ngx_Mesh :: UpdateTopology ()
{
if (mesh)
mesh -> UpdateTopology();
}
/* /*

View File

@ -47,6 +47,7 @@ namespace netgen
Mesh :: ~Mesh() Mesh :: ~Mesh()
{ {
// cout << "******************** deleting Mesh **********" << endl;
delete lochfunc; delete lochfunc;
delete boundaryedges; delete boundaryedges;
delete surfelementht; delete surfelementht;