little polish

This commit is contained in:
Joachim Schoeberl 2024-12-24 00:52:38 +01:00
parent 209863d79e
commit abe18a9b74
10 changed files with 59 additions and 43 deletions

View File

@ -29,11 +29,10 @@ class NgBitArray
public: public:
[[ deprecated ("use BitArray instead")]] // [[ deprecated ("use BitArray instead")]]
DLL_HEADER NgBitArray (); DLL_HEADER NgBitArray ();
/// ///
[[ deprecated ("use BitArray instead")]] // [[ deprecated ("use BitArray instead")]]
DLL_HEADER NgBitArray (INDEX asize); DLL_HEADER NgBitArray (INDEX asize);
/// ///
DLL_HEADER ~NgBitArray (); DLL_HEADER ~NgBitArray ();

View File

@ -341,8 +341,6 @@ namespace netgen
pmin(i) = 1e99; pmin(i) = 1e99;
pmax(i) = -1e99; pmax(i) = -1e99;
} }
// pmin = Point<D> (1e99, 1e99, 1e99);
// pmax = Point<D> (-1e99, -1e99, -1e99);
} }
const Point<D> & PMin () const { return pmin; } const Point<D> & PMin () const { return pmin; }

View File

@ -210,8 +210,8 @@ public:
/// ///
int GetNFL () const { return nfl; } int GetNFL () const { return nfl; }
const FrontLine & GetLine (int nr) { return lines[nr]; } const FrontLine & GetLine (int nr) const { return lines[nr]; }
const FrontPoint2 & GetPoint (int nr) { return points[nr]; } const FrontPoint2 & GetPoint (int nr) const { return points[nr]; }
const auto & GetLines () const { return lines; } const auto & GetLines () const { return lines; }
/// ///

View File

