mp with named args in constructor

This commit is contained in:
Joachim Schoeberl 2014-10-05 16:54:16 +00:00
parent a39fc1e28c
commit be8fa7286f

View File

@ -163,7 +163,18 @@ void ExportNetgenMeshing()
typedef MeshingParameters MP;
bp::class_<MP> ("MeshingParameters")
bp::class_<MP> ("MeshingParameters", bp::init<>())
.def("__init__", bp::make_constructor
(FunctionPointer ([](double maxh)
{
auto tmp = new MeshingParameters;
tmp->maxh = maxh;
return tmp;
}),
bp::default_call_policies(), // need it to use arguments
(bp::arg("maxh")=1000)),
"create meshing parameters"
)
.def("__str__", &ToString<MP>)
.add_property("maxh",
FunctionPointer ([](const MP & mp ) { return mp.maxh; }),