mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
allow quad dominated meshing of faces
This commit is contained in:
parent
f44c1894b8
commit
d6770fda0c
@ -17,12 +17,14 @@ namespace netgen
|
|||||||
optional<Vec<4>> col;
|
optional<Vec<4>> col;
|
||||||
double maxh = 1e99;
|
double maxh = 1e99;
|
||||||
double hpref = 0; // number of hp refinement levels (will be multiplied by factor later)
|
double hpref = 0; // number of hp refinement levels (will be multiplied by factor later)
|
||||||
|
optional<bool> quad_dominated;
|
||||||
void Merge(const ShapeProperties & prop2)
|
void Merge(const ShapeProperties & prop2)
|
||||||
{
|
{
|
||||||
if (!name && prop2.name) name = prop2.name;
|
if (!name && prop2.name) name = prop2.name;
|
||||||
if (!col && prop2.col) col = prop2.col;
|
if (!col && prop2.col) col = prop2.col;
|
||||||
maxh = min2(maxh, prop2.maxh);
|
maxh = min2(maxh, prop2.maxh);
|
||||||
hpref = max2(hpref, prop2.hpref);
|
hpref = max2(hpref, prop2.hpref);
|
||||||
|
if(!quad_dominated.has_value()) quad_dominated = prop2.quad_dominated;
|
||||||
}
|
}
|
||||||
|
|
||||||
string GetName() const { return name ? *name : "default"; }
|
string GetName() const { return name ? *name : "default"; }
|
||||||
|
@ -198,9 +198,14 @@ namespace netgen
|
|||||||
bool OCCGeometry :: MeshFace(Mesh& mesh,
|
bool OCCGeometry :: MeshFace(Mesh& mesh,
|
||||||
const MeshingParameters& mparam, int nr, FlatArray<int, PointIndex> glob2loc) const
|
const MeshingParameters& mparam, int nr, FlatArray<int, PointIndex> 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)
|
if(failed)
|
||||||
failed = OCCMeshFace(*this, mesh, glob2loc, mparam, nr, PLANESPACE, false);
|
failed = OCCMeshFace(*this, mesh, glob2loc, local_mp, nr, PLANESPACE, false);
|
||||||
|
|
||||||
if(failed)
|
if(failed)
|
||||||
{
|
{
|
||||||
|
@ -1423,6 +1423,14 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
|
|||||||
.def(py::init([] (const TopoDS_Shape & shape) {
|
.def(py::init([] (const TopoDS_Shape & shape) {
|
||||||
return TopoDS::Face(shape);
|
return TopoDS::Face(shape);
|
||||||
}))
|
}))
|
||||||
|
.def_property("quad_dominated", [](const TopoDS_Face& self) -> optional<bool>
|
||||||
|
{
|
||||||
|
return OCCGeometry::global_shape_properties[self.TShape()].quad_dominated;
|
||||||
|
},
|
||||||
|
[](TopoDS_Face& self, optional<bool> quad_dominated)
|
||||||
|
{
|
||||||
|
OCCGeometry::global_shape_properties[self.TShape()].quad_dominated = quad_dominated;
|
||||||
|
})
|
||||||
.def_property_readonly("surf", [] (TopoDS_Face face) -> Handle(Geom_Surface)
|
.def_property_readonly("surf", [] (TopoDS_Face face) -> Handle(Geom_Surface)
|
||||||
{
|
{
|
||||||
Handle(Geom_Surface) surf = BRep_Tool::Surface (face);
|
Handle(Geom_Surface) surf = BRep_Tool::Surface (face);
|
||||||
@ -1642,6 +1650,15 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
|
|||||||
val = max2(hpref, val);
|
val = max2(hpref, val);
|
||||||
}
|
}
|
||||||
}, "set hpref for all elements of list")
|
}, "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<bool> quad_dominated)
|
||||||
|
{
|
||||||
|
for(auto& shape : shapes)
|
||||||
|
OCCGeometry::global_shape_properties[shape.TShape()].quad_dominated = quad_dominated;
|
||||||
|
})
|
||||||
|
|
||||||
.def("Identify", py::overload_cast<const ListOfShapes&, const ListOfShapes&, string, Identifications::ID_TYPE, gp_Trsf>(&Identify),
|
.def("Identify", py::overload_cast<const ListOfShapes&, const ListOfShapes&, string, Identifications::ID_TYPE, gp_Trsf>(&Identify),
|
||||||
py::arg("other"), py::arg("name"),
|
py::arg("other"), py::arg("name"),
|
||||||
|
Loading…
Reference in New Issue
Block a user