@ -562,7 +562,7 @@ namespace netgen
void Delaunay1 (Mesh & mesh, int domainnr, const MeshingParameters & mp, AdFront3 * adfront, void Delaunay1 (Mesh & mesh, int domainnr, const MeshingParameters & mp, const AdFront3 & adfront,
NgArray<DelaunayTet> & tempels, NgArray<DelaunayTet> & tempels,
int oldnp, DelaunayTet & startel, Point3d & pmin, Point3d & pmax) int oldnp, DelaunayTet & startel, Point3d & pmin, Point3d & pmax)
{ {
@ -573,7 +573,7 @@ namespace netgen
Box<3> bbox(Box<3>::EMPTY_BOX); Box<3> bbox(Box<3>::EMPTY_BOX);
for (auto & face : adfront->Faces()) for (auto & face : adfront.Faces())
for (PointIndex pi : face.Face().PNums()) for (PointIndex pi : face.Face().PNums())
bbox.Add (mesh.Point(pi)); bbox.Add (mesh.Point(pi));
@ -610,7 +610,7 @@ namespace netgen
Array<bool, PointIndex> usep(np); Array<bool, PointIndex> usep(np);
usep = false; usep = false;
for (auto & face : adfront->Faces()) for (auto & face : adfront.Faces())
for (PointIndex pi : face.Face().PNums()) for (PointIndex pi : face.Face().PNums())
usep[pi] = true; usep[pi] = true;
@ -1088,7 +1088,7 @@ namespace netgen
} }
} }
void DelaunayRemoveOuter( const Mesh & mesh, NgArray<DelaunayTet> & tempels, AdFront3 * adfront ) void DelaunayRemoveOuter( const Mesh & mesh, NgArray<DelaunayTet> & tempels, const AdFront3 & adfront )
{ {
static Timer trem_outer("Delaunay - remove outer"); RegionTimer rt(trem_outer); static Timer trem_outer("Delaunay - remove outer"); RegionTimer rt(trem_outer);
@ -1326,7 +1326,7 @@ namespace netgen
Point3d ci = Center (p1, p2, p3, p4); Point3d ci = Center (p1, p2, p3, p4);
inside = adfront->Inside (ci); inside = adfront.Inside (ci);
/* /*
cout << "startel: " << i << endl; cout << "startel: " << i << endl;
@ -1408,7 +1408,7 @@ namespace netgen
// if (adfront->Inside (ci) != adfront->Inside (Center (ci, p1))) // if (adfront->Inside (ci) != adfront->Inside (Center (ci, p1)))
// cout << "ERROR: outer test unclear !!!" << endl; // cout << "ERROR: outer test unclear !!!" << endl;
if (inner.Test(i) != adfront->Inside (ci)) if (inner.Test(i) != adfront.Inside (ci))
{ {
/* /*
cout << "ERROR: outer test wrong !!!" cout << "ERROR: outer test wrong !!!"
@ -1436,7 +1436,7 @@ namespace netgen
} }
if (adfront->Inside(ci)) if (adfront.Inside(ci))
outer.Clear(i); outer.Clear(i);
else else
outer.SetBit(i); outer.SetBit(i);
@ -1565,7 +1565,7 @@ namespace netgen
int np = mesh.GetNP(); int np = mesh.GetNP();
Delaunay1 (mesh, domainnr, mp, adfront, tempels, oldnp, startel, pmin, pmax); Delaunay1 (mesh, domainnr, mp, *adfront, tempels, oldnp, startel, pmin, pmax);
{ {
// improve delaunay - mesh by swapping !!!! // improve delaunay - mesh by swapping !!!!
@ -1668,7 +1668,7 @@ namespace netgen
NgArray<int> openels; NgArray<int> openels;
DelaunayRemoveTwoTriaTets(mesh, tempels, openels); DelaunayRemoveTwoTriaTets(mesh, tempels, openels);
DelaunayRemoveIntersecting(mesh, tempels, openels, pmin, pmax); DelaunayRemoveIntersecting(mesh, tempels, openels, pmin, pmax);
DelaunayRemoveOuter(mesh, tempels, adfront); DelaunayRemoveOuter(mesh, tempels, *adfront);
for (int i = 0; i < tempels.Size(); i++) for (int i = 0; i < tempels.Size(); i++)
{ {

View File

@ -427,7 +427,7 @@ namespace netgen
} }
tcut.Stop(); tcut.Stop();
mesh.LocalHFunction().FindInnerBoxes (&adfront, NULL); mesh.LocalHFunction().FindInnerBoxes (adfront, NULL);
npoints.SetSize(0); npoints.SetSize(0);
mesh.LocalHFunction().GetInnerPoints (npoints); mesh.LocalHFunction().GetInnerPoints (npoints);
@ -521,7 +521,7 @@ namespace netgen
loch2.CutBoundary (bbox); loch2.CutBoundary (bbox);
} }
loch2.FindInnerBoxes (&adfront, NULL); loch2.FindInnerBoxes (adfront, NULL);
// outer points : smooth mesh-grading // outer points : smooth mesh-grading
npoints.SetSize(0); npoints.SetSize(0);

View File

@ -489,14 +489,14 @@ namespace netgen
void LocalH :: FindInnerBoxes (AdFront3 * adfront, void LocalH :: FindInnerBoxes (const AdFront3 & adfront,
int (*testinner)(const Point3d & p1)) int (*testinner)(const Point3d & p1))
{ {
static Timer timer("LocalH::FindInnerBoxes"); static Timer timer("LocalH::FindInnerBoxes");
RegionTimer reg (timer); RegionTimer reg (timer);
int nf = adfront->GetNF(); int nf = adfront.GetNF();
for (int i = 0; i < boxes.Size(); i++) for (int i = 0; i < boxes.Size(); i++)
boxes[i] -> flags.isinner = 0; boxes[i] -> flags.isinner = 0;
@ -509,7 +509,7 @@ namespace netgen
// Point3d rx1 = rpmid - rv; // Point3d rx1 = rpmid - rv;
root->flags.pinner = !adfront->SameSide (rpmid, rx2); root->flags.pinner = !adfront.SameSide (rpmid, rx2);
if (testinner) if (testinner)
(*testout) << "inner = " << root->flags.pinner << " =?= " (*testout) << "inner = " << root->flags.pinner << " =?= "
@ -521,7 +521,7 @@ namespace netgen
for (int i = 1; i <= nf; i++) for (int i = 1; i <= nf; i++)
{ {
faceinds.Elem(i) = i; faceinds.Elem(i) = i;
adfront->GetFaceBoundingBox(i, faceboxes.Elem(i)); adfront.GetFaceBoundingBox(i, faceboxes.Elem(i));
} }
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
@ -531,7 +531,7 @@ namespace netgen
void LocalH :: void LocalH ::
FindInnerBoxesRec2 (GradingBox * box, FindInnerBoxesRec2 (GradingBox * box,
class AdFront3 * adfront, const AdFront3 & adfront,
NgArray<Box3d> & faceboxes, NgArray<Box3d> & faceboxes,
NgArray<int> & faceinds, int nfinbox) NgArray<int> & faceinds, int nfinbox)
{ {
@ -592,7 +592,7 @@ namespace netgen
box->flags.pinner = 1; box->flags.pinner = 1;
else else
{ {
if (adfront->SameSide (c, cf, &faceused2)) if (adfront.SameSide (c, cf, &faceused2))
box->flags.pinner = father->flags.pinner; box->flags.pinner = father->flags.pinner;
else else
box->flags.pinner = 1 - father->flags.pinner; box->flags.pinner = 1 - father->flags.pinner;
@ -644,7 +644,7 @@ namespace netgen
void LocalH :: FindInnerBoxes (AdFront2 * adfront, void LocalH :: FindInnerBoxes (const AdFront2 & adfront,
int (*testinner)(const Point<2> & p1)) int (*testinner)(const Point<2> & p1))
{ {
static Timer t("LocalH::FindInnerBoxes 2d"); RegionTimer reg (t); static Timer t("LocalH::FindInnerBoxes 2d"); RegionTimer reg (t);
@ -667,23 +667,23 @@ namespace netgen
// Point<2> rx1 = rpmid - rv; // Point<2> rx1 = rpmid - rv;
root->flags.pinner = !adfront->SameSide (rpmid, rx2); root->flags.pinner = !adfront.SameSide (rpmid, rx2);
if (testinner) if (testinner)
(*testout) << "inner = " << root->flags.pinner << " =?= " (*testout) << "inner = " << root->flags.pinner << " =?= "
<< testinner(rpmid) << endl; << testinner(rpmid) << endl;
int nf = adfront->GetNFL(); int nf = adfront.GetNFL();
Array<int> faceinds(nf); Array<int> faceinds(nf);
Array<Box<2>> faceboxes(nf); Array<Box<2>> faceboxes(nf);
for (int i = 0; i < nf; i++) for (int i = 0; i < nf; i++)
{ {
faceinds[i] = i; faceinds[i] = i;
const FrontLine & line = adfront->GetLine(i); const FrontLine & line = adfront.GetLine(i);
Point<3> p1 = adfront->GetPoint (line.L().I1()); Point<3> p1 = adfront.GetPoint (line.L().I1());
Point<3> p2 = adfront->GetPoint (line.L().I2()); Point<3> p2 = adfront.GetPoint (line.L().I2());
faceboxes[i].Set (Point<2> (p1(0), p1(1))); faceboxes[i].Set (Point<2> (p1(0), p1(1)));
faceboxes[i].Add (Point<2> (p2(0), p2(1))); faceboxes[i].Add (Point<2> (p2(0), p2(1)));
@ -697,7 +697,7 @@ namespace netgen
void LocalH :: void LocalH ::
FindInnerBoxesRec2 (GradingBox * box, FindInnerBoxesRec2 (GradingBox * box,
class AdFront2 * adfront, const class AdFront2 & adfront,
FlatArray<Box<2>> faceboxes, FlatArray<Box<2>> faceboxes,
FlatArray<int> faceinds) // , int nfinbox) FlatArray<int> faceinds) // , int nfinbox)
{ {
@ -743,7 +743,7 @@ namespace netgen
// bool sameside = adfront->SameSide (c2d, cf2d, &faceused2); // bool sameside = adfront->SameSide (c2d, cf2d, &faceused2);
auto sub = faceinds.Range(0, iused); auto sub = faceinds.Range(0, iused);
bool sameside = adfront->SameSide (c, fc, &sub); bool sameside = adfront.SameSide (c, fc, &sub);
if (sameside) if (sameside)
box->flags.pinner = father->flags.pinner; box->flags.pinner = father->flags.pinner;
else else

View File

@ -121,10 +121,10 @@ namespace netgen
{ CutBoundaryRec (box.PMin(), box.PMax(), root); } { CutBoundaryRec (box.PMin(), box.PMax(), root); }
/// find inner boxes /// find inner boxes
void FindInnerBoxes (class AdFront3 * adfront, void FindInnerBoxes (const class AdFront3 & adfront,
int (*testinner)(const Point3d & p1)); int (*testinner)(const Point3d & p1));
void FindInnerBoxes (class AdFront2 * adfront, void FindInnerBoxes (const class AdFront2 & adfront,
int (*testinner)(const Point<2> & p1)); int (*testinner)(const Point<2> & p1));
@ -166,7 +166,7 @@ namespace netgen
/// ///
void FindInnerBoxesRec2 (GradingBox * box, void FindInnerBoxesRec2 (GradingBox * box,
class AdFront3 * adfront, const class AdFront3 & adfront,
NgArray<Box3d> & faceboxes, NgArray<Box3d> & faceboxes,
NgArray<int> & finds, int nfinbox); NgArray<int> & finds, int nfinbox);
@ -177,7 +177,7 @@ namespace netgen
/// ///
void FindInnerBoxesRec2 (GradingBox * box, void FindInnerBoxesRec2 (GradingBox * box,
class AdFront2 * adfront, const class AdFront2 & adfront,
FlatArray<Box<2>> faceboxes, FlatArray<Box<2>> faceboxes,
FlatArray<int> finds); // , int nfinbox); FlatArray<int> finds); // , int nfinbox);

View File

@ -2232,7 +2232,7 @@ namespace netgen
cerr << "illegal element for buildboundaryedges" << endl; cerr << "illegal element for buildboundaryedges" << endl;
} }
/*
for (int i = 0; i < openelements.Size(); i++) for (int i = 0; i < openelements.Size(); i++)
{ {
const Element2d & sel = openelements[i]; const Element2d & sel = openelements[i];
@ -2247,7 +2247,18 @@ namespace netgen
points[sel[j]].SetType(FIXEDPOINT); points[sel[j]].SetType(FIXEDPOINT);
} }
} }
*/
for (const Element2d & sel : openelements)
for (int j = 0; j < sel.GetNP(); j++)
{
PointIndices<2> i2 { sel.PNumMod(j+1), sel.PNumMod(j+2) };
i2.Sort();
boundaryedges->Set (i2, 1);
points[sel[j]].SetType(FIXEDPOINT);
}
/*
for (int i = 0; i < GetNSeg(); i++) for (int i = 0; i < GetNSeg(); i++)
{ {
const Segment & seg = segments[i]; const Segment & seg = segments[i];
@ -2257,7 +2268,15 @@ namespace netgen
boundaryedges -> Set (i2, 2); boundaryedges -> Set (i2, 2);
//segmentht -> Set (i2, i); //segmentht -> Set (i2, i);
} }
*/
for (const Segment & seg : segments)
{
PointIndices<2> i2 { seg[0], seg[1] };
i2.Sort();
boundaryedges -> Set (i2, 2);
//segmentht -> Set (i2, i);
}
} }

