From 457c2ad96deaaa65b6c2fdf0d3c7d8f5ba5fc840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Sch=C3=B6berl?= Date: Thu, 22 Oct 2015 16:32:58 +0200 Subject: [PATCH] mesh constructor gets dim argument --- libsrc/meshing/python_mesh.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index 3502c38a..2fa9c14e 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -262,7 +262,22 @@ DLL_HEADER void ExportNetgenMeshing() bp::class_,boost::noncopyable>("Mesh", bp::no_init) - .def(bp::init<>("create empty mesh")) + // .def(bp::init<>("create empty mesh")) + + .def("__init__", bp::make_constructor + (FunctionPointer ([](int dim) + { + auto mesh = make_shared(); + mesh->SetDimension(dim); + return mesh; + }), + bp::default_call_policies(), // need it to use named arguments + ( + bp::arg("dim")=3 + ) + )) + + .def("__str__", &ToString) .def("Load", FunctionPointer ([](Mesh & self, const string & filename)