diff --git a/opm/simulators/linalg/gpuistl/GpuSparseMatrix.hpp b/opm/simulators/linalg/gpuistl/GpuSparseMatrix.hpp index e82efa0522..e578121044 100644 --- a/opm/simulators/linalg/gpuistl/GpuSparseMatrix.hpp +++ b/opm/simulators/linalg/gpuistl/GpuSparseMatrix.hpp @@ -18,18 +18,19 @@ */ #ifndef OPM_GPUSPARSEMATRIX_HPP #define OPM_GPUSPARSEMATRIX_HPP -#include -#include -#include -#include -#include + #include -#include -#include #include #include #include -#include +#include +#include + +#include +#include +#include +#include +#include namespace Opm::gpuistl { @@ -87,9 +88,9 @@ public: GpuSparseMatrix(const T* nonZeroElements, const int* rowIndices, const int* columnIndices, - size_t numberOfNonzeroBlocks, - size_t blockSize, - size_t numberOfRows); + std::size_t numberOfNonzeroBlocks, + std::size_t blockSize, + std::size_t numberOfRows); //! Create a sparse matrix by copying the sparsity structure of another matrix, not filling in the values //! @@ -103,7 +104,7 @@ public: //! restrictions in the current version of cusparse. This might change in future versions. GpuSparseMatrix(const GpuVector& rowIndices, const GpuVector& columnIndices, - size_t blockSize); + std::size_t blockSize); GpuSparseMatrix(const GpuSparseMatrix&); @@ -149,7 +150,7 @@ public: /** * @brief N returns the number of rows (which is equal to the number of columns) */ - size_t N() const + std::size_t N() const { // Technically this safe conversion is not needed since we enforce these to be // non-negative in the constructor, but keeping them for added sanity for now. @@ -163,7 +164,7 @@ public: * @brief nonzeroes behaves as the Dune::BCRSMatrix::nonzeros() function and returns the number of non zero blocks * @return number of non zero blocks. */ - size_t nonzeroes() const + std::size_t nonzeroes() const { // Technically this safe conversion is not needed since we enforce these to be // non-negative in the constructor, but keeping them for added sanity for now. @@ -257,7 +258,7 @@ public: * This is equivalent to matrix.N() * matrix.blockSize() * @return matrix.N() * matrix.blockSize() */ - size_t dim() const + std::size_t dim() const { // Technically this safe conversion is not needed since we enforce these to be // non-negative in the constructor, but keeping them for added sanity for now. @@ -270,7 +271,7 @@ public: /** * @brief blockSize size of the blocks */ - size_t blockSize() const + std::size_t blockSize() const { // Technically this safe conversion is not needed since we enforce these to be // non-negative in the constructor, but keeping them for added sanity for now. @@ -396,5 +397,7 @@ private: } } }; + } // namespace Opm::gpuistl + #endif diff --git a/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.hpp b/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.hpp index 57395da851..29541d64bd 100644 --- a/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.hpp +++ b/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.hpp @@ -20,22 +20,19 @@ #define OPM_GPUSPARSEMATRIXGENERIC_HPP #include -#include -#include #include #include #include #include - -#include +#include +#include #include +#include namespace Opm::gpuistl { - - /** * @brief The GpuSparseMatrixGeneric class uses cuSPARSE Generic API for sparse matrix operations. * @@ -74,9 +71,9 @@ public: GpuSparseMatrixGeneric(const T* nonZeroElements, const int* rowIndices, const int* columnIndices, - size_t numberOfNonzeroBlocks, - size_t blockSize, - size_t numberOfRows); + std::size_t numberOfNonzeroBlocks, + std::size_t blockSize, + std::size_t numberOfRows); //! Create a sparse matrix by copying the sparsity structure of another matrix, not filling in the values //! @@ -84,7 +81,7 @@ public: //! \param[in] columnIndices the column indices of the non-zero elements //! \param[in] blockSize size of each block matrix (typically 3) //! - GpuSparseMatrixGeneric(const GpuVector& rowIndices, const GpuVector& columnIndices, size_t blockSize); + GpuSparseMatrixGeneric(const GpuVector& rowIndices, const GpuVector& columnIndices, std::size_t blockSize); GpuSparseMatrixGeneric(const GpuSparseMatrixGeneric&); @@ -116,7 +113,7 @@ public: /** * @brief N returns the number of rows (which is equal to the number of columns) */ - size_t N() const + std::size_t N() const { return detail::to_size_t(m_numberOfRows); } @@ -125,7 +122,7 @@ public: * @brief nonzeroes behaves as the Dune::BCRSMatrix::nonzeros() function and returns the number of non zero blocks * @return number of non zero blocks. */ - size_t nonzeroes() const + std::size_t nonzeroes() const { // Technically this safe conversion is not needed since we enforce these to be // non-negative in the constructor, but keeping them for added sanity for now. @@ -201,7 +198,7 @@ public: * This is equivalent to matrix.N() * matrix.blockSize() * @return matrix.N() * matrix.blockSize() */ - size_t dim() const + std::size_t dim() const { // Technically this safe conversion is not needed since we enforce these to be // non-negative in the constructor, but keeping them for added sanity for now. @@ -214,7 +211,7 @@ public: /** * @brief blockSize size of the blocks */ - size_t blockSize() const + std::size_t blockSize() const { // Technically this safe conversion is not needed since we enforce these to be // non-negative in the constructor, but keeping them for added sanity for now. diff --git a/opm/simulators/linalg/gpuistl/GpuSparseMatrixWrapper.hpp b/opm/simulators/linalg/gpuistl/GpuSparseMatrixWrapper.hpp index 55b87f8a88..7917f81658 100644 --- a/opm/simulators/linalg/gpuistl/GpuSparseMatrixWrapper.hpp +++ b/opm/simulators/linalg/gpuistl/GpuSparseMatrixWrapper.hpp @@ -18,19 +18,20 @@ */ #ifndef OPM_GPUSPARSEMATRIXWRAPPER_HPP #define OPM_GPUSPARSEMATRIXWRAPPER_HPP -#include -#include -#include -#include -#include + #include -#include -#include -#include #include #include #include -#include +#include +#include +#include + +#include +#include +#include +#include +#include namespace Opm::gpuistl { @@ -57,7 +58,6 @@ namespace Opm::gpuistl */ template class GpuSparseMatrixWrapper - { public: using field_type = T; @@ -114,9 +114,9 @@ public: GpuSparseMatrixWrapper(const T* nonZeroElements, const int* rowIndices, const int* columnIndices, - size_t numberOfNonzeroBlocks, - size_t blockSize, - size_t numberOfRows) + std::size_t numberOfNonzeroBlocks, + std::size_t blockSize, + std::size_t numberOfRows) { m_matrix = std::make_unique(nonZeroElements, rowIndices, @@ -138,7 +138,7 @@ public: //! restrictions in the current version of cusparse. This might change in future versions. GpuSparseMatrixWrapper(const GpuVector& rowIndices, const GpuVector& columnIndices, - size_t blockSize) + std::size_t blockSize) { m_matrix = std::make_unique(rowIndices, columnIndices, blockSize); } @@ -225,7 +225,7 @@ public: /** * @brief N returns the number of rows (which is equal to the number of columns) */ - size_t N() const + std::size_t N() const { return m_matrix->N(); } @@ -234,7 +234,7 @@ public: * @brief nonzeroes behaves as the Dune::BCRSMatrix::nonzeros() function and returns the number of non zero blocks * @return number of non zero blocks. */ - size_t nonzeroes() const + std::size_t nonzeroes() const { return m_matrix->nonzeroes(); } @@ -305,7 +305,7 @@ public: * This is equivalent to matrix.N() * matrix.blockSize() * @return matrix.N() * matrix.blockSize() */ - size_t dim() const + std::size_t dim() const { return m_matrix->dim(); } @@ -313,7 +313,7 @@ public: /** * @brief blockSize size of the blocks */ - size_t blockSize() const + std::size_t blockSize() const { return m_matrix->blockSize(); } @@ -414,8 +414,9 @@ public: } private: - - std::unique_ptr m_matrix = nullptr; + std::unique_ptr m_matrix{}; }; + } // namespace Opm::gpuistl + #endif