Skip to content

Commit

Permalink
WIP: add cube as struct
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes committed Jan 17, 2025
1 parent 7b19b81 commit ec581df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pybind11_add_module(
"${SRC}/common/geometry/polygons.cpp"
"${SRC}/common/geometry/quadrilateral.cpp"
"${SRC}/common/geometry/volumes.cpp"
"${SRC}/points/points.cpp"
"${SRC}/grid3d/cell.cpp"
"${SRC}/grid3d/grid.cpp"
"${SRC}/grid3d/grid_surf_oper.cpp"
Expand Down
4 changes: 2 additions & 2 deletions src/lib/include/xtgeo/points.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ init(py::module &m)
py::class_<Point>(m_points, "Point")
.def(py::init<>())
.def_readwrite("x", &Point::x)
.def_readwrite("y", &Point::y);
.def_readwrite("z", &Point::z);
.def_readwrite("y", &Point::y)
.def_readwrite("z", &Point::z);
}
} // namespace xtgeo::points
#endif // POINT_H_
11 changes: 6 additions & 5 deletions src/lib/include/xtgeo/regsurf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ init(py::module &m)
auto m_regsurf = m.def_submodule(
"regsurf", "Internal functions for operations on regular surface.");

py::class_<Point>(m_regsurf, "Point")
.def(py::init<>())
.def_readwrite("x", &Point::x)
.def_readwrite("y", &Point::y);

py::class_<RegularSurface>(m_regsurf, "RegularSurface")
.def(py::init<>())
.def_readwrite("ncol", &RegularSurface::ncol)
Expand All @@ -136,6 +131,12 @@ init(py::module &m)
.def_readwrite("values", &RegularSurface::values)
.def_readwrite("mask", &RegularSurface::mask);

py::class_<points::Point>(m_regsurf, "Point")
.def(py::init<>())
.def_readwrite("x", &points::Point::x)
.def_readwrite("y", &points::Point::y)
.def_readwrite("z", &points::Point::z);

m_regsurf.def("py2cpp", &py2cpp,
"Convert a RegularSurface (py) to a RegularSurface (c++).");

Expand Down
7 changes: 5 additions & 2 deletions src/lib/src/regsurf/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
#include <cstddef>
#include <tuple>
#include <xtgeo/geometry.hpp>
#include <xtgeo/points.hpp>
#include <xtgeo/regsurf.hpp>

namespace py = pybind11;

namespace xtgeo::regsurf {

using points::Point;

// Function to rotate a point (x, y) around the origin (xori, yori) by a given angle (in
// radians)
static points::Point
rotate_point(const points::Point p,
static Point
rotate_point(const Point p,
const double xori,
const double yori,
const double angle_rad)
Expand Down

0 comments on commit ec581df

Please sign in to comment.