From 9c4f4221ec84ad806131459506d813514f88328a Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 25 Jul 2011 11:33:19 +0000 Subject: [PATCH] non-global variable mparam --- configure.ac | 2 +- libsrc/csg/specpoin.hpp | 2 ++ libsrc/geom2d/genmesh2d.cpp | 1 + libsrc/interface/nginterface.cpp | 3 +- libsrc/meshing/boundarylayer.cpp | 2 +- libsrc/meshing/delaunay.cpp | 2 +- libsrc/meshing/delaunay2d.cpp | 2 +- libsrc/meshing/global.cpp | 1 - libsrc/meshing/global.hpp | 2 +- libsrc/meshing/improve3.cpp | 7 +++-- libsrc/meshing/improve3.hpp | 35 +++++++++++++++------- libsrc/meshing/meshclass.cpp | 16 ++++++---- libsrc/meshing/meshclass.hpp | 7 +++-- libsrc/meshing/meshfunc.cpp | 15 +++++----- libsrc/meshing/meshing2.cpp | 2 +- libsrc/meshing/meshing2.hpp | 3 +- libsrc/meshing/meshtool.hpp | 4 +-- libsrc/meshing/meshtype.cpp | 1 + libsrc/meshing/refine.cpp | 3 +- libsrc/meshing/ruler2.cpp | 5 ++-- libsrc/meshing/secondorder.cpp | 3 +- libsrc/meshing/smoothing3.cpp | 51 ++++++++++++++++++-------------- libsrc/meshing/specials.cpp | 2 +- libsrc/meshing/validate.cpp | 12 +++++--- libsrc/occ/occgeom.hpp | 4 ++- libsrc/stlgeom/stlgeom.hpp | 3 ++ 26 files changed, 117 insertions(+), 73 deletions(-) diff --git a/configure.ac b/configure.ac index c218534e..d50af3a5 100644 --- a/configure.ac +++ b/configure.ac @@ -42,7 +42,7 @@ AC_ARG_WITH([occ], if test a$occon = atrue ; then - AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/inc"]) + AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"]) AC_SUBST([OCCLIBS], ["-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"]) # -lTKDCAF diff --git a/libsrc/csg/specpoin.hpp b/libsrc/csg/specpoin.hpp index 8284ab3b..a6d850c9 100644 --- a/libsrc/csg/specpoin.hpp +++ b/libsrc/csg/specpoin.hpp @@ -11,6 +11,8 @@ namespace netgen { + extern DLL_HEADER MeshingParameters mparam; + /* Special Point Calculation diff --git a/libsrc/geom2d/genmesh2d.cpp b/libsrc/geom2d/genmesh2d.cpp index 5b6d43e0..000e5ad6 100644 --- a/libsrc/geom2d/genmesh2d.cpp +++ b/libsrc/geom2d/genmesh2d.cpp @@ -3,6 +3,7 @@ namespace netgen { + extern DLL_HEADER MeshingParameters mparam; extern void Optimize2d (Mesh & mesh, MeshingParameters & mp); diff --git a/libsrc/interface/nginterface.cpp b/libsrc/interface/nginterface.cpp index 8c937760..3640c66c 100644 --- a/libsrc/interface/nginterface.cpp +++ b/libsrc/interface/nginterface.cpp @@ -15,8 +15,6 @@ #include "nginterface.h" - - #ifdef _MSC_VER // Philippose - 30/01/2009 // MSVC Express Edition Support @@ -104,6 +102,7 @@ namespace netgen { #include "writeuser.hpp" + MeshingParameters mparam; // global variable mesh (should not be used in libraries) AutoPtr mesh; diff --git a/libsrc/meshing/boundarylayer.cpp b/libsrc/meshing/boundarylayer.cpp index 9a359ea2..94bfcbe0 100644 --- a/libsrc/meshing/boundarylayer.cpp +++ b/libsrc/meshing/boundarylayer.cpp @@ -562,7 +562,7 @@ namespace netgen for(j = 1; j <= vertelems.Size(); j++) { - double sfact = 0.9; + // double sfact = 0.9; Element volel = mesh.VolumeElement(vertelems.Elem(j)); if(((volel.GetType() == TET) || (volel.GetType() == TET10)) && (!volel.IsDeleted())) { diff --git a/libsrc/meshing/delaunay.cpp b/libsrc/meshing/delaunay.cpp index 86607199..90dbb621 100644 --- a/libsrc/meshing/delaunay.cpp +++ b/libsrc/meshing/delaunay.cpp @@ -890,7 +890,7 @@ namespace netgen tempmesh.FreeOpenElementsEnvironment (1); - MeshOptimize3d meshopt; + MeshOptimize3d meshopt(mp); // tempmesh.CalcSurfacesOfNode(); meshopt.SwapImprove(tempmesh, OPT_CONFORM); } diff --git a/libsrc/meshing/delaunay2d.cpp b/libsrc/meshing/delaunay2d.cpp index 19ae7afc..2b1119f1 100644 --- a/libsrc/meshing/delaunay2d.cpp +++ b/libsrc/meshing/delaunay2d.cpp @@ -160,7 +160,7 @@ namespace netgen { cout << "2D Delaunay meshing (in progress)" << endl; - int oldnp = mesh.GetNP(); + // int oldnp = mesh.GetNP(); cout << "np, old = " << mesh.GetNP() << endl; diff --git a/libsrc/meshing/global.cpp b/libsrc/meshing/global.cpp index 1265a006..b0f0108a 100644 --- a/libsrc/meshing/global.cpp +++ b/libsrc/meshing/global.cpp @@ -23,7 +23,6 @@ namespace netgen int silentflag = 0; int testmode = 0; - MeshingParameters mparam; volatile multithreadt multithread; string ngdir = "."; diff --git a/libsrc/meshing/global.hpp b/libsrc/meshing/global.hpp index b97c7886..43a20493 100644 --- a/libsrc/meshing/global.hpp +++ b/libsrc/meshing/global.hpp @@ -25,7 +25,7 @@ namespace netgen /// calling parameters // extern Flags parameters; - extern DLL_HEADER MeshingParameters mparam; + // extern DLL_HEADER MeshingParameters mparam; extern Array tets_in_qualclass; diff --git a/libsrc/meshing/improve3.cpp b/libsrc/meshing/improve3.cpp index 8fe8f916..8a236aa2 100644 --- a/libsrc/meshing/improve3.cpp +++ b/libsrc/meshing/improve3.cpp @@ -160,8 +160,9 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh, for (int k = 0; k < hasonepi.Size(); k++) { const Element & elem = mesh[hasonepi[k]]; - double err = CalcTetBadness (mesh[elem[0]], mesh[elem[1]], - mesh[elem[2]], mesh[elem[3]], 0, mparam); + double err = CalcBad (mesh.Points(), elem, 0); + // CalcTetBadness (mesh[elem[0]], mesh[elem[1]], + // mesh[elem[2]], mesh[elem[3]], 0, mparam); bad2 += err; oneperr[k] = err; } @@ -475,7 +476,7 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh, } } - PointFunction1 pf (mesh.Points(), locfaces, -1); + PointFunction1 pf (mesh.Points(), locfaces, mp, -1); OptiParameters par; par.maxit_linsearch = 50; par.maxit_bfgs = 20; diff --git a/libsrc/meshing/improve3.hpp b/libsrc/meshing/improve3.hpp index 6dd52881..41001e84 100644 --- a/libsrc/meshing/improve3.hpp +++ b/libsrc/meshing/improve3.hpp @@ -2,12 +2,17 @@ #define FILE_IMPROVE3 +extern double CalcTotalBad (const Mesh::T_POINTS & points, + const Mesh::T_VOLELEMENTS & elements, + const MeshingParameters & mp); /// class MeshOptimize3d { + const MeshingParameters & mp; public: + MeshOptimize3d (const MeshingParameters & amp) : mp(amp) { ; } void CombineImprove (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY); void SplitImprove (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY); void SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY, @@ -16,13 +21,28 @@ public: const BitArray * working_elements = NULL, const Array< Array* > * idmaps = NULL); void SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY); + + double + CalcBad (const Mesh::T_POINTS & points, const Element & elem, double h) + { + if (elem.GetType() == TET) + return CalcTetBadness (points[elem[0]], points[elem[1]], + points[elem[2]], points[elem[3]], h, mp); + return 0; + } + + + double CalcTotalBad (const Mesh::T_POINTS & points, + const Mesh::T_VOLELEMENTS & elements) + { + return netgen::CalcTotalBad (points, elements, mp); + } + }; - inline double -CalcBad (const Mesh::T_POINTS & points, const Element & elem, - double h, const MeshingParameters & mp = mparam) +CalcBad (const Mesh::T_POINTS & points, const Element & elem, double h, const MeshingParameters & mp) { if (elem.GetType() == TET) return CalcTetBadness (points[elem[0]], points[elem[1]], @@ -32,11 +52,6 @@ CalcBad (const Mesh::T_POINTS & points, const Element & elem, - -extern double CalcTotalBad (const Mesh::T_POINTS & points, - const Mesh::T_VOLELEMENTS & elements, - const MeshingParameters & mp = mparam); - extern int WrongOrientation (const Mesh::T_POINTS & points, const Element & el); @@ -63,15 +78,16 @@ public: }; - class PointFunction1 : public MinFunction { Mesh::T_POINTS & points; const Array & faces; + const MeshingParameters & mp; double h; public: PointFunction1 (Mesh::T_POINTS & apoints, const Array & afaces, + const MeshingParameters & amp, double ah); virtual double Func (const Vector & x) const; @@ -80,7 +96,6 @@ public: virtual double GradStopping (const Vector & x) const; }; - class JacobianPointFunction : public MinFunction { public: diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index 28117b2e..c4829f42 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -5461,15 +5461,21 @@ namespace netgen bool Mesh :: PureTrigMesh (int faceindex) const { + // if (!faceindex) return !mparam.quad; + if (!faceindex) - return !mparam.quad; + { + for (int i = 1; i <= GetNSE(); i++) + if (SurfaceElement(i).GetNP() != 3) + return false; + return true; + } - int i; - for (i = 1; i <= GetNSE(); i++) + for (int i = 1; i <= GetNSE(); i++) if (SurfaceElement(i).GetIndex() == faceindex && SurfaceElement(i).GetNP() != 3) - return 0; - return 1; + return false; + return true; } bool Mesh :: PureTetMesh () const diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index 29bb5b32..fbc35648 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -487,12 +487,13 @@ namespace netgen /// - void ImproveMesh (OPTIMIZEGOAL goal = OPT_QUALITY); + void ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal = OPT_QUALITY); /// - void ImproveMeshJacobian (OPTIMIZEGOAL goal = OPT_QUALITY, const BitArray * usepoint = NULL); + void ImproveMeshJacobian (const MeshingParameters & mp, OPTIMIZEGOAL goal = OPT_QUALITY, const BitArray * usepoint = NULL); /// - void ImproveMeshJacobianOnSurface (const BitArray & usepoint, + void ImproveMeshJacobianOnSurface (const MeshingParameters & mp, + const BitArray & usepoint, const Array< Vec<3>* > & nv, OPTIMIZEGOAL goal = OPT_QUALITY, const Array< Array* > * idmaps = NULL); diff --git a/libsrc/meshing/meshfunc.cpp b/libsrc/meshing/meshfunc.cpp index c19fc795..7d111b06 100644 --- a/libsrc/meshing/meshfunc.cpp +++ b/libsrc/meshing/meshfunc.cpp @@ -258,7 +258,7 @@ namespace netgen // mesh3d.Save ("tmp.vol"); - MeshOptimize3d optmesh; + MeshOptimize3d optmesh(mp); const char * optstr = "mcmstmcmstmcmstmcm"; size_t j; @@ -274,7 +274,7 @@ namespace netgen case 'd': optmesh.SplitImprove(mesh3d, OPT_REST); break; case 's': optmesh.SwapImprove(mesh3d, OPT_REST); break; case 't': optmesh.SwapImprove2(mesh3d, OPT_REST); break; - case 'm': mesh3d.ImproveMesh(OPT_REST); break; + case 'm': mesh3d.ImproveMesh(mp, OPT_REST); break; } } @@ -648,7 +648,7 @@ namespace netgen if (multithread.terminate) break; - MeshOptimize3d optmesh; + MeshOptimize3d optmesh(mp); // teterrpow = mp.opterrpow; for (size_t j = 1; j <= strlen(mp.optimize3d); j++) @@ -667,10 +667,10 @@ namespace netgen case 'm': mesh3d.ImproveMesh(*geometry); break; case 'M': mesh3d.ImproveMesh(*geometry); break; #else - case 'm': mesh3d.ImproveMesh(); break; - case 'M': mesh3d.ImproveMesh(); break; + case 'm': mesh3d.ImproveMesh(mp); break; + case 'M': mesh3d.ImproveMesh(mp); break; #endif - case 'j': mesh3d.ImproveMeshJacobian(); break; + case 'j': mesh3d.ImproveMeshJacobian(mp); break; } } mesh3d.mglevels = 1; @@ -698,7 +698,8 @@ namespace netgen nillegal = mesh3d.MarkIllegalElements(); - MeshOptimize3d optmesh; + MeshingParameters dummymp; + MeshOptimize3d optmesh(dummymp); while (nillegal && (it--) > 0) { if (multithread.terminate) diff --git a/libsrc/meshing/meshing2.cpp b/libsrc/meshing/meshing2.cpp index 80cc02ef..c443e444 100644 --- a/libsrc/meshing/meshing2.cpp +++ b/libsrc/meshing/meshing2.cpp @@ -751,7 +751,7 @@ namespace netgen { rulenr = ApplyRules (plainpoints, legalpoints, maxlegalpoint, loclines, maxlegalline, locelements, - dellines, qualclass); + dellines, qualclass, mp); // (*testout) << "Rule Nr = " << rulenr << endl; if (!rulenr) { diff --git a/libsrc/meshing/meshing2.hpp b/libsrc/meshing/meshing2.hpp index 8ea0637e..4e145964 100644 --- a/libsrc/meshing/meshing2.hpp +++ b/libsrc/meshing/meshing2.hpp @@ -141,7 +141,8 @@ protected: Array & llines, int maxlegelline, Array & elements, Array & dellines, - int tolerance); + int tolerance, + const MeshingParameters & mp); }; diff --git a/libsrc/meshing/meshtool.hpp b/libsrc/meshing/meshtool.hpp index 1b027222..b6472ce0 100644 --- a/libsrc/meshing/meshtool.hpp +++ b/libsrc/meshing/meshtool.hpp @@ -49,13 +49,13 @@ extern int CheckCode (); extern double CalcTetBadness (const Point3d & p1, const Point3d & p2, const Point3d & p3, const Point3d & p4, double h, - const MeshingParameters & mp = mparam); + const MeshingParameters & mp); /// extern double CalcTetBadnessGrad (const Point3d & p1, const Point3d & p2, const Point3d & p3, const Point3d & p4, double h, int pi, Vec<3> & grad, - const MeshingParameters & mp = mparam); + const MeshingParameters & mp); /** Calculates volume of an element. diff --git a/libsrc/meshing/meshtype.cpp b/libsrc/meshing/meshtype.cpp index d279968c..8bdbe8cb 100644 --- a/libsrc/meshing/meshtype.cpp +++ b/libsrc/meshing/meshtype.cpp @@ -1535,6 +1535,7 @@ namespace netgen { cout << "GetNodesLocal not impelemented for element " << GetType() << endl; np = 0; + pp = NULL; } } diff --git a/libsrc/meshing/refine.cpp b/libsrc/meshing/refine.cpp index 9f2ecb88..403e4532 100644 --- a/libsrc/meshing/refine.cpp +++ b/libsrc/meshing/refine.cpp @@ -719,7 +719,8 @@ namespace netgen mesh.CalcSurfacesOfNode(); free.Invert(); mesh.FixPoints (free); - mesh.ImproveMesh (OPT_REST); + MeshingParameters dummymp; + mesh.ImproveMesh (dummymp, OPT_REST); wrongels = 0; diff --git a/libsrc/meshing/ruler2.cpp b/libsrc/meshing/ruler2.cpp index ada29ba9..62058d2e 100644 --- a/libsrc/meshing/ruler2.cpp +++ b/libsrc/meshing/ruler2.cpp @@ -51,7 +51,8 @@ namespace netgen Array & llines1, int maxlegalline, Array & elements, - Array & dellines, int tolerance) + Array & dellines, int tolerance, + const MeshingParameters & mp) { static int timer = NgProfiler::CreateTimer ("meshing2::ApplyRules"); NgProfiler::RegionTimer reg (timer); @@ -627,7 +628,7 @@ namespace netgen for (int i = 1; i <= elements.Size(); i++) { double hf; - if (!mparam.quad) + if (!mp.quad) hf = CalcElementBadness (lpoints, elements.Get(i)); else hf = elements.Get(i).CalcJacobianBadness (lpoints) * 5; diff --git a/libsrc/meshing/secondorder.cpp b/libsrc/meshing/secondorder.cpp index bffd8a03..5b5b5d7f 100644 --- a/libsrc/meshing/secondorder.cpp +++ b/libsrc/meshing/secondorder.cpp @@ -457,7 +457,8 @@ namespace netgen while (wrongels && cnttrials > 0); mesh.CalcSurfacesOfNode(); - mesh.ImproveMeshJacobian (OPT_WORSTCASE); + MeshingParameters dummymp; + mesh.ImproveMeshJacobian (dummymp, OPT_WORSTCASE); facok = factry; for (int i = 1; i <= np; i++) diff --git a/libsrc/meshing/smoothing3.cpp b/libsrc/meshing/smoothing3.cpp index 47da61cc..bf295884 100644 --- a/libsrc/meshing/smoothing3.cpp +++ b/libsrc/meshing/smoothing3.cpp @@ -87,11 +87,11 @@ namespace netgen return *functions[i]; } - PointFunction1 :: PointFunction1 (Mesh::T_POINTS & apoints, const Array & afaces, + const MeshingParameters & amp, double ah) - : points(apoints), faces(afaces) + : points(apoints), faces(afaces), mp(amp) { h = ah; } @@ -109,7 +109,7 @@ namespace netgen double bad = CalcTetBadness (points[el.I1()], points[el.I3()], points[el.I2()], - pp, 0); + pp, 0, mp); badness += bad; } @@ -170,8 +170,6 @@ namespace netgen } - - /* Cheap Functional depending of inner point inside triangular surface */ // is it used ???? @@ -304,12 +302,14 @@ namespace netgen Mesh::T_POINTS & points; const Mesh::T_VOLELEMENTS & elements; TABLE elementsonpoint; + const MeshingParameters & mp; PointIndex actpind; double h; public: PointFunction (Mesh::T_POINTS & apoints, - const Mesh::T_VOLELEMENTS & aelements); + const Mesh::T_VOLELEMENTS & aelements, + const MeshingParameters & amp); virtual void SetPointIndex (PointIndex aactpind); void SetLocalH (double ah) { h = ah; } @@ -323,8 +323,9 @@ namespace netgen PointFunction :: PointFunction (Mesh::T_POINTS & apoints, - const Mesh::T_VOLELEMENTS & aelements) - : points(apoints), elements(aelements), elementsonpoint(apoints.Size()) + const Mesh::T_VOLELEMENTS & aelements, + const MeshingParameters & amp) + : points(apoints), elements(aelements), elementsonpoint(apoints.Size()), mp(amp) { for (int i = 0; i < elements.Size(); i++) if (elements[i].NP() == 4) @@ -351,7 +352,7 @@ namespace netgen { const Element & el = elements[elementsonpoint[actpind][j]]; badness += CalcTetBadness (points[el[0]], points[el[1]], - points[el[2]], points[el[3]], -1); + points[el[2]], points[el[3]], -1, mp); } points[actpind] = Point<3> (hp); @@ -375,7 +376,7 @@ namespace netgen { f += CalcTetBadnessGrad (points[el[0]], points[el[1]], points[el[2]], points[el[3]], - -1, k+1, vgradi); + -1, k+1, vgradi, mp); vgrad += vgradi; } @@ -407,7 +408,7 @@ namespace netgen f += CalcTetBadnessGrad (points[el.PNum(1)], points[el.PNum(2)], points[el.PNum(3)], - points[el.PNum(4)], -1, k, vgradi); + points[el.PNum(4)], -1, k, vgradi, mp); vgrad += vgradi; } @@ -476,7 +477,8 @@ namespace netgen DenseMatrix m; public: CheapPointFunction (Mesh::T_POINTS & apoints, - const Mesh::T_VOLELEMENTS & aelements); + const Mesh::T_VOLELEMENTS & aelements, + const MeshingParameters & amp); virtual void SetPointIndex (PointIndex aactpind); virtual double PointFunctionValue (const Point<3> & pp) const; virtual double PointFunctionValueGrad (const Point<3> & pp, Vec<3> & grad) const; @@ -484,8 +486,9 @@ namespace netgen CheapPointFunction :: CheapPointFunction (Mesh::T_POINTS & apoints, - const Mesh::T_VOLELEMENTS & aelements) - : PointFunction (apoints, aelements) + const Mesh::T_VOLELEMENTS & aelements, + const MeshingParameters & amp) + : PointFunction (apoints, aelements, amp) { ; } @@ -930,7 +933,7 @@ double CalcTotalBad (const Mesh::T_POINTS & points, for (int i = 1; i <= elements.Size(); i++) { - elbad = pow (max2(CalcBad (points, elements.Get(i), 0),1e-10), + elbad = pow (max2(CalcBad (points, elements.Get(i), 0, mp),1e-10), 1/teterrpow); int qualclass = int (20 / elbad + 1); @@ -1348,7 +1351,7 @@ void Mesh :: ImproveMesh (const CSGeometry & geometry, OPTIMIZEGOAL goal) -void Mesh :: ImproveMesh (OPTIMIZEGOAL goal) +void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) { int typ = 1; @@ -1373,7 +1376,7 @@ void Mesh :: ImproveMesh (OPTIMIZEGOAL goal) if (el.GetType() != TET) continue; - double hbad = CalcBad (points, el, 0); + double hbad = CalcBad (points, el, 0, mp); for (int j = 0; j < 4; j++) perrs[el[j]] += hbad; @@ -1388,7 +1391,7 @@ void Mesh :: ImproveMesh (OPTIMIZEGOAL goal) if (goal == OPT_QUALITY) { - bad1 = CalcTotalBad (points, volelements); + bad1 = CalcTotalBad (points, volelements, mp); (*testout) << "Total badness = " << bad1 << endl; PrintMessage (5, "Total badness = ", bad1); } @@ -1403,9 +1406,9 @@ void Mesh :: ImproveMesh (OPTIMIZEGOAL goal) PointFunction * pf; if (typ == 1) - pf = new PointFunction(points, volelements); + pf = new PointFunction(points, volelements, mp); else - pf = new CheapPointFunction(points, volelements); + pf = new CheapPointFunction(points, volelements, mp); // pf->SetLocalH (h); @@ -1508,7 +1511,7 @@ void Mesh :: ImproveMesh (OPTIMIZEGOAL goal) if (goal == OPT_QUALITY) { - bad1 = CalcTotalBad (points, volelements); + bad1 = CalcTotalBad (points, volelements, mp); (*testout) << "Total badness = " << bad1 << endl; PrintMessage (5, "Total badness = ", bad1); } @@ -1518,7 +1521,8 @@ void Mesh :: ImproveMesh (OPTIMIZEGOAL goal) // Improve Condition number of Jacobian, any elements -void Mesh :: ImproveMeshJacobian (OPTIMIZEGOAL goal, const BitArray * usepoint) +void Mesh :: ImproveMeshJacobian (const MeshingParameters & mp, + OPTIMIZEGOAL goal, const BitArray * usepoint) { int i, j; @@ -1638,7 +1642,8 @@ void Mesh :: ImproveMeshJacobian (OPTIMIZEGOAL goal, const BitArray * usepoint) // Improve Condition number of Jacobian, any elements -void Mesh :: ImproveMeshJacobianOnSurface (const BitArray & usepoint, +void Mesh :: ImproveMeshJacobianOnSurface (const MeshingParameters & mp, + const BitArray & usepoint, const Array< Vec<3>* > & nv, OPTIMIZEGOAL goal, const Array< Array* > * idmaps) diff --git a/libsrc/meshing/specials.cpp b/libsrc/meshing/specials.cpp index a227e268..0a218e10 100644 --- a/libsrc/meshing/specials.cpp +++ b/libsrc/meshing/specials.cpp @@ -156,7 +156,7 @@ void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh) mesh.AddLockedPoint (pmat.Elem(i)); mesh.CalcSurfacesOfNode(); - mesh.CalcLocalH(mparam.grading); + mesh.CalcLocalH(0.3); } diff --git a/libsrc/meshing/validate.cpp b/libsrc/meshing/validate.cpp index 2381f418..44b983cc 100644 --- a/libsrc/meshing/validate.cpp +++ b/libsrc/meshing/validate.cpp @@ -376,7 +376,8 @@ namespace netgen // smooth faces mesh.CalcSurfacesOfNode(); - mesh.ImproveMeshJacobianOnSurface(isworkingboundary,nv,OPT_QUALITY,&idmaps); + MeshingParameters dummymp; + mesh.ImproveMeshJacobianOnSurface(dummymp,isworkingboundary,nv,OPT_QUALITY, &idmaps); for (int i = 1; i <= np; i++) *can.Elem(i) = mesh.Point(i); @@ -447,7 +448,8 @@ namespace netgen mesh.CalcSurfacesOfNode(); - mesh.ImproveMeshJacobian (OPT_QUALITY,&working_points); + MeshingParameters dummymp; + mesh.ImproveMeshJacobian (dummymp, OPT_QUALITY,&working_points); //mesh.ImproveMeshJacobian (OPT_WORSTCASE,&working_points); @@ -460,7 +462,8 @@ namespace netgen cnttrials < maxtrials && multithread.terminate != 1) { - MeshOptimize3d optmesh; + MeshingParameters dummymp; + MeshOptimize3d optmesh(dummymp); for(int i=0; i 0) && (facenr <= fmap.Extent())) { - face_maxh[facenr-1] = min(mparam.maxh,faceh); + face_maxh[facenr-1] = min(mparam.maxh,faceh); // Philippose - 14/01/2010 // If the face maxh is greater than or equal to the diff --git a/libsrc/stlgeom/stlgeom.hpp b/libsrc/stlgeom/stlgeom.hpp index c2d3d5bc..05c7b014 100644 --- a/libsrc/stlgeom/stlgeom.hpp +++ b/libsrc/stlgeom/stlgeom.hpp @@ -28,6 +28,9 @@ namespace netgen { extern int IsInArray(int n, const Array& ia); extern int AddIfNotExists(Array& list, int x); + + extern DLL_HEADER MeshingParameters mparam; + #include "stltopology.hpp"