From b4e7db3153a225633ebb36457fd81eff487ff8af Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Fri, 17 Jan 2025 13:24:19 -0800 Subject: [PATCH] Test making wrapper converter constant. Ubuntu 24 complained, probably due to a newer version of SWIG? --- source/Matrix3D.h | 20 ++++++++++---------- wrappers/Python/roadrunner/PyUtils.cpp | 2 +- wrappers/Python/roadrunner/PyUtils.h | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source/Matrix3D.h b/source/Matrix3D.h index d5bc85cb97..a1ec3d1e7b 100644 --- a/source/Matrix3D.h +++ b/source/Matrix3D.h @@ -156,7 +156,7 @@ namespace rr { * @param i indexes the number of elements in each row vector j; i in 0, 1, ..., xMax * @return A scalar DataType object at index k, j, i of this Matrix3D. */ - DataType slice(int k, int j, int i) { + DataType slice(int k, int j, int i) const { if (k > numZ()) { std::ostringstream err; err << "requested kth index " << k << " from a Matrix3D with " << numZ() @@ -175,9 +175,9 @@ namespace rr { << " elements in the hight (y) direction"; throw std::invalid_argument(err.str()); } - std::vector> submatrix = data_[k].getValues(); + return data_[k][j][i];// .getValues(); // j indicates which row, i indicates which column - return submatrix[j][i]; + //return submatrix[j][i]; } /** @@ -221,7 +221,7 @@ namespace rr { * @brief get number of rows in this 3D matrix * @details x is rows, y is columns, z is depth. */ - int numRows() { + int numRows() const { if (data_.empty()) return 0; return data_[0].numRows(); @@ -231,7 +231,7 @@ namespace rr { * @brief get number of columns in this 3D matrix * @details if x is rows, y is columns, z is depth. */ - int numCols() { + int numCols() const { if (data_.empty()) return 0; return data_[0].numCols(); @@ -241,7 +241,7 @@ namespace rr { * @brief get number of matrices in this 3D matrix * @details if x is rows, y is columns, z is depth. */ - int numZ() { + int numZ() const { if (index_.empty()) return 0; return index_.size(); @@ -270,15 +270,15 @@ namespace rr { /** * @brief return the row names for this Matrix3D */ - std::vector getRowNames() { - return slice(0).rowNames; + std::vector getRowNames() const { + return data_[0].rowNames; } /** * @brief return the column names for this Matrix3D */ - std::vector getColNames() { - return slice(0).colNames; + std::vector getColNames() const { + return data_[0].colNames; } /** diff --git a/wrappers/Python/roadrunner/PyUtils.cpp b/wrappers/Python/roadrunner/PyUtils.cpp index c2fb853396..caaf056e84 100644 --- a/wrappers/Python/roadrunner/PyUtils.cpp +++ b/wrappers/Python/roadrunner/PyUtils.cpp @@ -1777,7 +1777,7 @@ namespace rr { } - Matrix3DToNumpy::Matrix3DToNumpy(Matrix3DToNumpy::DoubleMatrix3D &matrix) + Matrix3DToNumpy::Matrix3DToNumpy(const Matrix3DToNumpy::DoubleMatrix3D &matrix) : matrix_(matrix) {} PyObject *Matrix3DToNumpy::convertData() { diff --git a/wrappers/Python/roadrunner/PyUtils.h b/wrappers/Python/roadrunner/PyUtils.h index 7e832a2603..d918201d80 100644 --- a/wrappers/Python/roadrunner/PyUtils.h +++ b/wrappers/Python/roadrunner/PyUtils.h @@ -284,7 +284,7 @@ namespace rr { public: using DoubleMatrix3D = rr::Matrix3D; - explicit Matrix3DToNumpy(DoubleMatrix3D &matrix); + explicit Matrix3DToNumpy(const DoubleMatrix3D &matrix); /** * @brief converts the index data field of the Double3DMatrix @@ -314,7 +314,7 @@ namespace rr { /** * @brief the Matrix3D to convert */ - DoubleMatrix3D &matrix_; + const DoubleMatrix3D &matrix_; };