global stl parameters only visible in nglib, stlparameters from python

This commit is contained in:
Christopher Lackner 2019-08-06 12:16:30 +02:00
parent b2590bf517
commit 1bc2e1f5a7
9 changed files with 31 additions and 22 deletions

View File

@ -14,14 +14,15 @@ namespace netgen
{
static void STLFindEdges (STLGeometry & geom, Mesh & mesh,
const MeshingParameters& mparam)
const MeshingParameters& mparam,
const STLParameters& stlparam)
{
double h = mparam.maxh;
// mark edge points:
//int ngp = geom.GetNP();
geom.RestrictLocalH(mesh, h);
geom.RestrictLocalH(mesh, h, stlparam);
PushStatusF("Mesh Lines");
@ -230,17 +231,18 @@ static void STLFindEdges (STLGeometry & geom, Mesh & mesh,
void STLSurfaceMeshing1 (STLGeometry & geom, class Mesh & mesh, const MeshingParameters& mparam,
int retrynr);
int retrynr, const STLParameters& stlparam);
int STLSurfaceMeshing (STLGeometry & geom, class Mesh & mesh, const MeshingParameters& mparam)
int STLSurfaceMeshing (STLGeometry & geom, class Mesh & mesh, const MeshingParameters& mparam,
const STLParameters& stlparam)
{
PrintFnStart("Do Surface Meshing");
geom.PrepareSurfaceMeshing();
if (mesh.GetNSeg() == 0)
STLFindEdges (geom, mesh, mparam);
STLFindEdges (geom, mesh, mparam, stlparam);
int nopen;
int outercnt = 20;
@ -272,7 +274,7 @@ int STLSurfaceMeshing (STLGeometry & geom, class Mesh & mesh, const MeshingParam
if (multithread.terminate) { return MESHING3_TERMINATE; }
trialcnt++;
STLSurfaceMeshing1 (geom, mesh, mparam, trialcnt);
STLSurfaceMeshing1 (geom, mesh, mparam, trialcnt, stlparam);
mesh.FindOpenSegments();
nopen = mesh.GetNOpenSegments();
@ -528,7 +530,8 @@ int STLSurfaceMeshing (STLGeometry & geom, class Mesh & mesh, const MeshingParam
void STLSurfaceMeshing1 (STLGeometry & geom,
Mesh & mesh,
const MeshingParameters& mparam,
int retrynr)
int retrynr,
const STLParameters& stlparam)
{
static int timer1 = NgProfiler::CreateTimer ("STL surface meshing1");
static int timer1a = NgProfiler::CreateTimer ("STL surface meshing1a");

View File

@ -95,6 +95,7 @@ void STLGeometry :: Save (string filename) const
extern STLParameters stlparam;
int STLGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
{
STLParameters stlpar = stlparam;

View File

@ -450,10 +450,10 @@ namespace netgen
int LineEndPointsSet() const {return lineendpoints.Size() == GetNP();}
void ClearLineEndPoints();
DLL_HEADER void RestrictLocalH(class Mesh & mesh, double gh);
void RestrictLocalHCurv(class Mesh & mesh, double gh);
DLL_HEADER void RestrictLocalH(class Mesh & mesh, double gh, const STLParameters& stlparam);
void RestrictLocalHCurv(class Mesh & mesh, double gh, const STLParameters& stlparam);
void RestrictHChartDistOneChart(int chartnum, NgArray<int>& acttrigs, class Mesh & mesh,
double gh, double fact, double minh);
double gh, double fact, double minh, const STLParameters& stlparam);
friend class MeshingSTLSurface;

View File

@ -520,7 +520,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
// char key;
// cin >> key;
//calculate an estimate meshsize, not to produce too large outercharts, with factor 2 larger!
RestrictHChartDistOneChart(chartnum, chartdistacttrigs, mesh, h, 0.5, atlasminh);
RestrictHChartDistOneChart(chartnum, chartdistacttrigs, mesh, h, 0.5, atlasminh, stlparam);
// NgProfiler::Print(stdout);
// NgProfiler::StopTimer (timere2);

View File

@ -705,7 +705,7 @@ int STLGeometry :: ProjectNearest(Point<3> & p3d) const
//Restrict local h due to curvature for make atlas
void STLGeometry :: RestrictLocalHCurv(class Mesh & mesh, double gh)
void STLGeometry :: RestrictLocalHCurv(class Mesh & mesh, double gh, const STLParameters& stlparam)
{
PushStatusF("Restrict H due to surface curvature");
@ -810,7 +810,7 @@ void STLGeometry :: RestrictLocalHCurv(class Mesh & mesh, double gh)
}
//restrict local h due to near edges and due to outer chart distance
void STLGeometry :: RestrictLocalH(class Mesh & mesh, double gh)
void STLGeometry :: RestrictLocalH(class Mesh & mesh, double gh, const STLParameters& stlparam)
{
//bei jedem Dreieck alle Nachbardreiecke vergleichen, und, fallskein Kante dazwischen,
@ -1077,7 +1077,7 @@ void STLGeometry :: RestrictLocalH(class Mesh & mesh, double gh)
if (multithread.terminate)
{PopStatus(); return;}
RestrictHChartDistOneChart(i, acttrigs, mesh, gh, 1., 0.);
RestrictHChartDistOneChart(i, acttrigs, mesh, gh, 1., 0., stlparam);
}
PopStatus();
@ -1117,7 +1117,8 @@ void STLGeometry :: RestrictLocalH(class Mesh & mesh, double gh)
}
void STLGeometry :: RestrictHChartDistOneChart(int chartnum, NgArray<int>& acttrigs,
class Mesh & mesh, double gh, double fact, double minh)
class Mesh & mesh, double gh, double fact, double minh,
const STLParameters& stlparam)
{
static int timer1 = NgProfiler::CreateTimer ("restrictH OneChart 1");
static int timer2 = NgProfiler::CreateTimer ("restrictH OneChart 2");
@ -1400,7 +1401,7 @@ int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, const Me
}
success = 0;
int retval = STLSurfaceMeshing (*stlgeometry, *mesh, mparam);
int retval = STLSurfaceMeshing (*stlgeometry, *mesh, mparam, stlparam);
if (retval == MESHING3_OK)
{
PrintMessage(3,"Success !!!!");

View File

@ -22,6 +22,7 @@ namespace netgen
DLL_HEADER extern shared_ptr<NetgenGeometry> ng_geometry;
DLL_HEADER extern shared_ptr<Mesh> mesh;
DLL_HEADER extern MeshingParameters mparam;
DLL_HEADER extern STLParameters stlparam;
static VisualSceneSTLGeometry vsstlgeom;
static VisualSceneSTLMeshing vsstlmeshing;
@ -527,7 +528,7 @@ namespace netgen
mesh -> SetLocalH (stlgeometry->GetBoundingBox().PMin() - Vec3d(10, 10, 10),
stlgeometry->GetBoundingBox().PMax() + Vec3d(10, 10, 10),
mparam.grading);
stlgeometry -> RestrictLocalH(*mesh, mparam.maxh);
stlgeometry -> RestrictLocalH(*mesh, mparam.maxh, stlparam);
if (stlparam.resthsurfmeshcurvenable)
mesh -> CalcLocalHFromSurfaceCurvature (mparam.grading,

View File

@ -607,7 +607,8 @@ STLTopEdge :: STLTopEdge (int p1, int p2, int trig1, int trig2)
//+++++++++++++++++++ STL CHART +++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
STLChart :: STLChart(STLGeometry * ageometry, const STLParameters& stlparam)
STLChart :: STLChart(STLGeometry * ageometry, const STLParameters& astlparam)
: geometry(ageometry), stlparam(astlparam)
{
// charttrigs = new NgArray<int> (0,0);
// outertrigs = new NgArray<int> (0,0);

View File

@ -50,11 +50,12 @@ private:
NgArray<twoint> olimit; //outer limit of outer chart
NgArray<twoint> ilimit; //outer limit of inner chart
const STLParameters& stlparam;
public:
STLChart(STLGeometry * ageometry, const STLParameters& stlparam);
STLChart(STLGeometry * ageometry, const STLParameters& astlparam);
~STLChart();
void AddChartTrig(int i);
void AddOuterTrig(int i);
@ -274,7 +275,7 @@ public:
void Print (ostream & ost) const;
};
DLL_HEADER extern STLParameters stlparam;
// DLL_HEADER extern STLParameters stlparam;
void STLMeshing (STLGeometry & geom,
@ -285,7 +286,8 @@ void STLMeshing (STLGeometry & geom,
int STLSurfaceMeshing (STLGeometry & geom,
Mesh & mesh,
const MeshingParameters& mparam);
const MeshingParameters& mparam,
const STLParameters& stlpar);
void STLSurfaceOptimization (STLGeometry & geom,
Mesh & mesh,

View File

@ -711,7 +711,7 @@ namespace nglib
stlgeometry->surfaceoptimized = 0;
stlgeometry->volumemeshed = 0;
*/
int retval = STLSurfaceMeshing (*stlgeometry, *me, mparam);
int retval = STLSurfaceMeshing (*stlgeometry, *me, mparam, stlparam);
if (retval == MESHING3_OK)
{
(*mycout) << "Success !!!!" << endl;