|
@@ -30,10 +30,11 @@ PYBIND11_MODULE(LemmaCore, m) {
|
30
|
30
|
|
31
|
31
|
m.doc() = "Python binding of LemmaCore, additional details can be found at https://lemmasoftware.org";
|
32
|
32
|
|
33
|
|
- py::class_<Lemma::RectilinearGrid, std::shared_ptr<Lemma::RectilinearGrid> >(m, "RectilinearGrid")
|
|
33
|
+ py::class_<Lemma::RectilinearGrid, std::shared_ptr<Lemma::RectilinearGrid> > RectilinearGrid(m, "RectilinearGrid");
|
34
|
34
|
|
35
|
35
|
// lifecycle
|
36
|
|
- .def(py::init(&Lemma::RectilinearGrid::NewSP))
|
|
36
|
+ RectilinearGrid.def(py::init(&Lemma::RectilinearGrid::NewSP))
|
|
37
|
+ .def_static("DeSerialize", py::overload_cast<const std::string&>(&Lemma::RectilinearGrid::DeSerialize), "Construct object from yaml representation")
|
37
|
38
|
|
38
|
39
|
// print
|
39
|
40
|
.def("__repr__", &Lemma::RectilinearGrid::Print)
|
|
@@ -54,12 +55,14 @@ PYBIND11_MODULE(LemmaCore, m) {
|
54
|
55
|
// modifiers
|
55
|
56
|
.def("SetDimensions", &Lemma::RectilinearGrid::SetDimensions, "Sets the number of cells in x, y, and z")
|
56
|
57
|
.def("SetOffset", &Lemma::RectilinearGrid::SetOffset, "Sets the origin offset in x, y, and z")
|
57
|
|
- .def("SetSpacing", &Lemma::RectilinearGrid::SetSpacing, "Sets the grid spacing in x, y, and z");
|
|
58
|
+ .def("SetSpacing", &Lemma::RectilinearGrid::SetSpacing, "Sets the grid spacing in x, y, and z")
|
|
59
|
+ ;
|
58
|
60
|
|
59
|
|
- py::class_<Lemma::ASCIIParser, std::shared_ptr<Lemma::ASCIIParser> >(m, "ASCIIParser")
|
|
61
|
+ py::class_<Lemma::ASCIIParser, std::shared_ptr<Lemma::ASCIIParser> > ASCIIParser(m, "ASCIIParser");
|
60
|
62
|
|
61
|
63
|
// lifecycle
|
62
|
|
- .def(py::init(&Lemma::ASCIIParser::NewSP))
|
|
64
|
+ ASCIIParser.def(py::init(&Lemma::ASCIIParser::NewSP))
|
|
65
|
+ .def_static("DeSerialize", py::overload_cast<const std::string&>(&Lemma::ASCIIParser::DeSerialize), "Construct object from yaml representation")
|
63
|
66
|
|
64
|
67
|
// print
|
65
|
68
|
.def("__repr__", &Lemma::ASCIIParser::Print)
|
|
@@ -82,26 +85,50 @@ PYBIND11_MODULE(LemmaCore, m) {
|
82
|
85
|
.def("JumpToLocation", &Lemma::ASCIIParser::JumpToLocation, "File object jumps to specified location")
|
83
|
86
|
|
84
|
87
|
;
|
85
|
|
-}
|
86
|
|
-
|
87
|
88
|
|
88
|
|
-/*
|
89
|
|
-BOOST_PYTHON_MODULE(pyLemmaCore)
|
90
|
|
-{
|
91
|
|
- Py_Initialize();
|
92
|
|
- np::initialize();
|
|
89
|
+ py::class_<Lemma::CubicSplineInterpolator, std::shared_ptr<Lemma::CubicSplineInterpolator> >(m, "CubicSplineInterpolator")
|
93
|
90
|
|
94
|
|
- bp::class_<Lemma::RectilinearGrid, boost::noncopyable> ("RectilinearGrid", boost::python::no_init)
|
|
91
|
+ // lifecycle
|
|
92
|
+ .def(py::init(&Lemma::CubicSplineInterpolator::NewSP))
|
|
93
|
+ .def_static("DeSerialize", py::overload_cast<const std::string&>(&Lemma::CubicSplineInterpolator::DeSerialize), "Construct object from yaml representation")
|
95
|
94
|
|
96
|
95
|
// print
|
97
|
|
- .def(boost::python::self_ns::str(bp::self))
|
|
96
|
+ .def("__repr__", &Lemma::CubicSplineInterpolator::Print)
|
|
97
|
+ .def("Serialize", &Lemma::CubicSplineInterpolator::Print, "YAML representation of the class")
|
|
98
|
+
|
|
99
|
+ // accessors
|
|
100
|
+ .def("GetName", &Lemma::CubicSplineInterpolator::GetName, "Returns the name of the class")
|
|
101
|
+ .def("GetKnotAbscissa", &Lemma::CubicSplineInterpolator::GetKnotAbscissa, "Returns the knot abscissa values")
|
|
102
|
+ .def("GetKnotOrdinate", &Lemma::CubicSplineInterpolator::GetKnotOrdinate, "Returns the knot ordinate values")
|
|
103
|
+
|
|
104
|
+ // modifiers
|
|
105
|
+ .def("SetKnots", &Lemma::CubicSplineInterpolator::SetKnots, "Sets the knots to use for interpolation")
|
|
106
|
+ .def("ResetKnotOrdinate", &Lemma::CubicSplineInterpolator::ResetKnotOrdinate, "Resets the knots to use for interpolation, when abscissa values haven't changed")
|
|
107
|
+
|
|
108
|
+ // methods
|
|
109
|
+ .def("InterpolateOrderedSet", &Lemma::CubicSplineInterpolator::InterpolateOrderedSet, "Interpolate a monotonically increasing ordered set.")
|
|
110
|
+ .def("Integrate", py::overload_cast<const Lemma::Real&, const Lemma::Real& >(&Lemma::CubicSplineInterpolator::Integrate), "Integrates between the arguments using cubic spline values.")
|
|
111
|
+ .def("IntegrateN", py::overload_cast<const Lemma::Real&, const Lemma::Real&, const int& >(&Lemma::CubicSplineInterpolator::Integrate), "Integrates the spline from x0 to x1. Uses composite Simpson's rule and n is the number of segments")
|
|
112
|
+ .def("Interpolate", py::overload_cast<const Lemma::Real& >(&Lemma::CubicSplineInterpolator::Interpolate), "Interpolation at a single point, x is the interpolation abscissa point, returns the ordinate value at x")
|
|
113
|
+ .def("InterpolateI", py::overload_cast<const Lemma::Real&, int& >(&Lemma::CubicSplineInterpolator::Interpolate), "Interpolation at a single point, x is the interpolation abscissa point and i is the knot to begin searchin at returns the ordinate value at x")
|
|
114
|
+
|
|
115
|
+ ;
|
98
|
116
|
|
99
|
|
- // Lifecycle
|
100
|
|
- .def("__init__", boost::python::make_constructor(&Lemma::RectilinearGrid::NewSP))
|
101
|
|
- //.def("Serialize", &Lemma::RectilinearGrid::Serialize)
|
102
|
|
- //.def("DeSerialize", &Lemma::RectilinearGrid::DeSerialize)
|
|
117
|
+ // ABC
|
|
118
|
+ //py::class_<Lemma::EarthModel, std::shared_ptr<Lemma::EarthModel> >(m, "EarthModel")
|
|
119
|
+
|
|
120
|
+ /*
|
|
121
|
+ py::class_<Lemma::LayeredEarth, std::shared_ptr<Lemma::LayeredEarth> >(m, "LayeredEarth")
|
|
122
|
+
|
|
123
|
+ // lifecycle
|
|
124
|
+ .def(py::init(&Lemma::LayeredEarth::NewSP))
|
|
125
|
+ //.def_static("DeSerialize", py::overload_cast<const std::string&>(&Lemma::LayeredEarth::DeSerialize), "Construct object from yaml representation")
|
|
126
|
+
|
|
127
|
+ // print
|
|
128
|
+ .def("__repr__", &Lemma::LayeredEarth::Print)
|
|
129
|
+ .def("Serialize", &Lemma::LayeredEarth::Print, "YAML representation of the class")
|
103
|
130
|
|
104
|
|
- // Accessors
|
105
|
131
|
;
|
|
132
|
+ */
|
106
|
133
|
}
|
107
|
|
-*/
|
|
134
|
+
|