remove last placement init which is deprecated in pybind11

This commit is contained in:
Christopher Lackner 2019-08-09 14:43:58 +02:00
parent c900e0380b
commit ed024bb66a

View File

@ -212,7 +212,7 @@ DLL_HEADER void ExportCSG(py::module &m)
py::class_<SplineSurface, shared_ptr<SplineSurface>> (m, "SplineSurface", py::class_<SplineSurface, shared_ptr<SplineSurface>> (m, "SplineSurface",
"A surface for co dim 2 integrals on the splines") "A surface for co dim 2 integrals on the splines")
.def("__init__", FunctionPointer ([](SplineSurface* instance, shared_ptr<SPSolid> base, py::list cuts) .def(py::init([](shared_ptr<SPSolid> base, py::list cuts)
{ {
auto primitive = dynamic_cast<OneSurfacePrimitive*> (base->GetSolid()->GetPrimitive()); auto primitive = dynamic_cast<OneSurfacePrimitive*> (base->GetSolid()->GetPrimitive());
auto acuts = make_shared<NgArray<shared_ptr<OneSurfacePrimitive>>>(); auto acuts = make_shared<NgArray<shared_ptr<OneSurfacePrimitive>>>();
@ -225,12 +225,11 @@ DLL_HEADER void ExportCSG(py::module &m)
if(sp) if(sp)
acuts->Append(shared_ptr<OneSurfacePrimitive>(sp)); acuts->Append(shared_ptr<OneSurfacePrimitive>(sp));
else else
throw NgException("Cut must be SurfacePrimitive in constructor of SplineSurface!"); throw Exception("Cut must be SurfacePrimitive in constructor of SplineSurface!");
} }
if(!primitive) if(!primitive)
throw NgException("Base is not a SurfacePrimitive in constructor of SplineSurface!"); throw Exception("Base is not a SurfacePrimitive in constructor of SplineSurface!");
new (instance) SplineSurface(shared_ptr<OneSurfacePrimitive>(primitive),acuts); return make_shared<SplineSurface>(shared_ptr<OneSurfacePrimitive>(primitive),acuts);
py::object obj = py::cast(instance);
}),py::arg("base"), py::arg("cuts")=py::list()) }),py::arg("base"), py::arg("cuts")=py::list())
.def("AddPoint", FunctionPointer .def("AddPoint", FunctionPointer
([] (SplineSurface & self, double x, double y, double z, bool hpref) ([] (SplineSurface & self, double x, double y, double z, bool hpref)