diff --git a/libsrc/csg/csgeom.cpp b/libsrc/csg/csgeom.cpp index 8e18590f..a1abe6d6 100644 --- a/libsrc/csg/csgeom.cpp +++ b/libsrc/csg/csgeom.cpp @@ -136,8 +136,7 @@ namespace netgen { return CSGGenerateMesh (*this, mesh, mparam); } - - + const Refinement & CSGeometry :: GetRefinement () const { // cout << "get CSGeometry - Refinement" << endl; diff --git a/libsrc/meshing/improve3.cpp b/libsrc/meshing/improve3.cpp index 435ba4cd..43b67947 100644 --- a/libsrc/meshing/improve3.cpp +++ b/libsrc/meshing/improve3.cpp @@ -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]) { @@ -1236,13 +1251,14 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal, newpi = nel[0] + nel[1] + nel[2] + nel[3] - pi1 - pi2 - oldpi; - + tetused[k] = 1; suroundpts[l] = newpi; - } - } + + } + } } - + bad1 = 0; for (int k = 0; k < nsuround; k++) @@ -2380,6 +2396,9 @@ void MeshOptimize3d :: SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal) mesh.LegalTet (mesh[eli1]) && 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; diff --git a/libsrc/meshing/meshfunc.cpp b/libsrc/meshing/meshfunc.cpp index 54f06a65..062c3e99 100644 --- a/libsrc/meshing/meshfunc.cpp +++ b/libsrc/meshing/meshfunc.cpp @@ -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; diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index c550577f..3703c6b6 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -1116,6 +1116,8 @@ namespace netgen double badellimit = 175; bool check_impossible = 0; + + int only3D_domain_nr = 0; /// int secondorder = 0; diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index ba85c585..8ac969c1 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -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->optsteps3d = optsteps3d; + 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)