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 * p;
#pragma omp critical (BlockAllocator)
{
// return new char[size];
if (!freelist)
@ -49,16 +52,22 @@ namespace netgen
freelist = hcp;
}
void * p = freelist;
p = freelist;
freelist = *(void**)freelist;
}
return p;
}
/*
void BlockAllocator :: Free (void * p)
{
#pragma omp critical (BlockAllocator)
{
if (bablocks.Size())
{
*(void**)p = freelist;
freelist = p;
}
*/
}
}
}

View File

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

View File

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

View File

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