delaunay meshing

This commit is contained in:
Joachim Schoeberl 2010-09-23 14:07:12 +00:00
parent b20dda8e4a
commit 834937c671
17 changed files with 967 additions and 682 deletions

View File

@ -227,8 +227,13 @@ namespace netgen
mparam.checkoverlap = 0; mparam.checkoverlap = 0;
meshing.GenerateMesh (*mesh, h, domnr); /*
if (!mparam.quad)
meshing.Delaunay (*mesh, domnr, mparam);
else
*/
meshing.GenerateMesh (*mesh, h, domnr);
for (SurfaceElementIndex sei = oldnf; sei < mesh->GetNSE(); sei++) for (SurfaceElementIndex sei = oldnf; sei < mesh->GetNSE(); sei++)
(*mesh)[sei].SetIndex (domnr); (*mesh)[sei].SetIndex (domnr);

View File

@ -197,6 +197,14 @@ protected:
Point<D> pmin, pmax; Point<D> pmin, pmax;
public: public:
Box () { ; } Box () { ; }
Box ( const Point<D> & p1)
{
for (int i = 0; i < D; i++)
pmin(i) = pmax(i) = p1(i);
}
Box ( const Point<D> & p1, const Point<D> & p2) Box ( const Point<D> & p1, const Point<D> & p2)
{ {
for (int i = 0; i < D; i++) for (int i = 0; i < D; i++)

View File

@ -43,6 +43,7 @@ namespace netgen
{ {
Point3d p; Point3d p;
in >> p.X() >> p.Y() >> p.Z(); in >> p.X() >> p.Y() >> p.Z();
p.Z() *= 10;
mesh.AddPoint (p); mesh.AddPoint (p);
} }

View File

@ -262,6 +262,7 @@ namespace netgen
if (det == 0) if (det == 0)
{ {
(*myerr) << "CalcInverse: Matrix singular" << endl; (*myerr) << "CalcInverse: Matrix singular" << endl;
(*testout) << "CalcInverse: Matrix singular" << endl;
return; return;
} }
@ -488,6 +489,7 @@ namespace netgen
if (max < 1e-20) if (max < 1e-20)
{ {
cerr << "Inverse matrix: matrix singular" << endl; cerr << "Inverse matrix: matrix singular" << endl;
*testout << "Inverse matrix: matrix singular" << endl;
return; return;
} }

View File

@ -15,14 +15,15 @@ clusters.hpp hprefinement.hpp improve3.hpp meshtype.hpp \
METASOURCES = AUTO METASOURCES = AUTO
noinst_LTLIBRARIES = libmesh.la noinst_LTLIBRARIES = libmesh.la
libmesh_la_SOURCES = adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp \ libmesh_la_SOURCES = adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp \
clusters.cpp curvedelems.cpp delaunay.cpp geomsearch.cpp global.cpp \ clusters.cpp curvedelems.cpp delaunay.cpp delaunay2d.cpp \
hprefinement.cpp improve2.cpp improve2gen.cpp improve3.cpp localh.cpp \ geomsearch.cpp global.cpp hprefinement.cpp improve2.cpp \
meshclass.cpp meshfunc.cpp meshfunc2d.cpp meshing2.cpp meshing3.cpp \ improve2gen.cpp improve3.cpp localh.cpp meshclass.cpp \
meshtool.cpp meshtype.cpp msghandler.cpp netrule2.cpp \ meshfunc.cpp meshfunc2d.cpp meshing2.cpp meshing3.cpp \
netrule3.cpp parser2.cpp parser3.cpp prism2rls.cpp \ meshtool.cpp meshtype.cpp msghandler.cpp netrule2.cpp \
pyramid2rls.cpp pyramidrls.cpp quadrls.cpp refine.cpp \ netrule3.cpp parser2.cpp parser3.cpp prism2rls.cpp \
ruler2.cpp ruler3.cpp secondorder.cpp smoothing2.5.cpp \ pyramid2rls.cpp pyramidrls.cpp quadrls.cpp refine.cpp \
smoothing2.cpp smoothing3.cpp specials.cpp tetrarls.cpp \ ruler2.cpp ruler3.cpp secondorder.cpp smoothing2.5.cpp \
topology.cpp triarls.cpp validate.cpp zrefine.cpp bcfunctions.cpp \ smoothing2.cpp smoothing3.cpp specials.cpp tetrarls.cpp \
topology.cpp triarls.cpp validate.cpp zrefine.cpp bcfunctions.cpp \
parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp

View File

@ -8,8 +8,8 @@
namespace netgen namespace netgen
{ {
AdFront2::FrontPoint2 :: FrontPoint2 (const Point<3> & ap, PointIndex agi, FrontPoint2 :: FrontPoint2 (const Point<3> & ap, PointIndex agi,
MultiPointGeomInfo * amgi, bool aonsurface) MultiPointGeomInfo * amgi, bool aonsurface)
{ {
p = ap; p = ap;
globalindex = agi; globalindex = agi;
@ -464,4 +464,45 @@ namespace netgen
ost << flush; ost << flush;
} }
bool AdFront2 :: Inside (const Point<2> & p) const
{
int cnt;
Vec<2> n;
Vec<3> v1;
DenseMatrix a(2), ainv(2);
Vector b(2), u(2);
// random numbers:
n(0) = 0.123871;
n(1) = 0.15432;
cnt = 0;
for (int i = 0; i < lines.Size(); i++)
if (lines[i].Valid())
{
const Point<3> & p1 = points[lines[i].L().I1()].P();
const Point<3> & p2 = points[lines[i].L().I2()].P();
v1 = p2 - p1;
a(0, 0) = v1(0);
a(1, 0) = v1(1);
a(0, 1) = -n(0);
a(1, 1) = -n(1);
b(0) = p(0) - p1(0);
b(1) = p(1) - p1(1);
CalcInverse (a, ainv);
ainv.Mult (b, u);
if (u(0) >= 0 && u(0) <= 1 && u(1) > 0)
cnt++;
}
return ((cnt % 2) != 0);
}
} }

View File

@ -13,8 +13,6 @@
Advancing front class for surfaces Advancing front class for surfaces
*/ */
class AdFront2
{
/// ///
class FrontPoint2 class FrontPoint2
@ -163,6 +161,8 @@ class AdFront2
}; };
class AdFront2
{
/// ///
Array<FrontPoint2> points; /// front points Array<FrontPoint2> points; /// front points
@ -202,6 +202,11 @@ public:
} }
/// ///
int GetNFL () const { return nfl; } int GetNFL () const { return nfl; }
const FrontLine & GetLine (int nr) { return lines[nr]; }
const FrontPoint2 & GetPoint (int nr) { return points[nr]; }
/// ///
int SelectBaseLine (Point<3> & p1, Point<3> & p2, int SelectBaseLine (Point<3> & p1, Point<3> & p2,
const PointGeomInfo *& geominfo1, const PointGeomInfo *& geominfo1,
@ -250,6 +255,18 @@ public:
{ {
return points[pi].GlobalIndex(); return points[pi].GlobalIndex();
} }
/// is Point p inside Surface (flat geometry only)
bool Inside (const Point<2> & p) const;
bool SameSide (const Point<2> & lp1, const Point<2> & lp2,
const Array<int> * testfaces = NULL) const
{
return Inside (lp1) == Inside (lp2);
}
/// ///
void SetStartFront (); void SetStartFront ();
/// ///

View File

@ -772,7 +772,7 @@ void AdFront3 :: SetStartFront (int /* baseelnp */)
bool AdFront3 :: Inside (const Point<3> & p) const bool AdFront3 :: Inside (const Point<3> & p) const
{ {
int i, cnt; int cnt;
Vec3d n, v1, v2; Vec3d n, v1, v2;
DenseMatrix a(3), ainv(3); DenseMatrix a(3), ainv(3);
Vector b(3), u(3); Vector b(3), u(3);
@ -783,7 +783,7 @@ bool AdFront3 :: Inside (const Point<3> & p) const
n.Z() = -0.43989; n.Z() = -0.43989;
cnt = 0; cnt = 0;
for (i = 1; i <= faces.Size(); i++) for (int i = 1; i <= faces.Size(); i++)
if (faces.Get(i).Valid()) if (faces.Get(i).Valid())
{ {
const Point<3> & p1 = points[faces.Get(i).Face().PNum(1)].P(); const Point<3> & p1 = points[faces.Get(i).Face().PNum(1)].P();
@ -827,36 +827,29 @@ bool AdFront3 :: Inside (const Point<3> & p) const
int AdFront3 :: SameSide (const Point<3> & lp1, const Point<3> & lp2, int AdFront3 :: SameSide (const Point<3> & lp1, const Point<3> & lp2,
const Array<int> * testfaces) const const Array<int> * testfaces) const
{ {
int i, ii, cnt;
const Point<3> *line[2]; const Point<3> *line[2];
line[0] = &lp1; line[0] = &lp1;
line[1] = &lp2; line[1] = &lp2;
cnt = 0;
Point3d pmin(lp1); Point3d pmin(lp1);
Point3d pmax(lp1); Point3d pmax(lp1);
pmin.SetToMin (lp2); pmin.SetToMin (lp2);
pmax.SetToMax (lp2); pmax.SetToMax (lp2);
static Array<int> aprif; ArrayMem<int, 100> aprif;
aprif.SetSize(0); aprif.SetSize(0);
if (!testfaces) if (!testfaces)
facetree->GetIntersecting (pmin, pmax, aprif); facetree->GetIntersecting (pmin, pmax, aprif);
else else
{ for (int i = 1; i <= testfaces->Size(); i++)
for (i = 1; i <= testfaces->Size(); i++) aprif.Append (testfaces->Get(i));
aprif.Append (testfaces->Get(i));
}
// (*testout) << "test ss, p1,p2 = " << lp1 << lp2 << ", inters = " << aprif.Size() << endl; int cnt = 0;
// for (i = 1; i <= faces.Size(); i++) for (int ii = 1; ii <= aprif.Size(); ii++)
for (ii = 1; ii <= aprif.Size(); ii++)
{ {
i = aprif.Get(ii); int i = aprif.Get(ii);
if (faces.Get(i).Valid()) if (faces.Get(i).Valid())
{ {
@ -867,7 +860,6 @@ int AdFront3 :: SameSide (const Point<3> & lp1, const Point<3> & lp2,
if (IntersectTriangleLine (&tri[0], &line[0])) if (IntersectTriangleLine (&tri[0], &line[0]))
cnt++; cnt++;
} }
} }

View File

@ -0,0 +1,174 @@
#include <mystdlib.h>
#include "meshing.hpp"
// not yet working ....
namespace netgen
{
void Meshing2 :: BlockFillLocalH (Mesh & mesh, const MeshingParameters & mp)
{
double filldist = mp.filldist;
cout << "blockfill local h" << endl;
cout << "rel filldist = " << filldist << endl;
PrintMessage (3, "blockfill local h");
Array<Point<3> > npoints;
// adfront -> CreateTrees();
Box<3> bbox ( Box<3>::EMPTY_BOX );
double maxh = 0;
for (int i = 0; i < adfront->GetNFL(); i++)
{
const FrontLine & line = adfront->GetLine (i);
const Point<3> & p1 = adfront->GetPoint(line.L().I1());
const Point<3> & p2 = adfront->GetPoint(line.L().I2());
double hi = Dist (p1, p2);
if (hi > maxh) maxh = hi;
bbox.Add (p1);
bbox.Add (p2);
}
cout << "bbox = " << bbox << endl;
Point<3> mpc = bbox.Center();
bbox.Increase (bbox.Diam()/2);
Box<3> meshbox = bbox;
LocalH loch2 (bbox, 1);
if (mp.maxh < maxh) maxh = mp.maxh;
bool changed;
do
{
mesh.LocalHFunction().ClearFlags();
for (int i = 0; i < adfront->GetNFL(); i++)
{
const FrontLine & line = adfront->GetLine(i);
Box<3> bbox (adfront->GetPoint (line.L().I1()));
bbox.Add (adfront->GetPoint (line.L().I2()));
double filld = filldist * bbox.Diam();
bbox.Increase (filld);
mesh.LocalHFunction().CutBoundary (bbox);
}
mesh.LocalHFunction().FindInnerBoxes (adfront, NULL);
npoints.SetSize(0);
mesh.LocalHFunction().GetInnerPoints (npoints);
changed = false;
for (int i = 0; i < npoints.Size(); i++)
{
if (mesh.LocalHFunction().GetH(npoints[i]) > 1.5 * maxh)
{
mesh.LocalHFunction().SetH (npoints[i], maxh);
changed = true;
}
}
}
while (changed);
if (debugparam.slowchecks)
(*testout) << "Blockfill with points: " << endl;
*testout << "loch = " << mesh.LocalHFunction() << endl;
*testout << "npoints = " << endl << npoints << endl;
for (int i = 1; i <= npoints.Size(); i++)
{
if (meshbox.IsIn (npoints.Get(i)))
{
int gpnum = mesh.AddPoint (npoints.Get(i));
adfront->AddPoint (npoints.Get(i), gpnum);
if (debugparam.slowchecks)
{
(*testout) << npoints.Get(i) << endl;
Point<2> p2d (npoints.Get(i)(0), npoints.Get(i)(1));
if (!adfront->Inside(p2d))
{
cout << "add outside point" << endl;
(*testout) << "outside" << endl;
}
}
}
}
// find outer points
loch2.ClearFlags();
for (int i = 0; i < adfront->GetNFL(); i++)
{
const FrontLine & line = adfront->GetLine(i);
Box<3> bbox (adfront->GetPoint (line.L().I1()));
bbox.Add (adfront->GetPoint (line.L().I2()));
loch2.SetH (bbox.Center(), bbox.Diam());
}
for (int i = 0; i < adfront->GetNFL(); i++)
{
const FrontLine & line = adfront->GetLine(i);
Box<3> bbox (adfront->GetPoint (line.L().I1()));
bbox.Add (adfront->GetPoint (line.L().I2()));
bbox.Increase (filldist * bbox.Diam());
loch2.CutBoundary (bbox);
}
loch2.FindInnerBoxes (adfront, NULL);
npoints.SetSize(0);
loch2.GetOuterPoints (npoints);
for (int i = 1; i <= npoints.Size(); i++)
{
if (meshbox.IsIn (npoints.Get(i)))
{
int gpnum = mesh.AddPoint (npoints.Get(i));
adfront->AddPoint (npoints.Get(i), gpnum);
}
}
}
void Meshing2 :: Delaunay (Mesh & mesh, int domainnr, const MeshingParameters & mp)
{
cout << "2D Delaunay meshing (in progress)" << endl;
int oldnp = mesh.GetNP();
cout << "np, old = " << mesh.GetNP() << endl;
BlockFillLocalH (mesh, mp);
cout << "np, now = " << mesh.GetNP() << endl;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -13,12 +13,6 @@
/// box for grading /// box for grading
class GradingBox class GradingBox
{ {
/*
/// xmin
float x1[3];
/// xmax
float x2[3];
*/
/// xmid /// xmid
float xmid[3]; float xmid[3];
/// half edgelength /// half edgelength
@ -30,6 +24,8 @@ class GradingBox
/// ///
double hopt; double hopt;
/// ///
public:
struct struct
{ {
unsigned int cutboundary:1; unsigned int cutboundary:1;
@ -37,14 +33,17 @@ class GradingBox
unsigned int oldcell:1; unsigned int oldcell:1;
unsigned int pinner:1; unsigned int pinner:1;
} flags; } flags;
public:
/// ///
GradingBox (const double * ax1, const double * ax2); GradingBox (const double * ax1, const double * ax2);
/// ///
void DeleteChilds(); void DeleteChilds();
/// ///
friend class LocalH;
Point<3> PMid() const { return Point<3> (xmid[0], xmid[1], xmid[2]); }
double H2() const { return h2; }
friend class LocalH;
static BlockAllocator ball; static BlockAllocator ball;
void * operator new(size_t); void * operator new(size_t);
@ -53,6 +52,7 @@ public:
/** /**
Control of 3D mesh grading Control of 3D mesh grading
*/ */
@ -70,6 +70,8 @@ public:
/// ///
LocalH (const Point3d & pmin, const Point3d & pmax, double grading); LocalH (const Point3d & pmin, const Point3d & pmax, double grading);
/// ///
LocalH (const Box<3> & box, double grading);
///
~LocalH(); ~LocalH();
/// ///
void Delete(); void Delete();
@ -83,14 +85,19 @@ public:
double GetMinH (const Point3d & pmin, const Point3d & pmax) const; double GetMinH (const Point3d & pmin, const Point3d & pmax) const;
/// mark boxes intersecting with boundary-box /// mark boxes intersecting with boundary-box
void CutBoundary (const Point3d & pmin, const Point3d & pmax) // void CutBoundary (const Point3d & pmin, const Point3d & pmax)
{ CutBoundaryRec (pmin, pmax, root); } // { CutBoundaryRec (pmin, pmax, root); }
void CutBoundary (const Box<3> & box)
{ CutBoundaryRec (box.PMin(), box.PMax(), root); }
/// find inner boxes /// find inner boxes
void FindInnerBoxes ( // int (*sameside)(const Point3d & p1, const Point3d & p2), void FindInnerBoxes (class AdFront3 * adfront,
class AdFront3 * adfront,
int (*testinner)(const Point3d & p1)); int (*testinner)(const Point3d & p1));
void FindInnerBoxes (class AdFront2 * adfront,
int (*testinner)(const Point<2> & p1));
/// clears all flags /// clears all flags
void ClearFlags () void ClearFlags ()
{ ClearFlagsRec(root); } { ClearFlagsRec(root); }
@ -99,10 +106,10 @@ public:
void WidenRefinement (); void WidenRefinement ();
/// get points in inner elements /// get points in inner elements
void GetInnerPoints (Array<Point3d> & points); void GetInnerPoints (Array<Point<3> > & points);
/// get points in outer closure /// get points in outer closure
void GetOuterPoints (Array<Point3d> & points); void GetOuterPoints (Array<Point<3> > & points);
/// ///
void Convexify (); void Convexify ();
@ -131,6 +138,18 @@ private:
Array<int> & finds, int nfinbox); Array<int> & finds, int nfinbox);
void FindInnerBoxesRec ( int (*inner)(const Point<2> & p),
GradingBox * box);
///
void FindInnerBoxesRec2 (GradingBox * box,
class AdFront2 * adfront,
Array<Box<3> > & faceboxes,
Array<int> & finds, int nfinbox);
/// ///
void SetInnerBoxesRec (GradingBox * box); void SetInnerBoxesRec (GradingBox * box);
@ -139,7 +158,26 @@ private:
/// ///
void ConvexifyRec (GradingBox * box); void ConvexifyRec (GradingBox * box);
friend ostream & operator<< (ostream & ost, const LocalH & loch);
}; };
inline ostream & operator<< (ostream & ost, const GradingBox & box)
{
ost << "gradbox, pmid = " << box.PMid() << ", h2 = " << box.H2()
<< " cutbound = " << box.flags.cutboundary << " isinner = " << box.flags.isinner
<< endl;
return ost;
}
inline ostream & operator<< (ostream & ost, const LocalH & loch)
{
for (int i = 0; i < loch.boxes.Size(); i++)
ost << "box[" << i << "] = " << *(loch.boxes[i]);
return ost;
}
#endif #endif

View File

@ -4365,7 +4365,7 @@ namespace netgen
if(el.GetType() == TET || el.GetType() == TET10) if (el.GetType() == TET)
{ {
retval = (lam(0) > -eps && retval = (lam(0) > -eps &&
lam(1) > -eps && lam(1) > -eps &&

View File

@ -54,6 +54,10 @@ public:
/// ///
MESHING2_RESULT GenerateMesh (Mesh & mesh, double gh, int facenr); MESHING2_RESULT GenerateMesh (Mesh & mesh, double gh, int facenr);
void Delaunay (Mesh & mesh, int domainnr, const MeshingParameters & mp);
void BlockFillLocalH (Mesh & mesh, const MeshingParameters & mp);
/// ///
void AddPoint (const Point3d & p, PointIndex globind, MultiPointGeomInfo * mgi = NULL, void AddPoint (const Point3d & p, PointIndex globind, MultiPointGeomInfo * mgi = NULL,
bool pointonsurface = true); bool pointonsurface = true);

View File

@ -1082,7 +1082,7 @@ void Meshing3 :: BlockFill (Mesh & mesh, double gh)
} }
/*
static const AdFront3 * locadfront; static const AdFront3 * locadfront;
static int TestInner (const Point3d & p) static int TestInner (const Point3d & p)
{ {
@ -1092,62 +1092,45 @@ static int TestSameSide (const Point3d & p1, const Point3d & p2)
{ {
return locadfront->SameSide (p1, p2); return locadfront->SameSide (p1, p2);
} }
*/
void Meshing3 :: BlockFillLocalH (Mesh & mesh, void Meshing3 :: BlockFillLocalH (Mesh & mesh,
const MeshingParameters & mp) const MeshingParameters & mp)
{ {
int i, j;
double filldist = mp.filldist; double filldist = mp.filldist;
(*testout) << "blockfill local h" << endl; (*testout) << "blockfill local h" << endl;
(*testout) << "rel filldist = " << filldist << endl; (*testout) << "rel filldist = " << filldist << endl;
PrintMessage (3, "blockfill local h"); PrintMessage (3, "blockfill local h");
/*
(*mycout) << "boxes: " << mesh.LocalHFunction().GetNBoxes() << endl Array<Point<3> > npoints;
<< "filldist = " << filldist << endl;
*/
Array<Point3d> npoints;
adfront -> CreateTrees(); adfront -> CreateTrees();
Point3d mpmin, mpmax; Box<3> bbox ( Box<3>::EMPTY_BOX );
// mesh.GetBox (mpmin, mpmax);
bool firstp = 1;
double maxh = 0; double maxh = 0;
for (i = 1; i <= adfront->GetNF(); i++)
for (int i = 1; i <= adfront->GetNF(); i++)
{ {
const MiniElement2d & el = adfront->GetFace(i); const MiniElement2d & el = adfront->GetFace(i);
for (j = 1; j <= 3; j++) for (int j = 1; j <= 3; j++)
{ {
const Point3d & p1 = adfront->GetPoint (el.PNumMod(j)); const Point3d & p1 = adfront->GetPoint (el.PNumMod(j));
const Point3d & p2 = adfront->GetPoint (el.PNumMod(j+1)); const Point3d & p2 = adfront->GetPoint (el.PNumMod(j+1));
double hi = Dist (p1, p2);
if (hi > maxh)
{
maxh = hi;
//(*testout) << "reducing maxh to " << maxh << " because of " << p1 << " and " << p2 << endl;
}
if (firstp) double hi = Dist (p1, p2);
{ if (hi > maxh) maxh = hi;
mpmin = p1;
mpmax = p1; bbox.Add (p1);
firstp = 0;
}
else
{
mpmin.SetToMin (p1);
mpmax.SetToMax (p1);
}
} }
} }
Point3d mpmin = bbox.PMin();
Point3d mpmax = bbox.PMax();
Point3d mpc = Center (mpmin, mpmax); Point3d mpc = Center (mpmin, mpmax);
double d = max3(mpmax.X()-mpmin.X(), double d = max3(mpmax.X()-mpmin.X(),
mpmax.Y()-mpmin.Y(), mpmax.Y()-mpmin.Y(),
@ -1158,53 +1141,41 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh,
LocalH loch2 (mpmin, mpmax, 1); LocalH loch2 (mpmin, mpmax, 1);
if (mp.maxh < maxh) maxh = mp.maxh;
if (mp.maxh < maxh) bool changed;
{
maxh = mp.maxh;
//(*testout) << "reducing maxh to " << maxh << " because of mp.maxh" << endl;
}
int changed;
do do
{ {
mesh.LocalHFunction().ClearFlags(); mesh.LocalHFunction().ClearFlags();
for (i = 1; i <= adfront->GetNF(); i++) for (int i = 1; i <= adfront->GetNF(); i++)
{ {
const MiniElement2d & el = adfront->GetFace(i); const MiniElement2d & el = adfront->GetFace(i);
Point3d pmin = adfront->GetPoint (el.PNum(1));
Point3d pmax = pmin;
for (j = 2; j <= 3; j++)
{
const Point3d & p = adfront->GetPoint (el.PNum(j));
pmin.SetToMin (p);
pmax.SetToMax (p);
}
Box<3> bbox (adfront->GetPoint (el[0]));
bbox.Add (adfront->GetPoint (el[1]));
bbox.Add (adfront->GetPoint (el[2]));
double filld = filldist * Dist (pmin, pmax);
double filld = filldist * bbox.Diam();
pmin = pmin - Vec3d (filld, filld, filld); bbox.Increase (filld);
pmax = pmax + Vec3d (filld, filld, filld);
// (*testout) << "cut : " << pmin << " - " << pmax << endl; mesh.LocalHFunction().CutBoundary (bbox); // .PMin(), bbox.PMax());
mesh.LocalHFunction().CutBoundary (pmin, pmax);
} }
locadfront = adfront; // locadfront = adfront;
mesh.LocalHFunction().FindInnerBoxes (adfront, NULL); mesh.LocalHFunction().FindInnerBoxes (adfront, NULL);
npoints.SetSize(0); npoints.SetSize(0);
mesh.LocalHFunction().GetInnerPoints (npoints); mesh.LocalHFunction().GetInnerPoints (npoints);
changed = 0; changed = false;
for (i = 1; i <= npoints.Size(); i++) for (int i = 1; i <= npoints.Size(); i++)
{ {
if (mesh.LocalHFunction().GetH(npoints.Get(i)) > 1.5 * maxh) if (mesh.LocalHFunction().GetH(npoints.Get(i)) > 1.5 * maxh)
{ {
mesh.LocalHFunction().SetH (npoints.Get(i), maxh); mesh.LocalHFunction().SetH (npoints.Get(i), maxh);
changed = 1; changed = true;
} }
} }
} }
@ -1212,7 +1183,7 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh,
if (debugparam.slowchecks) if (debugparam.slowchecks)
(*testout) << "Blockfill with points: " << endl; (*testout) << "Blockfill with points: " << endl;
for (i = 1; i <= npoints.Size(); i++) for (int i = 1; i <= npoints.Size(); i++)
{ {
if (meshbox.IsIn (npoints.Get(i))) if (meshbox.IsIn (npoints.Get(i)))
{ {
@ -1238,13 +1209,13 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh,
loch2.ClearFlags(); loch2.ClearFlags();
for (i = 1; i <= adfront->GetNF(); i++) for (int i = 1; i <= adfront->GetNF(); i++)
{ {
const MiniElement2d & el = adfront->GetFace(i); const MiniElement2d & el = adfront->GetFace(i);
Point3d pmin = adfront->GetPoint (el.PNum(1)); Point3d pmin = adfront->GetPoint (el.PNum(1));
Point3d pmax = pmin; Point3d pmax = pmin;
for (j = 2; j <= 3; j++) for (int j = 2; j <= 3; j++)
{ {
const Point3d & p = adfront->GetPoint (el.PNum(j)); const Point3d & p = adfront->GetPoint (el.PNum(j));
pmin.SetToMin (p); pmin.SetToMin (p);
@ -1254,13 +1225,13 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh,
loch2.SetH (Center (pmin, pmax), Dist (pmin, pmax)); loch2.SetH (Center (pmin, pmax), Dist (pmin, pmax));
} }
for (i = 1; i <= adfront->GetNF(); i++) for (int i = 1; i <= adfront->GetNF(); i++)
{ {
const MiniElement2d & el = adfront->GetFace(i); const MiniElement2d & el = adfront->GetFace(i);
Point3d pmin = adfront->GetPoint (el.PNum(1)); Point3d pmin = adfront->GetPoint (el.PNum(1));
Point3d pmax = pmin; Point3d pmax = pmin;
for (j = 2; j <= 3; j++) for (int j = 2; j <= 3; j++)
{ {
const Point3d & p = adfront->GetPoint (el.PNum(j)); const Point3d & p = adfront->GetPoint (el.PNum(j));
pmin.SetToMin (p); pmin.SetToMin (p);
@ -1270,16 +1241,17 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh,
double filld = filldist * Dist (pmin, pmax); double filld = filldist * Dist (pmin, pmax);
pmin = pmin - Vec3d (filld, filld, filld); pmin = pmin - Vec3d (filld, filld, filld);
pmax = pmax + Vec3d (filld, filld, filld); pmax = pmax + Vec3d (filld, filld, filld);
loch2.CutBoundary (pmin, pmax); // loch2.CutBoundary (pmin, pmax);
loch2.CutBoundary (Box<3> (pmin, pmax)); // pmin, pmax);
} }
locadfront = adfront; // locadfront = adfront;
loch2.FindInnerBoxes (adfront, NULL); loch2.FindInnerBoxes (adfront, NULL);
npoints.SetSize(0); npoints.SetSize(0);
loch2.GetOuterPoints (npoints); loch2.GetOuterPoints (npoints);
for (i = 1; i <= npoints.Size(); i++) for (int i = 1; i <= npoints.Size(); i++)
{ {
if (meshbox.IsIn (npoints.Get(i))) if (meshbox.IsIn (npoints.Get(i)))
{ {

View File

@ -496,6 +496,8 @@ proc saveoptions { } {
puts $datei "stloptions.recalchopt ${stloptions.recalchopt}" puts $datei "stloptions.recalchopt ${stloptions.recalchopt}"
puts $datei "visoptions.subdivisions ${visoptions.subdivisions}" puts $datei "visoptions.subdivisions ${visoptions.subdivisions}"
puts $datei "visoptions.autoredraw ${visoptions.autoredraw}"
puts $datei "visoptions.autoredrawtime ${visoptions.autoredrawtime}"
# trafo options # trafo options

View File

@ -66,7 +66,7 @@ int main (int argc, char ** argv)
Ng_Meshing_Parameters mp; Ng_Meshing_Parameters mp;
mp.maxh = 1.0e+6; mp.maxh = 1.0e+6;
mp.fineness = 0.4; mp.fineness = 0.4;
mp.secondorder = 0; mp.second_order = 0;
cout << "Initialise the STL Geometry structure...." << endl; cout << "Initialise the STL Geometry structure...." << endl;
ng_res = Ng_STL_InitSTLGeometry(stl_geom); ng_res = Ng_STL_InitSTLGeometry(stl_geom);

View File

@ -63,7 +63,7 @@ int main (int argc, char ** argv)
Ng_Meshing_Parameters mp; Ng_Meshing_Parameters mp;
mp.maxh = 1e6; mp.maxh = 1e6;
mp.fineness = 1; mp.fineness = 1;
mp.secondorder = 0; mp.second_order = 0;
cout << "start meshing" << endl; cout << "start meshing" << endl;
Ng_GenerateVolumeMesh (mesh, &mp); Ng_GenerateVolumeMesh (mesh, &mp);