diff --git a/libsrc/meshing/basegeom.hpp b/libsrc/meshing/basegeom.hpp index bb411a4d..44c66bdd 100644 --- a/libsrc/meshing/basegeom.hpp +++ b/libsrc/meshing/basegeom.hpp @@ -17,12 +17,14 @@ namespace netgen optional> col; double maxh = 1e99; double hpref = 0; // number of hp refinement levels (will be multiplied by factor later) + optional quad_dominated; void Merge(const ShapeProperties & prop2) { if (!name && prop2.name) name = prop2.name; if (!col && prop2.col) col = prop2.col; maxh = min2(maxh, prop2.maxh); hpref = max2(hpref, prop2.hpref); + if(!quad_dominated.has_value()) quad_dominated = prop2.quad_dominated; } string GetName() const { return name ? *name : "default"; } diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index 7e26cf65..ea1d138d 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -198,9 +198,14 @@ namespace netgen bool OCCGeometry :: MeshFace(Mesh& mesh, const MeshingParameters& mparam, int nr, FlatArray glob2loc) const { - bool failed = OCCMeshFace(*this, mesh, glob2loc, mparam, nr, PARAMETERSPACE, true); + MeshingParameters local_mp = mparam; + auto face = TopoDS::Face(fmap(nr+1)); + if(auto quad_dominated = OCCGeometry::global_shape_properties[face.TShape()].quad_dominated; quad_dominated.has_value()) + local_mp.quad = *quad_dominated; + + bool failed = OCCMeshFace(*this, mesh, glob2loc, local_mp, nr, PARAMETERSPACE, true); if(failed) - failed = OCCMeshFace(*this, mesh, glob2loc, mparam, nr, PLANESPACE, false); + failed = OCCMeshFace(*this, mesh, glob2loc, local_mp, nr, PLANESPACE, false); if(failed) { diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index 467fb876..efcc112b 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -1423,6 +1423,14 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) .def(py::init([] (const TopoDS_Shape & shape) { return TopoDS::Face(shape); })) + .def_property("quad_dominated", [](const TopoDS_Face& self) -> optional + { + return OCCGeometry::global_shape_properties[self.TShape()].quad_dominated; + }, + [](TopoDS_Face& self, optional quad_dominated) + { + OCCGeometry::global_shape_properties[self.TShape()].quad_dominated = quad_dominated; + }) .def_property_readonly("surf", [] (TopoDS_Face face) -> Handle(Geom_Surface) { Handle(Geom_Surface) surf = BRep_Tool::Surface (face); @@ -1642,6 +1650,15 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) val = max2(hpref, val); } }, "set hpref for all elements of list") + .def_property("quad_dominated", [](ListOfShapes& shapes) + { + throw Exception("Cannot get property of ListOfShapes, get the property from individual shapes!"); + }, + [](ListOfShapes& shapes, optional quad_dominated) + { + for(auto& shape : shapes) + OCCGeometry::global_shape_properties[shape.TShape()].quad_dominated = quad_dominated; + }) .def("Identify", py::overload_cast(&Identify), py::arg("other"), py::arg("name"),