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
@ -137,7 +137,6 @@ namespace netgen
|
||||
return CSGGenerateMesh (*this, mesh, mparam);
|
||||
}
|
||||
|
||||
|
||||
const Refinement & CSGeometry :: GetRefinement () const
|
||||
{
|
||||
// cout << "get CSGeometry - Refinement" << endl;
|
||||
|
@ -18,6 +18,7 @@ namespace netgen
|
||||
point is inner point.
|
||||
*/
|
||||
|
||||
|
||||
void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
||||
OPTIMIZEGOAL goal)
|
||||
{
|
||||
@ -41,6 +42,8 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
||||
double totalbad = 0;
|
||||
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);
|
||||
totalbad += elerr;
|
||||
elerrs[ei] = elerr;
|
||||
@ -64,6 +67,8 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
||||
|
||||
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)
|
||||
break;
|
||||
|
||||
@ -238,7 +243,8 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
||||
|
||||
totalbad = 0;
|
||||
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)
|
||||
{
|
||||
@ -247,8 +253,9 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
|
||||
|
||||
int cntill = 0;
|
||||
for (ElementIndex ei = 0; ei < ne; ei++)
|
||||
if (!mesh.LegalTet (mesh[ei]))
|
||||
cntill++;
|
||||
if(!(mesh.GetDimension()==3 && mp.only3D_domain_nr && mp.only3D_domain_nr != mesh.VolumeElement(ei).GetIndex()))
|
||||
if (!mesh.LegalTet (mesh[ei]))
|
||||
cntill++;
|
||||
|
||||
PrintMessage (5, cntill, " illegal tets");
|
||||
}
|
||||
@ -306,6 +313,8 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
|
||||
badmax = 0;
|
||||
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);
|
||||
bad1 += elerrs[ei];
|
||||
if (elerrs[ei] > badmax) badmax = elerrs[ei];
|
||||
@ -337,12 +346,12 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
|
||||
int cntill = 0;
|
||||
for (ei = 0; ei < ne; ei++)
|
||||
{
|
||||
// if (!LegalTet (volelements.Get(i)))
|
||||
if (mesh[ei].flags.illegal)
|
||||
{
|
||||
cntill++;
|
||||
illegaltet.Set (ei+1);
|
||||
}
|
||||
// if (!LegalTet (volelements.Get(i)))
|
||||
if (mesh[ei].flags.illegal)
|
||||
{
|
||||
cntill++;
|
||||
illegaltet.Set (ei+1);
|
||||
}
|
||||
}
|
||||
// (*mycout) << cntill << " illegal tets" << endl;
|
||||
}
|
||||
@ -350,6 +359,8 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
|
||||
|
||||
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)
|
||||
break;
|
||||
|
||||
@ -637,6 +648,9 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
|
||||
if (multithread.terminate)
|
||||
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;
|
||||
|
||||
if ((mesh.ElementType(ei)) == FIXEDELEMENT)
|
||||
@ -1225,6 +1239,7 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
|
||||
int oldpi = suroundpts[l-1];
|
||||
int newpi = 0;
|
||||
|
||||
|
||||
for (int k = 0; k < nsuround && !newpi; k++)
|
||||
if (!tetused[k])
|
||||
{
|
||||
@ -1239,8 +1254,9 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
|
||||
|
||||
tetused[k] = 1;
|
||||
suroundpts[l] = newpi;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2381,6 +2397,9 @@ void MeshOptimize3d :: SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal)
|
||||
CalcBad (mesh.Points(), mesh[eli1], 0) < 1e3)
|
||||
continue;
|
||||
|
||||
if(mesh.GetDimension()==3 && mp.only3D_domain_nr && mp.only3D_domain_nr != mesh.VolumeElement(eli1).GetIndex())
|
||||
continue;
|
||||
|
||||
// cout << "eli = " << eli1 << endl;
|
||||
// (*testout) << "swapimp2, eli = " << eli1 << "; el = " << mesh[eli1] << endl;
|
||||
|
||||
|
@ -32,6 +32,8 @@ namespace netgen
|
||||
int nonconsist = 0;
|
||||
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());
|
||||
|
||||
mesh3d.FindOpenElements(k);
|
||||
@ -63,6 +65,8 @@ namespace netgen
|
||||
|
||||
for (int k = 1; k <= mesh3d.GetNDomains(); k++)
|
||||
{
|
||||
if(mp.only3D_domain_nr && mp.only3D_domain_nr !=k)
|
||||
continue;
|
||||
if (multithread.terminate)
|
||||
break;
|
||||
|
||||
|
@ -1117,6 +1117,8 @@ namespace netgen
|
||||
|
||||
bool check_impossible = 0;
|
||||
|
||||
int only3D_domain_nr = 0;
|
||||
|
||||
///
|
||||
int secondorder = 0;
|
||||
/// high order element curvature
|
||||
|
@ -597,20 +597,22 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
.def(py::init<>())
|
||||
.def("__init__",
|
||||
[](MP *instance, double maxh, bool quad_dominated, int optsteps2d, int optsteps3d,
|
||||
MESHING_STEP perfstepsend)
|
||||
MESHING_STEP perfstepsend, int only3D_domain)
|
||||
{
|
||||
new (instance) MeshingParameters;
|
||||
instance->maxh = maxh;
|
||||
instance->quad = int(quad_dominated);
|
||||
instance->optsteps2d = optsteps2d;
|
||||
instance->optsteps3d = optsteps3d;
|
||||
instance->perfstepsend = perfstepsend;
|
||||
instance->only3D_domain_nr = only3D_domain;
|
||||
instance->perfstepsend = perfstepsend;
|
||||
},
|
||||
py::arg("maxh")=1000,
|
||||
py::arg("quad_dominated")=false,
|
||||
py::arg("optsteps2d") = 3,
|
||||
py::arg("optsteps3d") = 3,
|
||||
py::arg("perfstepsend") = MESHCONST_OPTVOLUME,
|
||||
py::arg("only3D_domain") = 0,
|
||||
"create meshing parameters"
|
||||
)
|
||||
.def("__str__", &ToString<MP>)
|
||||
|
Loading…
Reference in New Issue
Block a user