occ meshing, lock in block-allocator

This commit is contained in:
Joachim Schoeberl 2015-01-20 17:41:16 +00:00
parent cb5c6b477c
commit 69429c6e09
5 changed files with 47 additions and 37 deletions

View File

@ -34,6 +34,9 @@ namespace netgen
} }
void * BlockAllocator :: Alloc () void * BlockAllocator :: Alloc ()
{
void * p;
#pragma omp critical (BlockAllocator)
{ {
// return new char[size]; // return new char[size];
if (!freelist) if (!freelist)
@ -49,16 +52,22 @@ namespace netgen
freelist = hcp; freelist = hcp;
} }
void * p = freelist; p = freelist;
freelist = *(void**)freelist; freelist = *(void**)freelist;
}
return p; return p;
} }
/*
void BlockAllocator :: Free (void * p) void BlockAllocator :: Free (void * p)
{
#pragma omp critical (BlockAllocator)
{
if (bablocks.Size())
{ {
*(void**)p = freelist; *(void**)p = freelist;
freelist = p; freelist = p;
} }
*/ }
}
} }

View File

@ -46,12 +46,14 @@ public:
/// ///
void Free (void * p) void Free (void * p);
/*
{ {
if (!bablocks.Size()) return; if (!bablocks.Size()) return;
*(void**)p = freelist; *(void**)p = freelist;
freelist = p; freelist = p;
} }
*/
private: private:

View File

@ -101,7 +101,6 @@ namespace netgen
{ {
NgLock lock(mutex); NgLock lock(mutex);
lock.Lock(); lock.Lock();
points.SetSize(0); points.SetSize(0);
segments.SetSize(0); segments.SetSize(0);
surfelements.SetSize(0); surfelements.SetSize(0);

View File

@ -1281,7 +1281,7 @@ namespace netgen
if (perfstepsstart <= MESHCONST_ANALYSE) if (perfstepsstart <= MESHCONST_ANALYSE)
{ {
// delete mesh; // delete mesh;
mesh = make_shared<Mesh>(); // mesh = make_shared<Mesh>();
mesh->geomtype = Mesh::GEOM_OCC; mesh->geomtype = Mesh::GEOM_OCC;
OCCSetLocalMeshSize(geom,*mesh); OCCSetLocalMeshSize(geom,*mesh);