non-global variable mparam

This commit is contained in:
Joachim Schoeberl 2011-07-25 11:33:19 +00:00
parent 3a43cec5d7
commit 9c4f4221ec
26 changed files with 117 additions and 73 deletions

View File

@ -42,7 +42,7 @@ AC_ARG_WITH([occ],
if test a$occon = atrue ; then 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"]) 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 # -lTKDCAF

View File

@ -11,6 +11,8 @@
namespace netgen namespace netgen
{ {
extern DLL_HEADER MeshingParameters mparam;
/* /*
Special Point Calculation Special Point Calculation

View File

@ -3,6 +3,7 @@
namespace netgen namespace netgen
{ {
extern DLL_HEADER MeshingParameters mparam;
extern void Optimize2d (Mesh & mesh, MeshingParameters & mp); extern void Optimize2d (Mesh & mesh, MeshingParameters & mp);

View File

@ -15,8 +15,6 @@
#include "nginterface.h" #include "nginterface.h"
#ifdef _MSC_VER #ifdef _MSC_VER
// Philippose - 30/01/2009 // Philippose - 30/01/2009
// MSVC Express Edition Support // MSVC Express Edition Support
@ -104,6 +102,7 @@ namespace netgen
{ {
#include "writeuser.hpp" #include "writeuser.hpp"
MeshingParameters mparam;
// global variable mesh (should not be used in libraries) // global variable mesh (should not be used in libraries)
AutoPtr<Mesh> mesh; AutoPtr<Mesh> mesh;

View File

@ -562,7 +562,7 @@ namespace netgen
for(j = 1; j <= vertelems.Size(); j++) for(j = 1; j <= vertelems.Size(); j++)
{ {
double sfact = 0.9; // double sfact = 0.9;
Element volel = mesh.VolumeElement(vertelems.Elem(j)); Element volel = mesh.VolumeElement(vertelems.Elem(j));
if(((volel.GetType() == TET) || (volel.GetType() == TET10)) && (!volel.IsDeleted())) if(((volel.GetType() == TET) || (volel.GetType() == TET10)) && (!volel.IsDeleted()))
{ {

View File

@ -890,7 +890,7 @@ namespace netgen
tempmesh.FreeOpenElementsEnvironment (1); tempmesh.FreeOpenElementsEnvironment (1);
MeshOptimize3d meshopt; MeshOptimize3d meshopt(mp);
// tempmesh.CalcSurfacesOfNode(); // tempmesh.CalcSurfacesOfNode();
meshopt.SwapImprove(tempmesh, OPT_CONFORM); meshopt.SwapImprove(tempmesh, OPT_CONFORM);
} }

View File

@ -160,7 +160,7 @@ namespace netgen
{ {
cout << "2D Delaunay meshing (in progress)" << endl; cout << "2D Delaunay meshing (in progress)" << endl;
int oldnp = mesh.GetNP(); // int oldnp = mesh.GetNP();
cout << "np, old = " << mesh.GetNP() << endl; cout << "np, old = " << mesh.GetNP() << endl;

View File

@ -23,7 +23,6 @@ namespace netgen
int silentflag = 0; int silentflag = 0;
int testmode = 0; int testmode = 0;
MeshingParameters mparam;
volatile multithreadt multithread; volatile multithreadt multithread;
string ngdir = "."; string ngdir = ".";

View File

@ -25,7 +25,7 @@ namespace netgen
/// calling parameters /// calling parameters
// extern Flags parameters; // extern Flags parameters;
extern DLL_HEADER MeshingParameters mparam; // extern DLL_HEADER MeshingParameters mparam;
extern Array<int> tets_in_qualclass; extern Array<int> tets_in_qualclass;

View File

@ -160,8 +160,9 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
for (int k = 0; k < hasonepi.Size(); k++) for (int k = 0; k < hasonepi.Size(); k++)
{ {
const Element & elem = mesh[hasonepi[k]]; const Element & elem = mesh[hasonepi[k]];
double err = CalcTetBadness (mesh[elem[0]], mesh[elem[1]], double err = CalcBad (mesh.Points(), elem, 0);
mesh[elem[2]], mesh[elem[3]], 0, mparam); // CalcTetBadness (mesh[elem[0]], mesh[elem[1]],
// mesh[elem[2]], mesh[elem[3]], 0, mparam);
bad2 += err; bad2 += err;
oneperr[k] = 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; OptiParameters par;
par.maxit_linsearch = 50; par.maxit_linsearch = 50;
par.maxit_bfgs = 20; par.maxit_bfgs = 20;

View File

@ -2,12 +2,17 @@
#define FILE_IMPROVE3 #define FILE_IMPROVE3
extern double CalcTotalBad (const Mesh::T_POINTS & points,
const Mesh::T_VOLELEMENTS & elements,
const MeshingParameters & mp);
/// ///
class MeshOptimize3d class MeshOptimize3d
{ {
const MeshingParameters & mp;
public: public:
MeshOptimize3d (const MeshingParameters & amp) : mp(amp) { ; }
void CombineImprove (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY); void CombineImprove (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY);
void SplitImprove (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY); void SplitImprove (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY);
void SwapImprove (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 BitArray * working_elements = NULL,
const Array< Array<int,PointIndex::BASE>* > * idmaps = NULL); const Array< Array<int,PointIndex::BASE>* > * idmaps = NULL);
void SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY); 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 inline double
CalcBad (const Mesh::T_POINTS & points, const Element & elem, CalcBad (const Mesh::T_POINTS & points, const Element & elem, double h, const MeshingParameters & mp)
double h, const MeshingParameters & mp = mparam)
{ {
if (elem.GetType() == TET) if (elem.GetType() == TET)
return CalcTetBadness (points[elem[0]], points[elem[1]], 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); extern int WrongOrientation (const Mesh::T_POINTS & points, const Element & el);
@ -63,15 +78,16 @@ public:
}; };
class PointFunction1 : public MinFunction class PointFunction1 : public MinFunction
{ {
Mesh::T_POINTS & points; Mesh::T_POINTS & points;
const Array<INDEX_3> & faces; const Array<INDEX_3> & faces;
const MeshingParameters & mp;
double h; double h;
public: public:
PointFunction1 (Mesh::T_POINTS & apoints, PointFunction1 (Mesh::T_POINTS & apoints,
const Array<INDEX_3> & afaces, const Array<INDEX_3> & afaces,
const MeshingParameters & amp,
double ah); double ah);
virtual double Func (const Vector & x) const; virtual double Func (const Vector & x) const;
@ -80,7 +96,6 @@ public:
virtual double GradStopping (const Vector & x) const; virtual double GradStopping (const Vector & x) const;
}; };
class JacobianPointFunction : public MinFunction class JacobianPointFunction : public MinFunction
{ {
public: public:

View File

@ -5461,15 +5461,21 @@ namespace netgen
bool Mesh :: PureTrigMesh (int faceindex) const bool Mesh :: PureTrigMesh (int faceindex) const
{ {
// if (!faceindex) return !mparam.quad;
if (!faceindex) if (!faceindex)
return !mparam.quad; {
for (int i = 1; i <= GetNSE(); i++)
if (SurfaceElement(i).GetNP() != 3)
return false;
return true;
}
int i; for (int i = 1; i <= GetNSE(); i++)
for (i = 1; i <= GetNSE(); i++)
if (SurfaceElement(i).GetIndex() == faceindex && if (SurfaceElement(i).GetIndex() == faceindex &&
SurfaceElement(i).GetNP() != 3) SurfaceElement(i).GetNP() != 3)
return 0; return false;
return 1; return true;
} }
bool Mesh :: PureTetMesh () const bool Mesh :: PureTetMesh () const

View File

@ -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, const Array< Vec<3>* > & nv,
OPTIMIZEGOAL goal = OPT_QUALITY, OPTIMIZEGOAL goal = OPT_QUALITY,
const Array< Array<int,PointIndex::BASE>* > * idmaps = NULL); const Array< Array<int,PointIndex::BASE>* > * idmaps = NULL);

View File

@ -258,7 +258,7 @@ namespace netgen
// mesh3d.Save ("tmp.vol"); // mesh3d.Save ("tmp.vol");
MeshOptimize3d optmesh; MeshOptimize3d optmesh(mp);
const char * optstr = "mcmstmcmstmcmstmcm"; const char * optstr = "mcmstmcmstmcmstmcm";
size_t j; size_t j;
@ -274,7 +274,7 @@ namespace netgen
case 'd': optmesh.SplitImprove(mesh3d, OPT_REST); break; case 'd': optmesh.SplitImprove(mesh3d, OPT_REST); break;
case 's': optmesh.SwapImprove(mesh3d, OPT_REST); break; case 's': optmesh.SwapImprove(mesh3d, OPT_REST); break;
case 't': optmesh.SwapImprove2(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) if (multithread.terminate)
break; break;
MeshOptimize3d optmesh; MeshOptimize3d optmesh(mp);
// teterrpow = mp.opterrpow; // teterrpow = mp.opterrpow;
for (size_t j = 1; j <= strlen(mp.optimize3d); j++) 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;
case 'M': mesh3d.ImproveMesh(*geometry); break; case 'M': mesh3d.ImproveMesh(*geometry); break;
#else #else
case 'm': mesh3d.ImproveMesh(); break; case 'm': mesh3d.ImproveMesh(mp); break;
case 'M': mesh3d.ImproveMesh(); break; case 'M': mesh3d.ImproveMesh(mp); break;
#endif #endif
case 'j': mesh3d.ImproveMeshJacobian(); break; case 'j': mesh3d.ImproveMeshJacobian(mp); break;
} }
} }
mesh3d.mglevels = 1; mesh3d.mglevels = 1;
@ -698,7 +698,8 @@ namespace netgen
nillegal = mesh3d.MarkIllegalElements(); nillegal = mesh3d.MarkIllegalElements();
MeshOptimize3d optmesh; MeshingParameters dummymp;
MeshOptimize3d optmesh(dummymp);
while (nillegal && (it--) > 0) while (nillegal && (it--) > 0)
{ {
if (multithread.terminate) if (multithread.terminate)

View File

@ -751,7 +751,7 @@ namespace netgen
{ {
rulenr = ApplyRules (plainpoints, legalpoints, maxlegalpoint, rulenr = ApplyRules (plainpoints, legalpoints, maxlegalpoint,
loclines, maxlegalline, locelements, loclines, maxlegalline, locelements,
dellines, qualclass); dellines, qualclass, mp);
// (*testout) << "Rule Nr = " << rulenr << endl; // (*testout) << "Rule Nr = " << rulenr << endl;
if (!rulenr) if (!rulenr)
{ {

View File

@ -141,7 +141,8 @@ protected:
Array<INDEX_2> & llines, Array<INDEX_2> & llines,
int maxlegelline, int maxlegelline,
Array<Element2d> & elements, Array<INDEX> & dellines, Array<Element2d> & elements, Array<INDEX> & dellines,
int tolerance); int tolerance,
const MeshingParameters & mp);
}; };

View File

@ -49,13 +49,13 @@ extern int CheckCode ();
extern double CalcTetBadness (const Point3d & p1, const Point3d & p2, extern double CalcTetBadness (const Point3d & p1, const Point3d & p2,
const Point3d & p3, const Point3d & p4, const Point3d & p3, const Point3d & p4,
double h, double h,
const MeshingParameters & mp = mparam); const MeshingParameters & mp);
/// ///
extern double CalcTetBadnessGrad (const Point3d & p1, const Point3d & p2, extern double CalcTetBadnessGrad (const Point3d & p1, const Point3d & p2,
const Point3d & p3, const Point3d & p4, const Point3d & p3, const Point3d & p4,
double h, int pi, double h, int pi,
Vec<3> & grad, Vec<3> & grad,
const MeshingParameters & mp = mparam); const MeshingParameters & mp);
/** Calculates volume of an element. /** Calculates volume of an element.

View File

@ -1535,6 +1535,7 @@ namespace netgen
{ {
cout << "GetNodesLocal not impelemented for element " << GetType() << endl; cout << "GetNodesLocal not impelemented for element " << GetType() << endl;
np = 0; np = 0;
pp = NULL;
} }
} }

View File

@ -719,7 +719,8 @@ namespace netgen
mesh.CalcSurfacesOfNode(); mesh.CalcSurfacesOfNode();
free.Invert(); free.Invert();
mesh.FixPoints (free); mesh.FixPoints (free);
mesh.ImproveMesh (OPT_REST); MeshingParameters dummymp;
mesh.ImproveMesh (dummymp, OPT_REST);
wrongels = 0; wrongels = 0;

View File

@ -51,7 +51,8 @@ namespace netgen
Array<INDEX_2> & llines1, Array<INDEX_2> & llines1,
int maxlegalline, int maxlegalline,
Array<Element2d> & elements, Array<Element2d> & elements,
Array<INDEX> & dellines, int tolerance) Array<INDEX> & dellines, int tolerance,
const MeshingParameters & mp)
{ {
static int timer = NgProfiler::CreateTimer ("meshing2::ApplyRules"); static int timer = NgProfiler::CreateTimer ("meshing2::ApplyRules");
NgProfiler::RegionTimer reg (timer); NgProfiler::RegionTimer reg (timer);
@ -627,7 +628,7 @@ namespace netgen
for (int i = 1; i <= elements.Size(); i++) for (int i = 1; i <= elements.Size(); i++)
{ {
double hf; double hf;
if (!mparam.quad) if (!mp.quad)
hf = CalcElementBadness (lpoints, elements.Get(i)); hf = CalcElementBadness (lpoints, elements.Get(i));
else else
hf = elements.Get(i).CalcJacobianBadness (lpoints) * 5; hf = elements.Get(i).CalcJacobianBadness (lpoints) * 5;

View File

@ -457,7 +457,8 @@ namespace netgen
while (wrongels && cnttrials > 0); while (wrongels && cnttrials > 0);
mesh.CalcSurfacesOfNode(); mesh.CalcSurfacesOfNode();
mesh.ImproveMeshJacobian (OPT_WORSTCASE); MeshingParameters dummymp;
mesh.ImproveMeshJacobian (dummymp, OPT_WORSTCASE);
facok = factry; facok = factry;
for (int i = 1; i <= np; i++) for (int i = 1; i <= np; i++)

View File

@ -87,11 +87,11 @@ namespace netgen
return *functions[i]; return *functions[i];
} }
PointFunction1 :: PointFunction1 (Mesh::T_POINTS & apoints, PointFunction1 :: PointFunction1 (Mesh::T_POINTS & apoints,
const Array<INDEX_3> & afaces, const Array<INDEX_3> & afaces,
const MeshingParameters & amp,
double ah) double ah)
: points(apoints), faces(afaces) : points(apoints), faces(afaces), mp(amp)
{ {
h = ah; h = ah;
} }
@ -109,7 +109,7 @@ namespace netgen
double bad = CalcTetBadness (points[el.I1()], double bad = CalcTetBadness (points[el.I1()],
points[el.I3()], points[el.I3()],
points[el.I2()], points[el.I2()],
pp, 0); pp, 0, mp);
badness += bad; badness += bad;
} }
@ -170,8 +170,6 @@ namespace netgen
} }
/* Cheap Functional depending of inner point inside triangular surface */ /* Cheap Functional depending of inner point inside triangular surface */
// is it used ???? // is it used ????
@ -304,12 +302,14 @@ namespace netgen
Mesh::T_POINTS & points; Mesh::T_POINTS & points;
const Mesh::T_VOLELEMENTS & elements; const Mesh::T_VOLELEMENTS & elements;
TABLE<int,PointIndex::BASE> elementsonpoint; TABLE<int,PointIndex::BASE> elementsonpoint;
const MeshingParameters & mp;
PointIndex actpind; PointIndex actpind;
double h; double h;
public: public:
PointFunction (Mesh::T_POINTS & apoints, PointFunction (Mesh::T_POINTS & apoints,
const Mesh::T_VOLELEMENTS & aelements); const Mesh::T_VOLELEMENTS & aelements,
const MeshingParameters & amp);
virtual void SetPointIndex (PointIndex aactpind); virtual void SetPointIndex (PointIndex aactpind);
void SetLocalH (double ah) { h = ah; } void SetLocalH (double ah) { h = ah; }
@ -323,8 +323,9 @@ namespace netgen
PointFunction :: PointFunction (Mesh::T_POINTS & apoints, PointFunction :: PointFunction (Mesh::T_POINTS & apoints,
const Mesh::T_VOLELEMENTS & aelements) const Mesh::T_VOLELEMENTS & aelements,
: points(apoints), elements(aelements), elementsonpoint(apoints.Size()) const MeshingParameters & amp)
: points(apoints), elements(aelements), elementsonpoint(apoints.Size()), mp(amp)
{ {
for (int i = 0; i < elements.Size(); i++) for (int i = 0; i < elements.Size(); i++)
if (elements[i].NP() == 4) if (elements[i].NP() == 4)
@ -351,7 +352,7 @@ namespace netgen
{ {
const Element & el = elements[elementsonpoint[actpind][j]]; const Element & el = elements[elementsonpoint[actpind][j]];
badness += CalcTetBadness (points[el[0]], points[el[1]], 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); points[actpind] = Point<3> (hp);
@ -375,7 +376,7 @@ namespace netgen
{ {
f += CalcTetBadnessGrad (points[el[0]], points[el[1]], f += CalcTetBadnessGrad (points[el[0]], points[el[1]],
points[el[2]], points[el[3]], points[el[2]], points[el[3]],
-1, k+1, vgradi); -1, k+1, vgradi, mp);
vgrad += vgradi; vgrad += vgradi;
} }
@ -407,7 +408,7 @@ namespace netgen
f += CalcTetBadnessGrad (points[el.PNum(1)], f += CalcTetBadnessGrad (points[el.PNum(1)],
points[el.PNum(2)], points[el.PNum(2)],
points[el.PNum(3)], points[el.PNum(3)],
points[el.PNum(4)], -1, k, vgradi); points[el.PNum(4)], -1, k, vgradi, mp);
vgrad += vgradi; vgrad += vgradi;
} }
@ -476,7 +477,8 @@ namespace netgen
DenseMatrix m; DenseMatrix m;
public: public:
CheapPointFunction (Mesh::T_POINTS & apoints, CheapPointFunction (Mesh::T_POINTS & apoints,
const Mesh::T_VOLELEMENTS & aelements); const Mesh::T_VOLELEMENTS & aelements,
const MeshingParameters & amp);
virtual void SetPointIndex (PointIndex aactpind); virtual void SetPointIndex (PointIndex aactpind);
virtual double PointFunctionValue (const Point<3> & pp) const; virtual double PointFunctionValue (const Point<3> & pp) const;
virtual double PointFunctionValueGrad (const Point<3> & pp, Vec<3> & grad) const; virtual double PointFunctionValueGrad (const Point<3> & pp, Vec<3> & grad) const;
@ -484,8 +486,9 @@ namespace netgen
CheapPointFunction :: CheapPointFunction (Mesh::T_POINTS & apoints, CheapPointFunction :: CheapPointFunction (Mesh::T_POINTS & apoints,
const Mesh::T_VOLELEMENTS & aelements) const Mesh::T_VOLELEMENTS & aelements,
: PointFunction (apoints, 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++) 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); 1/teterrpow);
int qualclass = int (20 / elbad + 1); 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; int typ = 1;
@ -1373,7 +1376,7 @@ void Mesh :: ImproveMesh (OPTIMIZEGOAL goal)
if (el.GetType() != TET) if (el.GetType() != TET)
continue; continue;
double hbad = CalcBad (points, el, 0); double hbad = CalcBad (points, el, 0, mp);
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
perrs[el[j]] += hbad; perrs[el[j]] += hbad;
@ -1388,7 +1391,7 @@ void Mesh :: ImproveMesh (OPTIMIZEGOAL goal)
if (goal == OPT_QUALITY) if (goal == OPT_QUALITY)
{ {
bad1 = CalcTotalBad (points, volelements); bad1 = CalcTotalBad (points, volelements, mp);
(*testout) << "Total badness = " << bad1 << endl; (*testout) << "Total badness = " << bad1 << endl;
PrintMessage (5, "Total badness = ", bad1); PrintMessage (5, "Total badness = ", bad1);
} }
@ -1403,9 +1406,9 @@ void Mesh :: ImproveMesh (OPTIMIZEGOAL goal)
PointFunction * pf; PointFunction * pf;
if (typ == 1) if (typ == 1)
pf = new PointFunction(points, volelements); pf = new PointFunction(points, volelements, mp);
else else
pf = new CheapPointFunction(points, volelements); pf = new CheapPointFunction(points, volelements, mp);
// pf->SetLocalH (h); // pf->SetLocalH (h);
@ -1508,7 +1511,7 @@ void Mesh :: ImproveMesh (OPTIMIZEGOAL goal)
if (goal == OPT_QUALITY) if (goal == OPT_QUALITY)
{ {
bad1 = CalcTotalBad (points, volelements); bad1 = CalcTotalBad (points, volelements, mp);
(*testout) << "Total badness = " << bad1 << endl; (*testout) << "Total badness = " << bad1 << endl;
PrintMessage (5, "Total badness = ", bad1); PrintMessage (5, "Total badness = ", bad1);
} }
@ -1518,7 +1521,8 @@ void Mesh :: ImproveMesh (OPTIMIZEGOAL goal)
// Improve Condition number of Jacobian, any elements // 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; int i, j;
@ -1638,7 +1642,8 @@ void Mesh :: ImproveMeshJacobian (OPTIMIZEGOAL goal, const BitArray * usepoint)
// Improve Condition number of Jacobian, any elements // 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, const Array< Vec<3>* > & nv,
OPTIMIZEGOAL goal, OPTIMIZEGOAL goal,
const Array< Array<int,PointIndex::BASE>* > * idmaps) const Array< Array<int,PointIndex::BASE>* > * idmaps)

View File

@ -156,7 +156,7 @@ void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh)
mesh.AddLockedPoint (pmat.Elem(i)); mesh.AddLockedPoint (pmat.Elem(i));
mesh.CalcSurfacesOfNode(); mesh.CalcSurfacesOfNode();
mesh.CalcLocalH(mparam.grading); mesh.CalcLocalH(0.3);
} }

