This commit is contained in:
Joachim Schöberl 2019-01-31 18:41:20 +01:00
parent 8671e2423f
commit 17a457c1fc
6 changed files with 48 additions and 29 deletions

View File

@ -602,7 +602,9 @@ namespace netgen
Array<DelaunayTet> & tempels, Array<DelaunayTet> & tempels,
int oldnp, DelaunayTet & startel, Point3d & pmin, Point3d & pmax) int oldnp, DelaunayTet & startel, Point3d & pmin, Point3d & pmax)
{ {
Array<Point<3> > centers; static Timer t("Meshing3::Delaunay1"); RegionTimer reg(t);
Array<Point<3>> centers;
Array<double> radi2; Array<double> radi2;
Point3d tpmin, tpmax; Point3d tpmin, tpmax;
@ -783,6 +785,8 @@ namespace netgen
void Meshing3 :: Delaunay (Mesh & mesh, int domainnr, const MeshingParameters & mp) void Meshing3 :: Delaunay (Mesh & mesh, int domainnr, const MeshingParameters & mp)
{ {
static Timer t("Meshing3::Delaunay"); RegionTimer reg(t);
int np, ne; int np, ne;
PrintMessage (1, "Delaunay meshing"); PrintMessage (1, "Delaunay meshing");

View File

@ -22,6 +22,8 @@ namespace netgen
void MeshOptimize3d :: CombineImprove (Mesh & mesh, void MeshOptimize3d :: CombineImprove (Mesh & mesh,
OPTIMIZEGOAL goal) OPTIMIZEGOAL goal)
{ {
static Timer t("MeshOptimize3d::CombineImprove"); RegionTimer reg(t);
int np = mesh.GetNP(); int np = mesh.GetNP();
int ne = mesh.GetNE(); int ne = mesh.GetNE();
@ -274,6 +276,8 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
void MeshOptimize3d :: SplitImprove (Mesh & mesh, void MeshOptimize3d :: SplitImprove (Mesh & mesh,
OPTIMIZEGOAL goal) OPTIMIZEGOAL goal)
{ {
static Timer t("MeshOptimize3d::SplitImprove"); RegionTimer reg(t);
double bad1, bad2, badmax, badlimit; double bad1, bad2, badmax, badlimit;
int cnt = 0; int cnt = 0;
@ -569,6 +573,8 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal, void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
const BitArray * working_elements) const BitArray * working_elements)
{ {
static Timer t("MeshOptimize3d::SwapImprove"); RegionTimer reg(t);
PointIndex pi3(0), pi4(0), pi5(0), pi6(0); PointIndex pi3(0), pi4(0), pi5(0), pi6(0);
int cnt = 0; int cnt = 0;
@ -2303,6 +2309,8 @@ void MeshOptimize3d :: SwapImproveSurface (Mesh & mesh, OPTIMIZEGOAL goal,
void MeshOptimize3d :: SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal) void MeshOptimize3d :: SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal)
{ {
static Timer t("MeshOptimize3d::SwapImprove2"); RegionTimer reg(t);
PointIndex pi1(0), pi2(0), pi3(0), pi4(0), pi5(0); PointIndex pi1(0), pi2(0), pi3(0), pi4(0), pi5(0);
Element el21(TET), el22(TET), el31(TET), el32(TET), el33(TET); Element el21(TET), el22(TET), el31(TET), el32(TET), el33(TET);

View File

@ -221,7 +221,7 @@ namespace netgen
DLL_HEADER PointIndex AddPoint (const Point3d & p, int layer = 1); DLL_HEADER PointIndex AddPoint (const Point3d & p, int layer = 1);
DLL_HEADER PointIndex AddPoint (const Point3d & p, int layer, POINTTYPE type); DLL_HEADER PointIndex AddPoint (const Point3d & p, int layer, POINTTYPE type);
int GetNP () const { return points.Size(); } auto GetNP () const { return points.Size(); }
// [[deprecated("Use Point(PointIndex) instead of int !")]] // [[deprecated("Use Point(PointIndex) instead of int !")]]
MeshPoint & Point(int i) { return points.Elem(i); } MeshPoint & Point(int i) { return points.Elem(i); }
@ -291,7 +291,7 @@ namespace netgen
timestamp = NextTimeStamp(); timestamp = NextTimeStamp();
} }
int GetNSE () const { return surfelements.Size(); } auto GetNSE () const { return surfelements.Size(); }
// [[deprecated("Use SurfaceElement(SurfaceElementIndex) instead of int !")]] // [[deprecated("Use SurfaceElement(SurfaceElementIndex) instead of int !")]]
Element2d & SurfaceElement(int i) { return surfelements.Elem(i); } Element2d & SurfaceElement(int i) { return surfelements.Elem(i); }
@ -316,7 +316,7 @@ namespace netgen
// write to pre-allocated container, thread-safe // write to pre-allocated container, thread-safe
DLL_HEADER void SetVolumeElement (ElementIndex sei, const Element & el); DLL_HEADER void SetVolumeElement (ElementIndex sei, const Element & el);
int GetNE () const { return volelements.Size(); } auto GetNE () const { return volelements.Size(); }
// [[deprecated("Use VolumeElement(ElementIndex) instead of int !")]] // [[deprecated("Use VolumeElement(ElementIndex) instead of int !")]]
Element & VolumeElement(int i) { return volelements.Elem(i); } Element & VolumeElement(int i) { return volelements.Elem(i); }

View File

@ -14,6 +14,8 @@ namespace netgen
// extern double teterrpow; // extern double teterrpow;
MESHING3_RESULT MeshVolume (MeshingParameters & mp, Mesh& mesh3d) MESHING3_RESULT MeshVolume (MeshingParameters & mp, Mesh& mesh3d)
{ {
static Timer t("MeshVolume"); RegionTimer reg(t);
int oldne; int oldne;
int meshed; int meshed;
@ -639,6 +641,8 @@ namespace netgen
Mesh & mesh3d) Mesh & mesh3d)
// const CSGeometry * geometry) // const CSGeometry * geometry)
{ {
static Timer t("OptimizeVolume"); RegionTimer reg(t);
int i; int i;
PrintMessage (1, "Volume Optimization"); PrintMessage (1, "Volume Optimization");
@ -698,6 +702,8 @@ namespace netgen
void RemoveIllegalElements (Mesh & mesh3d) void RemoveIllegalElements (Mesh & mesh3d)
{ {
static Timer t("RemoveIllegalElements"); RegionTimer reg(t);
int it = 10; int it = 10;
int nillegal, oldn; int nillegal, oldn;

View File

@ -168,12 +168,17 @@ int Meshing3 :: AddConnectedPair (const INDEX_2 & apair)
MESHING3_RESULT Meshing3 :: MESHING3_RESULT Meshing3 ::
GenerateMesh (Mesh & mesh, const MeshingParameters & mp) GenerateMesh (Mesh & mesh, const MeshingParameters & mp)
{ {
static int meshing3_timer = NgProfiler::CreateTimer ("Meshing3::GenerateMesh"); static Timer t("Meshing3::GenerateMesh"); RegionTimer reg(t);
static int meshing3_timer_a = NgProfiler::CreateTimer ("Meshing3::GenerateMesh a"); static Timer meshing3_timer_a("Meshing3::GenerateMesh a", 2);
static int meshing3_timer_b = NgProfiler::CreateTimer ("Meshing3::GenerateMesh b"); static Timer meshing3_timer_b("Meshing3::GenerateMesh b", 2);
static int meshing3_timer_c = NgProfiler::CreateTimer ("Meshing3::GenerateMesh c"); static Timer meshing3_timer_c("Meshing3::GenerateMesh c", 1);
static int meshing3_timer_d = NgProfiler::CreateTimer ("Meshing3::GenerateMesh d"); static Timer meshing3_timer_d("Meshing3::GenerateMesh d", 2);
NgProfiler::RegionTimer reg (meshing3_timer); // static int meshing3_timer = NgProfiler::CreateTimer ("Meshing3::GenerateMesh");
// static int meshing3_timer_a = NgProfiler::CreateTimer ("Meshing3::GenerateMesh a");
// static int meshing3_timer_b = NgProfiler::CreateTimer ("Meshing3::GenerateMesh b");
// static int meshing3_timer_c = NgProfiler::CreateTimer ("Meshing3::GenerateMesh c");
// static int meshing3_timer_d = NgProfiler::CreateTimer ("Meshing3::GenerateMesh d");
// NgProfiler::RegionTimer reg (meshing3_timer);
Array<Point3d, PointIndex::BASE> locpoints; // local points Array<Point3d, PointIndex::BASE> locpoints; // local points
@ -269,20 +274,16 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp)
} }
const MiniElement2d & bel = adfront->GetFace (baseelem); const MiniElement2d & bel = adfront->GetFace (baseelem);
const Point3d & p1 = adfront->GetPoint (bel[0]); const Point<3> p1 = adfront->GetPoint (bel[0]);
const Point3d & p2 = adfront->GetPoint (bel[1]); const Point<3> p2 = adfront->GetPoint (bel[1]);
const Point3d & p3 = adfront->GetPoint (bel[2]); const Point<3> p3 = adfront->GetPoint (bel[2]);
// (*testout) << endl << "base = " << bel << endl; Point<3> pmid = Center (p1, p2, p3);
Point3d pmid = Center (p1, p2, p3);
double his = (Dist (p1, p2) + Dist(p1, p3) + Dist(p2, p3)) / 3; double his = (Dist (p1, p2) + Dist(p1, p3) + Dist(p2, p3)) / 3;
double hshould; double hshould = mesh.GetH (pmid);
hshould = mesh.GetH (pmid);
if (adfront->GetFace (baseelem).GetNP() == 4) if (adfront->GetFace (baseelem).GetNP() == 4)
hshould = max2 (his, hshould); hshould = max2 (his, hshould);
@ -292,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);
NgProfiler::StartTimer (meshing3_timer_a); 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);
NgProfiler::StopTimer (meshing3_timer_a); meshing3_timer_a.Stop();
// (*testout) << "locfaces = " << endl << locfaces << endl; // (*testout) << "locfaces = " << endl << locfaces << endl;
@ -320,9 +321,6 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp)
} }
if (testmode) if (testmode)
{ {
(*testout) << "baseelem = " << baseelem << " qualclass = " << stat.qualclass << endl; (*testout) << "baseelem = " << baseelem << " qualclass = " << stat.qualclass << endl;
@ -479,7 +477,8 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp)
(*testout) << endl; (*testout) << endl;
} }
NgProfiler::StartTimer (meshing3_timer_c); // NgProfiler::StartTimer (meshing3_timer_c);
meshing3_timer_c.Start();
found = ApplyRules (plainpoints, allowpoint, found = ApplyRules (plainpoints, allowpoint,
locfaces, locfacesplit, connectedpairs, locfaces, locfacesplit, connectedpairs,
@ -489,8 +488,8 @@ 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();
NgProfiler::StopTimer (meshing3_timer_c); // NgProfiler::StopTimer (meshing3_timer_c);
if (!found) loktestmode = 0; if (!found) loktestmode = 0;

View File

@ -1353,6 +1353,8 @@ void Mesh :: ImproveMesh (const CSG eometry & geometry, OPTIMIZEGOAL goal)
void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal)
{ {
static Timer t("Mesh::ImproveMesh"); RegionTimer reg(t);
int typ = 1; int typ = 1;
(*testout) << "Improve Mesh" << "\n"; (*testout) << "Improve Mesh" << "\n";