rever PrepareForBlockFillLocalH stuff, copy only relevant part of LocalH tree

This commit is contained in:
Matthias Hochsteger 2021-07-16 18:49:05 +02:00
parent e5e8882d07
commit 8687b540c6
3 changed files with 31 additions and 90 deletions

View File

@ -260,26 +260,6 @@ namespace netgen
}
}
void PrepareForBlockFillLocalH(MeshingData & md)
{
static Timer t("PrepareForBlockFillLocalH"); RegionTimer rt(t);
md.meshing = make_unique<Meshing3>(nullptr);
auto & mesh = *md.mesh;
mesh.CalcSurfacesOfNode();
mesh.FindOpenElements(md.domain);
for (PointIndex pi : mesh.Points().Range())
md.meshing->AddPoint (mesh[pi], pi);
for (int i = 1; i <= mesh.GetNOpenElements(); i++)
md.meshing->AddBoundaryElement (mesh.OpenElement(i));
if (mesh.HasLocalHFunction())
md.meshing->PrepareBlockFillLocalH(mesh, md.mp);
}
void MeshDomain( MeshingData & md)
{
@ -287,6 +267,16 @@ namespace netgen
auto domain = md.domain;
MeshingParameters & mp = md.mp;
mesh.CalcSurfacesOfNode();
mesh.FindOpenElements(md.domain);
md.meshing = make_unique<Meshing3>(nullptr);
for (PointIndex pi : mesh.Points().Range())
md.meshing->AddPoint (mesh[pi], pi);
for (int i = 1; i <= mesh.GetNOpenElements(); i++)
md.meshing->AddBoundaryElement (mesh.OpenElement(i));
if (mp.delaunay && mesh.GetNOpenElements())
{
int oldne = mesh.GetNE();
@ -767,13 +757,6 @@ namespace netgen
ParallelFor( md.Range(), [&](int i)
{
CloseOpenQuads( md[i] );
});
for(auto & md_ : md)
PrepareForBlockFillLocalH(md_);
ParallelFor( md.Range(), [&](int i)
{
MeshDomain(md[i]);
});

View File

@ -1094,10 +1094,11 @@ static int TestSameSide (const Point3d & p1, const Point3d & p2)
*/
void Meshing3 :: PrepareBlockFillLocalH (Mesh & mesh,
void Meshing3 :: BlockFillLocalH (Mesh & mesh,
const MeshingParameters & mp)
{
static Timer t("Mesing3::PrepareBlockFillLocalH"); RegionTimer reg(t);
static Timer t("Mesing3::BlockFillLocalH"); RegionTimer reg(t);
double filldist = mp.filldist;
@ -1106,10 +1107,12 @@ void Meshing3 :: PrepareBlockFillLocalH (Mesh & mesh,
PrintMessage (3, "blockfill local h");
NgArray<Point<3> > npoints;
adfront -> CreateTrees();
Box<3> bbox ( Box<3>::EMPTY_BOX );
double maxh = 0;
Box<3> bounding_box(Box<3>::EMPTY_BOX);
for (int i = 1; i <= adfront->GetNF(); i++)
{
@ -1118,19 +1121,31 @@ void Meshing3 :: PrepareBlockFillLocalH (Mesh & mesh,
{
const Point3d & p1 = adfront->GetPoint (el.PNumMod(j));
const Point3d & p2 = adfront->GetPoint (el.PNumMod(j+1));
bounding_box.Add(p1);
double hi = Dist (p1, p2);
if (hi > maxh) maxh = hi;
bbox.Add (p1);
}
}
Point3d mpmin = bbox.PMin();
Point3d mpmax = bbox.PMax();
Point3d mpc = Center (mpmin, mpmax);
double d = max3(mpmax.X()-mpmin.X(),
mpmax.Y()-mpmin.Y(),
mpmax.Z()-mpmin.Z()) / 2;
mpmin = mpc - Vec3d (d, d, d);
mpmax = mpc + Vec3d (d, d, d);
Box3d meshbox (mpmin, mpmax);
LocalH loch2 (mpmin, mpmax, 1);
if (mp.maxh < maxh) maxh = mp.maxh;
auto loch_ptr = mesh.LocalHFunction().Copy(); //bounding_box);
auto loch_ptr = mesh.LocalHFunction().Copy(bbox);
auto & loch = *loch_ptr;
// auto & loch = mesh.LocalHFunction();
bool changed;
static Timer t1("loop1");
@ -1174,61 +1189,6 @@ void Meshing3 :: PrepareBlockFillLocalH (Mesh & mesh,
}
}
while (changed);
t1.Stop();
}
void Meshing3 :: BlockFillLocalH (Mesh & mesh,
const MeshingParameters & mp)
{
static Timer t("Mesing3::BlockFillLocalH"); RegionTimer reg(t);
if (!mesh.HasLocalHFunction())
{
mesh.CalcLocalH(mp.grading);
PrepareBlockFillLocalH(mesh, mp);
}
double filldist = mp.filldist;
// (*testout) << "blockfill local h" << endl;
// (*testout) << "rel filldist = " << filldist << endl;
PrintMessage (3, "blockfill local h");
Box<3> bbox ( Box<3>::EMPTY_BOX );
double maxh = 0;
for (int i = 1; i <= adfront->GetNF(); i++)
{
const MiniElement2d & el = adfront->GetFace(i);
for (int j = 1; j <= 3; j++)
{
const Point3d & p1 = adfront->GetPoint (el.PNumMod(j));
const Point3d & p2 = adfront->GetPoint (el.PNumMod(j+1));
double hi = Dist (p1, p2);
if (hi > maxh) maxh = hi;
bbox.Add (p1);
}
}
Point3d mpmin = bbox.PMin();
Point3d mpmax = bbox.PMax();
Point3d mpc = Center (mpmin, mpmax);
double d = max3(mpmax.X()-mpmin.X(),
mpmax.Y()-mpmin.Y(),
mpmax.Z()-mpmin.Z()) / 2;
mpmin = mpc - Vec3d (d, d, d);
mpmax = mpc + Vec3d (d, d, d);
Box3d meshbox (mpmin, mpmax);
LocalH loch2 (mpmin, mpmax, 1);
if (mp.maxh < maxh) maxh = mp.maxh;
if (debugparam.slowchecks)
(*testout) << "Blockfill with points: " << endl;

View File

@ -28,7 +28,6 @@ class Meshing3
NgArray<char*> problems;
/// tolerance criterion
double tolfak;
NgArray<Point<3> > npoints;
public:
///
Meshing3 (const string & rulefilename);
@ -64,7 +63,6 @@ public:
///
void BlockFill (Mesh & mesh, double gh);
///
void PrepareBlockFillLocalH (Mesh & mesh, const MeshingParameters & mp);
void BlockFillLocalH (Mesh & mesh, const MeshingParameters & mp);
/// uses points of adfront, and puts new elements into mesh