View File

@ -24,7 +24,7 @@ Meshing3 :: Meshing3 (const string & rulefilename)
tolfak = 1; tolfak = 1;
LoadRules (rulefilename.c_str(), NULL); LoadRules (rulefilename.c_str(), NULL);
adfront = new AdFront3; adfront = make_unique<AdFront3>();
problems.SetSize (rules.Size()); problems.SetSize (rules.Size());
foundmap.SetSize (rules.Size()); foundmap.SetSize (rules.Size());
@ -46,7 +46,7 @@ Meshing3 :: Meshing3 (const char ** rulep)
tolfak = 1; tolfak = 1;
LoadRules (NULL, rulep); LoadRules (NULL, rulep);
adfront = new AdFront3; adfront = make_unique<AdFront3>();
problems.SetSize (rules.Size()); problems.SetSize (rules.Size());
foundmap.SetSize (rules.Size()); foundmap.SetSize (rules.Size());
@ -64,7 +64,7 @@ Meshing3 :: Meshing3 (const char ** rulep)
Meshing3 :: ~Meshing3 () Meshing3 :: ~Meshing3 ()
{ {
delete adfront; // delete adfront;
for (int i = 0; i < rules.Size(); i++) for (int i = 0; i < rules.Size(); i++)
{ {
delete [] problems[i]; delete [] problems[i];
@ -1185,7 +1185,7 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh,
tbox.Stop(); tbox.Stop();
// locadfront = adfront; // locadfront = adfront;
loch.FindInnerBoxes (adfront, NULL); loch.FindInnerBoxes (*adfront, NULL);
npoints.SetSize(0); npoints.SetSize(0);
loch.GetInnerPoints (npoints); loch.GetInnerPoints (npoints);
@ -1271,7 +1271,7 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh,
tloch2.Stop(); tloch2.Stop();
// locadfront = adfront; // locadfront = adfront;
loch2.FindInnerBoxes (adfront, NULL); loch2.FindInnerBoxes (*adfront, NULL);
npoints.SetSize(0); npoints.SetSize(0);
loch2.GetOuterPoints (npoints); loch2.GetOuterPoints (npoints);

View File

@ -22,7 +22,7 @@ enum MESHING3_RESULT
class Meshing3 class Meshing3
{ {
/// current state of front /// current state of front
AdFront3 * adfront; unique_ptr<AdFront3> adfront;
/// 3d generation rules /// 3d generation rules
NgArray<vnetrule*> rules; NgArray<vnetrule*> rules;
/// counts how often a rule is used /// counts how often a rule is used