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

View File

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

View File

@ -520,7 +520,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
// char key; // char key;
// cin >> key; // cin >> key;
//calculate an estimate meshsize, not to produce too large outercharts, with factor 2 larger! //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::Print(stdout);
// NgProfiler::StopTimer (timere2); // 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 //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"); 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 //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, //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) if (multithread.terminate)
{PopStatus(); return;} {PopStatus(); return;}
RestrictHChartDistOneChart(i, acttrigs, mesh, gh, 1., 0.); RestrictHChartDistOneChart(i, acttrigs, mesh, gh, 1., 0., stlparam);
} }
PopStatus(); PopStatus();
@ -1117,7 +1117,8 @@ void STLGeometry :: RestrictLocalH(class Mesh & mesh, double gh)
} }
void STLGeometry :: RestrictHChartDistOneChart(int chartnum, NgArray<int>& acttrigs, 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 timer1 = NgProfiler::CreateTimer ("restrictH OneChart 1");
static int timer2 = NgProfiler::CreateTimer ("restrictH OneChart 2"); static int timer2 = NgProfiler::CreateTimer ("restrictH OneChart 2");
@ -1400,7 +1401,7 @@ int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, const Me
} }
success = 0; success = 0;
int retval = STLSurfaceMeshing (*stlgeometry, *mesh, mparam); int retval = STLSurfaceMeshing (*stlgeometry, *mesh, mparam, stlparam);
if (retval == MESHING3_OK) if (retval == MESHING3_OK)
{ {
PrintMessage(3,"Success !!!!"); PrintMessage(3,"Success !!!!");

View File

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

View File

@ -607,7 +607,8 @@ STLTopEdge :: STLTopEdge (int p1, int p2, int trig1, int trig2)
//+++++++++++++++++++ STL CHART +++++++++++++++++++++++++++++++ //+++++++++++++++++++ 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); // charttrigs = new NgArray<int> (0,0);
// outertrigs = 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> olimit; //outer limit of outer chart
NgArray<twoint> ilimit; //outer limit of inner chart NgArray<twoint> ilimit; //outer limit of inner chart
const STLParameters& stlparam;
public: public:
STLChart(STLGeometry * ageometry, const STLParameters& stlparam); STLChart(STLGeometry * ageometry, const STLParameters& astlparam);
~STLChart(); ~STLChart();
void AddChartTrig(int i); void AddChartTrig(int i);
void AddOuterTrig(int i); void AddOuterTrig(int i);
@ -274,7 +275,7 @@ public:
void Print (ostream & ost) const; void Print (ostream & ost) const;
}; };
DLL_HEADER extern STLParameters stlparam; // DLL_HEADER extern STLParameters stlparam;
void STLMeshing (STLGeometry & geom, void STLMeshing (STLGeometry & geom,
@ -285,7 +286,8 @@ void STLMeshing (STLGeometry & geom,
int STLSurfaceMeshing (STLGeometry & geom, int STLSurfaceMeshing (STLGeometry & geom,
Mesh & mesh, Mesh & mesh,
const MeshingParameters& mparam); const MeshingParameters& mparam,
const STLParameters& stlpar);
void STLSurfaceOptimization (STLGeometry & geom, void STLSurfaceOptimization (STLGeometry & geom,
Mesh & mesh, Mesh & mesh,

View File

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