Merge branch 'optimize_occ_surf_mesh' into 'master'

only do optimization for occ surface mesh

See merge request jschoeberl/netgen!256
This commit is contained in:
Joachim Schöberl 2019-09-30 13:30:55 +00:00
commit af7d6fea48
4 changed files with 26 additions and 13 deletions

View File

@ -601,7 +601,7 @@ namespace netgen
void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh, int perfstepsend, void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh,
MeshingParameters & mparam) MeshingParameters & mparam)
{ {
static Timer t("OCCMeshSurface"); RegionTimer r(t); static Timer t("OCCMeshSurface"); RegionTimer r(t);
@ -910,12 +910,15 @@ namespace netgen
// problemfile.close(); // problemfile.close();
} }
for (int i = 0; i < mesh.GetNFD(); i++)
mesh.SetBCName (i, mesh.GetFaceDescriptor(i+1).GetBCName());
multithread.task = savetask;
}
void OCCOptimizeSurface(OCCGeometry & geom, Mesh & mesh,
MeshingParameters & mparam)
if (multithread.terminate || perfstepsend < MESHCONST_OPTSURFACE) {
return; const char * savetask = multithread.task;
multithread.task = "Optimizing surface"; multithread.task = "Optimizing surface";
static Timer timer_opt2d("Optimization 2D"); static Timer timer_opt2d("Optimization 2D");
@ -984,9 +987,6 @@ namespace netgen
timer_opt2d.Stop(); timer_opt2d.Stop();
multithread.task = savetask; multithread.task = savetask;
for (int i = 0; i < mesh.GetNFD(); i++)
mesh.SetBCName (i, mesh.GetFaceDescriptor(i+1).GetBCName());
} }
@ -1371,7 +1371,7 @@ namespace netgen
if (mparam.perfstepsstart <= MESHCONST_MESHSURFACE) if (mparam.perfstepsstart <= MESHCONST_MESHSURFACE)
{ {
OCCMeshSurface (geom, *mesh, mparam.perfstepsend, mparam); OCCMeshSurface (geom, *mesh, mparam);
if (multithread.terminate) return TCL_OK; if (multithread.terminate) return TCL_OK;
#ifdef LOG_STREAM #ifdef LOG_STREAM
@ -1390,6 +1390,14 @@ namespace netgen
mesh->CalcSurfacesOfNode(); mesh->CalcSurfacesOfNode();
} }
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHSURFACE)
return TCL_OK;
if (mparam.perfstepsstart <= MESHCONST_OPTSURFACE)
{
OCCOptimizeSurface(geom, *mesh, mparam);
}
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_OPTSURFACE) if (multithread.terminate || mparam.perfstepsend <= MESHCONST_OPTSURFACE)
return TCL_OK; return TCL_OK;

View File

@ -441,7 +441,9 @@ namespace netgen
DLL_HEADER extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam, DLL_HEADER extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam,
const OCCParameters& occparam); const OCCParameters& occparam);
DLL_HEADER extern void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh, int perfstepsend, MeshingParameters & mparam); DLL_HEADER extern void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh, MeshingParameters & mparam);
DLL_HEADER extern void OCCOptimizeSurface (OCCGeometry & geom, Mesh & mesh, MeshingParameters & mparam);
DLL_HEADER extern void OCCFindEdges (OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam); DLL_HEADER extern void OCCFindEdges (OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam);
} }

View File

@ -1378,6 +1378,8 @@ namespace netgen
} }
else if (mesh) else if (mesh)
{ {
if(perfstepsstart > 1 && perfstepsstart < 5)
throw Exception("Need geometry for surface mesh operations!");
MeshVolume(mparam, *mesh); MeshVolume(mparam, *mesh);
OptimizeVolume(mparam, *mesh); OptimizeVolume(mparam, *mesh);
return 0; return 0;

View File

@ -926,7 +926,8 @@ namespace nglib
perfstepsend = MESHCONST_OPTSURFACE; perfstepsend = MESHCONST_OPTSURFACE;
} }
OCCMeshSurface(*occgeom, *me, perfstepsend, mparam); OCCMeshSurface(*occgeom, *me, mparam);
OCCOptimizeSurface(*occgeom, *me, mparam);
me->CalcSurfacesOfNode(); me->CalcSurfacesOfNode();