occ use optimize surface functionality from basegeom

This commit is contained in:
Christopher Lackner 2019-10-02 18:14:38 +02:00 committed by Matthias Hochsteger
parent bee097b153
commit 43cc5e68b1
4 changed files with 41 additions and 10 deletions

View File

@ -10,6 +10,40 @@ namespace netgen
GeometryRegister :: ~GeometryRegister()
{ ; }
void NetgenGeometry :: OptimizeSurface(Mesh& mesh, const MeshingParameters& mparam)
{
const auto savetask = multithread.task;
multithread.task = "Optimizing surface";
static Timer timer_opt2d("Optimization 2D");
RegionTimer reg(timer_opt2d);
auto meshopt = GetMeshOptimizer();
for(auto i : Range(mparam.optsteps2d))
{
PrintMessage(2, "Optimization step ", i);
for(auto optstep : mparam.optimize2d)
{
switch(optstep)
{
case 's':
meshopt->EdgeSwapping(mesh, 0);
break;
case 'S':
meshopt->EdgeSwapping(mesh, 1);
break;
case 'm':
meshopt->ImproveMesh(mesh, mparam);
break;
case 'c':
meshopt->CombineImprove (mesh);
break;
}
}
}
mesh.CalcSurfacesOfNode();
mesh.Compress();
multithread.task = savetask;
}
shared_ptr<NetgenGeometry> GeometryRegisterArray :: LoadFromMeshFile (istream & ist) const
{

View File

@ -30,7 +30,9 @@ namespace netgen
const MeshingParameters& mparam) {}
virtual void FindEdges(Mesh& mesh, const MeshingParameters& mparam) {}
virtual void MeshSurface(Mesh& mesh, const MeshingParameters& mparam) {}
virtual void OptimizeSurface(Mesh& mesh, const MeshingParameters& mparam) {}
virtual void OptimizeSurface(Mesh& mesh, const MeshingParameters& mparam);
virtual unique_ptr<MeshOptimize2d> GetMeshOptimizer() const
{ return make_unique<MeshOptimize2d>(); }
virtual void FinalizeMesh(Mesh& mesh) const {}
virtual void Save (string filename) const;
virtual void SaveToMeshFile (ostream & /* ost */) const { ; }

View File

@ -92,12 +92,6 @@ void STEP_GetEntityName(const TopoDS_Shape & theShape, STEPCAFControl_Reader * a
OCCMeshSurface(*this, mesh, mparam);
}
void OCCGeometry :: OptimizeSurface(Mesh& mesh,
const MeshingParameters& mparam)
{
OCCOptimizeSurface(*this, mesh, mparam);
}
void OCCGeometry :: FinalizeMesh(Mesh& mesh) const
{
for (int i = 0; i < mesh.GetNDomains(); i++)

View File

@ -265,7 +265,7 @@ namespace netgen
{ return Mesh::GEOM_OCC; }
void SetOCCParameters(const OCCParameters& par)
{ cout << "set occ pars to = " << par.resthcloseedgefac << endl; occparam = par; }
{ occparam = par; }
void Analyse(Mesh& mesh,
const MeshingParameters& mparam) override;
@ -273,8 +273,9 @@ namespace netgen
const MeshingParameters& mparam) override;
void MeshSurface(Mesh& mesh,
const MeshingParameters& mparam) override;
void OptimizeSurface(Mesh& mesh,
const MeshingParameters& mparam) override;
unique_ptr<MeshOptimize2d> GetMeshOptimizer() const override
{ return make_unique<MeshOptimize2dOCCSurfaces>(*this); }
void FinalizeMesh(Mesh& mesh) const override;
DLL_HEADER void Save (string filename) const override;