remove timer, PointIndex::INVALID

This commit is contained in:
Joachim Schöberl 2019-08-07 07:47:08 +02:00
parent 6d383c69c0
commit bbc3661bfe
5 changed files with 35 additions and 21 deletions

View File

@ -533,7 +533,8 @@ namespace netgen
NgArray<Vec<3>,PointIndex::BASE> normals(np); NgArray<Vec<3>,PointIndex::BASE> normals(np);
for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End(); pi++) // for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End(); pi++)
for (PointIndex pi : mesh.Points().Range())
{ {
if (elementsonnode[pi].Size()) if (elementsonnode[pi].Size())
{ {

View File

@ -576,7 +576,8 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
static Timer t("MeshOptimize3d::SwapImprove"); RegionTimer reg(t); static Timer t("MeshOptimize3d::SwapImprove"); RegionTimer reg(t);
static Timer tloop("MeshOptimize3d::SwapImprove loop"); static Timer tloop("MeshOptimize3d::SwapImprove loop");
PointIndex pi3(0), pi4(0), pi5(0), pi6(0); PointIndex pi3(PointIndex::INVALID), pi4(PointIndex::INVALID),
pi5(PointIndex::INVALID), pi6(PointIndex::INVALID);
int cnt = 0; int cnt = 0;
Element el21(TET), el22(TET), el31(TET), el32(TET), el33(TET); Element el21(TET), el22(TET), el31(TET), el32(TET), el33(TET);
@ -1178,6 +1179,7 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
} }
} }
// if (goal == OPT_QUALITY)
if (nsuround >= 5) if (nsuround >= 5)
{ {
Element hel(TET); Element hel(TET);
@ -1209,7 +1211,7 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
// suroundpts.SetSize (nsuround); // suroundpts.SetSize (nsuround);
suroundpts = -17; suroundpts = PointIndex::INVALID;
suroundpts[0] = pi3; suroundpts[0] = pi3;
suroundpts[1] = pi4; suroundpts[1] = pi4;

View File

@ -169,10 +169,10 @@ MESHING3_RESULT Meshing3 ::
GenerateMesh (Mesh & mesh, const MeshingParameters & mp) GenerateMesh (Mesh & mesh, const MeshingParameters & mp)
{ {
static Timer t("Meshing3::GenerateMesh"); RegionTimer reg(t); static Timer t("Meshing3::GenerateMesh"); RegionTimer reg(t);
static Timer meshing3_timer_a("Meshing3::GenerateMesh a", 2); // static Timer meshing3_timer_a("Meshing3::GenerateMesh a", 2);
static Timer meshing3_timer_b("Meshing3::GenerateMesh b", 2); // static Timer meshing3_timer_b("Meshing3::GenerateMesh b", 2);
static Timer meshing3_timer_c("Meshing3::GenerateMesh c", 1); // static Timer meshing3_timer_c("Meshing3::GenerateMesh c", 1);
static Timer meshing3_timer_d("Meshing3::GenerateMesh d", 2); // static Timer meshing3_timer_d("Meshing3::GenerateMesh d", 2);
// static int meshing3_timer = NgProfiler::CreateTimer ("Meshing3::GenerateMesh"); // static int meshing3_timer = NgProfiler::CreateTimer ("Meshing3::GenerateMesh");
// static int meshing3_timer_a = NgProfiler::CreateTimer ("Meshing3::GenerateMesh a"); // static int meshing3_timer_a = NgProfiler::CreateTimer ("Meshing3::GenerateMesh a");
// static int meshing3_timer_b = NgProfiler::CreateTimer ("Meshing3::GenerateMesh b"); // static int meshing3_timer_b = NgProfiler::CreateTimer ("Meshing3::GenerateMesh b");
@ -293,13 +293,13 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp)
double hinner = hmax * (1 + stat.qualclass); double hinner = hmax * (1 + stat.qualclass);
double houter = hmax * (1 + 2 * stat.qualclass); double houter = hmax * (1 + 2 * stat.qualclass);
meshing3_timer_a.Start(); // meshing3_timer_a.Start();
stat.qualclass = stat.qualclass =
adfront -> GetLocals (baseelem, locpoints, locfaces, adfront -> GetLocals (baseelem, locpoints, locfaces,
pindex, findex, connectedpairs, pindex, findex, connectedpairs,
houter, hinner, houter, hinner,
locfacesplit); locfacesplit);
meshing3_timer_a.Stop(); // meshing3_timer_a.Stop();
// (*testout) << "locfaces = " << endl << locfaces << endl; // (*testout) << "locfaces = " << endl << locfaces << endl;
@ -355,7 +355,7 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp)
if (stat.qualclass >= mp.starshapeclass && if (stat.qualclass >= mp.starshapeclass &&
mp.baseelnp != 4) mp.baseelnp != 4)
{ {
NgProfiler::RegionTimer reg1 (meshing3_timer_b); // NgProfiler::RegionTimer reg1 (meshing3_timer_b);
// star-shaped domain removing // star-shaped domain removing
grouppoints.SetSize (0); grouppoints.SetSize (0);
@ -478,7 +478,7 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp)
} }
// NgProfiler::StartTimer (meshing3_timer_c); // NgProfiler::StartTimer (meshing3_timer_c);
meshing3_timer_c.Start(); // meshing3_timer_c.Start();
found = ApplyRules (plainpoints, allowpoint, found = ApplyRules (plainpoints, allowpoint,
locfaces, locfacesplit, connectedpairs, locfaces, locfacesplit, connectedpairs,
@ -488,12 +488,12 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp)
if (found >= 0) impossible = 0; if (found >= 0) impossible = 0;
if (found < 0) found = 0; if (found < 0) found = 0;
meshing3_timer_c.Stop(); // meshing3_timer_c.Stop();
// NgProfiler::StopTimer (meshing3_timer_c); // NgProfiler::StopTimer (meshing3_timer_c);
if (!found) loktestmode = 0; if (!found) loktestmode = 0;
NgProfiler::RegionTimer reg2 (meshing3_timer_d); // NgProfiler::RegionTimer reg2 (meshing3_timer_d);
if (loktestmode) if (loktestmode)
{ {

View File

@ -153,13 +153,24 @@ namespace netgen
{ {
int i; int i;
public: public:
class t_invalid { };
static constexpr t_invalid INVALID;
PointIndex () = default; PointIndex () = default;
PointIndex (const PointIndex&) = default; PointIndex (const PointIndex&) = default;
PointIndex (PointIndex &&) = default; PointIndex (PointIndex &&) = default;
PointIndex & operator= (const PointIndex&) = default; PointIndex & operator= (const PointIndex&) = default;
PointIndex & operator= (PointIndex&&) = default; PointIndex & operator= (PointIndex&&) = default;
PointIndex (int ai) : i(ai) { ; } PointIndex (int ai) : i(ai)
{
#ifdef DEBUG
if (ai < PointIndex::BASE)
cout << "illegal PointIndex, use PointIndex::INVALID instead" << endl;
// throw Exception("illegal PointIndex, use PointIndex::INVALID instead");
#endif
}
PointIndex (t_invalid inv) : i(PointIndex::BASE-1) { ; }
// PointIndex & operator= (const PointIndex &ai) { i = ai.i; return *this; } // PointIndex & operator= (const PointIndex &ai) { i = ai.i; return *this; }
operator int () const { return i; } operator int () const { return i; }
PointIndex operator++ (int) { PointIndex hi(*this); i++; return hi; } PointIndex operator++ (int) { PointIndex hi(*this); i++; return hi; }

View File

@ -63,11 +63,11 @@ int Meshing3 :: ApplyRules
) )
{ {
static Timer t("ruler3 - all"); RegionTimer reg(t); // static Timer t("ruler3 - all"); RegionTimer reg(t);
static Timer tstart("ruler3 - rule start"); // static Timer tstart("ruler3 - rule start");
static Timer tloop("ruler3 - rule loop"); // static Timer tloop("ruler3 - rule loop");
tstart.Start(); // tstart.Start();
float err, minerr, teterr, minteterr; float err, minerr, teterr, minteterr;
char ok, found, hc; char ok, found, hc;
// vnetrule * rule; // vnetrule * rule;
@ -224,8 +224,8 @@ int Meshing3 :: ApplyRules
// check each rule: // check each rule:
tstart.Stop(); // tstart.Stop();
tloop.Start(); // tloop.Start();
for (int ri = 1; ri <= rules.Size(); ri++) for (int ri = 1; ri <= rules.Size(); ri++)
{ {
int base = (lfaces[0].GetNP() == 3) ? 100 : 200; int base = (lfaces[0].GetNP() == 3) ? 100 : 200;
@ -1115,7 +1115,7 @@ int Meshing3 :: ApplyRules
if (loktestmode) if (loktestmode)
(*testout) << "end rule" << endl; (*testout) << "end rule" << endl;
} }
tloop.Stop(); // tloop.Stop();
if (found) if (found)
{ {