From cc7b36714ea4f971578cb1efb1e7ca6929eb2057 Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Thu, 20 Jul 2017 14:58:44 +0200 Subject: [PATCH] [MaL] don't use std::size_t in EigenVector and EigenMatrix interface --- MathLib/LinAlg/Eigen/EigenMatrix.h | 10 +++++----- MathLib/LinAlg/Eigen/EigenVector.h | 8 ++++---- MathLib/LinAlg/UnifiedMatrixSetters.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/MathLib/LinAlg/Eigen/EigenMatrix.h b/MathLib/LinAlg/Eigen/EigenMatrix.h index 22d523efd1e..e8fd6b2bf06 100644 --- a/MathLib/LinAlg/Eigen/EigenMatrix.h +++ b/MathLib/LinAlg/Eigen/EigenMatrix.h @@ -39,23 +39,23 @@ public: * @param n the number of rows (that is equal to the number of columns) * @param n_nonzero_columns the number of non-zero columns used for preallocation */ - explicit EigenMatrix(std::size_t n, std::size_t n_nonzero_columns = 0) :_mat(n, n) + explicit EigenMatrix(IndexType n, IndexType n_nonzero_columns = 0) :_mat(n, n) { if (n_nonzero_columns > 0) _mat.reserve(Eigen::VectorXi::Constant(n, n_nonzero_columns)); } /// return the number of rows - std::size_t getNumberOfRows() const { return _mat.rows(); } + IndexType getNumberOfRows() const { return _mat.rows(); } /// return the number of columns - std::size_t getNumberOfColumns() const { return _mat.cols(); } + IndexType getNumberOfColumns() const { return _mat.cols(); } /// return a start index of the active data range - std::size_t getRangeBegin() const { return 0; } + IndexType getRangeBegin() const { return 0; } /// return an end index of the active data range - std::size_t getRangeEnd() const { return getNumberOfRows(); } + IndexType getRangeEnd() const { return getNumberOfRows(); } /// reset data entries to zero. void setZero() diff --git a/MathLib/LinAlg/Eigen/EigenVector.h b/MathLib/LinAlg/Eigen/EigenVector.h index 8266cdba9e3..981139dd595 100644 --- a/MathLib/LinAlg/Eigen/EigenVector.h +++ b/MathLib/LinAlg/Eigen/EigenVector.h @@ -37,19 +37,19 @@ public: /// Constructor for initialization of the number of rows /// @param length number of rows - explicit EigenVector(std::size_t length) : _vec(length) {} + explicit EigenVector(IndexType length) : _vec(length) {} /// copy constructor EigenVector(EigenVector const& src) = default; /// return a vector length - std::size_t size() const { return _vec.size(); } + IndexType size() const { return _vec.size(); } /// return a start index of the active data range - std::size_t getRangeBegin() const { return 0;} + IndexType getRangeBegin() const { return 0;} /// return an end index of the active data range - std::size_t getRangeEnd() const { return size(); } + IndexType getRangeEnd() const { return size(); } // TODO preliminary void setZero() { _vec.setZero(); } diff --git a/MathLib/LinAlg/UnifiedMatrixSetters.cpp b/MathLib/LinAlg/UnifiedMatrixSetters.cpp index dae45664fff..253d0faea5d 100644 --- a/MathLib/LinAlg/UnifiedMatrixSetters.cpp +++ b/MathLib/LinAlg/UnifiedMatrixSetters.cpp @@ -133,8 +133,8 @@ void setMatrix(EigenMatrix& m, Eigen::MatrixXd tmp(rows, cols); auto it = values.begin(); - for (std::size_t r=0; r<rows; ++r) { - for (std::size_t c=0; c<cols; ++c) { + for (GlobalIndexType r=0; r<rows; ++r) { + for (GlobalIndexType c=0; c<cols; ++c) { tmp(r, c) = *(it++); } } @@ -157,8 +157,8 @@ void addToMatrix(EigenMatrix& m, Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> tmp(rows, cols); auto it = values.begin(); - for (std::size_t r=0; r<rows; ++r) { - for (std::size_t c=0; c<cols; ++c) { + for (GlobalIndexType r=0; r<rows; ++r) { + for (GlobalIndexType c=0; c<cols; ++c) { tmp(r, c) = *(it++); } } -- GitLab