12#ifndef DUMUX_COMMON_PDESOLVER_HH
13#define DUMUX_COMMON_PDESOLVER_HH
18#include <dune/common/hybridutilities.hh>
19#include <dune/common/std/type_traits.hh>
25template <
class FirstRow,
class ... Args>
31template<
class Assembler>
34template<
class Assembler>
41template<
class Assembler>
59template<
class A,
class LS>
62 using Scalar =
typename A::Scalar;
122 {
return *assembler_; }
128 {
return *assembler_; }
134 {
return *linearSolver_; }
142 {
return *linearSolver_; }
147 template <
class FirstRow,
class ... Args>
150 bool matrixHasCorrectSize =
true;
151 using namespace Dune::Hybrid;
154 const auto& row = matrix[i];
155 const auto numRowsLeftMostBlock = row[Dune::index_constant<0>{}].N();
156 forEach(row, [&](
const auto& subBlock)
158 if (subBlock.N() != numRowsLeftMostBlock)
159 matrixHasCorrectSize =
false;
162 return matrixHasCorrectSize;
172 std::shared_ptr<Assembler> assembler_;
173 std::shared_ptr<LinearSolver> linearSolver_;
A high-level interface for a PDESolver.
Definition: common/pdesolver.hh:61
LS LinearSolver
Definition: common/pdesolver.hh:68
virtual void solve(Variables &vars, TimeLoop &timeLoop)
Solve the given PDE system with time step control.
Definition: common/pdesolver.hh:112
A Assembler
export the assembler and linear solver types
Definition: common/pdesolver.hh:67
bool checkSizesOfSubMatrices(const M &) const
Default implementation for any matrix type.
Definition: common/pdesolver.hh:169
virtual bool apply(Variables &vars)=0
Solve the given PDE system (usually assemble + solve linear system + update)
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:148
const LinearSolver & linearSolver() const
Access the linear solver.
Definition: common/pdesolver.hh:133
virtual void solve(Variables &vars)=0
Solve the given PDE system (usually assemble + solve linear system + update)
Assembler & assembler()
Access the assembler.
Definition: common/pdesolver.hh:127
const Assembler & assembler() const
Access the assembler.
Definition: common/pdesolver.hh:121
PDESolver(std::shared_ptr< Assembler > assembler, std::shared_ptr< LinearSolver > linearSolver)
Constructor.
Definition: common/pdesolver.hh:78
LinearSolver & linearSolver()
Access the linear solver.
Definition: common/pdesolver.hh:141
virtual ~PDESolver()=default
Detail::PDESolver::AssemblerVariables< Assembler > Variables
export the type of variables that represent a numerical solution
Definition: common/pdesolver.hh:71
Definition: common/pdesolver.hh:26
Manages the handling of time dependent problems.
Definition: common/pdesolver.hh:29
typename VariablesChooser< Assembler >::Type AssemblerVariables
Definition: common/pdesolver.hh:42
typename Assembler::Variables AssemblerVariablesType
Definition: common/pdesolver.hh:32
constexpr bool assemblerExportsVariables
Definition: common/pdesolver.hh:35
Definition: common/pdesolver.hh:24
typename A::SolutionVector Type
Definition: common/pdesolver.hh:39
AssemblerVariablesType< A > Type
Definition: common/pdesolver.hh:38
Definition: common/pdesolver.hh:37