Allow modification to minh from Python

This commit is contained in:
Loïc Séguin-C 2019-01-18 18:02:41 -05:00
parent b8359f52d0
commit d482566caa
2 changed files with 7 additions and 1 deletions

View File

@ -2706,6 +2706,7 @@ namespace netgen
<< " grading = " << grading << endl << " grading = " << grading << endl
<< " delaunay = " << delaunay << endl << " delaunay = " << delaunay << endl
<< " maxh = " << maxh << endl << " maxh = " << maxh << endl
<< " minh = " << minh << endl
<< " meshsizefilename = " << meshsizefilename << endl << " meshsizefilename = " << meshsizefilename << endl
<< " startinsurface = " << startinsurface << endl << " startinsurface = " << startinsurface << endl
<< " checkoverlap = " << checkoverlap << endl << " checkoverlap = " << checkoverlap << endl

View File

@ -846,12 +846,13 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
typedef MeshingParameters MP; typedef MeshingParameters MP;
py::class_<MP> (m, "MeshingParameters") py::class_<MP> (m, "MeshingParameters")
.def(py::init<>()) .def(py::init<>())
.def(py::init([](double maxh, bool quad_dominated, int optsteps2d, int optsteps3d, .def(py::init([](double maxh, double minh, bool quad_dominated, int optsteps2d, int optsteps3d,
MESHING_STEP perfstepsend, int only3D_domain, const string & meshsizefilename, MESHING_STEP perfstepsend, int only3D_domain, const string & meshsizefilename,
double grading, double curvaturesafety, double segmentsperedge) double grading, double curvaturesafety, double segmentsperedge)
{ {
MP * instance = new MeshingParameters; MP * instance = new MeshingParameters;
instance->maxh = maxh; instance->maxh = maxh;
instance->minh = minh;
instance->quad = int(quad_dominated); instance->quad = int(quad_dominated);
instance->optsteps2d = optsteps2d; instance->optsteps2d = optsteps2d;
instance->optsteps3d = optsteps3d; instance->optsteps3d = optsteps3d;
@ -865,6 +866,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
return instance; return instance;
}), }),
py::arg("maxh")=1000, py::arg("maxh")=1000,
py::arg("minh")=0,
py::arg("quad_dominated")=false, py::arg("quad_dominated")=false,
py::arg("optsteps2d") = 3, py::arg("optsteps2d") = 3,
py::arg("optsteps3d") = 3, py::arg("optsteps3d") = 3,
@ -880,6 +882,9 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
.def_property("maxh", .def_property("maxh",
FunctionPointer ([](const MP & mp ) { return mp.maxh; }), FunctionPointer ([](const MP & mp ) { return mp.maxh; }),
FunctionPointer ([](MP & mp, double maxh) { return mp.maxh = maxh; })) FunctionPointer ([](MP & mp, double maxh) { return mp.maxh = maxh; }))
.def_property("minh",
FunctionPointer ([](const MP & mp ) { return mp.minh; }),
FunctionPointer ([](MP & mp, double minh) { return mp.minh = minh; }))
.def("RestrictH", FunctionPointer .def("RestrictH", FunctionPointer
([](MP & mp, double x, double y, double z, double h) ([](MP & mp, double x, double y, double z, double h)
{ {