add SetDomainLayer for geom2d

This commit is contained in:
Christopher Lackner 2021-09-01 14:34:30 +02:00
parent 33722fcfd6
commit aca46c49c8
2 changed files with 12 additions and 1 deletions

View File

@ -250,7 +250,17 @@ namespace netgen
if ( layer.Size() ) return layer[domnr-1]; if ( layer.Size() ) return layer[domnr-1];
else return 1; else return 1;
} }
void SetDomainLayer (int domnr, int layernr)
{
auto old_size = layer.Size();
if(domnr > old_size)
{
layer.SetSize(domnr);
for(size_t i = old_size; i < domnr; i++)
layer[i] = 1;
}
layer[domnr-1] = layernr;
}
string GetBCName (int bcnr) const; string GetBCName (int bcnr) const;
void SetBCName (int bcnr, string name); void SetBCName (int bcnr, string name);

View File

@ -49,6 +49,7 @@ NGCORE_API_EXPORT void ExportGeom2d(py::module &m)
})) }))
.def(NGSPickle<SplineGeometry2d>()) .def(NGSPickle<SplineGeometry2d>())
.def("Load",&SplineGeometry2d::Load) .def("Load",&SplineGeometry2d::Load)
.def("SetDomainLayer", &SplineGeometry2d::SetDomainLayer)
.def("AppendPoint", FunctionPointer .def("AppendPoint", FunctionPointer
([](SplineGeometry2d &self, double px, double py, double maxh, double hpref, string name) ([](SplineGeometry2d &self, double px, double py, double maxh, double hpref, string name)
{ {