mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
remove old meshing functions
This commit is contained in:
parent
17b5f1c7a4
commit
872dddbcd7
@ -754,368 +754,6 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
// extern double teterrpow;
|
||||
MESHING3_RESULT MeshVolume_ori (const MeshingParameters & mp, Mesh& mesh3d)
|
||||
{
|
||||
static Timer t("MeshVolume"); RegionTimer reg(t);
|
||||
|
||||
if (!mesh3d.HasLocalHFunction()) mesh3d.CalcLocalH(mp.grading);
|
||||
|
||||
mesh3d.Compress();
|
||||
|
||||
// mesh3d.PrintMemInfo (cout);
|
||||
|
||||
if (mp.checkoverlappingboundary)
|
||||
if (mesh3d.CheckOverlappingBoundary())
|
||||
throw NgException ("Stop meshing since boundary mesh is overlapping");
|
||||
|
||||
|
||||
if(mesh3d.GetNDomains()==0)
|
||||
return MESHING3_OK;
|
||||
|
||||
Array<Mesh> meshes(mesh3d.GetNDomains()-1);
|
||||
auto first_new_pi = mesh3d.Points().Range().Next();
|
||||
|
||||
for(auto & m : meshes)
|
||||
{
|
||||
m = mesh3d;
|
||||
m.SetLocalH(mesh3d.GetLocalH());
|
||||
}
|
||||
|
||||
ParallelFor(Range(1, mesh3d.GetNDomains()+1), [&](int k)
|
||||
{
|
||||
if(k==1)
|
||||
MeshDomain(mesh3d, mp, k, mesh3d.GetIdentifications());
|
||||
else
|
||||
MeshDomain(meshes[k-2], mp, k, mesh3d.GetIdentifications());
|
||||
});
|
||||
MergeMeshes(mesh3d, meshes, first_new_pi);
|
||||
|
||||
MeshQuality3d (mesh3d);
|
||||
|
||||
return MESHING3_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
MESHING3_RESULT MeshVolumeOld (MeshingParameters & mp, Mesh& mesh3d)
|
||||
{
|
||||
int i, k, oldne;
|
||||
|
||||
|
||||
int meshed;
|
||||
int cntsteps;
|
||||
|
||||
|
||||
PlotStatistics3d * pstat;
|
||||
if (globflags.GetNumFlag("silentflag", 1) <= 2)
|
||||
pstat = new XPlotStatistics3d;
|
||||
else
|
||||
pstat = new TerminalPlotStatistics3d;
|
||||
|
||||
cntsteps = 0;
|
||||
do
|
||||
{
|
||||
cntsteps++;
|
||||
if (cntsteps > mp.maxoutersteps)
|
||||
{
|
||||
return MESHING3_OUTERSTEPSEXCEEDED;
|
||||
}
|
||||
|
||||
|
||||
int noldp = mesh3d.GetNP();
|
||||
|
||||
|
||||
if ( (cntsteps == 1) && globflags.GetDefineFlag ("delaunay"))
|
||||
{
|
||||
cntsteps ++;
|
||||
|
||||
mesh3d.CalcSurfacesOfNode();
|
||||
|
||||
|
||||
for (k = 1; k <= mesh3d.GetNDomains(); k++)
|
||||
{
|
||||
Meshing3 meshing(NULL, pstat);
|
||||
|
||||
mesh3d.FindOpenElements(k);
|
||||
|
||||
for (i = 1; i <= noldp; i++)
|
||||
meshing.AddPoint (mesh3d.Point(i), i);
|
||||
|
||||
for (i = 1; i <= mesh3d.GetNOpenElements(); i++)
|
||||
{
|
||||
if (mesh3d.OpenElement(i).GetIndex() == k)
|
||||
meshing.AddBoundaryElement (mesh3d.OpenElement(i));
|
||||
}
|
||||
|
||||
oldne = mesh3d.GetNE();
|
||||
if (globflags.GetDefineFlag ("blockfill"))
|
||||
{
|
||||
if (!globflags.GetDefineFlag ("localh"))
|
||||
meshing.BlockFill
|
||||
(mesh3d, mp.h * globflags.GetNumFlag ("relblockfillh", 1));
|
||||
else
|
||||
meshing.BlockFillLocalH (mesh3d);
|
||||
}
|
||||
|
||||
MeshingParameters mpd;
|
||||
meshing.Delaunay (mesh3d, mpd);
|
||||
|
||||
for (i = oldne + 1; i <= mesh3d.GetNE(); i++)
|
||||
mesh3d.VolumeElement(i).SetIndex (k);
|
||||
}
|
||||
}
|
||||
|
||||
noldp = mesh3d.GetNP();
|
||||
|
||||
mesh3d.CalcSurfacesOfNode();
|
||||
mesh3d.FindOpenElements();
|
||||
for (k = 1; k <= mesh3d.GetNDomains(); k++)
|
||||
{
|
||||
Meshing3 meshing(globflags.GetStringFlag ("rules3d", NULL), pstat);
|
||||
|
||||
Point3d pmin, pmax;
|
||||
mesh3d.GetBox (pmin, pmax, k);
|
||||
|
||||
rot.SetCenter (Center (pmin, pmax));
|
||||
|
||||
for (i = 1; i <= noldp; i++)
|
||||
meshing.AddPoint (mesh3d.Point(i), i);
|
||||
|
||||
for (i = 1; i <= mesh3d.GetNOpenElements(); i++)
|
||||
{
|
||||
if (mesh3d.OpenElement(i).GetIndex() == k)
|
||||
meshing.AddBoundaryElement (mesh3d.OpenElement(i));
|
||||
}
|
||||
|
||||
oldne = mesh3d.GetNE();
|
||||
|
||||
|
||||
if ( (cntsteps == 1) && globflags.GetDefineFlag ("blockfill"))
|
||||
{
|
||||
if (!globflags.GetDefineFlag ("localh"))
|
||||
{
|
||||
meshing.BlockFill
|
||||
(mesh3d,
|
||||
mp.h * globflags.GetNumFlag ("relblockfillh", 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
meshing.BlockFillLocalH (mesh3d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mp.giveuptol = int(globflags.GetNumFlag ("giveuptol", 15));
|
||||
|
||||
meshing.GenerateMesh (mesh3d, mp);
|
||||
|
||||
for (i = oldne + 1; i <= mesh3d.GetNE(); i++)
|
||||
mesh3d.VolumeElement(i).SetIndex (k);
|
||||
}
|
||||
|
||||
|
||||
|
||||
mesh3d.CalcSurfacesOfNode();
|
||||
mesh3d.FindOpenElements();
|
||||
|
||||
teterrpow = 2;
|
||||
if (mesh3d.GetNOpenElements() != 0)
|
||||
{
|
||||
meshed = 0;
|
||||
(*mycout) << "Open elements found, old" << endl;
|
||||
const char * optstr = "mcmcmcmcm";
|
||||
int j;
|
||||
for (j = 1; j <= strlen(optstr); j++)
|
||||
switch (optstr[j-1])
|
||||
{
|
||||
case 'c': mesh3d.CombineImprove(); break;
|
||||
case 'd': mesh3d.SplitImprove(); break;
|
||||
case 's': mesh3d.SwapImprove(); break;
|
||||
case 'm': mesh3d.ImproveMesh(2); break;
|
||||
}
|
||||
|
||||
(*mycout) << "Call remove" << endl;
|
||||
RemoveProblem (mesh3d);
|
||||
(*mycout) << "Problem removed" << endl;
|
||||
}
|
||||
else
|
||||
meshed = 1;
|
||||
}
|
||||
while (!meshed);
|
||||
|
||||
MeshQuality3d (mesh3d);
|
||||
|
||||
return MESHING3_OK;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
MESHING3_RESULT MeshMixedVolume(MeshingParameters & mp, Mesh& mesh3d)
|
||||
{
|
||||
int i, j;
|
||||
MESHING3_RESULT res;
|
||||
Point3d pmin, pmax;
|
||||
|
||||
mp.giveuptol = 10;
|
||||
mp.baseelnp = 4;
|
||||
mp.starshapeclass = 100;
|
||||
|
||||
// TerminalPlotStatistics3d pstat;
|
||||
|
||||
Meshing3 meshing1("pyramids.rls");
|
||||
for (i = 1; i <= mesh3d.GetNP(); i++)
|
||||
meshing1.AddPoint (mesh3d.Point(i), i);
|
||||
|
||||
mesh3d.FindOpenElements();
|
||||
for (i = 1; i <= mesh3d.GetNOpenElements(); i++)
|
||||
if (mesh3d.OpenElement(i).GetIndex() == 1)
|
||||
meshing1.AddBoundaryElement (mesh3d.OpenElement(i));
|
||||
|
||||
res = meshing1.GenerateMesh (mesh3d, mp);
|
||||
|
||||
mesh3d.GetBox (pmin, pmax);
|
||||
PrintMessage (1, "Mesh pyramids, res = ", res);
|
||||
if (res)
|
||||
exit (1);
|
||||
|
||||
|
||||
for (i = 1; i <= mesh3d.GetNE(); i++)
|
||||
mesh3d.VolumeElement(i).SetIndex (1);
|
||||
|
||||
// do delaunay
|
||||
|
||||
mp.baseelnp = 0;
|
||||
mp.starshapeclass = 5;
|
||||
|
||||
Meshing3 meshing2(NULL);
|
||||
for (i = 1; i <= mesh3d.GetNP(); i++)
|
||||
meshing2.AddPoint (mesh3d.Point(i), i);
|
||||
|
||||
mesh3d.FindOpenElements();
|
||||
for (i = 1; i <= mesh3d.GetNOpenElements(); i++)
|
||||
if (mesh3d.OpenElement(i).GetIndex() == 1)
|
||||
meshing2.AddBoundaryElement (mesh3d.OpenElement(i));
|
||||
|
||||
MeshingParameters mpd;
|
||||
meshing2.Delaunay (mesh3d, mpd);
|
||||
|
||||
for (i = 1; i <= mesh3d.GetNE(); i++)
|
||||
mesh3d.VolumeElement(i).SetIndex (1);
|
||||
|
||||
|
||||
mp.baseelnp = 0;
|
||||
mp.giveuptol = 10;
|
||||
|
||||
for (int trials = 1; trials <= 50; trials++)
|
||||
{
|
||||
if (multithread.terminate)
|
||||
return MESHING3_TERMINATE;
|
||||
|
||||
Meshing3 meshing3("tetra.rls");
|
||||
for (i = 1; i <= mesh3d.GetNP(); i++)
|
||||
meshing3.AddPoint (mesh3d.Point(i), i);
|
||||
|
||||
mesh3d.FindOpenElements();
|
||||
for (i = 1; i <= mesh3d.GetNOpenElements(); i++)
|
||||
if (mesh3d.OpenElement(i).GetIndex() == 1)
|
||||
meshing3.AddBoundaryElement (mesh3d.OpenElement(i));
|
||||
|
||||
if (trials > 1)
|
||||
CheckSurfaceMesh2 (mesh3d);
|
||||
res = meshing3.GenerateMesh (mesh3d, mp);
|
||||
|
||||
for (i = 1; i <= mesh3d.GetNE(); i++)
|
||||
mesh3d.VolumeElement(i).SetIndex (1);
|
||||
|
||||
if (res == 0) break;
|
||||
|
||||
|
||||
|
||||
for (i = 1; i <= mesh3d.GetNE(); i++)
|
||||
{
|
||||
const Element & el = mesh3d.VolumeElement(i);
|
||||
if (el.GetNP() != 4)
|
||||
{
|
||||
for (j = 1; j <= el.GetNP(); j++)
|
||||
mesh3d.AddLockedPoint (el.PNum(j));
|
||||
}
|
||||
}
|
||||
|
||||
mesh3d.CalcSurfacesOfNode();
|
||||
mesh3d.FindOpenElements();
|
||||
|
||||
MeshOptimize3d optmesh;
|
||||
|
||||
teterrpow = 2;
|
||||
const char * optstr = "mcmcmcmcm";
|
||||
for (j = 1; j <= strlen(optstr); j++)
|
||||
switch (optstr[j-1])
|
||||
{
|
||||
case 'c': optmesh.CombineImprove(mesh3d, OPT_REST); break;
|
||||
case 'd': optmesh.SplitImprove(mesh3d); break;
|
||||
case 's': optmesh.SwapImprove(mesh3d); break;
|
||||
case 'm': mesh3d.ImproveMesh(); break;
|
||||
}
|
||||
|
||||
RemoveProblem (mesh3d);
|
||||
}
|
||||
|
||||
|
||||
PrintMessage (1, "Meshing tets, res = ", res);
|
||||
if (res)
|
||||
{
|
||||
mesh3d.FindOpenElements();
|
||||
PrintSysError (1, "Open elements: ", mesh3d.GetNOpenElements());
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (i = 1; i <= mesh3d.GetNE(); i++)
|
||||
{
|
||||
const Element & el = mesh3d.VolumeElement(i);
|
||||
if (el.GetNP() != 4)
|
||||
{
|
||||
for (j = 1; j <= el.GetNP(); j++)
|
||||
mesh3d.AddLockedPoint (el.PNum(j));
|
||||
}
|
||||
}
|
||||
|
||||
mesh3d.CalcSurfacesOfNode();
|
||||
mesh3d.FindOpenElements();
|
||||
|
||||
MeshOptimize3d optmesh;
|
||||
|
||||
teterrpow = 2;
|
||||
const char * optstr = "mcmcmcmcm";
|
||||
for (j = 1; j <= strlen(optstr); j++)
|
||||
switch (optstr[j-1])
|
||||
{
|
||||
case 'c': optmesh.CombineImprove(mesh3d, OPT_REST); break;
|
||||
case 'd': optmesh.SplitImprove(mesh3d); break;
|
||||
case 's': optmesh.SwapImprove(mesh3d); break;
|
||||
case 'm': mesh3d.ImproveMesh(); break;
|
||||
}
|
||||
|
||||
|
||||
return MESHING3_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MESHING3_RESULT OptimizeVolume (const MeshingParameters & mp,
|
||||
Mesh & mesh3d)
|
||||
// const CSGeometry * geometry)
|
||||
|
Loading…
Reference in New Issue
Block a user