h5geo 0.4.0
C++17 and python API to work with geo-data (seismic, wells, maps, other in process) based on HDF5. Aimed at geoscientists and developers.
Loading...
Searching...
No Matches
h5geo_py.h
1#ifndef H5GEO_PY_H
2#define H5GEO_PY_H
3
4#ifndef H5GT_USE_EIGEN
5#define H5GT_USE_EIGEN // should be defined before including h5gt
6#endif
7
8#include <h5gt/H5Object.hpp>
9#include <h5gt/H5File.hpp>
10#include <h5gt/H5DataSet.hpp>
11#include <h5gt/H5DataSpace.hpp>
12
13#include <Eigen/Dense>
14
15#ifdef H5GEO_USE_GDAL
16#include <gdal.h>
17#include <gdal_priv.h>
18#endif
19
20#include <pybind11/pybind11.h>
21#include <pybind11/eigen.h>
22#include <pybind11/stl.h>
23#include <pybind11/stl_bind.h>
24#include <pybind11/complex.h>
25#include <pybind11/operators.h>
26#include <pybind11/cast.h>
27#include <pybind11/functional.h>
28
29#ifdef H5GEO_USE_GDAL
30#include <gdal.h>
31#include <gdal_priv.h>
32#endif
33
34// DON'T WRITE 'using namespace h5gt' AS h5gt AND h5geo ARE INCOPATIBLE
35
36namespace py = pybind11;
37
38namespace h5geo{};
39using namespace h5geo;
40
41// opaque types must be included to every translation unit or ODR falls (warnings is given)
42#include <h5geo/h5points3.h>
43
44PYBIND11_MAKE_OPAQUE(h5geo::Point1Array);
45PYBIND11_MAKE_OPAQUE(h5geo::Point2Array);
46PYBIND11_MAKE_OPAQUE(h5geo::Point3Array);
47PYBIND11_MAKE_OPAQUE(h5geo::Point4Array);
48
49/* to generate .pyi the returned type should be declared before it
50 * is called. For example `createGroup` returns `Group` so I need to
51 * place `py::class_<Group, Object>(m, "Group")`
52 * before calling `.def("createGroup", ...` ) */
53
54/* py::arithmetic() -> create an enumeration that also supports
55 * rudimentary arithmetic and bit-level operations like
56 * comparisons, and, or, xor, negation, etc. */
57
58/* export_values() -> export the enum entries into the parent scope,
59 * which should be skipped for newer C++11-style strongly typed enums */
60
61/* py::const_ -> is neccessary when binding overoaded functions */
62
63/* All declarations are here. And all functions are invoked in `h5gt.cpp` */
64
65#include <h5geo/h5base.h>
66
67class H5BasePy : public H5Base {
68public:
69 /* Inherit the constructors */
70 using H5Base::H5Base;
71
72 /* Trampoline (need one for each virtual function) */
73 void Delete() override {
74 PYBIND11_OVERRIDE_PURE(
75 void, /* Return type */
76 H5Base, /* Parent class */
77 Delete /* Name of function in C++ (must match Python name) */
78 );
79 }
80};
81
82
83#endif // H5GEOPY_H
Base class for all geo-containers and geo-objects.
Definition h5base.h:182
Definition h5geo_py.h:67
Basic namespace.
Definition h5base.h:29