Main Lemma Repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pyLemmaCore.cpp 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 22/04/19 14:06:32
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email Trevor.Irons@utah.edu
  14. * @copyright Copyright (c) 2019, University of Utah
  15. * @copyright Copyright (c) 2019, Lemma Software, LLC
  16. */
  17. #include <pybind11/pybind11.h>
  18. #include <pybind11/iostream.h>
  19. #include <pybind11/eigen.h>
  20. #include "LemmaCore"
  21. namespace py = pybind11;
  22. PYBIND11_MODULE(pyLemmaCore, m) {
  23. py::add_ostream_redirect(m, "ostream_redirect");
  24. m.doc() = "Python binding of LemmaCore, additional details can be found at https://lemmasoftware.org";
  25. py::class_<Lemma::RectilinearGrid, std::shared_ptr<Lemma::RectilinearGrid> >(m, "RectilinearGrid")
  26. // lifecycle
  27. .def(py::init(&Lemma::RectilinearGrid::NewSP))
  28. // print
  29. .def("__repr__", &Lemma::RectilinearGrid::Print)
  30. .def("Serialize", &Lemma::RectilinearGrid::Print)
  31. // accessors
  32. .def("GetName", &Lemma::RectilinearGrid::GetName, "Returns the name of the class")
  33. .def("GetNx", &Lemma::RectilinearGrid::GetNx, "Returns the number of cells in the x direction")
  34. .def("GetNy", &Lemma::RectilinearGrid::GetNy, "Returns the number of cells in the y direction")
  35. .def("GetNz", &Lemma::RectilinearGrid::GetNz, "Returns the number of cells in the z direction")
  36. .def("GetOx", &Lemma::RectilinearGrid::GetOx, "Returns the grid origin offset in the x direction")
  37. .def("GetOy", &Lemma::RectilinearGrid::GetOy, "Returns the grid origin offset in the y direction")
  38. .def("GetOz", &Lemma::RectilinearGrid::GetOz, "Returns the grid origin offset in the z direction")
  39. .def("GetDx", &Lemma::RectilinearGrid::GetDx, "Returns the grid spacing in the x direction")
  40. .def("GetDy", &Lemma::RectilinearGrid::GetDy, "Returns the grid spacing in the y direction")
  41. .def("GetDz", &Lemma::RectilinearGrid::GetDz, "Returns the grid spacing in the z direction")
  42. .def("SetDimensions", &Lemma::RectilinearGrid::SetDimensions, "Sets the number of cells in x, y, and z")
  43. .def("SetOffset", &Lemma::RectilinearGrid::SetOffset, "Sets the origin offset in x, y, and z")
  44. .def("SetSpacing", &Lemma::RectilinearGrid::SetSpacing, "Sets the grid spacing in x, y, and z");
  45. }
  46. /*
  47. BOOST_PYTHON_MODULE(pyLemmaCore)
  48. {
  49. Py_Initialize();
  50. np::initialize();
  51. bp::class_<Lemma::RectilinearGrid, boost::noncopyable> ("RectilinearGrid", boost::python::no_init)
  52. // print
  53. .def(boost::python::self_ns::str(bp::self))
  54. // Lifecycle
  55. .def("__init__", boost::python::make_constructor(&Lemma::RectilinearGrid::NewSP))
  56. //.def("Serialize", &Lemma::RectilinearGrid::Serialize)
  57. //.def("DeSerialize", &Lemma::RectilinearGrid::DeSerialize)
  58. // Accessors
  59. ;
  60. }
  61. */