mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-25 04:10:33 +05:00
Merge branch 'mesh_only_one_domain' into 'master'
Mesh only one domain See merge request !24
This commit is contained in:
commit
6513fa3a44
@ -136,8 +136,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
return CSGGenerateMesh (*this, mesh, mparam);
|
return CSGGenerateMesh (*this, mesh, mparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Refinement & CSGeometry :: GetRefinement () const
|
const Refinement & CSGeometry :: GetRefinement () const
|
||||||
{
|
{
|
||||||
// cout << "get CSGeometry - Refinement" << endl;
|
// cout << "get CSGeometry - Refinement" << endl;
|
||||||
|
@ -18,6 +18,7 @@ namespace netgen
|
|||||||
point is inner point.
|
point is inner point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
||||||
OPTIMIZEGOAL goal)
|
OPTIMIZEGOAL goal)
|
||||||
{
|
{
|
||||||
@ -41,6 +42,8 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
|||||||
double totalbad = 0;
|
double totalbad = 0;
|
||||||
for (ElementIndex ei = 0; ei < ne; ei++)
|
for (ElementIndex ei = 0; ei < ne; ei++)
|
||||||
{
|
{
|
||||||
|
if(mesh.GetDimension()==3 && mp.only3D_domain_nr && mp.only3D_domain_nr != mesh.VolumeElement(ei).GetIndex())
|
||||||
|
continue;
|
||||||
double elerr = CalcBad (mesh.Points(), mesh[ei], 0);
|
double elerr = CalcBad (mesh.Points(), mesh[ei], 0);
|
||||||
totalbad += elerr;
|
totalbad += elerr;
|
||||||
elerrs[ei] = elerr;
|
elerrs[ei] = elerr;
|
||||||
@ -64,6 +67,8 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
|||||||
|
|
||||||
for (ElementIndex ei = 0; ei < ne; ei++)
|
for (ElementIndex ei = 0; ei < ne; ei++)
|
||||||
{
|
{
|
||||||
|
if(mesh.GetDimension()==3 && mp.only3D_domain_nr && mp.only3D_domain_nr != mesh.VolumeElement(ei).GetIndex())
|
||||||
|
continue;
|
||||||
if (multithread.terminate)
|
if (multithread.terminate)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -238,7 +243,8 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
|||||||
|
|
||||||
totalbad = 0;
|
totalbad = 0;
|
||||||
for (ElementIndex ei = 0; ei < mesh.GetNE(); ei++)
|
for (ElementIndex ei = 0; ei < mesh.GetNE(); ei++)
|
||||||
totalbad += CalcBad (mesh.Points(), mesh[ei], 0);
|
if(!(mesh.GetDimension()==3 && mp.only3D_domain_nr && mp.only3D_domain_nr != mesh.VolumeElement(ei).GetIndex()))
|
||||||
|
totalbad += CalcBad (mesh.Points(), mesh[ei], 0);
|
||||||
|
|
||||||
if (goal == OPT_QUALITY)
|
if (goal == OPT_QUALITY)
|
||||||
{
|
{
|
||||||
@ -247,8 +253,9 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
|||||||
|
|
||||||
int cntill = 0;
|
int cntill = 0;
|
||||||
for (ElementIndex ei = 0; ei < ne; ei++)
|
for (ElementIndex ei = 0; ei < ne; ei++)
|
||||||
if (!mesh.LegalTet (mesh[ei]))
|
if(!(mesh.GetDimension()==3 && mp.only3D_domain_nr && mp.only3D_domain_nr != mesh.VolumeElement(ei).GetIndex()))
|
||||||
cntill++;
|
if (!mesh.LegalTet (mesh[ei]))
|
||||||
|
cntill++;
|
||||||
|
|
||||||
PrintMessage (5, cntill, " illegal tets");
|
PrintMessage (5, cntill, " illegal tets");
|
||||||
}
|
}
|
||||||
@ -306,6 +313,8 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
|
|||||||
badmax = 0;
|
badmax = 0;
|
||||||
for (ei = 0; ei < ne; ei++)
|
for (ei = 0; ei < ne; ei++)
|
||||||
{
|
{
|
||||||
|
if(mesh.GetDimension()==3 && mp.only3D_domain_nr && mp.only3D_domain_nr != mesh.VolumeElement(ei).GetIndex())
|
||||||
|
continue;
|
||||||
elerrs[ei] = CalcBad (mesh.Points(), mesh[ei], 0);
|
elerrs[ei] = CalcBad (mesh.Points(), mesh[ei], 0);
|
||||||
bad1 += elerrs[ei];
|
bad1 += elerrs[ei];
|
||||||
if (elerrs[ei] > badmax) badmax = elerrs[ei];
|
if (elerrs[ei] > badmax) badmax = elerrs[ei];
|
||||||
@ -337,12 +346,12 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
|
|||||||
int cntill = 0;
|
int cntill = 0;
|
||||||
for (ei = 0; ei < ne; ei++)
|
for (ei = 0; ei < ne; ei++)
|
||||||
{
|
{
|
||||||
// if (!LegalTet (volelements.Get(i)))
|
// if (!LegalTet (volelements.Get(i)))
|
||||||
if (mesh[ei].flags.illegal)
|
if (mesh[ei].flags.illegal)
|
||||||
{
|
{
|
||||||
cntill++;
|
cntill++;
|
||||||
illegaltet.Set (ei+1);
|
illegaltet.Set (ei+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// (*mycout) << cntill << " illegal tets" << endl;
|
// (*mycout) << cntill << " illegal tets" << endl;
|
||||||
}
|
}
|
||||||
@ -350,6 +359,8 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
|
|||||||
|
|
||||||
for (ei = 0; ei < ne; ei++)
|
for (ei = 0; ei < ne; ei++)
|
||||||
{
|
{
|
||||||
|
if(mesh.GetDimension()==3 && mp.only3D_domain_nr && mp.only3D_domain_nr != mesh.VolumeElement(ei).GetIndex())
|
||||||
|
continue;
|
||||||
if (multithread.terminate)
|
if (multithread.terminate)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -637,6 +648,9 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
|
|||||||
if (multithread.terminate)
|
if (multithread.terminate)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if(mesh.GetDimension()==3 && mp.only3D_domain_nr && mp.only3D_domain_nr != mesh.VolumeElement(ei).GetIndex())
|
||||||
|
continue;
|
||||||
|
|
||||||
multithread.percent = 100.0 * (ei+1) / ne;
|
multithread.percent = 100.0 * (ei+1) / ne;
|
||||||
|
|
||||||
if ((mesh.ElementType(ei)) == FIXEDELEMENT)
|
if ((mesh.ElementType(ei)) == FIXEDELEMENT)
|
||||||
@ -1225,6 +1239,7 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
|
|||||||
int oldpi = suroundpts[l-1];
|
int oldpi = suroundpts[l-1];
|
||||||
int newpi = 0;
|
int newpi = 0;
|
||||||
|
|
||||||
|
|
||||||
for (int k = 0; k < nsuround && !newpi; k++)
|
for (int k = 0; k < nsuround && !newpi; k++)
|
||||||
if (!tetused[k])
|
if (!tetused[k])
|
||||||
{
|
{
|
||||||
@ -1236,13 +1251,14 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
|
|||||||
newpi =
|
newpi =
|
||||||
nel[0] + nel[1] + nel[2] + nel[3]
|
nel[0] + nel[1] + nel[2] + nel[3]
|
||||||
- pi1 - pi2 - oldpi;
|
- pi1 - pi2 - oldpi;
|
||||||
|
|
||||||
tetused[k] = 1;
|
tetused[k] = 1;
|
||||||
suroundpts[l] = newpi;
|
suroundpts[l] = newpi;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bad1 = 0;
|
bad1 = 0;
|
||||||
for (int k = 0; k < nsuround; k++)
|
for (int k = 0; k < nsuround; k++)
|
||||||
@ -2380,6 +2396,9 @@ void MeshOptimize3d :: SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal)
|
|||||||
mesh.LegalTet (mesh[eli1]) &&
|
mesh.LegalTet (mesh[eli1]) &&
|
||||||
CalcBad (mesh.Points(), mesh[eli1], 0) < 1e3)
|
CalcBad (mesh.Points(), mesh[eli1], 0) < 1e3)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if(mesh.GetDimension()==3 && mp.only3D_domain_nr && mp.only3D_domain_nr != mesh.VolumeElement(eli1).GetIndex())
|
||||||
|
continue;
|
||||||
|
|
||||||
// cout << "eli = " << eli1 << endl;
|
// cout << "eli = " << eli1 << endl;
|
||||||
// (*testout) << "swapimp2, eli = " << eli1 << "; el = " << mesh[eli1] << endl;
|
// (*testout) << "swapimp2, eli = " << eli1 << "; el = " << mesh[eli1] << endl;
|
||||||
|
@ -32,6 +32,8 @@ namespace netgen
|
|||||||
int nonconsist = 0;
|
int nonconsist = 0;
|
||||||
for (int k = 1; k <= mesh3d.GetNDomains(); k++)
|
for (int k = 1; k <= mesh3d.GetNDomains(); k++)
|
||||||
{
|
{
|
||||||
|
if(mp.only3D_domain_nr && mp.only3D_domain_nr !=k)
|
||||||
|
continue;
|
||||||
PrintMessage (3, "Check subdomain ", k, " / ", mesh3d.GetNDomains());
|
PrintMessage (3, "Check subdomain ", k, " / ", mesh3d.GetNDomains());
|
||||||
|
|
||||||
mesh3d.FindOpenElements(k);
|
mesh3d.FindOpenElements(k);
|
||||||
@ -63,6 +65,8 @@ namespace netgen
|
|||||||
|
|
||||||
for (int k = 1; k <= mesh3d.GetNDomains(); k++)
|
for (int k = 1; k <= mesh3d.GetNDomains(); k++)
|
||||||
{
|
{
|
||||||
|
if(mp.only3D_domain_nr && mp.only3D_domain_nr !=k)
|
||||||
|
continue;
|
||||||
if (multithread.terminate)
|
if (multithread.terminate)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1116,6 +1116,8 @@ namespace netgen
|
|||||||
double badellimit = 175;
|
double badellimit = 175;
|
||||||
|
|
||||||
bool check_impossible = 0;
|
bool check_impossible = 0;
|
||||||
|
|
||||||
|
int only3D_domain_nr = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
int secondorder = 0;
|
int secondorder = 0;
|
||||||
|
@ -597,20 +597,22 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
.def(py::init<>())
|
.def(py::init<>())
|
||||||
.def("__init__",
|
.def("__init__",
|
||||||
[](MP *instance, double maxh, bool quad_dominated, int optsteps2d, int optsteps3d,
|
[](MP *instance, double maxh, bool quad_dominated, int optsteps2d, int optsteps3d,
|
||||||
MESHING_STEP perfstepsend)
|
MESHING_STEP perfstepsend, int only3D_domain)
|
||||||
{
|
{
|
||||||
new (instance) MeshingParameters;
|
new (instance) MeshingParameters;
|
||||||
instance->maxh = maxh;
|
instance->maxh = maxh;
|
||||||
instance->quad = int(quad_dominated);
|
instance->quad = int(quad_dominated);
|
||||||
instance->optsteps2d = optsteps2d;
|
instance->optsteps2d = optsteps2d;
|
||||||
instance->optsteps3d = optsteps3d;
|
instance->optsteps3d = optsteps3d;
|
||||||
instance->perfstepsend = perfstepsend;
|
instance->only3D_domain_nr = only3D_domain;
|
||||||
|
instance->perfstepsend = perfstepsend;
|
||||||
},
|
},
|
||||||
py::arg("maxh")=1000,
|
py::arg("maxh")=1000,
|
||||||
py::arg("quad_dominated")=false,
|
py::arg("quad_dominated")=false,
|
||||||
py::arg("optsteps2d") = 3,
|
py::arg("optsteps2d") = 3,
|
||||||
py::arg("optsteps3d") = 3,
|
py::arg("optsteps3d") = 3,
|
||||||
py::arg("perfstepsend") = MESHCONST_OPTVOLUME,
|
py::arg("perfstepsend") = MESHCONST_OPTVOLUME,
|
||||||
|
py::arg("only3D_domain") = 0,
|
||||||
"create meshing parameters"
|
"create meshing parameters"
|
||||||
)
|
)
|
||||||
.def("__str__", &ToString<MP>)
|
.def("__str__", &ToString<MP>)
|
||||||
|
Loading…
Reference in New Issue
Block a user