mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 21:30:35 +05:00
little polish
This commit is contained in:
parent
209863d79e
commit
abe18a9b74
@ -29,11 +29,10 @@ class NgBitArray
|
||||
|
||||
public:
|
||||
|
||||
[[ deprecated ("use BitArray instead")]]
|
||||
// [[ deprecated ("use BitArray instead")]]
|
||||
DLL_HEADER NgBitArray ();
|
||||
///
|
||||
[[ deprecated ("use BitArray instead")]]
|
||||
|
||||
// [[ deprecated ("use BitArray instead")]]
|
||||
DLL_HEADER NgBitArray (INDEX asize);
|
||||
///
|
||||
DLL_HEADER ~NgBitArray ();
|
||||
|
@ -341,8 +341,6 @@ namespace netgen
|
||||
pmin(i) = 1e99;
|
||||
pmax(i) = -1e99;
|
||||
}
|
||||
// pmin = Point<D> (1e99, 1e99, 1e99);
|
||||
// pmax = Point<D> (-1e99, -1e99, -1e99);
|
||||
}
|
||||
|
||||
const Point<D> & PMin () const { return pmin; }
|
||||
|
@ -210,8 +210,8 @@ public:
|
||||
///
|
||||
int GetNFL () const { return nfl; }
|
||||
|
||||
const FrontLine & GetLine (int nr) { return lines[nr]; }
|
||||
const FrontPoint2 & GetPoint (int nr) { return points[nr]; }
|
||||
const FrontLine & GetLine (int nr) const { return lines[nr]; }
|
||||
const FrontPoint2 & GetPoint (int nr) const { return points[nr]; }
|
||||
const auto & GetLines () const { return lines; }
|
||||
|
||||
///
|
||||
|
@ -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,
|
||||
int oldnp, DelaunayTet & startel, Point3d & pmin, Point3d & pmax)
|
||||
{
|
||||
@ -573,7 +573,7 @@ namespace netgen
|
||||
|
||||
Box<3> bbox(Box<3>::EMPTY_BOX);
|
||||
|
||||
for (auto & face : adfront->Faces())
|
||||
for (auto & face : adfront.Faces())
|
||||
for (PointIndex pi : face.Face().PNums())
|
||||
bbox.Add (mesh.Point(pi));
|
||||
|
||||
@ -610,7 +610,7 @@ namespace netgen
|
||||
Array<bool, PointIndex> usep(np);
|
||||
usep = false;
|
||||
|
||||
for (auto & face : adfront->Faces())
|
||||
for (auto & face : adfront.Faces())
|
||||
for (PointIndex pi : face.Face().PNums())
|
||||
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);
|
||||
|
||||
@ -1326,7 +1326,7 @@ namespace netgen
|
||||
|
||||
Point3d ci = Center (p1, p2, p3, p4);
|
||||
|
||||
inside = adfront->Inside (ci);
|
||||
inside = adfront.Inside (ci);
|
||||
|
||||
/*
|
||||
cout << "startel: " << i << endl;
|
||||
@ -1408,7 +1408,7 @@ namespace netgen
|
||||
// if (adfront->Inside (ci) != adfront->Inside (Center (ci, p1)))
|
||||
// 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 !!!"
|
||||
@ -1436,7 +1436,7 @@ namespace netgen
|
||||
|
||||
}
|
||||
|
||||
if (adfront->Inside(ci))
|
||||
if (adfront.Inside(ci))
|
||||
outer.Clear(i);
|
||||
else
|
||||
outer.SetBit(i);
|
||||
@ -1565,7 +1565,7 @@ namespace netgen
|
||||
|
||||
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 !!!!
|
||||
@ -1668,7 +1668,7 @@ namespace netgen
|
||||
NgArray<int> openels;
|
||||
DelaunayRemoveTwoTriaTets(mesh, tempels, openels);
|
||||
DelaunayRemoveIntersecting(mesh, tempels, openels, pmin, pmax);
|
||||
DelaunayRemoveOuter(mesh, tempels, adfront);
|
||||
DelaunayRemoveOuter(mesh, tempels, *adfront);
|
||||
|
||||
for (int i = 0; i < tempels.Size(); i++)
|
||||
{
|
||||
|
@ -427,7 +427,7 @@ namespace netgen
|
||||
}
|
||||
tcut.Stop();
|
||||
|
||||
mesh.LocalHFunction().FindInnerBoxes (&adfront, NULL);
|
||||
mesh.LocalHFunction().FindInnerBoxes (adfront, NULL);
|
||||
|
||||
npoints.SetSize(0);
|
||||
mesh.LocalHFunction().GetInnerPoints (npoints);
|
||||
@ -521,7 +521,7 @@ namespace netgen
|
||||
loch2.CutBoundary (bbox);
|
||||
}
|
||||
|
||||
loch2.FindInnerBoxes (&adfront, NULL);
|
||||
loch2.FindInnerBoxes (adfront, NULL);
|
||||
|
||||
// outer points : smooth mesh-grading
|
||||
npoints.SetSize(0);
|
||||
|
@ -489,14 +489,14 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
void LocalH :: FindInnerBoxes (AdFront3 * adfront,
|
||||
void LocalH :: FindInnerBoxes (const AdFront3 & adfront,
|
||||
int (*testinner)(const Point3d & p1))
|
||||
{
|
||||
static Timer timer("LocalH::FindInnerBoxes");
|
||||
RegionTimer reg (timer);
|
||||
|
||||
|
||||
int nf = adfront->GetNF();
|
||||
int nf = adfront.GetNF();
|
||||
|
||||
for (int i = 0; i < boxes.Size(); i++)
|
||||
boxes[i] -> flags.isinner = 0;
|
||||
@ -509,7 +509,7 @@ namespace netgen
|
||||
// Point3d rx1 = rpmid - rv;
|
||||
|
||||
|
||||
root->flags.pinner = !adfront->SameSide (rpmid, rx2);
|
||||
root->flags.pinner = !adfront.SameSide (rpmid, rx2);
|
||||
|
||||
if (testinner)
|
||||
(*testout) << "inner = " << root->flags.pinner << " =?= "
|
||||
@ -521,7 +521,7 @@ namespace netgen
|
||||
for (int i = 1; i <= nf; i++)
|
||||
{
|
||||
faceinds.Elem(i) = i;
|
||||
adfront->GetFaceBoundingBox(i, faceboxes.Elem(i));
|
||||
adfront.GetFaceBoundingBox(i, faceboxes.Elem(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
@ -531,7 +531,7 @@ namespace netgen
|
||||
|
||||
void LocalH ::
|
||||
FindInnerBoxesRec2 (GradingBox * box,
|
||||
class AdFront3 * adfront,
|
||||
const AdFront3 & adfront,
|
||||
NgArray<Box3d> & faceboxes,
|
||||
NgArray<int> & faceinds, int nfinbox)
|
||||
{
|
||||
@ -592,7 +592,7 @@ namespace netgen
|
||||
box->flags.pinner = 1;
|
||||
else
|
||||
{
|
||||
if (adfront->SameSide (c, cf, &faceused2))
|
||||
if (adfront.SameSide (c, cf, &faceused2))
|
||||
box->flags.pinner = father->flags.pinner;
|
||||
else
|
||||
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))
|
||||
{
|
||||
static Timer t("LocalH::FindInnerBoxes 2d"); RegionTimer reg (t);
|
||||
@ -667,23 +667,23 @@ namespace netgen
|
||||
// Point<2> rx1 = rpmid - rv;
|
||||
|
||||
|
||||
root->flags.pinner = !adfront->SameSide (rpmid, rx2);
|
||||
root->flags.pinner = !adfront.SameSide (rpmid, rx2);
|
||||
|
||||
if (testinner)
|
||||
(*testout) << "inner = " << root->flags.pinner << " =?= "
|
||||
<< testinner(rpmid) << endl;
|
||||
|
||||
|
||||
int nf = adfront->GetNFL();
|
||||
int nf = adfront.GetNFL();
|
||||
Array<int> faceinds(nf);
|
||||
Array<Box<2>> faceboxes(nf);
|
||||
|
||||
for (int i = 0; i < nf; i++)
|
||||
{
|
||||
faceinds[i] = i;
|
||||
const FrontLine & line = adfront->GetLine(i);
|
||||
Point<3> p1 = adfront->GetPoint (line.L().I1());
|
||||
Point<3> p2 = adfront->GetPoint (line.L().I2());
|
||||
const FrontLine & line = adfront.GetLine(i);
|
||||
Point<3> p1 = adfront.GetPoint (line.L().I1());
|
||||
Point<3> p2 = adfront.GetPoint (line.L().I2());
|
||||
|
||||
faceboxes[i].Set (Point<2> (p1(0), p1(1)));
|
||||
faceboxes[i].Add (Point<2> (p2(0), p2(1)));
|
||||
@ -697,7 +697,7 @@ namespace netgen
|
||||
|
||||
void LocalH ::
|
||||
FindInnerBoxesRec2 (GradingBox * box,
|
||||
class AdFront2 * adfront,
|
||||
const class AdFront2 & adfront,
|
||||
FlatArray<Box<2>> faceboxes,
|
||||
FlatArray<int> faceinds) // , int nfinbox)
|
||||
{
|
||||
@ -743,7 +743,7 @@ namespace netgen
|
||||
|
||||
// bool sameside = adfront->SameSide (c2d, cf2d, &faceused2);
|
||||
auto sub = faceinds.Range(0, iused);
|
||||
bool sameside = adfront->SameSide (c, fc, &sub);
|
||||
bool sameside = adfront.SameSide (c, fc, &sub);
|
||||
if (sameside)
|
||||
box->flags.pinner = father->flags.pinner;
|
||||
else
|
||||
|
@ -121,10 +121,10 @@ namespace netgen
|
||||
{ CutBoundaryRec (box.PMin(), box.PMax(), root); }
|
||||
|
||||
/// find inner boxes
|
||||
void FindInnerBoxes (class AdFront3 * adfront,
|
||||
void FindInnerBoxes (const class AdFront3 & adfront,
|
||||
int (*testinner)(const Point3d & p1));
|
||||
|
||||
void FindInnerBoxes (class AdFront2 * adfront,
|
||||
void FindInnerBoxes (const class AdFront2 & adfront,
|
||||
int (*testinner)(const Point<2> & p1));
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ namespace netgen
|
||||
|
||||
///
|
||||
void FindInnerBoxesRec2 (GradingBox * box,
|
||||
class AdFront3 * adfront,
|
||||
const class AdFront3 & adfront,
|
||||
NgArray<Box3d> & faceboxes,
|
||||
NgArray<int> & finds, int nfinbox);
|
||||
|
||||
@ -177,7 +177,7 @@ namespace netgen
|
||||
|
||||
///
|
||||
void FindInnerBoxesRec2 (GradingBox * box,
|
||||
class AdFront2 * adfront,
|
||||
const class AdFront2 & adfront,
|
||||
FlatArray<Box<2>> faceboxes,
|
||||
FlatArray<int> finds); // , int nfinbox);
|
||||
|
||||
|
@ -2232,7 +2232,7 @@ namespace netgen
|
||||
cerr << "illegal element for buildboundaryedges" << endl;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
for (int i = 0; i < openelements.Size(); i++)
|
||||
{
|
||||
const Element2d & sel = openelements[i];
|
||||
@ -2247,7 +2247,18 @@ namespace netgen
|
||||
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++)
|
||||
{
|
||||
const Segment & seg = segments[i];
|
||||
@ -2257,7 +2268,15 @@ namespace netgen
|
||||
boundaryedges -> Set (i2, 2);
|
||||
//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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ Meshing3 :: Meshing3 (const string & rulefilename)
|
||||
tolfak = 1;
|
||||
|
||||
LoadRules (rulefilename.c_str(), NULL);
|
||||
adfront = new AdFront3;
|
||||
adfront = make_unique<AdFront3>();
|
||||
|
||||
problems.SetSize (rules.Size());
|
||||
foundmap.SetSize (rules.Size());
|
||||
@ -46,7 +46,7 @@ Meshing3 :: Meshing3 (const char ** rulep)
|
||||
tolfak = 1;
|
||||
|
||||
LoadRules (NULL, rulep);
|
||||
adfront = new AdFront3;
|
||||
adfront = make_unique<AdFront3>();
|
||||
|
||||
problems.SetSize (rules.Size());
|
||||
foundmap.SetSize (rules.Size());
|
||||
@ -64,7 +64,7 @@ Meshing3 :: Meshing3 (const char ** rulep)
|
||||
|
||||
Meshing3 :: ~Meshing3 ()
|
||||
{
|
||||
delete adfront;
|
||||
// delete adfront;
|
||||
for (int i = 0; i < rules.Size(); i++)
|
||||
{
|
||||
delete [] problems[i];
|
||||
@ -1185,7 +1185,7 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh,
|
||||
tbox.Stop();
|
||||
|
||||
// locadfront = adfront;
|
||||
loch.FindInnerBoxes (adfront, NULL);
|
||||
loch.FindInnerBoxes (*adfront, NULL);
|
||||
|
||||
npoints.SetSize(0);
|
||||
loch.GetInnerPoints (npoints);
|
||||
@ -1271,7 +1271,7 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh,
|
||||
tloch2.Stop();
|
||||
|
||||
// locadfront = adfront;
|
||||
loch2.FindInnerBoxes (adfront, NULL);
|
||||
loch2.FindInnerBoxes (*adfront, NULL);
|
||||
|
||||
npoints.SetSize(0);
|
||||
loch2.GetOuterPoints (npoints);
|
||||
|
@ -22,7 +22,7 @@ enum MESHING3_RESULT
|
||||
class Meshing3
|
||||
{
|
||||
/// current state of front
|
||||
AdFront3 * adfront;
|
||||
unique_ptr<AdFront3> adfront;
|
||||
/// 3d generation rules
|
||||
NgArray<vnetrule*> rules;
|
||||
/// counts how often a rule is used
|
||||
|
Loading…
Reference in New Issue
Block a user