mirror of
https://github.com/NGSolve/netgen.git
synced 2025-04-15 19:11:23 +05:00
little modernization
This commit is contained in:
parent
168df170ec
commit
f7fcc67fc7
@ -293,6 +293,11 @@ namespace netgen
|
|||||||
size = nsize;
|
size = nsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetSize0()
|
||||||
|
{
|
||||||
|
size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// Change physical size. Keeps logical size. Keeps contents.
|
/// Change physical size. Keeps logical size. Keeps contents.
|
||||||
void SetAllocSize (size_t nallocsize)
|
void SetAllocSize (size_t nallocsize)
|
||||||
{
|
{
|
||||||
|
@ -53,13 +53,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
Meshing2 :: ~Meshing2 ()
|
Meshing2 :: ~Meshing2 ()
|
||||||
{
|
{ ; }
|
||||||
// delete adfront;
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < rules.Size(); i++)
|
|
||||||
delete rules[i];
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Meshing2 :: AddPoint (const Point3d & p, PointIndex globind,
|
void Meshing2 :: AddPoint (const Point3d & p, PointIndex globind,
|
||||||
MultiPointGeomInfo * mgi,
|
MultiPointGeomInfo * mgi,
|
||||||
@ -239,7 +233,6 @@ namespace netgen
|
|||||||
int z1, z2, oldnp(-1);
|
int z1, z2, oldnp(-1);
|
||||||
bool found;
|
bool found;
|
||||||
int rulenr(-1);
|
int rulenr(-1);
|
||||||
Point<3> p1, p2;
|
|
||||||
|
|
||||||
const PointGeomInfo * blgeominfo1;
|
const PointGeomInfo * blgeominfo1;
|
||||||
const PointGeomInfo * blgeominfo2;
|
const PointGeomInfo * blgeominfo2;
|
||||||
@ -247,8 +240,7 @@ namespace netgen
|
|||||||
bool morerisc;
|
bool morerisc;
|
||||||
bool debugflag;
|
bool debugflag;
|
||||||
|
|
||||||
double h, his, hshould;
|
// double h;
|
||||||
|
|
||||||
|
|
||||||
NgArray<Point3d> locpoints;
|
NgArray<Point3d> locpoints;
|
||||||
NgArray<int> legalpoints;
|
NgArray<int> legalpoints;
|
||||||
@ -369,6 +361,10 @@ namespace netgen
|
|||||||
|
|
||||||
NgProfiler::StopTimer (ts3);
|
NgProfiler::StopTimer (ts3);
|
||||||
|
|
||||||
|
static Timer tloop("surfacemeshing mainloop");
|
||||||
|
static Timer tgetlocals("surfacemeshing getlocals");
|
||||||
|
{
|
||||||
|
RegionTimer rloop(tloop);
|
||||||
while (!adfront.Empty() && !multithread.terminate)
|
while (!adfront.Empty() && !multithread.terminate)
|
||||||
{
|
{
|
||||||
NgProfiler::RegionTimer reg1 (timer1);
|
NgProfiler::RegionTimer reg1 (timer1);
|
||||||
@ -384,13 +380,13 @@ namespace netgen
|
|||||||
multithread.percent = 0;
|
multithread.percent = 0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
locpoints.SetSize(0);
|
locpoints.SetSize0();
|
||||||
loclines.SetSize(0);
|
loclines.SetSize0();
|
||||||
pindex.SetSize(0);
|
pindex.SetSize0();
|
||||||
lindex.SetSize(0);
|
lindex.SetSize0();
|
||||||
delpoints.SetSize(0);
|
delpoints.SetSize0();
|
||||||
dellines.SetSize(0);
|
dellines.SetSize0();
|
||||||
locelements.SetSize(0);
|
locelements.SetSize0();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -408,8 +404,8 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
// unique-pgi, multi-pgi
|
// unique-pgi, multi-pgi
|
||||||
upgeominfo.SetSize(0);
|
upgeominfo.SetSize0();
|
||||||
mpgeominfo.SetSize(0);
|
mpgeominfo.SetSize0();
|
||||||
|
|
||||||
|
|
||||||
nfaces = adfront.GetNFL();
|
nfaces = adfront.GetNFL();
|
||||||
@ -428,27 +424,27 @@ namespace netgen
|
|||||||
(*testout) << "\n";
|
(*testout) << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Point<3> p1, p2;
|
||||||
int baselineindex = adfront.SelectBaseLine (p1, p2, blgeominfo1, blgeominfo2, qualclass);
|
int baselineindex = adfront.SelectBaseLine (p1, p2, blgeominfo1, blgeominfo2, qualclass);
|
||||||
|
|
||||||
|
|
||||||
found = 1;
|
found = 1;
|
||||||
|
|
||||||
his = Dist (p1, p2);
|
double his = Dist (p1, p2);
|
||||||
|
|
||||||
Point3d pmid = Center (p1, p2);
|
Point<3> pmid = Center (p1, p2);
|
||||||
hshould = CalcLocalH (pmid, mesh.GetH (pmid));
|
double hshould = CalcLocalH (pmid, mesh.GetH (pmid));
|
||||||
if (gh < hshould) hshould = gh;
|
if (gh < hshould) hshould = gh;
|
||||||
|
|
||||||
mesh.RestrictLocalH (pmid, hshould);
|
mesh.RestrictLocalH (pmid, hshould);
|
||||||
|
|
||||||
h = hshould;
|
double h = hshould;
|
||||||
|
|
||||||
double hinner = (3 + qualclass) * max2 (his, hshould);
|
double hinner = (3 + qualclass) * max2 (his, hshould);
|
||||||
|
|
||||||
|
tgetlocals.Start();
|
||||||
adfront.GetLocals (baselineindex, locpoints, mpgeominfo, loclines,
|
adfront.GetLocals (baselineindex, locpoints, mpgeominfo, loclines,
|
||||||
pindex, lindex, 2*hinner);
|
pindex, lindex, 2*hinner);
|
||||||
|
tgetlocals.Stop();
|
||||||
|
|
||||||
NgProfiler::RegionTimer reg2 (timer2);
|
NgProfiler::RegionTimer reg2 (timer2);
|
||||||
|
|
||||||
@ -535,6 +531,12 @@ namespace netgen
|
|||||||
*testout << "3d points: " << endl << locpoints << endl;
|
*testout << "3d points: " << endl << locpoints << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (size_t i = 0; i < locpoints.Size(); i++)
|
||||||
|
TransformToPlain (locpoints[i], mpgeominfo[i],
|
||||||
|
plainpoints[i], h, plainzones[i]);
|
||||||
|
|
||||||
|
/*
|
||||||
for (int i = 1; i <= locpoints.Size(); i++)
|
for (int i = 1; i <= locpoints.Size(); i++)
|
||||||
{
|
{
|
||||||
// (*testout) << "pindex(i) = " << pindex[i-1] << endl;
|
// (*testout) << "pindex(i) = " << pindex[i-1] << endl;
|
||||||
@ -545,6 +547,7 @@ namespace netgen
|
|||||||
// (*testout) << plainpoints.Get(i).X() << " " << plainpoints.Get(i).Y() << endl;
|
// (*testout) << plainpoints.Get(i).X() << " " << plainpoints.Get(i).Y() << endl;
|
||||||
//(*testout) << "transform " << locpoints.Get(i) << " to " << plainpoints.Get(i).X() << " " << plainpoints.Get(i).Y() << endl;
|
//(*testout) << "transform " << locpoints.Get(i) << " to " << plainpoints.Get(i).X() << " " << plainpoints.Get(i).Y() << endl;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// (*testout) << endl << endl << endl;
|
// (*testout) << endl << endl << endl;
|
||||||
|
|
||||||
|
|
||||||
@ -671,31 +674,34 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
legalpoints.SetSize(plainpoints.Size());
|
legalpoints.SetSize(plainpoints.Size());
|
||||||
|
legalpoints = 1;
|
||||||
|
/*
|
||||||
for (int i = 1; i <= legalpoints.Size(); i++)
|
for (int i = 1; i <= legalpoints.Size(); i++)
|
||||||
legalpoints.Elem(i) = 1;
|
legalpoints.Elem(i) = 1;
|
||||||
|
*/
|
||||||
|
|
||||||
double avy = 0;
|
double avy = 0;
|
||||||
for (int i = 1; i <= plainpoints.Size(); i++)
|
for (size_t i = 0; i < plainpoints.Size(); i++)
|
||||||
avy += plainpoints.Elem(i).Y();
|
avy += plainpoints[i].Y();
|
||||||
avy *= 1./plainpoints.Size();
|
avy *= 1./plainpoints.Size();
|
||||||
|
|
||||||
|
|
||||||
for (int i = 1; i <= plainpoints.Size(); i++)
|
for (auto i : Range(plainpoints))
|
||||||
{
|
{
|
||||||
if (plainzones.Elem(i) < 0)
|
if (plainzones[i] < 0)
|
||||||
{
|
{
|
||||||
plainpoints.Elem(i) = Point2d (1e4, 1e4);
|
plainpoints[i] = Point2d (1e4, 1e4);
|
||||||
legalpoints.Elem(i) = 0;
|
legalpoints[i] = 0;
|
||||||
}
|
}
|
||||||
if (pindex.Elem(i) == -1)
|
if (pindex[i] == -1)
|
||||||
{
|
{
|
||||||
legalpoints.Elem(i) = 0;
|
legalpoints[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (plainpoints.Elem(i).Y() < -1e-10*avy) // changed
|
if (plainpoints[i].Y() < -1e-10*avy) // changed
|
||||||
{
|
{
|
||||||
legalpoints.Elem(i) = 0;
|
legalpoints[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -784,6 +790,8 @@ namespace netgen
|
|||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
|
static Timer t("ApplyRules");
|
||||||
|
RegionTimer r(t);
|
||||||
rulenr = ApplyRules (plainpoints, legalpoints, maxlegalpoint,
|
rulenr = ApplyRules (plainpoints, legalpoints, maxlegalpoint,
|
||||||
loclines, maxlegalline, locelements,
|
loclines, maxlegalline, locelements,
|
||||||
dellines, qualclass, mp);
|
dellines, qualclass, mp);
|
||||||
@ -1538,7 +1546,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
PrintMessage (3, "Surface meshing done");
|
PrintMessage (3, "Surface meshing done");
|
||||||
|
|
||||||
|
|
||||||
|
@ -668,11 +668,14 @@ namespace netgen
|
|||||||
Meshing2OCCSurfaces meshing(TopoDS::Face(geom.fmap(k)), bb, projecttype, mparam);
|
Meshing2OCCSurfaces meshing(TopoDS::Face(geom.fmap(k)), bb, projecttype, mparam);
|
||||||
tinit.Stop();
|
tinit.Stop();
|
||||||
|
|
||||||
|
|
||||||
|
static Timer tprint("print");
|
||||||
|
tprint.Start();
|
||||||
if (meshing.GetProjectionType() == PLANESPACE)
|
if (meshing.GetProjectionType() == PLANESPACE)
|
||||||
PrintMessage (2, "Face ", k, " / ", mesh.GetNFD(), " (plane space projection)");
|
PrintMessage (2, "Face ", k, " / ", mesh.GetNFD(), " (plane space projection)");
|
||||||
else
|
else
|
||||||
PrintMessage (2, "Face ", k, " / ", mesh.GetNFD(), " (parameter space projection)");
|
PrintMessage (2, "Face ", k, " / ", mesh.GetNFD(), " (parameter space projection)");
|
||||||
|
tprint.Stop();
|
||||||
if (surfmesherror)
|
if (surfmesherror)
|
||||||
cout << "Surface meshing error occurred before (in " << surfmesherror << " faces)" << endl;
|
cout << "Surface meshing error occurred before (in " << surfmesherror << " faces)" << endl;
|
||||||
|
|
||||||
@ -795,8 +798,11 @@ namespace netgen
|
|||||||
// int noldpoints = mesh->GetNP();
|
// int noldpoints = mesh->GetNP();
|
||||||
int noldsurfel = mesh.GetNSE();
|
int noldsurfel = mesh.GetNSE();
|
||||||
|
|
||||||
|
static Timer tsurfprop("surfprop");
|
||||||
|
tsurfprop.Start();
|
||||||
GProp_GProps sprops;
|
GProp_GProps sprops;
|
||||||
BRepGProp::SurfaceProperties(TopoDS::Face(geom.fmap(k)),sprops);
|
BRepGProp::SurfaceProperties(TopoDS::Face(geom.fmap(k)),sprops);
|
||||||
|
tsurfprop.Stop();
|
||||||
meshing.SetMaxArea(2.*sprops.Mass());
|
meshing.SetMaxArea(2.*sprops.Mass());
|
||||||
|
|
||||||
MESHING2_RESULT res;
|
MESHING2_RESULT res;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user