This commit is contained in:
Joachim Schöberl 2019-02-11 21:38:05 +01:00
parent 9ced2f561f
commit 7aa5c536a8
6 changed files with 43 additions and 35 deletions

View File

@ -521,7 +521,6 @@ namespace netgen
int oldnp, DelaunayTet & startel, Point3d & pmin, Point3d & pmax) int oldnp, DelaunayTet & startel, Point3d & pmin, Point3d & pmax)
{ {
static Timer t("Meshing3::Delaunay1"); RegionTimer reg(t); static Timer t("Meshing3::Delaunay1"); RegionTimer reg(t);
static Timer tloop("Meshing3::Delaunay1 loop");
Array<Point<3>> centers; Array<Point<3>> centers;
Array<double> radi2; Array<double> radi2;
@ -632,7 +631,6 @@ namespace netgen
for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++) for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++)
mixed[pi] = PointIndex ( (prim * pi) % np + PointIndex::BASE ); mixed[pi] = PointIndex ( (prim * pi) % np + PointIndex::BASE );
tloop.Start();
for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++) for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++)
{ {
if (pi % 1000 == 0) if (pi % 1000 == 0)
@ -661,7 +659,6 @@ namespace netgen
connected, treesearch, freelist, list, insphere, closesphere); connected, treesearch, freelist, list, insphere, closesphere);
} }
tloop.Stop();
for (int i = tempels.Size(); i >= 1; i--) for (int i = tempels.Size(); i >= 1; i--)
if (tempels.Get(i)[0] <= 0) if (tempels.Get(i)[0] <= 0)
@ -775,14 +772,13 @@ namespace netgen
// for (i = mesh.GetNP() - 3; i <= mesh.GetNP(); i++) // for (i = mesh.GetNP() - 3; i <= mesh.GetNP(); i++)
// tempmesh.AddLockedPoint (i); // tempmesh.AddLockedPoint (i);
for (PointIndex pi = tempmesh.Points().Begin(); for (auto pi : tempmesh.Points().Range())
pi < tempmesh.Points().End(); pi++) tempmesh.AddLockedPoint (pi);
tempmesh.AddLockedPoint (pi);
// tempmesh.PrintMemInfo(cout); // tempmesh.PrintMemInfo(cout);
// tempmesh.Save ("tempmesh.vol"); // tempmesh.Save ("tempmesh.vol");
for (int i = 1; i <= 2; i++) for (int i = 1; i <= 4; i++)
{ {
tempmesh.FindOpenElements (); tempmesh.FindOpenElements ();
@ -793,14 +789,14 @@ namespace netgen
MeshOptimize3d meshopt(mp); MeshOptimize3d meshopt(mp);
// tempmesh.CalcSurfacesOfNode(); // tempmesh.CalcSurfacesOfNode();
meshopt.SwapImprove(tempmesh, OPT_CONFORM); meshopt.SwapImprove(tempmesh, OPT_CONFORM);
} }
MeshQuality3d (tempmesh); MeshQuality3d (tempmesh);
tempels.SetSize(0); tempels.SetSize(0);
for (int i = 1; i <= tempmesh.GetNE(); i++) for (auto & el : tempmesh.VolumeElements())
tempels.Append (tempmesh.VolumeElement(i)); tempels.Append (el);
} }
@ -1588,7 +1584,6 @@ namespace netgen
mesh.FindOpenElements(domainnr); mesh.FindOpenElements(domainnr);
mesh.Compress(); mesh.Compress();
PopStatus (); PopStatus ();
} }
} }

View File

