1 // a wrapper to load netgen-dll into python
2
3 #include <iostream>
4 #include <../general/ngpython.hpp>
5 #include <core/ngcore_api.hpp>
6
7 void NGCORE_API_IMPORT ExportNetgenMeshing(py::module &m);
8 void NGCORE_API_IMPORT ExportMeshVis(py::module &m);
9 void NGCORE_API_IMPORT ExportCSG(py::module &m);
10 void NGCORE_API_IMPORT ExportCSGVis(py::module &m);
11 void NGCORE_API_IMPORT ExportGeom2d(py::module &m);
12 void NGCORE_API_IMPORT ExportSTL(py::module &m);
13 void NGCORE_API_IMPORT ExportSTLVis(py::module &m);
14 #ifdef OCCGEOMETRY
15 void NGCORE_API_IMPORT ExportNgOCC(py::module &m);
16 #endif // OCCGEOMETRY
17 namespace netgen
18 {
19 std::vector<unsigned char> NGCORE_API_IMPORT Snapshot( int w, int h );
20 }
21
PYBIND11_MODULE(libngpy,ngpy)22 PYBIND11_MODULE(libngpy, ngpy)
23 {
24 py::module::import("pyngcore");
25 py::module meshing = ngpy.def_submodule("_meshing", "pybind meshing module");
26 ExportNetgenMeshing(meshing);
27 py::module csg = ngpy.def_submodule("_csg", "pybind csg module");
28 ExportCSG(csg);
29 py::module geom2d = ngpy.def_submodule("_geom2d", "pybind geom2d module");
30 ExportGeom2d(geom2d);
31 py::module stl = ngpy.def_submodule("_stl", "pybind stl module");
32 ExportSTL(stl);
33 #ifdef OCCGEOMETRY
34 py::module NgOCC = ngpy.def_submodule("_NgOCC", "pybind NgOCC module");
35 ExportNgOCC(NgOCC);
36 #endif // OCCGEOMETRY
37 #ifdef OPENGL
38 py::module meshvis = ngpy.def_submodule("meshvis", "pybind meshvis module");
39 ExportMeshVis(meshvis);
40 py::module csgvis = ngpy.def_submodule("csgvis", "pybind csgvis module");
41 ExportCSGVis(csgvis);
42 py::module stlvis = ngpy.def_submodule("stlvis", "pybind stlvis module");
43 ExportSTLVis(stlvis);
44 ngpy.def("Snapshot", netgen::Snapshot);
45 #endif // OPENGL
46 }
47
48 // Force linking libnglib to libnetgenpy
49 namespace netgen
50 {
51 void MyBeep (int i);
MyDummyToForceLinkingNGLib()52 void MyDummyToForceLinkingNGLib()
53 {
54 MyBeep(0);
55 }
56 }
57