View File

@ -376,7 +376,8 @@ namespace netgen
// smooth faces // smooth faces
mesh.CalcSurfacesOfNode(); 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++) for (int i = 1; i <= np; i++)
*can.Elem(i) = mesh.Point(i); *can.Elem(i) = mesh.Point(i);
@ -447,7 +448,8 @@ namespace netgen
mesh.CalcSurfacesOfNode(); mesh.CalcSurfacesOfNode();
mesh.ImproveMeshJacobian (OPT_QUALITY,&working_points); MeshingParameters dummymp;
mesh.ImproveMeshJacobian (dummymp, OPT_QUALITY,&working_points);
//mesh.ImproveMeshJacobian (OPT_WORSTCASE,&working_points); //mesh.ImproveMeshJacobian (OPT_WORSTCASE,&working_points);
@ -460,7 +462,8 @@ namespace netgen
cnttrials < maxtrials && cnttrials < maxtrials &&
multithread.terminate != 1) multithread.terminate != 1)
{ {
MeshOptimize3d optmesh; MeshingParameters dummymp;
MeshOptimize3d optmesh(dummymp);
for(int i=0; i<numtopimprove; i++) for(int i=0; i<numtopimprove; i++)
{ {
optmesh.SwapImproveSurface(mesh,OPT_QUALITY,&working_elements,&idmaps); optmesh.SwapImproveSurface(mesh,OPT_QUALITY,&working_elements,&idmaps);
@ -507,7 +510,8 @@ namespace netgen
} }
MeshOptimize3d optmesh; MeshingParameters dummymp;
MeshOptimize3d optmesh(dummymp);
for(int i=0; i<numtopimprove && multithread.terminate != 1; i++) for(int i=0; i<numtopimprove && multithread.terminate != 1; i++)
{ {
optmesh.SwapImproveSurface(mesh,OPT_QUALITY,NULL,&idmaps); optmesh.SwapImproveSurface(mesh,OPT_QUALITY,NULL,&idmaps);

View File

@ -114,6 +114,8 @@ namespace netgen
{ {
#include "occmeshsurf.hpp" #include "occmeshsurf.hpp"
extern DLL_HEADER MeshingParameters mparam;
#define PROJECTION_TOLERANCE 1e-10 #define PROJECTION_TOLERANCE 1e-10
#define ENTITYISVISIBLE 1 #define ENTITYISVISIBLE 1
@ -301,7 +303,7 @@ namespace netgen
{ {
if((facenr> 0) && (facenr <= fmap.Extent())) if((facenr> 0) && (facenr <= fmap.Extent()))
{ {
face_maxh[facenr-1] = min(mparam.maxh,faceh); face_maxh[facenr-1] = min(mparam.maxh,faceh);
// Philippose - 14/01/2010 // Philippose - 14/01/2010
// If the face maxh is greater than or equal to the // If the face maxh is greater than or equal to the

View File

@ -28,6 +28,9 @@ namespace netgen
{ {
extern int IsInArray(int n, const Array<int>& ia); extern int IsInArray(int n, const Array<int>& ia);
extern int AddIfNotExists(Array<int>& list, int x); extern int AddIfNotExists(Array<int>& list, int x);
extern DLL_HEADER MeshingParameters mparam;
#include "stltopology.hpp" #include "stltopology.hpp"