24#ifndef DUMUX_COMMON_PDESOLVER_HH
25#define DUMUX_COMMON_PDESOLVER_HH
30#include <dune/common/hybridutilities.hh>
36template <
class FirstRow,
class ... Args>
53template<
class Assembler,
class LinearSolver>
56 using SolutionVector =
typename Assembler::ResidualType;
57 using Scalar =
typename Assembler::Scalar;
73 virtual void solve(SolutionVector& sol) = 0;
93 {
return *assembler_; }
99 {
return *assembler_; }
105 {
return *linearSolver_; }
111 {
return *linearSolver_; }
116 template <
class FirstRow,
class ... Args>
119 bool matrixHasCorrectSize =
true;
120 using namespace Dune::Hybrid;
123 const auto& row = matrix[i];
124 const auto numRowsLeftMostBlock = row[Dune::index_constant<0>{}].N();
125 forEach(row, [&](
const auto& subBlock)
127 if (subBlock.N() != numRowsLeftMostBlock)
128 matrixHasCorrectSize =
false;
131 return matrixHasCorrectSize;
135 std::shared_ptr<Assembler> assembler_;
136 std::shared_ptr<LinearSolver> linearSolver_;
Definition: common/pdesolver.hh:35
Definition: common/pdesolver.hh:37
A high-level interface for a PDESolver.
Definition: common/pdesolver.hh:55
virtual ~PDESolver()=default
virtual void solve(SolutionVector &sol, TimeLoop &timeLoop)
Solve the given PDE system with time step control.
Definition: common/pdesolver.hh:82
LinearSolver & linearSolver()
Access the linear solver.
Definition: common/pdesolver.hh:110
const Assembler & assembler() const
Access the assembler.
Definition: common/pdesolver.hh:92
const LinearSolver & linearSolver() const
Access the linear solver.
Definition: common/pdesolver.hh:104
virtual void solve(SolutionVector &sol)=0
Solve the given PDE system (usually assemble + solve linear system + update)
Assembler & assembler()
Access the assembler.
Definition: common/pdesolver.hh:98
bool checkSizesOfSubMatrices(const Dune::MultiTypeBlockMatrix< FirstRow, Args... > &matrix) const
Helper function to assure the MultiTypeBlockMatrix's sub-blocks have the correct sizes.
Definition: common/pdesolver.hh:117
PDESolver(std::shared_ptr< Assembler > assembler, std::shared_ptr< LinearSolver > linearSolver)
Definition: common/pdesolver.hh:61
Manages the handling of time dependent problems.
Definition: common/timeloop.hh:69
Base class for linear solvers.
Definition: solver.hh:37
Manages the handling of time dependent problems.