Merge branch 'layer_for_2d_occ' into 'master'

separate_layers now also working for 2d occ geometries

See merge request ngsolve/netgen!577
This commit is contained in:
Lackner, Christopher 2023-06-29 12:31:43 +02:00
commit e577c0a1a2
2 changed files with 18 additions and 3 deletions

View File

@ -486,13 +486,21 @@ namespace netgen
int maxlayer = 1;
int dom = 0;
for (TopExp_Explorer e(geom.GetShape(), TopAbs_SOLID); e.More(); e.Next(), dom++)
for(const auto& s : GetSolids(geom.GetShape()))
{
auto& props = OCCGeometry::GetProperties(e.Current());
if(!OCCGeometry::HaveProperties(s))
continue;
auto& props = OCCGeometry::GetProperties(s);
maxhdom[dom] = min2(maxhdom[dom], props.maxh);
maxlayer = max2(maxlayer, props.layer);
dom++;
}
for(const auto& f : GetFaces(geom.GetShape()))
if(OCCGeometry::HaveProperties(f))
maxlayer = max2(maxlayer, OCCGeometry::GetProperties(f).layer);
for(const auto& e : GetEdges(geom.GetShape()))
if(OCCGeometry::HaveProperties(e))
maxlayer = max2(maxlayer, OCCGeometry::GetProperties(e).layer);
mesh.SetMaxHDomain (maxhdom);

View File

@ -846,6 +846,13 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
col[3] = c[3];
OCCGeometry::GetProperties(self).col = col;
}, "color of shape as RGB - tuple")
.def_property("layer", [](const TopoDS_Shape& self) {
if (!OCCGeometry::HaveProperties(self))
return 1;
return OCCGeometry::GetProperties(self).layer;
}, [](const TopoDS_Shape& self, int layer) {
OCCGeometry::GetProperties(self).layer = layer;
}, "layer of shape")
.def("UnifySameDomain", [](const TopoDS_Shape& shape,
bool edges, bool faces,
bool concatBSplines)