diff --git a/libsrc/meshing/delaunay.cpp b/libsrc/meshing/delaunay.cpp index cbd2a73b..c51598b7 100644 --- a/libsrc/meshing/delaunay.cpp +++ b/libsrc/meshing/delaunay.cpp @@ -521,7 +521,6 @@ namespace netgen int oldnp, DelaunayTet & startel, Point3d & pmin, Point3d & pmax) { static Timer t("Meshing3::Delaunay1"); RegionTimer reg(t); - static Timer tloop("Meshing3::Delaunay1 loop"); Array> centers; Array radi2; @@ -632,7 +631,6 @@ namespace netgen for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++) mixed[pi] = PointIndex ( (prim * pi) % np + PointIndex::BASE ); - tloop.Start(); for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++) { if (pi % 1000 == 0) @@ -661,7 +659,6 @@ namespace netgen connected, treesearch, freelist, list, insphere, closesphere); } - tloop.Stop(); for (int i = tempels.Size(); i >= 1; i--) if (tempels.Get(i)[0] <= 0) @@ -775,14 +772,13 @@ namespace netgen // for (i = mesh.GetNP() - 3; i <= mesh.GetNP(); i++) // tempmesh.AddLockedPoint (i); - for (PointIndex pi = tempmesh.Points().Begin(); - pi < tempmesh.Points().End(); pi++) - tempmesh.AddLockedPoint (pi); + for (auto pi : tempmesh.Points().Range()) + tempmesh.AddLockedPoint (pi); - // tempmesh.PrintMemInfo(cout); + // tempmesh.PrintMemInfo(cout); // tempmesh.Save ("tempmesh.vol"); - for (int i = 1; i <= 2; i++) + for (int i = 1; i <= 4; i++) { tempmesh.FindOpenElements (); @@ -793,14 +789,14 @@ namespace netgen MeshOptimize3d meshopt(mp); // tempmesh.CalcSurfacesOfNode(); - meshopt.SwapImprove(tempmesh, OPT_CONFORM); + meshopt.SwapImprove(tempmesh, OPT_CONFORM); } MeshQuality3d (tempmesh); tempels.SetSize(0); - for (int i = 1; i <= tempmesh.GetNE(); i++) - tempels.Append (tempmesh.VolumeElement(i)); + for (auto & el : tempmesh.VolumeElements()) + tempels.Append (el); } @@ -1588,7 +1584,6 @@ namespace netgen mesh.FindOpenElements(domainnr); mesh.Compress(); - PopStatus (); } } diff --git a/libsrc/meshing/improve3.cpp b/libsrc/meshing/improve3.cpp index 943c4197..544592b3 100644 --- a/libsrc/meshing/improve3.cpp +++ b/libsrc/meshing/improve3.cpp @@ -277,9 +277,9 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh, OPTIMIZEGOAL goal) { static Timer t("MeshOptimize3d::SplitImprove"); RegionTimer reg(t); + static Timer tloop("MeshOptimize3d::SplitImprove loop"); double bad1, bad2, badmax, badlimit; - int cnt = 0; int np = mesh.GetNP(); int ne = mesh.GetNE(); @@ -319,7 +319,6 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh, PrintMessage (5, "badmax = ", badmax); badlimit = 0.5 * badmax; - boundp.Clear(); for (auto & el : mesh.SurfaceElements()) for (PointIndex pi : el.PNums()) @@ -350,6 +349,7 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh, } } + tloop.Start(); for (ElementIndex ei : mesh.VolumeElements().Range()) { Element & elem = mesh[ei]; @@ -543,7 +543,7 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh, } } } - + tloop.Stop(); mesh.Compress(); PrintMessage (5, cnt, " splits performed"); @@ -574,6 +574,7 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal, const BitArray * working_elements) { static Timer t("MeshOptimize3d::SwapImprove"); RegionTimer reg(t); + static Timer tloop("MeshOptimize3d::SwapImprove loop"); PointIndex pi3(0), pi4(0), pi5(0), pi6(0); int cnt = 0; @@ -631,7 +632,8 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal, // INDEX_2_HASHTABLE edgeused(2 * ne + 5); INDEX_2_CLOSED_HASHTABLE edgeused(12 * ne + 5); - + + tloop.Start(); for (ElementIndex ei = 0; ei < ne; ei++) { if (multithread.terminate) @@ -1405,7 +1407,7 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal, */ } // (*mycout) << endl; - + tloop.Stop(); /* cout << "edgeused: "; edgeused.PrintMemInfo(cout); diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index d1f09b91..2aea32fe 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -33,7 +33,7 @@ namespace netgen T_POINTS points; // The communicator for this mesh. Just a dummy if compiled without MPI. - MPI_Comm comm; + NgMPI_Comm comm; /// line-segments at edges Array segments; @@ -605,8 +605,8 @@ namespace netgen int AddEdgeDescriptor(const EdgeDescriptor & fd) { edgedecoding.Append(fd); return edgedecoding.Size() - 1; } - MPI_Comm GetCommunicator() const { return this->comm; } - void SetCommunicator(MPI_Comm acomm); + auto GetCommunicator() const { return this->comm; } + void SetCommunicator(NgMPI_Comm acomm); /// DLL_HEADER void SetMaterial (int domnr, const string & mat); diff --git a/libsrc/meshing/meshing3.cpp b/libsrc/meshing/meshing3.cpp index e30454d1..1aa99c83 100644 --- a/libsrc/meshing/meshing3.cpp +++ b/libsrc/meshing/meshing3.cpp @@ -732,6 +732,8 @@ enum blocktyp { BLOCKUNDEF, BLOCKINNER, BLOCKBOUND, BLOCKOUTER }; void Meshing3 :: BlockFill (Mesh & mesh, double gh) { + static Timer t("Mesing3::BlockFill"); RegionTimer reg(t); + PrintMessage (3, "Block-filling called (obsolete) "); int i, j(0), i1, i2, i3, j1, j2, j3; @@ -1096,10 +1098,12 @@ static int TestSameSide (const Point3d & p1, const Point3d & p2) void Meshing3 :: BlockFillLocalH (Mesh & mesh, const MeshingParameters & mp) { + static Timer t("Mesing3::BlockFillLocalH"); RegionTimer reg(t); + double filldist = mp.filldist; - - (*testout) << "blockfill local h" << endl; - (*testout) << "rel filldist = " << filldist << endl; + + // (*testout) << "blockfill local h" << endl; + // (*testout) << "rel filldist = " << filldist << endl; PrintMessage (3, "blockfill local h"); diff --git a/libsrc/meshing/ruler3.cpp b/libsrc/meshing/ruler3.cpp index 22c1e800..10fa5e69 100644 --- a/libsrc/meshing/ruler3.cpp +++ b/libsrc/meshing/ruler3.cpp @@ -63,8 +63,11 @@ int Meshing3 :: ApplyRules ) { - NgProfiler::RegionTimer regtot(97); + static Timer t("ruler3 - all"); RegionTimer reg(t); + static Timer tstart("ruler3 - rule start"); + static Timer tloop("ruler3 - rule loop"); + tstart.Start(); float err, minerr, teterr, minteterr; char ok, found, hc; // vnetrule * rule; @@ -76,19 +79,19 @@ int Meshing3 :: ApplyRules Array pused; // point is already mapped, number of uses - Array fused; // face is already mapped - Array pmap; // map of reference point to local point - Array pfixed; // point mapped by face-map - Array fmapi; // face in reference is mapped to face nr ... - Array fmapr; // face in reference is rotated to map - Array transfreezone; // transformed free-zone + ArrayMem fused; // face is already mapped + ArrayMem pmap; // map of reference point to local point + ArrayMem pfixed; // point mapped by face-map + ArrayMem fmapi; // face in reference is mapped to face nr ... + ArrayMem fmapr; // face in reference is rotated to map + ArrayMem transfreezone; // transformed free-zone INDEX_2_CLOSED_HASHTABLE ledges(100); // edges in local environment - Array tempnewpoints; + ArrayMem tempnewpoints; Array tempnewfaces; - Array tempdelfaces; + ArrayMem tempdelfaces; Array tempelements; - Array triboxes; // bounding boxes of local faces + ArrayMem triboxes; // bounding boxes of local faces Array pnearness; Array fnearness; @@ -221,7 +224,8 @@ int Meshing3 :: ApplyRules // check each rule: - + tstart.Stop(); + tloop.Start(); for (int ri = 1; ri <= rules.Size(); ri++) { int base = (lfaces[0].GetNP() == 3) ? 100 : 200; @@ -1111,7 +1115,8 @@ int Meshing3 :: ApplyRules if (loktestmode) (*testout) << "end rule" << endl; } - + tloop.Stop(); + if (found) { /* diff --git a/libsrc/meshing/smoothing3.cpp b/libsrc/meshing/smoothing3.cpp index 1353e156..f85af08f 100644 --- a/libsrc/meshing/smoothing3.cpp +++ b/libsrc/meshing/smoothing3.cpp @@ -923,6 +923,8 @@ double CalcTotalBad (const Mesh::T_POINTS & points, const Mesh::T_VOLELEMENTS & elements, const MeshingParameters & mp) { + static Timer t("CalcTotalBad"); RegionTimer reg(t); + double sum = 0; double elbad;