#ifdef NG_PYTHON #ifdef OCCGEOMETRY #include <../general/ngpython.hpp> #include #include using namespace netgen; namespace netgen { extern std::shared_ptr ng_geometry; } DLL_HEADER void ExportNgOCC(py::module &m) { py::class_> (m, "OCCGeometry") .def(py::init<>()) ; m.def("LoadOCCGeometry",FunctionPointer([] (const string & filename) { cout << "load OCC geometry"; ifstream ist(filename); OCCGeometry * instance = new OCCGeometry(); instance = LoadOCC_STEP(filename.c_str()); return shared_ptr(instance, NOOP_Deleter); })); m.def("GenerateMesh", FunctionPointer([] (shared_ptr geo, MeshingParameters ¶m) { auto mesh = make_shared(); SetGlobalMesh(mesh); mesh->SetGeometry(geo); ng_geometry = geo; try { geo->GenerateMesh(mesh,param); } catch (NgException ex) { cout << "Caught NgException: " << ex.What() << endl; } return mesh; })) ; } PYBIND11_PLUGIN(libNgOCC) { py::module m("NgOCC", "pybind NgOCC"); ExportNgOCC(m); return m.ptr(); } #endif // OCCGEOMETRY #endif // NG_PYTHON