diff --git a/CMakeLists.txt b/CMakeLists.txt index 376337301bf..2e408bfdcdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,7 @@ option(USE_HYPRE "Use the Hypre library for linear solvers?" OFF) set(OPM_COMPILE_COMPONENTS "2;3;4;5;6;7;8;9;10" CACHE STRING "The components to compile support for") option(USE_OPENCL "Enable OpenCL support?" ON) option(USE_DEV_SIMULATOR_IN_TESTS "Use the development simulator binaries in tests?" OFF) +option(USE_EXPERIMENTAL_ISTL_MATRIX "Use experimental IBCRSMatrix from dune-istl?" OFF) # Wrapper for opm_add_target_options that also adds # compile definitions and target links from the library @@ -126,6 +127,9 @@ macro(opm-simulators_prereqs_hook) target_link_libraries(opmsimulators PUBLIC HDF5::HDF5) target_compile_definitions(opmsimulators PUBLIC HAVE_HDF5=1) endif() + if(USE_EXPERIMENTAL_ISTL_MATRIX) + target_compile_definitions(opmsimulators PUBLIC OPM_USE_EXPERIMENTAL_IBCRSMATRIX=1) + endif() if (OPM_ENABLE_PYTHON) # Be backwards compatible. diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 40891042c65..2d0c31cb634 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -1095,6 +1095,7 @@ list (APPEND PUBLIC_HEADER_FILES opm/simulators/linalg/amgcpr.hh opm/simulators/linalg/bicgstabsolver.hh opm/simulators/linalg/blacklist.hh + opm/simulators/linalg/BlockSparseMatrix.hpp opm/simulators/linalg/combinedcriterion.hh opm/simulators/linalg/convergencecriterion.hh opm/simulators/linalg/DILU.hpp diff --git a/flowexperimental/comp/wells/CompWellEquations.hpp b/flowexperimental/comp/wells/CompWellEquations.hpp index 2bb847e5717..dda50399c07 100644 --- a/flowexperimental/comp/wells/CompWellEquations.hpp +++ b/flowexperimental/comp/wells/CompWellEquations.hpp @@ -20,9 +20,10 @@ #ifndef OPM_COMP_WELL_EQUATIONS_HPP #define OPM_COMP_WELL_EQUATIONS_HPP +#include + #include #include -#include #include namespace Opm { @@ -48,11 +49,11 @@ class CompWellEquations // the matrix type for the diagonal matrix D using DiagMatrixBlockWellType = Dune::FieldMatrix; - using DiagMatWell = Dune::BCRSMatrix; + using DiagMatWell = BlockSparseMatrix; // the matrix type for the non-diagonal matrix B and C^T using OffDiagMatrixBlockWellType = Dune::FieldMatrix; - using OffDiagMatWell = Dune::BCRSMatrix; + using OffDiagMatWell = BlockSparseMatrix; void init(const int num_conn, const std::vector& cells); diff --git a/opm/simulators/flow/GenericTemperatureModel.hpp b/opm/simulators/flow/GenericTemperatureModel.hpp index 20719b0e9e6..4957bd73b50 100644 --- a/opm/simulators/flow/GenericTemperatureModel.hpp +++ b/opm/simulators/flow/GenericTemperatureModel.hpp @@ -28,7 +28,6 @@ #ifndef OPM_GENERIC_TEMPERATURE_MODEL_HPP #define OPM_GENERIC_TEMPERATURE_MODEL_HPP -#include #include @@ -37,6 +36,7 @@ #include #include +#include #include #include @@ -54,7 +54,7 @@ class GenericTemperatureModel public: // the jacobian matrix using MatrixBlockTemp = MatrixBlock; - using EnergyMatrix = Dune::BCRSMatrix; + using EnergyMatrix = BlockSparseMatrix; using EnergyVector = Dune::BlockVector>; using CartesianIndexMapper = Dune::CartesianIndexMapper; static constexpr int dimWorld = Grid::dimensionworld; diff --git a/opm/simulators/flow/GenericTracerModel.hpp b/opm/simulators/flow/GenericTracerModel.hpp index a026856a0c7..14f844d5c52 100644 --- a/opm/simulators/flow/GenericTracerModel.hpp +++ b/opm/simulators/flow/GenericTracerModel.hpp @@ -28,14 +28,13 @@ #ifndef OPM_GENERIC_TRACER_MODEL_HPP #define OPM_GENERIC_TRACER_MODEL_HPP -#include - #include #include #include +#include #include #include @@ -56,7 +55,7 @@ template>; - using TracerMatrix = Dune::BCRSMatrix>; + using TracerMatrix = BlockSparseMatrix>; using TracerVector = Dune::BlockVector>; using CartesianIndexMapper = Dune::CartesianIndexMapper; static constexpr int dimWorld = Grid::dimensionworld; diff --git a/opm/simulators/flow/NonlinearSolver.hpp b/opm/simulators/flow/NonlinearSolver.hpp index 5d51e634866..c7439171383 100644 --- a/opm/simulators/flow/NonlinearSolver.hpp +++ b/opm/simulators/flow/NonlinearSolver.hpp @@ -22,7 +22,6 @@ #define OPM_NON_LINEAR_SOLVER_HPP #include -#include #include #include diff --git a/opm/simulators/linalg/AmgxPreconditioner.hpp b/opm/simulators/linalg/AmgxPreconditioner.hpp index 43e39ff2341..8828d146c3c 100644 --- a/opm/simulators/linalg/AmgxPreconditioner.hpp +++ b/opm/simulators/linalg/AmgxPreconditioner.hpp @@ -28,7 +28,6 @@ #include #include -#include #include diff --git a/opm/simulators/linalg/BlockSparseMatrix.hpp b/opm/simulators/linalg/BlockSparseMatrix.hpp new file mode 100644 index 00000000000..9afc922cb1f --- /dev/null +++ b/opm/simulators/linalg/BlockSparseMatrix.hpp @@ -0,0 +1,50 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/* + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . + + Consult the COPYING file in the top-level source directory of this + module for the precise wording of the license and the list of + copyright holders. +*/ +/*! + * \file + * + */ +#ifndef OPM_BLOCKSPARSEMATRIX_HEADER_INCLUDED +#define OPM_BLOCKSPARSEMATRIX_HEADER_INCLUDED + +#if defined(OPM_USE_EXPERIMENTAL_IBCRSMATRIX) && OPM_USE_EXPERIMENTAL_IBCRSMATRIX +#include +#else +#include +#endif + +namespace Opm { + +#if defined(OPM_USE_EXPERIMENTAL_IBCRSMATRIX) && OPM_USE_EXPERIMENTAL_IBCRSMATRIX +// Use the exprimental IBCRSMatrix, which has a better performance under distributed workloads. +template> +using BlockSparseMatrix = Dune::IBCRSMatrix; +#else +// Use the classic BCRSMatrix. +template> +using BlockSparseMatrix = Dune::BCRSMatrix; +#endif + +} // namespace Opm + +#endif diff --git a/opm/simulators/linalg/DILU.hpp b/opm/simulators/linalg/DILU.hpp index 7e4ce5f7a6d..43130d918f3 100644 --- a/opm/simulators/linalg/DILU.hpp +++ b/opm/simulators/linalg/DILU.hpp @@ -24,7 +24,6 @@ #include #include #include -#include #include diff --git a/opm/simulators/linalg/FlexibleSolver_impl.hpp b/opm/simulators/linalg/FlexibleSolver_impl.hpp index 9910256c63c..5b4ab0b9874 100644 --- a/opm/simulators/linalg/FlexibleSolver_impl.hpp +++ b/opm/simulators/linalg/FlexibleSolver_impl.hpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -355,7 +356,7 @@ namespace Dune template using BV = Dune::BlockVector>; template -using OBM = Dune::BCRSMatrix>; +using OBM = Opm::BlockSparseMatrix>; // Sequential operators. template diff --git a/opm/simulators/linalg/HyprePreconditioner.hpp b/opm/simulators/linalg/HyprePreconditioner.hpp index c5c1421abac..4fb405313b7 100644 --- a/opm/simulators/linalg/HyprePreconditioner.hpp +++ b/opm/simulators/linalg/HyprePreconditioner.hpp @@ -34,7 +34,6 @@ #endif #include -#include #include #include diff --git a/opm/simulators/linalg/ISTLSolver.cpp b/opm/simulators/linalg/ISTLSolver.cpp index c7d7031a25b..1924df3fd06 100644 --- a/opm/simulators/linalg/ISTLSolver.cpp +++ b/opm/simulators/linalg/ISTLSolver.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -164,7 +165,7 @@ void FlexibleSolverInfo::create(const Matrix& matrix, } template -using BM = Dune::BCRSMatrix>; +using BM = BlockSparseMatrix>; template using BV = Dune::BlockVector>; diff --git a/opm/simulators/linalg/ISTLSolverGpuBridge.cpp b/opm/simulators/linalg/ISTLSolverGpuBridge.cpp index c00b5ce1110..ddaa38f7740 100644 --- a/opm/simulators/linalg/ISTLSolverGpuBridge.cpp +++ b/opm/simulators/linalg/ISTLSolverGpuBridge.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -237,7 +238,7 @@ copyMatToBlockJac(const Matrix& mat, Matrix& blockJac) } template -using BM = Dune::BCRSMatrix>; +using BM = BlockSparseMatrix>; template using BV = Dune::BlockVector>; diff --git a/opm/simulators/linalg/MILU.cpp b/opm/simulators/linalg/MILU.cpp index c1a32556f6c..85309823200 100644 --- a/opm/simulators/linalg/MILU.cpp +++ b/opm/simulators/linalg/MILU.cpp @@ -23,13 +23,13 @@ #include #include -#include #include #include #include #include +#include #include #include @@ -267,8 +267,8 @@ void milun_decomposition(const M& A, int n, MILU_VARIANT milu, M& ILU, INSTANTIATE_ILUN(__VA_ARGS__) #define INSTANTIATE_DIM(T,Dim) \ - INSTANTIATE_FULL(T,Dune::BCRSMatrix>) \ - INSTANTIATE_FULL(T,Dune::BCRSMatrix>) + INSTANTIATE_FULL(T,BlockSparseMatrix>) \ + INSTANTIATE_FULL(T,BlockSparseMatrix>) #define INSTANTIATE_TYPE(T) \ template T identityFunctor(const T&); \ diff --git a/opm/simulators/linalg/MatrixMarketSpecializations.hpp b/opm/simulators/linalg/MatrixMarketSpecializations.hpp index 2743b4410fd..12e69fb7499 100644 --- a/opm/simulators/linalg/MatrixMarketSpecializations.hpp +++ b/opm/simulators/linalg/MatrixMarketSpecializations.hpp @@ -44,6 +44,18 @@ namespace MatrixMarketImpl } }; +#if defined(OPM_USE_EXPERIMENTAL_IBCRSMATRIX) && OPM_USE_EXPERIMENTAL_IBCRSMATRIX + template + struct mm_header_printer, I, A>> + { + static void print(std::ostream& os) + { + os << "%%MatrixMarket matrix coordinate "; + os << mm_numeric_type::str() << " general" << std::endl; + } + }; +#endif + template struct mm_block_structure_header, A>> { @@ -54,6 +66,19 @@ namespace MatrixMarketImpl os << i << " " << j << std::endl; } }; + +#if defined(OPM_USE_EXPERIMENTAL_IBCRSMATRIX) && OPM_USE_EXPERIMENTAL_IBCRSMATRIX + template + struct mm_block_structure_header, I, A>> + { + using M = IBCRSMatrix, I, A>; + static void print(std::ostream& os, const M&) + { + os << "% ISTL_STRUCT blocked "; + os << i << " " << j << std::endl; + } + }; +#endif } // namespace MatrixMarketImpl namespace MatrixMarketImpl diff --git a/opm/simulators/linalg/OwningTwoLevelPreconditioner.hpp b/opm/simulators/linalg/OwningTwoLevelPreconditioner.hpp index 63145c73e8b..9c630d183e6 100644 --- a/opm/simulators/linalg/OwningTwoLevelPreconditioner.hpp +++ b/opm/simulators/linalg/OwningTwoLevelPreconditioner.hpp @@ -27,7 +27,6 @@ #include #include -#include #include #include diff --git a/opm/simulators/linalg/ParallelOverlappingILU0.cpp b/opm/simulators/linalg/ParallelOverlappingILU0.cpp index 47679303bf1..d77128c394c 100644 --- a/opm/simulators/linalg/ParallelOverlappingILU0.cpp +++ b/opm/simulators/linalg/ParallelOverlappingILU0.cpp @@ -22,17 +22,19 @@ #include +#include + #include namespace Opm { #define INSTANTIATE_PAR(T, Dim, ...) \ - template class ParallelOverlappingILU0>, \ + template class ParallelOverlappingILU0>, \ Dune::BlockVector>, \ Dune::BlockVector>, \ __VA_ARGS__>; \ - template class ParallelOverlappingILU0>, \ + template class ParallelOverlappingILU0>, \ Dune::BlockVector>, \ Dune::BlockVector>, \ __VA_ARGS__>; diff --git a/opm/simulators/linalg/PreconditionerFactory_impl.hpp b/opm/simulators/linalg/PreconditionerFactory_impl.hpp index deb84fbc409..c455e890772 100644 --- a/opm/simulators/linalg/PreconditionerFactory_impl.hpp +++ b/opm/simulators/linalg/PreconditionerFactory_impl.hpp @@ -25,6 +25,7 @@ #include +#include #include #include #include @@ -198,21 +199,21 @@ PreconditionerFactory::addCreator(const std::string& type, ParCr using CommSeq = Dune::Amg::SequentialInformation; template -using OpFSeq = Dune::MatrixAdapter>, +using OpFSeq = Dune::MatrixAdapter>, Dune::BlockVector>, Dune::BlockVector>>; template -using OpBSeq = Dune::MatrixAdapter>, +using OpBSeq = Dune::MatrixAdapter>, Dune::BlockVector>, Dune::BlockVector>>; template -using OpW = WellModelMatrixAdapter>, +using OpW = WellModelMatrixAdapter>, Dune::BlockVector>, Dune::BlockVector>>; template -using OpWG = WellModelGhostLastMatrixAdapter>, +using OpWG = WellModelGhostLastMatrixAdapter>, Dune::BlockVector>, Dune::BlockVector>, overlap>; @@ -221,24 +222,24 @@ using OpWG = WellModelGhostLastMatrixAdapter; template -using OpFPar = Dune::OverlappingSchwarzOperator>, +using OpFPar = Dune::OverlappingSchwarzOperator>, Dune::BlockVector>, Dune::BlockVector>, CommPar>; template -using OpBPar = Dune::OverlappingSchwarzOperator>, +using OpBPar = Dune::OverlappingSchwarzOperator>, Dune::BlockVector>, Dune::BlockVector>, CommPar>; template -using OpGLFPar = Opm::GhostLastMatrixAdapter>, +using OpGLFPar = Opm::GhostLastMatrixAdapter>, Dune::BlockVector>, Dune::BlockVector>, CommPar>; template -using OpGLBPar = Opm::GhostLastMatrixAdapter>, +using OpGLBPar = Opm::GhostLastMatrixAdapter>, Dune::BlockVector>, Dune::BlockVector>, CommPar>; diff --git a/opm/simulators/linalg/PressureBhpTransferPolicy.hpp b/opm/simulators/linalg/PressureBhpTransferPolicy.hpp index 3d6e78bae92..04b238dabbb 100644 --- a/opm/simulators/linalg/PressureBhpTransferPolicy.hpp +++ b/opm/simulators/linalg/PressureBhpTransferPolicy.hpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -77,7 +78,7 @@ namespace Opm namespace Details { - template using PressureMatrixType = Dune::BCRSMatrix>; + template using PressureMatrixType = BlockSparseMatrix>; template using PressureVectorType = Dune::BlockVector>; template using SeqCoarseOperatorType = Dune::MatrixAdapter, PressureVectorType, diff --git a/opm/simulators/linalg/PressureTransferPolicy.hpp b/opm/simulators/linalg/PressureTransferPolicy.hpp index 60d19904a42..dfff9416a83 100644 --- a/opm/simulators/linalg/PressureTransferPolicy.hpp +++ b/opm/simulators/linalg/PressureTransferPolicy.hpp @@ -24,13 +24,14 @@ #include #include +#include #include #include #include namespace Opm { namespace Details { - template using PressureMatrixType = Dune::BCRSMatrix>; + template using PressureMatrixType = BlockSparseMatrix>; template using PressureVectorType = Dune::BlockVector>; template using SeqCoarseOperatorType = Dune::MatrixAdapter, PressureVectorType, diff --git a/opm/simulators/linalg/StandardPreconditioners_gpu_mpi.hpp b/opm/simulators/linalg/StandardPreconditioners_gpu_mpi.hpp index aeb116e96c3..889ba6cdb81 100644 --- a/opm/simulators/linalg/StandardPreconditioners_gpu_mpi.hpp +++ b/opm/simulators/linalg/StandardPreconditioners_gpu_mpi.hpp @@ -17,7 +17,6 @@ #ifndef OPM_STANDARDPRECONDITIONERS_GPU_MPI_HEADER #define OPM_STANDARDPRECONDITIONERS_GPU_MPI_HEADER -#include #include #include diff --git a/opm/simulators/linalg/StandardPreconditioners_gpu_serial.hpp b/opm/simulators/linalg/StandardPreconditioners_gpu_serial.hpp index 49c0f1289e3..99dcf4ed4cb 100644 --- a/opm/simulators/linalg/StandardPreconditioners_gpu_serial.hpp +++ b/opm/simulators/linalg/StandardPreconditioners_gpu_serial.hpp @@ -23,8 +23,6 @@ #include #endif -#include - #include diff --git a/opm/simulators/linalg/StandardPreconditioners_serial.hpp b/opm/simulators/linalg/StandardPreconditioners_serial.hpp index e18c007ef56..2a598b468c5 100644 --- a/opm/simulators/linalg/StandardPreconditioners_serial.hpp +++ b/opm/simulators/linalg/StandardPreconditioners_serial.hpp @@ -29,6 +29,8 @@ #endif #endif +#include + #include #include #include @@ -273,8 +275,7 @@ struct StandardPreconditioners("relaxation", 1.0); using block_type = typename V::block_type; using VTo = Dune::BlockVector>; - using matrix_type_to = - typename Dune::BCRSMatrix>; + using matrix_type_to = BlockSparseMatrix>; using GpuILU0 = typename gpuistl:: GpuSeqILU0, gpuistl::GpuVector>; using Adapter = typename gpuistl::PreconditionerAdapter; @@ -337,7 +338,7 @@ struct StandardPreconditioners>; - using matrix_type_to = typename Dune::BCRSMatrix>; + using matrix_type_to = BlockSparseMatrix>; using GpuDILU = typename gpuistl::GpuDILU, gpuistl::GpuVector>; using MatrixOwner = Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix, gpuistl::GpuVector, GpuDILU, matrix_type_to>; diff --git a/opm/simulators/linalg/WellOperators.hpp b/opm/simulators/linalg/WellOperators.hpp index 44d4a15cc8c..6db661e9368 100644 --- a/opm/simulators/linalg/WellOperators.hpp +++ b/opm/simulators/linalg/WellOperators.hpp @@ -24,11 +24,11 @@ #include #include -#include #include #include +#include #include #include @@ -57,7 +57,7 @@ class LinearOperatorExtra : public Dune::LinearOperator { public: using field_type = typename X::field_type; - using PressureMatrix = Dune::BCRSMatrix>; + using PressureMatrix = BlockSparseMatrix>; virtual void addWellPressureEquations(PressureMatrix& jacobian, const X& weights, const bool use_well_weights) const = 0; @@ -228,7 +228,7 @@ class WellModelMatrixAdapter : public Dune::AssembledLinearOperator using domain_type = X; using range_type = Y; using field_type = typename X::field_type; - using PressureMatrix = Dune::BCRSMatrix>; + using PressureMatrix = BlockSparseMatrix>; Dune::SolverCategory::Category category() const override { @@ -302,7 +302,7 @@ class WellModelGhostLastMatrixAdapter : public Dune::AssembledLinearOperator>; + using PressureMatrix = BlockSparseMatrix>; #if HAVE_MPI using communication_type = Dune::OwnerOverlapCopyCommunication; #else diff --git a/opm/simulators/linalg/foreignoverlapfrombcrsmatrix.hh b/opm/simulators/linalg/foreignoverlapfrombcrsmatrix.hh index 14e0c608c7c..878bea399a7 100644 --- a/opm/simulators/linalg/foreignoverlapfrombcrsmatrix.hh +++ b/opm/simulators/linalg/foreignoverlapfrombcrsmatrix.hh @@ -33,7 +33,6 @@ #include #include -#include #include #include diff --git a/opm/simulators/linalg/globalindices.hh b/opm/simulators/linalg/globalindices.hh index 61fe0a89aed..73f9be9c8de 100644 --- a/opm/simulators/linalg/globalindices.hh +++ b/opm/simulators/linalg/globalindices.hh @@ -28,7 +28,6 @@ #define EWOMS_GLOBAL_INDICES_HH #include -#include #include #include diff --git a/opm/simulators/linalg/gpubridge/CprCreation.hpp b/opm/simulators/linalg/gpubridge/CprCreation.hpp index c3a3bf53cde..7480255777c 100644 --- a/opm/simulators/linalg/gpubridge/CprCreation.hpp +++ b/opm/simulators/linalg/gpubridge/CprCreation.hpp @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -55,7 +56,7 @@ class CprCreation BlockedMatrix *mat = nullptr; // input matrix, blocked - using DuneMat = Dune::BCRSMatrix >; + using DuneMat = BlockSparseMatrix >; using DuneVec = Dune::BlockVector >; using MatrixOperator = Dune::MatrixAdapter; using DuneAmg = Dune::Amg::MatrixHierarchy; diff --git a/opm/simulators/linalg/gpubridge/GpuBridge.cpp b/opm/simulators/linalg/gpubridge/GpuBridge.cpp index 8d49c22213f..2ceaf6ef923 100644 --- a/opm/simulators/linalg/gpubridge/GpuBridge.cpp +++ b/opm/simulators/linalg/gpubridge/GpuBridge.cpp @@ -19,8 +19,8 @@ #include #include -#include "dune/istl/bcrsmatrix.hh" #include +#include #include #include @@ -359,9 +359,9 @@ initWellContributions([[maybe_unused]] WellContributions& wellContribs, // the tests use Dune::FieldMatrix, Flow uses Opm::MatrixBlock #define INSTANTIATE_GPU_FUNCTIONS(T,n) \ - template class GpuBridge>, \ + template class GpuBridge>, \ Dune::BlockVector>,n>; \ - template class GpuBridge>, \ + template class GpuBridge>, \ Dune::BlockVector>,n>; #define INSTANTIATE_TYPE(T) \ diff --git a/opm/simulators/linalg/gpubridge/GpuBridge.hpp b/opm/simulators/linalg/gpubridge/GpuBridge.hpp index 8a67534ed55..b46458cc578 100644 --- a/opm/simulators/linalg/gpubridge/GpuBridge.hpp +++ b/opm/simulators/linalg/gpubridge/GpuBridge.hpp @@ -70,8 +70,8 @@ class GpuBridge /// Solve linear system, A*x = b /// \warning Values of A might get overwritten! - /// \param[in] bridgeMat matrix A, should be of type Dune::BCRSMatrix - /// \param[in] jacMat matrix A, but modified for the preconditioner, should be of type Dune::BCRSMatrix + /// \param[in] bridgeMat matrix A, should be a matrix like Dune::BCRSMatrix + /// \param[in] jacMat matrix A, but modified for the preconditioner, should a matrix like Dune::BCRSMatrix /// \param[in] numJacobiBlocks number of jacobi blocks in jacMat /// \param[in] b vector b, should be of type Dune::BlockVector /// \param[in] wellContribs contains all WellContributions, to apply them separately, instead of adding them to matrix A diff --git a/opm/simulators/linalg/gpuistl/GpuDILU.cpp b/opm/simulators/linalg/gpuistl/GpuDILU.cpp index ca19d9607ae..56d544ed0e1 100644 --- a/opm/simulators/linalg/gpuistl/GpuDILU.cpp +++ b/opm/simulators/linalg/gpuistl/GpuDILU.cpp @@ -18,11 +18,11 @@ */ #include #include -#include #include #include #include #include +#include #include #include #include @@ -535,10 +535,10 @@ GpuDILU::tuneThreadBlockSizes() } // namespace Opm::gpuistl #define INSTANTIATE_CUDILU_DUNE(realtype, blockdim) \ - template class ::Opm::gpuistl::GpuDILU>, \ + template class ::Opm::gpuistl::GpuDILU>, \ ::Opm::gpuistl::GpuVector, \ ::Opm::gpuistl::GpuVector>; \ - template class ::Opm::gpuistl::GpuDILU>, \ + template class ::Opm::gpuistl::GpuDILU>, \ ::Opm::gpuistl::GpuVector, \ ::Opm::gpuistl::GpuVector> diff --git a/opm/simulators/linalg/gpuistl/GpuJac.cpp b/opm/simulators/linalg/gpuistl/GpuJac.cpp index 741dc162d4e..c3d2cdb7a7a 100644 --- a/opm/simulators/linalg/gpuistl/GpuJac.cpp +++ b/opm/simulators/linalg/gpuistl/GpuJac.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include diff --git a/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp b/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp index 2b63c361f77..be5d153739f 100644 --- a/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp +++ b/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp @@ -22,10 +22,10 @@ #include #include -#include #include #include +#include #include #include #include @@ -324,10 +324,10 @@ GpuSeqILU0::updateILUConfiguration() } } // namespace Opm::gpuistl #define INSTANTIATE_GPUSEQILU0_DUNE(realtype, blockdim) \ - template class ::Opm::gpuistl::GpuSeqILU0>, \ + template class ::Opm::gpuistl::GpuSeqILU0>, \ ::Opm::gpuistl::GpuVector, \ ::Opm::gpuistl::GpuVector>; \ - template class ::Opm::gpuistl::GpuSeqILU0>, \ + template class ::Opm::gpuistl::GpuSeqILU0>, \ ::Opm::gpuistl::GpuVector, \ ::Opm::gpuistl::GpuVector> diff --git a/opm/simulators/linalg/gpuistl/GpuSparseMatrix.cpp b/opm/simulators/linalg/gpuistl/GpuSparseMatrix.cpp index 6104408b3e2..13d061c2ec7 100644 --- a/opm/simulators/linalg/gpuistl/GpuSparseMatrix.cpp +++ b/opm/simulators/linalg/gpuistl/GpuSparseMatrix.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include diff --git a/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.cpp b/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.cpp index ffac016badb..85add2ac45e 100644 --- a/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.cpp +++ b/opm/simulators/linalg/gpuistl/GpuSparseMatrixGeneric.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include diff --git a/opm/simulators/linalg/gpuistl/OpmGpuILU0.cpp b/opm/simulators/linalg/gpuistl/OpmGpuILU0.cpp index d56b65f3cc7..5c3e645682b 100644 --- a/opm/simulators/linalg/gpuistl/OpmGpuILU0.cpp +++ b/opm/simulators/linalg/gpuistl/OpmGpuILU0.cpp @@ -18,11 +18,11 @@ */ #include #include -#include #include #include #include #include +#include #include #include #include @@ -432,10 +432,10 @@ OpmGpuILU0::tuneThreadBlockSizes() } // namespace Opm::gpuistl #define INSTANTIATE_GPUILU_DUNE(realtype, blockdim) \ - template class ::Opm::gpuistl::OpmGpuILU0>, \ + template class ::Opm::gpuistl::OpmGpuILU0>, \ ::Opm::gpuistl::GpuVector, \ ::Opm::gpuistl::GpuVector>; \ - template class ::Opm::gpuistl::OpmGpuILU0>, \ + template class ::Opm::gpuistl::OpmGpuILU0>, \ ::Opm::gpuistl::GpuVector, \ ::Opm::gpuistl::GpuVector> diff --git a/opm/simulators/linalg/gpuistl/PreconditionerConvertFieldTypeAdapter.hpp b/opm/simulators/linalg/gpuistl/PreconditionerConvertFieldTypeAdapter.hpp index 615b816283d..915fec74ac3 100644 --- a/opm/simulators/linalg/gpuistl/PreconditionerConvertFieldTypeAdapter.hpp +++ b/opm/simulators/linalg/gpuistl/PreconditionerConvertFieldTypeAdapter.hpp @@ -19,9 +19,9 @@ #ifndef OPM_PRECONDITIONERCONVERTOFLOATADAPTER_HPP #define OPM_PRECONDITIONERCONVERTOFLOATADAPTER_HPP #include -#include #include #include +#include #include #include #include @@ -55,10 +55,10 @@ namespace Opm::gpuistl //! //! using XDouble = Dune::BlockVector>; //! using MDouble = Dune::FieldMatrix; -//! using SpMatrixDouble = Dune::BCRSMatrix; +//! using SpMatrixDouble = BlockSparseMatrix; //! using XFloat = Dune::BlockVector>; //! using MFloat = Dune::FieldMatrix; -//! using SpMatrixFloat = Dune::BCRSMatrix; +//! using SpMatrixFloat = BlockSparseMatrix; //! //! template //! void applyILU0AsFloat(const MDouble& matrix, const XDouble& x, XDouble& y) { @@ -107,8 +107,7 @@ class PreconditionerConvertFieldTypeAdapter : public Dune::PreconditionerWithUpd using XTo = Dune::BlockVector>; using YTo = Dune::BlockVector>; - using matrix_type_to = - typename Dune::BCRSMatrix>; + using matrix_type_to = BlockSparseMatrix>; //! \brief Constructor. //! diff --git a/opm/simulators/linalg/gpuistl/SolverAdapter.hpp b/opm/simulators/linalg/gpuistl/SolverAdapter.hpp index 5f33d24e13e..96310a8825d 100644 --- a/opm/simulators/linalg/gpuistl/SolverAdapter.hpp +++ b/opm/simulators/linalg/gpuistl/SolverAdapter.hpp @@ -19,7 +19,6 @@ #ifndef OPM_SOLVERADAPTER_HPP #define OPM_SOLVERADAPTER_HPP -#include #include #include #include diff --git a/opm/simulators/linalg/gpuistl/detail/gpu_preconditioner_utils.hpp b/opm/simulators/linalg/gpuistl/detail/gpu_preconditioner_utils.hpp index e0749841f0b..7d603ef490b 100644 --- a/opm/simulators/linalg/gpuistl/detail/gpu_preconditioner_utils.hpp +++ b/opm/simulators/linalg/gpuistl/detail/gpu_preconditioner_utils.hpp @@ -21,8 +21,7 @@ #define OPM_GPUISTL_DETAIL_GPU_PRECONDITIONER_UTILS_HEADER #include - -#include +#include namespace Opm::gpuistl::detail { @@ -44,7 +43,7 @@ namespace Opm::gpuistl::detail { * used in the constructor, **not** in the update function or the apply function. */ template -Dune::BCRSMatrix makeCPUMatrix(const Operator& op) { +BlockSparseMatrix makeCPUMatrix(const Operator& op) { // TODO: Make this more efficient. Maybe we can simply copy the memory areas directly? // Do note that this function is anyway going away when we have a GPU // constructor for the preconditioners, so it is not a priority. @@ -57,7 +56,7 @@ Dune::BCRSMatrix makeCPUMatrix(const Operator& op) { const auto numberOfNonZeroes = gpuMatrix.nonzeroes(); const auto N = gpuMatrix.N(); - Dune::BCRSMatrix matrix(N, N, numberOfNonZeroes, Dune::BCRSMatrix::row_wise); + BlockSparseMatrix matrix(N, N, numberOfNonZeroes, BlockSparseMatrix::row_wise); for (auto row = matrix.createbegin(); row != matrix.createend(); ++row) { for (auto j = rowIndices[row.index()]; j != rowIndices[row.index() + 1]; ++j) { const auto columnIndex = columnIndices[j]; diff --git a/opm/simulators/linalg/gpuistl/detail/gpusparse_matrix_utilities.hpp b/opm/simulators/linalg/gpuistl/detail/gpusparse_matrix_utilities.hpp index 5bb5e6b2474..e12fee8161e 100644 --- a/opm/simulators/linalg/gpuistl/detail/gpusparse_matrix_utilities.hpp +++ b/opm/simulators/linalg/gpuistl/detail/gpusparse_matrix_utilities.hpp @@ -20,6 +20,7 @@ #define OPM_GPUISTL_GPUSPARSE_MATRIX_UTILITIES_HPP #include +#include #include #include @@ -231,13 +232,13 @@ validateVectorMatrixSizes(size_t vectorSize, size_t matrixBlockSize, size_t matr */ #define INSTANTIATE_SPARSE_MATRIX_DUNE_OPERATIONS(CLASS_NAME, realtype, blockdim) \ template CLASS_NAME CLASS_NAME::fromMatrix( \ - const Dune::BCRSMatrix>&, bool); \ + const BlockSparseMatrix>&, bool); \ template CLASS_NAME CLASS_NAME::fromMatrix( \ - const Dune::BCRSMatrix>&, bool); \ + const BlockSparseMatrix>&, bool); \ template void CLASS_NAME::updateNonzeroValues( \ - const Dune::BCRSMatrix>&, bool); \ + const BlockSparseMatrix>&, bool); \ template void CLASS_NAME::updateNonzeroValues( \ - const Dune::BCRSMatrix>&, bool) + const BlockSparseMatrix>&, bool) /** * @brief Macro for generating template instantiations for a range of block sizes diff --git a/opm/simulators/linalg/istlsparsematrixadapter.hh b/opm/simulators/linalg/istlsparsematrixadapter.hh index cd6fd977d99..244f3fd4183 100644 --- a/opm/simulators/linalg/istlsparsematrixadapter.hh +++ b/opm/simulators/linalg/istlsparsematrixadapter.hh @@ -27,10 +27,11 @@ #ifndef EWOMS_ISTL_SPARSE_MATRIX_ADAPTER_HH #define EWOMS_ISTL_SPARSE_MATRIX_ADAPTER_HH -#include #include #include +#include + namespace Opm { namespace Linear { @@ -43,7 +44,7 @@ class IstlSparseMatrixAdapter { public: //! \brief Implementation of matrix - using IstlMatrix = Dune::BCRSMatrix; + using IstlMatrix = BlockSparseMatrix; //! \brief block type forming the matrix entries using MatrixBlock = typename IstlMatrix::block_type; diff --git a/opm/simulators/linalg/matrixblock.hh b/opm/simulators/linalg/matrixblock.hh index ee65037bfe9..4c3c522962a 100644 --- a/opm/simulators/linalg/matrixblock.hh +++ b/opm/simulators/linalg/matrixblock.hh @@ -289,6 +289,23 @@ public: : Base(reinterpret_cast(matrix), verbose) {} }; + +#if defined(OPM_USE_EXPERIMENTAL_IBCRSMATRIX) && OPM_USE_EXPERIMENTAL_IBCRSMATRIX +template +class UMFPack, I, A> > + : public UMFPack, I, A> > +{ + using Base = UMFPack, I, A> >; + using Matrix = IBCRSMatrix, I, A>; + +public: + using RealMatrix = IBCRSMatrix, I, A>; + + UMFPack(const RealMatrix& matrix, int verbose, bool) + : Base(reinterpret_cast(matrix), verbose) + {} +}; +#endif #endif #if HAVE_SUPERLU @@ -309,6 +326,23 @@ public: : Base(reinterpret_cast(matrix), verb, reuse) {} }; + +#if defined(OPM_USE_EXPERIMENTAL_IBCRSMATRIX) && OPM_USE_EXPERIMENTAL_IBCRSMATRIX +template +class SuperLU, I, A> > + : public SuperLU, I, A> > +{ + using Base = SuperLU, I, A> >; + using Matrix = IBCRSMatrix, I, A>; + +public: + using RealMatrix = IBCRSMatrix, I, A>; + + SuperLU(const RealMatrix& matrix, int verb, bool reuse=true) + : Base(reinterpret_cast(matrix), verb, reuse) + {} +}; +#endif #endif template diff --git a/opm/simulators/linalg/parallelamgbackend.hh b/opm/simulators/linalg/parallelamgbackend.hh index 457e9731e2c..bff7671cb38 100644 --- a/opm/simulators/linalg/parallelamgbackend.hh +++ b/opm/simulators/linalg/parallelamgbackend.hh @@ -33,7 +33,6 @@ #include "combinedcriterion.hh" #include "istlsparsematrixadapter.hh" -#include #include #include #include diff --git a/opm/simulators/linalg/parallelbasebackend.hh b/opm/simulators/linalg/parallelbasebackend.hh index 52ede634dcf..e1e6bd0397f 100644 --- a/opm/simulators/linalg/parallelbasebackend.hh +++ b/opm/simulators/linalg/parallelbasebackend.hh @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -401,7 +402,7 @@ private: static constexpr int numEq = getPropValue(); using LinearSolverScalar = GetPropType; using MatrixBlock = Opm::MatrixBlock; - using NonOverlappingMatrix = Dune::BCRSMatrix; + using NonOverlappingMatrix = Opm::BlockSparseMatrix; public: using type = Opm::Linear::OverlappingBCRSMatrix; diff --git a/opm/simulators/linalg/superlubackend.hh b/opm/simulators/linalg/superlubackend.hh index f33b36e3617..14eb91c830b 100644 --- a/opm/simulators/linalg/superlubackend.hh +++ b/opm/simulators/linalg/superlubackend.hh @@ -40,6 +40,7 @@ #include #include +#include namespace Opm::Properties::TTag { @@ -151,7 +152,7 @@ public: using DoubleEqVector = Dune::FieldVector; using DoubleEqMatrix = Dune::FieldMatrix; using DoubleVector = Dune::BlockVector; - using DoubleMatrix = Dune::BCRSMatrix; + using DoubleMatrix = BlockSparseMatrix; // copy the inputs into the double precision data structures DoubleVector bDouble(b); diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 14f7db21c8e..7e9fb4aedb8 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -25,7 +25,6 @@ #include -#include #include #include @@ -300,7 +299,7 @@ template class WellContributions; const WellInterface& getWell(const std::string& well_name) const; - using PressureMatrix = Dune::BCRSMatrix>; + using PressureMatrix = BlockSparseMatrix>; void addWellPressureEquations(PressureMatrix& jacobian, const BVector& weights, diff --git a/opm/simulators/wells/MSWellHelpers.cpp b/opm/simulators/wells/MSWellHelpers.cpp index 29c6acb1520..e17e3ebf005 100644 --- a/opm/simulators/wells/MSWellHelpers.cpp +++ b/opm/simulators/wells/MSWellHelpers.cpp @@ -33,6 +33,8 @@ #include #include +#include + #include #include @@ -360,7 +362,7 @@ ValueType emulsionViscosity(const ValueType& water_fraction, template using Vec = Dune::BlockVector>; template -using Mat = Dune::BCRSMatrix>; +using Mat = BlockSparseMatrix>; #define INSTANTIATE_PARALLELLMSWELLB(T, M, N) \ template class ParallellMSWellB>; \ diff --git a/opm/simulators/wells/MultisegmentWellEquations.cpp b/opm/simulators/wells/MultisegmentWellEquations.cpp index 729f948e800..e710e1abc95 100644 --- a/opm/simulators/wells/MultisegmentWellEquations.cpp +++ b/opm/simulators/wells/MultisegmentWellEquations.cpp @@ -467,7 +467,7 @@ sumDistributed(Parallel::Communication comm) template void MultisegmentWellEquations:: \ extract(Linear::IstlSparseMatrixAdapter>&) const; \ template void MultisegmentWellEquations:: \ - extractCPRPressureMatrix(Dune::BCRSMatrix>&, \ + extractCPRPressureMatrix(BlockSparseMatrix>&, \ const MultisegmentWellEquations::BVector&, \ const int, \ const bool, \ diff --git a/opm/simulators/wells/MultisegmentWellEquations.hpp b/opm/simulators/wells/MultisegmentWellEquations.hpp index 5e44001de50..2d187314ddb 100644 --- a/opm/simulators/wells/MultisegmentWellEquations.hpp +++ b/opm/simulators/wells/MultisegmentWellEquations.hpp @@ -22,12 +22,12 @@ #ifndef OPM_MULTISEGMENTWELL_EQUATIONS_HEADER_INCLUDED #define OPM_MULTISEGMENTWELL_EQUATIONS_HEADER_INCLUDED +#include #include #include #include #include #include -#include #include #include @@ -65,11 +65,11 @@ class MultisegmentWellEquations // the matrix type for the diagonal matrix D using DiagMatrixBlockWellType = Dune::FieldMatrix; - using DiagMatWell = Dune::BCRSMatrix; + using DiagMatWell = BlockSparseMatrix; // the matrix type for the non-diagonal matrix B and C^T using OffDiagMatrixBlockWellType = Dune::FieldMatrix; - using OffDiagMatWell = Dune::BCRSMatrix; + using OffDiagMatWell = BlockSparseMatrix; MultisegmentWellEquations(const MultisegmentWellGeneric& well, const ParallelWellInfo& parallel_well_info); diff --git a/opm/simulators/wells/StandardWellEquations.cpp b/opm/simulators/wells/StandardWellEquations.cpp index 9efa27445f3..0b7e1b9c510 100644 --- a/opm/simulators/wells/StandardWellEquations.cpp +++ b/opm/simulators/wells/StandardWellEquations.cpp @@ -422,7 +422,7 @@ sumDistributed(Parallel::Communication comm) template void StandardWellEquations:: \ extract(Linear::IstlSparseMatrixAdapter>&) const; \ template void StandardWellEquations:: \ - extractCPRPressureMatrix(Dune::BCRSMatrix>&, \ + extractCPRPressureMatrix(BlockSparseMatrix>&, \ const typename StandardWellEquations::BVector&, \ const int, \ const bool, \ diff --git a/opm/simulators/wells/StandardWellEquations.hpp b/opm/simulators/wells/StandardWellEquations.hpp index 2295e07c407..1e814fe1229 100644 --- a/opm/simulators/wells/StandardWellEquations.hpp +++ b/opm/simulators/wells/StandardWellEquations.hpp @@ -23,12 +23,12 @@ #ifndef OPM_STANDARDWELL_EQUATIONS_HEADER_INCLUDED #define OPM_STANDARDWELL_EQUATIONS_HEADER_INCLUDED +#include #include #include #include #include #include -#include #include namespace Opm @@ -56,11 +56,11 @@ class StandardWellEquations // the matrix type for the diagonal matrix D using DiagMatrixBlockWellType = Dune::DynamicMatrix; - using DiagMatWell = Dune::BCRSMatrix; + using DiagMatWell = BlockSparseMatrix; // the matrix type for the non-diagonal matrix B and C^T using OffDiagMatrixBlockWellType = Dune::DynamicMatrix; - using OffDiagMatWell = Dune::BCRSMatrix; + using OffDiagMatWell = BlockSparseMatrix; // block vector type using BVector = Dune::BlockVector>; diff --git a/opm/simulators/wells/WellHelpers.hpp b/opm/simulators/wells/WellHelpers.hpp index 4df4e1a4126..77fd8889b3f 100644 --- a/opm/simulators/wells/WellHelpers.hpp +++ b/opm/simulators/wells/WellHelpers.hpp @@ -23,9 +23,10 @@ #ifndef OPM_WELLHELPERS_HEADER_INCLUDED #define OPM_WELLHELPERS_HEADER_INCLUDED -#include #include +#include + #include namespace Opm { @@ -53,7 +54,7 @@ class ParallelStandardWellB { public: using Block = Dune::DynamicMatrix; - using Matrix = Dune::BCRSMatrix; + using Matrix = BlockSparseMatrix; ParallelStandardWellB(const Matrix& B, const ParallelWellInfo& parallel_well_info); diff --git a/opm/simulators/wells/WellInterface.hpp b/opm/simulators/wells/WellInterface.hpp index f591ed6b17e..29c21c5f73c 100644 --- a/opm/simulators/wells/WellInterface.hpp +++ b/opm/simulators/wells/WellInterface.hpp @@ -41,6 +41,7 @@ namespace Opm { #include +#include #include #include @@ -57,7 +58,6 @@ namespace Opm { #include #include -#include #include #include @@ -96,7 +96,7 @@ class WellInterface : public WellInterfaceIndices; using Eval = typename Base::Eval; using BVector = Dune::BlockVector; - using PressureMatrix = Dune::BCRSMatrix>; + using PressureMatrix = BlockSparseMatrix>; using WellStateType = WellState; using SingleWellStateType = SingleWellState; diff --git a/tests/AmgxPreconditionerTestHelper.hpp b/tests/AmgxPreconditionerTestHelper.hpp index a549fe8ccb9..6ac4cf72a87 100644 --- a/tests/AmgxPreconditionerTestHelper.hpp +++ b/tests/AmgxPreconditionerTestHelper.hpp @@ -24,12 +24,12 @@ #include #include -#include #include #include #include #include +#include #include #include #include @@ -93,7 +93,7 @@ createMatrix(int N) } else { // For GPU matrix, create CPU matrix first then convert using ScalarType = typename MatrixType::field_type; - using CpuMatrix = Dune::BCRSMatrix>; + using CpuMatrix = Opm::BlockSparseMatrix>; CpuMatrix cpu_matrix; setupLaplace2d(N, cpu_matrix); return MatrixType::fromMatrix(cpu_matrix); @@ -214,7 +214,7 @@ testAmgxPreconditioner() using Vector = Opm::gpuistl::GpuVector; testAmgxPreconditionerGeneric(); } else { - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; testAmgxPreconditionerGeneric(); } @@ -229,7 +229,7 @@ testAmgxPreconditionerUpdate() using Vector = Opm::gpuistl::GpuVector; testAmgxPreconditionerUpdateGeneric(); } else { - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; testAmgxPreconditionerUpdateGeneric(); } diff --git a/tests/HypreTestHelper.hpp b/tests/HypreTestHelper.hpp index 52bafa3b0f3..f9d87649f11 100644 --- a/tests/HypreTestHelper.hpp +++ b/tests/HypreTestHelper.hpp @@ -24,12 +24,12 @@ #include #include -#include #include #include #include #include +#include #include #include #include @@ -412,7 +412,7 @@ void testMatrixTransfer(bool use_gpu_backend) HypreInterface::initialize(use_gpu_backend); // Create test matrix - start with CPU matrix - using CpuMatrix = Dune::BCRSMatrix>; + using CpuMatrix = Opm::BlockSparseMatrix>; CpuMatrix cpu_matrix; cpu_matrix.setBuildMode(CpuMatrix::row_wise); cpu_matrix.setSize(3, 3, 3); @@ -429,7 +429,7 @@ void testMatrixTransfer(bool use_gpu_backend) // Convert to target matrix type MatrixType matrix = [&]() { - if constexpr (std::is_same_v>>) { + if constexpr (std::is_same_v>>) { return std::move(cpu_matrix); } #if HAVE_CUDA || HAVE_HIP @@ -444,7 +444,7 @@ void testMatrixTransfer(bool use_gpu_backend) std::vector rows; std::vector cols; - if constexpr (std::is_same_v>>) { + if constexpr (std::is_same_v>>) { setupMatrixHelperArrays(matrix, ncols, rows, cols); } #if HAVE_CUDA || HAVE_HIP diff --git a/tests/gpuistl/test_AmgxInterface.cpp b/tests/gpuistl/test_AmgxInterface.cpp index 11df7b3d70b..c609de6a51f 100644 --- a/tests/gpuistl/test_AmgxInterface.cpp +++ b/tests/gpuistl/test_AmgxInterface.cpp @@ -26,9 +26,9 @@ #include #include #include +#include #include -#include #include #include @@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE(TestMatrixTransfer) const int blockSize = 1; using FieldMatrix = Dune::FieldMatrix; - using BCRSMatrix = Dune::BCRSMatrix; + using BCRSMatrix = Opm::BlockSparseMatrix; BCRSMatrix dune_matrix(N, N, BCRSMatrix::row_wise); diff --git a/tests/gpuistl/test_GpuDILU.cpp b/tests/gpuistl/test_GpuDILU.cpp index 86e25ed6a53..89b344e8e51 100644 --- a/tests/gpuistl/test_GpuDILU.cpp +++ b/tests/gpuistl/test_GpuDILU.cpp @@ -22,8 +22,8 @@ #include #include -#include #include +#include #include #include #include @@ -40,8 +40,8 @@ using FM1x1 = Dune::FieldMatrix; using FM2x2 = Dune::FieldMatrix; using B1x1Vec = Dune::BlockVector>; using B2x2Vec = Dune::BlockVector>; -using Sp1x1BlockMatrix = Dune::BCRSMatrix; -using Sp2x2BlockMatrix = Dune::BCRSMatrix; +using Sp1x1BlockMatrix = Opm::BlockSparseMatrix; +using Sp2x2BlockMatrix = Opm::BlockSparseMatrix; using CuMatrix = Opm::gpuistl::GpuSparseMatrixWrapper; using CuIntVec = Opm::gpuistl::GpuVector; using CuFloatingPointVec = Opm::gpuistl::GpuVector; diff --git a/tests/gpuistl/test_GpuJac.cpp b/tests/gpuistl/test_GpuJac.cpp index 2b5a8ad1d1f..8f83ead07f3 100644 --- a/tests/gpuistl/test_GpuJac.cpp +++ b/tests/gpuistl/test_GpuJac.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(GPUJACApplyBlocksize2, T, NumericTypes) constexpr int blocksize = 2; const int nonZeroes = 3; using M = Dune::FieldMatrix; - using SpMatrix = Dune::BCRSMatrix; + using SpMatrix = Opm::BlockSparseMatrix; using Vector = Dune::BlockVector>; using GpuMatrix = Opm::gpuistl::GpuSparseMatrixWrapper; using GpuJac = Opm::gpuistl::GpuJac, Opm::gpuistl::GpuVector>; @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(GPUJACApplyBlocksize1, T, NumericTypes) constexpr int blocksize = 1; const int nonZeroes = 8; using M = Dune::FieldMatrix; - using SpMatrix = Dune::BCRSMatrix; + using SpMatrix = Opm::BlockSparseMatrix; using Vector = Dune::BlockVector>; using GpuMatrix = Opm::gpuistl::GpuSparseMatrixWrapper; using GpuJac = Opm::gpuistl::GpuJac, Opm::gpuistl::GpuVector>; diff --git a/tests/gpuistl/test_GpuOwnerOverlapCopy.cpp b/tests/gpuistl/test_GpuOwnerOverlapCopy.cpp index 4e30406d463..b24c8a8ecea 100644 --- a/tests/gpuistl/test_GpuOwnerOverlapCopy.cpp +++ b/tests/gpuistl/test_GpuOwnerOverlapCopy.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/tests/gpuistl/test_GpuPressureTransferPolicy.cpp b/tests/gpuistl/test_GpuPressureTransferPolicy.cpp index 471b6778937..dfb6ae070f3 100644 --- a/tests/gpuistl/test_GpuPressureTransferPolicy.cpp +++ b/tests/gpuistl/test_GpuPressureTransferPolicy.cpp @@ -25,10 +25,10 @@ #include #include -#include #include #include +#include #include #include #include @@ -51,7 +51,7 @@ struct TestFixture { static constexpr int N = 10; using BlockType = Dune::FieldMatrix; - using MatrixType = Dune::BCRSMatrix; + using MatrixType = Opm::BlockSparseMatrix; using VectorType = Dune::BlockVector>; using CommInfo = Dune::Amg::SequentialInformation; diff --git a/tests/gpuistl/test_GpuSeqILU0.cpp b/tests/gpuistl/test_GpuSeqILU0.cpp index d396157503d..7898728c734 100644 --- a/tests/gpuistl/test_GpuSeqILU0.cpp +++ b/tests/gpuistl/test_GpuSeqILU0.cpp @@ -25,8 +25,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(TestFiniteDifference1D, T, NumericTypes) const int N = 5; const int nonZeroes = N * 3 - 2; using M = Dune::FieldMatrix; - using SpMatrix = Dune::BCRSMatrix; + using SpMatrix = Opm::BlockSparseMatrix; using Vector = Dune::BlockVector>; using GpuILU0 = Opm::gpuistl::GpuSeqILU0, Opm::gpuistl::GpuVector>; @@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(TestFiniteDifferenceBlock2, T, NumericTypes) const int N = 5; const int nonZeroes = N * 3 - 2; using M = Dune::FieldMatrix; - using SpMatrix = Dune::BCRSMatrix; + using SpMatrix = Opm::BlockSparseMatrix; using Vector = Dune::BlockVector>; using GpuILU0 = Opm::gpuistl::GpuSeqILU0, Opm::gpuistl::GpuVector>; diff --git a/tests/gpuistl/test_GpuSparseMatrix.cu b/tests/gpuistl/test_GpuSparseMatrix.cu index 936b7556b57..a8fc8d9645a 100644 --- a/tests/gpuistl/test_GpuSparseMatrix.cu +++ b/tests/gpuistl/test_GpuSparseMatrix.cu @@ -26,11 +26,10 @@ #include #include #include +#include #include -#include - #include #include #include @@ -63,7 +62,7 @@ BOOST_AUTO_TEST_CASE(TestConstruction1D) const int N = 5; const int nonZeroes = N * 3 - 2; using M = Dune::FieldMatrix; - using SpMatrix = Dune::BCRSMatrix; + using SpMatrix = Opm::BlockSparseMatrix; SpMatrix B(N, N, nonZeroes, SpMatrix::row_wise); for (auto row = B.createbegin(); row != B.createend(); ++row) { @@ -131,7 +130,7 @@ BOOST_AUTO_TEST_CASE(TestGetDiagPtrs) const int N = 3; const int nonZeroes = 6; using M = Dune::FieldMatrix; - using SpMatrix = Dune::BCRSMatrix; + using SpMatrix = Opm::BlockSparseMatrix; /* Fill in a matrix with this sparsity pattern: @@ -218,7 +217,7 @@ BOOST_AUTO_TEST_CASE(TestGetDiagPtrsBlockedNonScalar) const int N = 3; const int nonZeroes = 6; using M = Dune::FieldMatrix; - using SpMatrix = Dune::BCRSMatrix; + using SpMatrix = Opm::BlockSparseMatrix; /* Fill in a blockmatrix with this sparsity pattern: @@ -319,7 +318,7 @@ void runRandomSparsityMatrixTest() std::uniform_real_distribution distribution(0.0, 1.0); const std::size_t N = 300; using M = Dune::FieldMatrix; - using SpMatrix = Dune::BCRSMatrix; + using SpMatrix = Opm::BlockSparseMatrix; using Vector = Dune::BlockVector>; std::vector> nonzerocols(N); diff --git a/tests/gpuistl/test_GpuSparseTable.cu b/tests/gpuistl/test_GpuSparseTable.cu index b7b8c2ff8f8..aead89df18f 100644 --- a/tests/gpuistl/test_GpuSparseTable.cu +++ b/tests/gpuistl/test_GpuSparseTable.cu @@ -27,8 +27,6 @@ #include #include -#include - #include #include #include diff --git a/tests/gpuistl/test_HypreInterfaceCPU.cpp b/tests/gpuistl/test_HypreInterfaceCPU.cpp index 9c6279d0d4e..a8444ffd5d6 100644 --- a/tests/gpuistl/test_HypreInterfaceCPU.cpp +++ b/tests/gpuistl/test_HypreInterfaceCPU.cpp @@ -30,9 +30,9 @@ #include #include +#include #include -#include #include using namespace Opm::gpuistl; @@ -45,7 +45,7 @@ BOOST_FIXTURE_TEST_CASE(TestTypeTraits, HypreTestFixture) { BOOST_CHECK(!is_gpu_type>::value); - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; BOOST_CHECK(!is_gpu_type::value); BOOST_CHECK(!is_gpu_type::value); @@ -65,7 +65,7 @@ BOOST_FIXTURE_TEST_CASE(TestVectorTransfer_CpuInputCpuBackend, HypreTestFixture) BOOST_FIXTURE_TEST_CASE(TestMatrixTransfer_CpuInputCpuBackend, HypreTestFixture) { - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; testMatrixTransfer(false); } diff --git a/tests/gpuistl/test_HypreInterfaceGPU.cpp b/tests/gpuistl/test_HypreInterfaceGPU.cpp index 732f132bdf4..a7e0a4c9f2b 100644 --- a/tests/gpuistl/test_HypreInterfaceGPU.cpp +++ b/tests/gpuistl/test_HypreInterfaceGPU.cpp @@ -30,10 +30,10 @@ #include #include #include +#include #include #include -#include #include @@ -57,7 +57,7 @@ BOOST_FIXTURE_TEST_CASE(TestVectorTransfer_CpuInputGpuBackend, HypreTestFixture) BOOST_FIXTURE_TEST_CASE(TestMatrixTransfer_CpuInputGpuBackend, HypreTestFixture) { - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; testMatrixTransfer(true); } diff --git a/tests/gpuistl/test_converttofloatadapter.cpp b/tests/gpuistl/test_converttofloatadapter.cpp index bc0c49e7a43..e138afdd1b7 100644 --- a/tests/gpuistl/test_converttofloatadapter.cpp +++ b/tests/gpuistl/test_converttofloatadapter.cpp @@ -25,19 +25,19 @@ #include #include #include -#include #include #include #include +#include #include using XDouble = Dune::BlockVector>; using MDouble = Dune::FieldMatrix; -using SpMatrixDouble = Dune::BCRSMatrix; +using SpMatrixDouble = Opm::BlockSparseMatrix; using XFloat = Dune::BlockVector>; using MFloat = Dune::FieldMatrix; -using SpMatrixFloat = Dune::BCRSMatrix; +using SpMatrixFloat = Opm::BlockSparseMatrix; namespace { class TestPreconditioner : Dune::PreconditionerWithUpdate diff --git a/tests/gpuistl/test_cuSparse_matrix_operations.cpp b/tests/gpuistl/test_cuSparse_matrix_operations.cpp index ea65f328d4d..f5364e6a41d 100644 --- a/tests/gpuistl/test_cuSparse_matrix_operations.cpp +++ b/tests/gpuistl/test_cuSparse_matrix_operations.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(FlattenAndInvertDiagonalWith3By3Blocks, T, Numeric const size_t N = 2; const int nonZeroes = 3; using M = Dune::FieldMatrix; - using SpMatrix = Dune::BCRSMatrix; + using SpMatrix = Opm::BlockSparseMatrix; /* create this sparse matrix | |1 2 3| | 1 0 0| | @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(FlattenAndInvertDiagonalWith2By2Blocks, T, Numeric const size_t N = 2; const int nonZeroes = 3; using M = Dune::FieldMatrix; - using SpMatrix = Dune::BCRSMatrix; + using SpMatrix = Opm::BlockSparseMatrix; /* create this sparse matrix | | 1 2| | 1 0| | diff --git a/tests/gpuistl/test_cuVector_operations.cpp b/tests/gpuistl/test_cuVector_operations.cpp index 17bb33c6f06..7e1f4bcc074 100644 --- a/tests/gpuistl/test_cuVector_operations.cpp +++ b/tests/gpuistl/test_cuVector_operations.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/gpuistl/test_preconditioner_factory_gpu.cpp b/tests/gpuistl/test_preconditioner_factory_gpu.cpp index 7e9ff74ab0c..e9572224f4b 100644 --- a/tests/gpuistl/test_preconditioner_factory_gpu.cpp +++ b/tests/gpuistl/test_preconditioner_factory_gpu.cpp @@ -27,13 +27,14 @@ #include #include +#include using ScalarT = double; constexpr static int Dim = 1; using CommSeq = Dune::Amg::SequentialInformation; -using MatrixTypeCPU = Dune::BCRSMatrix>; +using MatrixTypeCPU = Opm::BlockSparseMatrix>; using VectorCPU = Dune::BlockVector>; using CpuOperatorType = Dune::MatrixAdapter; using FactoryTypeCpu = Opm::PreconditionerFactory; diff --git a/tests/gpuistl/test_solver_adapter.cpp b/tests/gpuistl/test_solver_adapter.cpp index c04d9de743c..0ffb89109a3 100644 --- a/tests/gpuistl/test_solver_adapter.cpp +++ b/tests/gpuistl/test_solver_adapter.cpp @@ -22,12 +22,13 @@ #include #include +#include #include #include #include static const constexpr int dim = 3; -using Matrix = Dune::BCRSMatrix>; +using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; using Moperator = Dune::MatrixAdapter; using PrecondFactory = Opm::PreconditionerFactory; diff --git a/tests/test_HyprePreconditionerCPU.cpp b/tests/test_HyprePreconditionerCPU.cpp index 720378ecfe3..e49245bb5e5 100644 --- a/tests/test_HyprePreconditionerCPU.cpp +++ b/tests/test_HyprePreconditionerCPU.cpp @@ -31,9 +31,10 @@ #include #include -#include #include +#include + using namespace HypreTestHelpers; @@ -42,7 +43,7 @@ BOOST_GLOBAL_FIXTURE(MPIFixture); BOOST_FIXTURE_TEST_CASE(TestHyprePreconditioner_CpuInputCpuBackend, HypreTestFixture) { constexpr int N = 100; // 100x100 grid - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; // Create matrix diff --git a/tests/test_HyprePreconditionerGPU.cpp b/tests/test_HyprePreconditionerGPU.cpp index cb176990daa..4c561787964 100644 --- a/tests/test_HyprePreconditionerGPU.cpp +++ b/tests/test_HyprePreconditionerGPU.cpp @@ -47,7 +47,7 @@ BOOST_GLOBAL_FIXTURE(MPIFixture); BOOST_FIXTURE_TEST_CASE(TestHyprePreconditioner_CpuInputGpuBackend, HypreTestFixture) { constexpr int N = 100; // 100x100 grid - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; // Create matrix @@ -62,7 +62,7 @@ BOOST_FIXTURE_TEST_CASE(TestHyprePreconditioner_GpuInputGpuBackend, HypreTestFix using namespace Opm::gpuistl; constexpr int N = 100; // 100x100 grid - using CpuMatrix = Dune::BCRSMatrix>; + using CpuMatrix = Opm::BlockSparseMatrix>; using GpuMatrixType = GpuSparseMatrixWrapper; using GpuVectorType = GpuVector; @@ -81,7 +81,7 @@ BOOST_FIXTURE_TEST_CASE(TestHyprePreconditioner_GpuInputCpuBackend, HypreTestFix using namespace Opm::gpuistl; constexpr int N = 100; // 100x100 grid - using CpuMatrix = Dune::BCRSMatrix>; + using CpuMatrix = Opm::BlockSparseMatrix>; using GpuMatrixType = GpuSparseMatrixWrapper; using GpuVectorType = GpuVector; diff --git a/tests/test_blackoil_amg.cpp b/tests/test_blackoil_amg.cpp index 39f906c4c71..4d365204de3 100644 --- a/tests/test_blackoil_amg.cpp +++ b/tests/test_blackoil_amg.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,6 @@ #include #include #include -#include #include #include @@ -270,7 +270,7 @@ void runBlackoilAmgLaplace() { constexpr int BS=2, N=100; typedef Dune::FieldMatrix MatrixBlock; - typedef Dune::BCRSMatrix BCRSMat; + typedef Opm::BlockSparseMatrix BCRSMat; typedef Dune::FieldVector VectorBlock; typedef Dune::BlockVector Vector; typedef int GlobalId; diff --git a/tests/test_csrToCscOffsetMap.cpp b/tests/test_csrToCscOffsetMap.cpp index 34287b91e63..65b74da22ed 100644 --- a/tests/test_csrToCscOffsetMap.cpp +++ b/tests/test_csrToCscOffsetMap.cpp @@ -6,14 +6,14 @@ #include #include -#include #include +#include #include BOOST_AUTO_TEST_CASE(testcsrtocscoffsetmap){ - using Matrix = Dune::BCRSMatrix; + using Matrix = Opm::BlockSparseMatrix; Matrix matrix; { diff --git a/tests/test_cusparseSolver.cpp b/tests/test_cusparseSolver.cpp index 79917f32be3..de15b54f85b 100644 --- a/tests/test_cusparseSolver.cpp +++ b/tests/test_cusparseSolver.cpp @@ -25,10 +25,10 @@ #include #include +#include #include #include -#include #include #include #include @@ -45,7 +45,7 @@ class DeviceInitException : public std::logic_error }; template -using Matrix = Dune::BCRSMatrix>; +using Matrix = Opm::BlockSparseMatrix>; template using Vector = Dune::BlockVector>; diff --git a/tests/test_dilu.cpp b/tests/test_dilu.cpp index 22f572adc6c..095047a87b9 100644 --- a/tests/test_dilu.cpp +++ b/tests/test_dilu.cpp @@ -16,11 +16,11 @@ #include #include +#include #include #include #include -#include #include using NumericTypes = boost::mpl::list; @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUDiagIsCorrect2x2NoZeros, T, NumericTypes) const int N = 2; constexpr int bz = 2; const int nonZeroes = 4; - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; Matrix A(N, N, nonZeroes, Matrix::row_wise); @@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUDiagIsCorrect2x2, T, NumericTypes) const int N = 2; constexpr int bz = 2; const int nonZeroes = 3; - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; Matrix A(N, N, nonZeroes, Matrix::row_wise); @@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUApplyIsCorrectNoZeros, T, NumericTypes) const int N = 2; constexpr int bz = 2; const int nonZeroes = 4; - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; Matrix A(N, N, nonZeroes, Matrix::row_wise); @@ -288,7 +288,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUApplyIsCorrect1, T, NumericTypes) const int N = 2; constexpr int bz = 2; const int nonZeroes = 3; - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; Matrix A(N, N, nonZeroes, Matrix::row_wise); @@ -391,7 +391,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUApplyIsCorrect2, T, NumericTypes) const int N = 2; constexpr int bz = 2; const int nonZeroes = 3; - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; Matrix A(N, N, nonZeroes, Matrix::row_wise); @@ -497,7 +497,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUDiagIsCorrect3x3, T, NumericTypes) const int N = 3; constexpr int bz = 3; const int nonZeroes = 5; - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; Matrix A(N, N, nonZeroes, Matrix::row_wise); @@ -620,7 +620,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUApplyIsCorrect3, T, NumericTypes) const int N = 3; constexpr int bz = 3; const int nonZeroes = 5; - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; Matrix A(N, N, nonZeroes, Matrix::row_wise); @@ -795,7 +795,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SeqDILUApplyIsEqualToDuneSeqILUApply, T, NumericTy const int N = 2; constexpr int bz = 2; const int nonZeroes = 2; - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; Matrix A(N, N, nonZeroes, Matrix::row_wise); diff --git a/tests/test_extractMatrix.cpp b/tests/test_extractMatrix.cpp index 29ee8fe408d..b1d905266bc 100644 --- a/tests/test_extractMatrix.cpp +++ b/tests/test_extractMatrix.cpp @@ -23,12 +23,12 @@ #include #include +#include #include -#include #include using B = Dune::FieldMatrix; -using M = Dune::BCRSMatrix; +using M = Opm::BlockSparseMatrix; using V = Dune::BlockVector>; M build3x3BlockMatrix() diff --git a/tests/test_flexiblesolver.cpp b/tests/test_flexiblesolver.cpp index ad6ef0cf05f..8101b10ca42 100644 --- a/tests/test_flexiblesolver.cpp +++ b/tests/test_flexiblesolver.cpp @@ -24,11 +24,11 @@ #include #include +#include #include #include #include -#include #include #include @@ -39,7 +39,7 @@ template Dune::BlockVector> testSolver(const Opm::PropertyTree& prm, const std::string& matrix_filename, const std::string& rhs_filename) { - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; Matrix matrix; { @@ -47,7 +47,7 @@ testSolver(const Opm::PropertyTree& prm, const std::string& matrix_filename, con if (!mfile) { throw std::runtime_error("Could not read matrix file"); } - using M = Dune::BCRSMatrix>; + using M = Opm::BlockSparseMatrix>; readMatrixMarket(reinterpret_cast(matrix), mfile); // Hack to avoid hassle } Vector rhs; diff --git a/tests/test_ghostlastmatrixadapter.cpp b/tests/test_ghostlastmatrixadapter.cpp index 63ac6897205..529afdc13b5 100644 --- a/tests/test_ghostlastmatrixadapter.cpp +++ b/tests/test_ghostlastmatrixadapter.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,6 @@ #include #include #include -#include #include #include @@ -265,7 +265,7 @@ int main(int argc, char** argv) constexpr int BS=2, N=100; using MatrixBlock = Dune::FieldMatrix; - using BCRSMat = Dune::BCRSMatrix; + using BCRSMat = Opm::BlockSparseMatrix; using VectorBlock = Dune::FieldVector; using Vector = Dune::BlockVector; using Communication = Dune::OwnerOverlapCopyCommunication; diff --git a/tests/test_graphcoloring.cpp b/tests/test_graphcoloring.cpp index 335b49d0d22..15e1915c078 100644 --- a/tests/test_graphcoloring.cpp +++ b/tests/test_graphcoloring.cpp @@ -1,9 +1,9 @@ #include #include -#include #include +#include #include #define BOOST_TEST_MODULE GraphColoringTest @@ -26,7 +26,7 @@ void checkAllIndices(const std::vector& ordering) BOOST_AUTO_TEST_CASE(TestWelschPowell) { - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Graph = Dune::Amg::MatrixGraph; int N = 10; Matrix matrix(N*N, N*N, 5, 0.4, Matrix::implicit); @@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(TestColoredDiluParallelisms3x3Matrix) const int nonZeroes = 5; // creating some shorthand typenames - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; Matrix testMatrix(N, N, nonZeroes, Matrix::row_wise); for (auto row = testMatrix.createbegin(); row != testMatrix.createend(); ++row) { @@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(TestColoredDiluParallelisms5x5Simple) const int nonZeroes = 11; // creating some shorthand typenames - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; Matrix testMatrix(N, N, nonZeroes, Matrix::row_wise); for (auto row = testMatrix.createbegin(); row != testMatrix.createend(); ++row) { @@ -250,7 +250,7 @@ BOOST_AUTO_TEST_CASE(TestColoredDiluParallelisms5x5Tridiagonal) const int nonZeroes = 13; // creating some shorthand typenames - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; Matrix testMatrix(N, N, nonZeroes, Matrix::row_wise); for (auto row = testMatrix.createbegin(); row != testMatrix.createend(); ++row) { @@ -325,7 +325,7 @@ BOOST_AUTO_TEST_CASE(TestColoredDiluParallelisms5x5Complex) const int nonZeroes = 15; // creating some shorthand typenames - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; Matrix testMatrix(N, N, nonZeroes, Matrix::row_wise); for (auto row = testMatrix.createbegin(); row != testMatrix.createend(); ++row) { diff --git a/tests/test_milu.cpp b/tests/test_milu.cpp index 605076d5858..2db12912bbe 100644 --- a/tests/test_milu.cpp +++ b/tests/test_milu.cpp @@ -5,11 +5,11 @@ #include #include -#include #include #include #include #include +#include #include #include @@ -104,13 +104,13 @@ void test_milu0(M& A) } template -void setupSparsityPattern(Dune::BCRSMatrix& A, int N) +void setupSparsityPattern(Opm::BlockSparseMatrix& A, int N) { - typedef typename Dune::BCRSMatrix Matrix; - A.setSize(N*N, N*N, N*N*5); + typedef typename Opm::BlockSparseMatrix Matrix; A.setBuildMode(Matrix::row_wise); + A.setSize(N*N, N*N, N*N*5); - for (typename Dune::BCRSMatrix::CreateIterator i = A.createbegin(); i != A.createend(); ++i) { + for (typename Opm::BlockSparseMatrix::CreateIterator i = A.createbegin(); i != A.createend(); ++i) { int x = i.index()%N; // x coordinate in the 2d field int y = i.index()/N; // y coordinate in the 2d field @@ -135,9 +135,9 @@ void setupSparsityPattern(Dune::BCRSMatrix& A, int N) template -void setupLaplacian(Dune::BCRSMatrix& A, int N) +void setupLaplacian(Opm::BlockSparseMatrix& A, int N) { - typedef typename Dune::BCRSMatrix::field_type FieldType; + typedef typename Opm::BlockSparseMatrix::field_type FieldType; setupSparsityPattern(A,N); @@ -150,7 +150,7 @@ void setupLaplacian(Dune::BCRSMatrix& A, int N) b->operator[](b.index())=-1.0; - for (typename Dune::BCRSMatrix::RowIterator i = A.begin(); i != A.end(); ++i) { + for (typename Opm::BlockSparseMatrix::RowIterator i = A.begin(); i != A.end(); ++i) { int x = i.index()%N; // x coordinate in the 2d field int y = i.index()/N; // y coordinate in the 2d field @@ -174,7 +174,7 @@ template void test() { std::size_t N = 32; - Dune::BCRSMatrix > A; + Opm::BlockSparseMatrix > A; setupLaplacian(A, N); test_milu0(A); #ifdef DEBUG diff --git a/tests/test_openclSolver.cpp b/tests/test_openclSolver.cpp index 8dada17f118..478a79de3f6 100644 --- a/tests/test_openclSolver.cpp +++ b/tests/test_openclSolver.cpp @@ -25,10 +25,10 @@ #include #include +#include #include #include -#include #include #include #include @@ -43,7 +43,7 @@ class PlatformInitException : public std::logic_error }; template -using Matrix = Dune::BCRSMatrix>; +using Matrix = Opm::BlockSparseMatrix>; template using Vector = Dune::BlockVector>; diff --git a/tests/test_preconditionerfactory.cpp b/tests/test_preconditionerfactory.cpp index 66b38008788..21a627b664a 100644 --- a/tests/test_preconditionerfactory.cpp +++ b/tests/test_preconditionerfactory.cpp @@ -28,11 +28,11 @@ #include #include #include +#include #include #include #include -#include #include #include @@ -68,7 +68,7 @@ template Dune::BlockVector> testPrec(const Opm::PropertyTree& prm, const std::string& matrix_filename, const std::string& rhs_filename) { - using Matrix = Dune::BCRSMatrix>; + using Matrix = Opm::BlockSparseMatrix>; using Vector = Dune::BlockVector>; Matrix matrix; { @@ -76,7 +76,7 @@ testPrec(const Opm::PropertyTree& prm, const std::string& matrix_filename, const if (!mfile) { throw std::runtime_error("Could not read matrix file"); } - using M = Dune::BCRSMatrix>; + using M = Opm::BlockSparseMatrix>; readMatrixMarket(reinterpret_cast(matrix), mfile); // Hack to avoid hassle } Vector rhs; @@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE(TestDefaultPreconditionerFactory) template -using M = Dune::BCRSMatrix>; +using M = Opm::BlockSparseMatrix>; template using V = Dune::BlockVector>; template @@ -292,7 +292,7 @@ testPrecRepeating(const Opm::PropertyTree& prm, const std::string& matrix_filena if (!mfile) { throw std::runtime_error("Could not read matrix file"); } - using M = Dune::BCRSMatrix>; + using M = Opm::BlockSparseMatrix>; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" readMatrixMarket(reinterpret_cast(matrix), mfile); // Hack to avoid hassle diff --git a/tests/test_rocalutionSolver.cpp b/tests/test_rocalutionSolver.cpp index 3da8146f48b..665eb29398f 100644 --- a/tests/test_rocalutionSolver.cpp +++ b/tests/test_rocalutionSolver.cpp @@ -25,11 +25,11 @@ #include #include +#include #include #include #include -#include #include #include #include @@ -38,7 +38,7 @@ #include template -using Matrix = Dune::BCRSMatrix>; +using Matrix = Opm::BlockSparseMatrix>; template using Vector = Dune::BlockVector>; diff --git a/tests/test_rocsparseSolver.cpp b/tests/test_rocsparseSolver.cpp index 56d78659d9f..db83db4438d 100644 --- a/tests/test_rocsparseSolver.cpp +++ b/tests/test_rocsparseSolver.cpp @@ -29,10 +29,10 @@ #include #include +#include #include #include -#include #include #include #include @@ -47,7 +47,7 @@ class HIPInitException : public std::logic_error }; template -using Matrix = Dune::BCRSMatrix>; +using Matrix = Opm::BlockSparseMatrix>; template using Vector = Dune::BlockVector>; diff --git a/tests/test_solvetransposed3x3.cpp b/tests/test_solvetransposed3x3.cpp index 3be615e8681..b8c4b8f85ef 100644 --- a/tests/test_solvetransposed3x3.cpp +++ b/tests/test_solvetransposed3x3.cpp @@ -29,8 +29,6 @@ #include #endif -#include - #include #include