@ -277,9 +277,9 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
OPTIMIZEGOAL goal) OPTIMIZEGOAL goal)
{ {
static Timer t("MeshOptimize3d::SplitImprove"); RegionTimer reg(t); static Timer t("MeshOptimize3d::SplitImprove"); RegionTimer reg(t);
static Timer tloop("MeshOptimize3d::SplitImprove loop");
double bad1, bad2, badmax, badlimit; double bad1, bad2, badmax, badlimit;
int cnt = 0; int cnt = 0;
int np = mesh.GetNP(); int np = mesh.GetNP();
int ne = mesh.GetNE(); int ne = mesh.GetNE();
@ -319,7 +319,6 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
PrintMessage (5, "badmax = ", badmax); PrintMessage (5, "badmax = ", badmax);
badlimit = 0.5 * badmax; badlimit = 0.5 * badmax;
boundp.Clear(); boundp.Clear();
for (auto & el : mesh.SurfaceElements()) for (auto & el : mesh.SurfaceElements())
for (PointIndex pi : el.PNums()) for (PointIndex pi : el.PNums())
@ -350,6 +349,7 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
} }
} }
tloop.Start();
for (ElementIndex ei : mesh.VolumeElements().Range()) for (ElementIndex ei : mesh.VolumeElements().Range())
{ {
Element & elem = mesh[ei]; Element & elem = mesh[ei];
@ -543,7 +543,7 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
} }
} }
} }
tloop.Stop();
mesh.Compress(); mesh.Compress();
PrintMessage (5, cnt, " splits performed"); PrintMessage (5, cnt, " splits performed");
@ -574,6 +574,7 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
const BitArray * working_elements) const BitArray * working_elements)
{ {
static Timer t("MeshOptimize3d::SwapImprove"); RegionTimer reg(t); static Timer t("MeshOptimize3d::SwapImprove"); RegionTimer reg(t);
static Timer tloop("MeshOptimize3d::SwapImprove loop");
PointIndex pi3(0), pi4(0), pi5(0), pi6(0); PointIndex pi3(0), pi4(0), pi5(0), pi6(0);
int cnt = 0; int cnt = 0;
@ -631,7 +632,8 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
// INDEX_2_HASHTABLE<int> edgeused(2 * ne + 5); // INDEX_2_HASHTABLE<int> edgeused(2 * ne + 5);
INDEX_2_CLOSED_HASHTABLE<int> edgeused(12 * ne + 5); INDEX_2_CLOSED_HASHTABLE<int> edgeused(12 * ne + 5);
tloop.Start();
for (ElementIndex ei = 0; ei < ne; ei++) for (ElementIndex ei = 0; ei < ne; ei++)
{ {
if (multithread.terminate) if (multithread.terminate)
@ -1405,7 +1407,7 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
*/ */
} }
// (*mycout) << endl; // (*mycout) << endl;
tloop.Stop();
/* /*
cout << "edgeused: "; cout << "edgeused: ";
edgeused.PrintMemInfo(cout); edgeused.PrintMemInfo(cout);

View File

@ -33,7 +33,7 @@ namespace netgen
T_POINTS points; T_POINTS points;
// The communicator for this mesh. Just a dummy if compiled without MPI. // The communicator for this mesh. Just a dummy if compiled without MPI.
MPI_Comm comm; NgMPI_Comm comm;
/// line-segments at edges /// line-segments at edges
Array<Segment, 0, size_t> segments; Array<Segment, 0, size_t> segments;
@ -605,8 +605,8 @@ namespace netgen
int AddEdgeDescriptor(const EdgeDescriptor & fd) int AddEdgeDescriptor(const EdgeDescriptor & fd)
{ edgedecoding.Append(fd); return edgedecoding.Size() - 1; } { edgedecoding.Append(fd); return edgedecoding.Size() - 1; }
MPI_Comm GetCommunicator() const { return this->comm; } auto GetCommunicator() const { return this->comm; }
void SetCommunicator(MPI_Comm acomm); void SetCommunicator(NgMPI_Comm acomm);
/// ///
DLL_HEADER void SetMaterial (int domnr, const string & mat); DLL_HEADER void SetMaterial (int domnr, const string & mat);

View File

@ -732,6 +732,8 @@ enum blocktyp { BLOCKUNDEF, BLOCKINNER, BLOCKBOUND, BLOCKOUTER };
void Meshing3 :: BlockFill (Mesh & mesh, double gh) void Meshing3 :: BlockFill (Mesh & mesh, double gh)
{ {
static Timer t("Mesing3::BlockFill"); RegionTimer reg(t);
PrintMessage (3, "Block-filling called (obsolete) "); PrintMessage (3, "Block-filling called (obsolete) ");
int i, j(0), i1, i2, i3, j1, j2, j3; 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, void Meshing3 :: BlockFillLocalH (Mesh & mesh,
const MeshingParameters & mp) const MeshingParameters & mp)
{ {
static Timer t("Mesing3::BlockFillLocalH"); RegionTimer reg(t);
double filldist = mp.filldist; double filldist = mp.filldist;
(*testout) << "blockfill local h" << endl; // (*testout) << "blockfill local h" << endl;
(*testout) << "rel filldist = " << filldist << endl; // (*testout) << "rel filldist = " << filldist << endl;
PrintMessage (3, "blockfill local h"); PrintMessage (3, "blockfill local h");

View File

@ -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; float err, minerr, teterr, minteterr;
char ok, found, hc; char ok, found, hc;
// vnetrule * rule; // vnetrule * rule;
@ -76,19 +79,19 @@ int Meshing3 :: ApplyRules
Array<int, PointIndex::BASE> pused; // point is already mapped, number of uses Array<int, PointIndex::BASE> pused; // point is already mapped, number of uses
Array<char> fused; // face is already mapped ArrayMem<char,100> fused; // face is already mapped
Array<PointIndex> pmap; // map of reference point to local point ArrayMem<PointIndex,100> pmap; // map of reference point to local point
Array<bool> pfixed; // point mapped by face-map ArrayMem<bool,100> pfixed; // point mapped by face-map
Array<int> fmapi; // face in reference is mapped to face nr ... ArrayMem<int,100> fmapi; // face in reference is mapped to face nr ...
Array<int> fmapr; // face in reference is rotated to map ArrayMem<int,100> fmapr; // face in reference is rotated to map
Array<Point3d> transfreezone; // transformed free-zone ArrayMem<Point3d,100> transfreezone; // transformed free-zone
INDEX_2_CLOSED_HASHTABLE<int> ledges(100); // edges in local environment INDEX_2_CLOSED_HASHTABLE<int> ledges(100); // edges in local environment
Array<Point3d> tempnewpoints; ArrayMem<Point3d,100> tempnewpoints;
Array<MiniElement2d> tempnewfaces; Array<MiniElement2d> tempnewfaces;
Array<int> tempdelfaces; ArrayMem<int,100> tempdelfaces;
Array<Element> tempelements; Array<Element> tempelements;
Array<Box3d> triboxes; // bounding boxes of local faces ArrayMem<Box3d,100> triboxes; // bounding boxes of local faces
Array<int, PointIndex::BASE> pnearness; Array<int, PointIndex::BASE> pnearness;
Array<int> fnearness; Array<int> fnearness;
@ -221,7 +224,8 @@ int Meshing3 :: ApplyRules
// check each rule: // check each rule:
tstart.Stop();
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;
@ -1111,7 +1115,8 @@ int Meshing3 :: ApplyRules
if (loktestmode) if (loktestmode)
(*testout) << "end rule" << endl; (*testout) << "end rule" << endl;
} }
tloop.Stop();
if (found) if (found)
{ {
/* /*

View File

@ -923,6 +923,8 @@ double CalcTotalBad (const Mesh::T_POINTS & points,
const Mesh::T_VOLELEMENTS & elements, const Mesh::T_VOLELEMENTS & elements,
const MeshingParameters & mp) const MeshingParameters & mp)
{ {
static Timer t("CalcTotalBad"); RegionTimer reg(t);
double sum = 0; double sum = 0;
double elbad; double elbad;