#ifdef NG_PYTHON #include <../general/ngpython.hpp> #include #ifdef WIN32 #define DLL_HEADER __declspec(dllexport) #endif using namespace netgen; namespace netgen { //extern shared_ptr mesh; extern shared_ptr ng_geometry; } DLL_HEADER void ExportSTL(py::module & m) { py::class_, NetgenGeometry> (m,"STLGeometry") .def(py::init<>()) ; m.def("LoadSTLGeometry", FunctionPointer([] (const string & filename) { ifstream ist(filename); return shared_ptr(STLGeometry::Load(ist)); }),py::call_guard()); 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; }),py::call_guard()) ; } PYBIND11_MODULE(libstl, m) { ExportSTL(m); } #endif