mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
occ meshing, lock in block-allocator
This commit is contained in:
parent
cb5c6b477c
commit
69429c6e09
@ -35,30 +35,39 @@ namespace netgen
|
||||
|
||||
void * BlockAllocator :: Alloc ()
|
||||
{
|
||||
// return new char[size];
|
||||
if (!freelist)
|
||||
{
|
||||
// cout << "freelist = " << freelist << endl;
|
||||
// cout << "BlockAlloc: " << size*blocks << endl;
|
||||
char * hcp = new char [size * blocks];
|
||||
bablocks.Append (hcp);
|
||||
bablocks.Last() = hcp;
|
||||
for (unsigned i = 0; i < blocks-1; i++)
|
||||
*(void**)&(hcp[i * size]) = &(hcp[ (i+1) * size]);
|
||||
*(void**)&(hcp[(blocks-1)*size]) = NULL;
|
||||
freelist = hcp;
|
||||
}
|
||||
|
||||
void * p = freelist;
|
||||
freelist = *(void**)freelist;
|
||||
void * p;
|
||||
#pragma omp critical (BlockAllocator)
|
||||
{
|
||||
// return new char[size];
|
||||
if (!freelist)
|
||||
{
|
||||
// cout << "freelist = " << freelist << endl;
|
||||
// cout << "BlockAlloc: " << size*blocks << endl;
|
||||
char * hcp = new char [size * blocks];
|
||||
bablocks.Append (hcp);
|
||||
bablocks.Last() = hcp;
|
||||
for (unsigned i = 0; i < blocks-1; i++)
|
||||
*(void**)&(hcp[i * size]) = &(hcp[ (i+1) * size]);
|
||||
*(void**)&(hcp[(blocks-1)*size]) = NULL;
|
||||
freelist = hcp;
|
||||
}
|
||||
|
||||
p = freelist;
|
||||
freelist = *(void**)freelist;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
void BlockAllocator :: Free (void * p)
|
||||
{
|
||||
*(void**)p = freelist;
|
||||
freelist = p;
|
||||
#pragma omp critical (BlockAllocator)
|
||||
{
|
||||
if (bablocks.Size())
|
||||
{
|
||||
*(void**)p = freelist;
|
||||
freelist = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
@ -46,13 +46,15 @@ public:
|
||||
|
||||
|
||||
///
|
||||
void Free (void * p)
|
||||
void Free (void * p);
|
||||
/*
|
||||
{
|
||||
if (!bablocks.Size()) return;
|
||||
*(void**)p = freelist;
|
||||
freelist = p;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
private:
|
||||
// void Alloc2 ();
|
||||
|
@ -101,7 +101,6 @@ namespace netgen
|
||||
{
|
||||
NgLock lock(mutex);
|
||||
lock.Lock();
|
||||
|
||||
points.SetSize(0);
|
||||
segments.SetSize(0);
|
||||
surfelements.SetSize(0);
|
||||
|
@ -69,7 +69,7 @@ DLL_HEADER void ExportNetgenMeshing()
|
||||
return bp::tuple(l);
|
||||
}))
|
||||
;
|
||||
|
||||
|
||||
bp::class_<Element>("Element3D")
|
||||
.add_property("index", &Element::GetIndex, &Element::SetIndex)
|
||||
.add_property("vertices",
|
||||
@ -82,17 +82,17 @@ DLL_HEADER void ExportNetgenMeshing()
|
||||
}))
|
||||
;
|
||||
|
||||
bp::class_<Element2d>("Element2D")
|
||||
.add_property("index", &Element2d::GetIndex, &Element2d::SetIndex)
|
||||
.add_property("vertices",
|
||||
FunctionPointer([](const Element2d & self) -> bp::list
|
||||
{
|
||||
bp::list li;
|
||||
for (int i = 0; i < self.GetNV(); i++)
|
||||
li.append(self[i]);
|
||||
return li;
|
||||
}))
|
||||
;
|
||||
bp::class_<Element2d>("Element2D")
|
||||
.add_property("index", &Element2d::GetIndex, &Element2d::SetIndex)
|
||||
.add_property("vertices",
|
||||
FunctionPointer([](const Element2d & self) -> bp::list
|
||||
{
|
||||
bp::list li;
|
||||
for (int i = 0; i < self.GetNV(); i++)
|
||||
li.append(self[i]);
|
||||
return li;
|
||||
}))
|
||||
;
|
||||
ExportArray<Element>();
|
||||
ExportArray<Element2d>();
|
||||
ExportArray<MeshPoint,PointIndex::BASE,PointIndex>();
|
||||
|
@ -1281,9 +1281,9 @@ namespace netgen
|
||||
if (perfstepsstart <= MESHCONST_ANALYSE)
|
||||
{
|
||||
// delete mesh;
|
||||
mesh = make_shared<Mesh>();
|
||||
// mesh = make_shared<Mesh>();
|
||||
mesh->geomtype = Mesh::GEOM_OCC;
|
||||
|
||||
|
||||
OCCSetLocalMeshSize(geom,*mesh);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user