From be8fa7286f6506757cb242c779ddc6b8262754ac Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Sun, 5 Oct 2014 16:54:16 +0000 Subject: [PATCH] mp with named args in constructor --- libsrc/meshing/python_mesh.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index 74653a86..6139b713 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -163,7 +163,18 @@ void ExportNetgenMeshing() typedef MeshingParameters MP; - bp::class_ ("MeshingParameters") + bp::class_ ("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) .add_property("maxh", FunctionPointer ([](const MP & mp ) { return mp.maxh; }),