LinearSolverInterface.hpp 1.88 KB
 Praetorius, Simon committed Mar 21, 2016 1 2 3 4 5 6 7 8 9 10 11 12 13 ``````#pragma once /** \file LinearSolverInterface.h */ /** * \defgroup Solver Solver module * @{ @} * * \brief * Contains all classes needed for solving linear and non linear equation * systems. */ `````` Praetorius, Simon committed Mar 22, 2016 14 15 16 17 18 ``````#include #include #include #include `````` Praetorius, Simon committed Mar 21, 2016 19 `````` `````` Praetorius, Simon committed Mar 22, 2016 20 21 22 ``````namespace AMDiS { /// Abstract base class for linear solvers `````` Praetorius, Simon committed Mar 21, 2016 23 24 `````` template class LinearSolverInterface `````` Praetorius, Simon committed Mar 22, 2016 25 `````` { `````` Praetorius, Simon committed Mar 22, 2016 26 `````` protected: `````` 27 28 `````` using RunnerBase = RunnerInterface, BaseVector_t>; `````` Praetorius, Simon committed Mar 22, 2016 29 30 `````` public: `````` Praetorius, Simon committed Mar 21, 2016 31 32 33 34 35 36 37 38 39 `````` /// Destructor. virtual ~LinearSolverInterface() {} /// Public method to call in order to solve a linear system Ax = b. /** * The method redirects to the specific linear solver and prints statistics * and error estimations at the end. * * The parameters correspond to `````` Praetorius, Simon committed Mar 22, 2016 40 41 42 `````` * \p A A [block-]matrix that represents the system-matrix. * \p x A [block-]vector for the unknown components. * \p b A [block-]vector for the right-hand side of the linear system. `````` Praetorius, Simon committed Mar 21, 2016 43 44 `````` **/ void solve(Matrix const& A, VectorX& x, VectorB const& b, `````` Praetorius, Simon committed Mar 22, 2016 45 `````` SolverInfo& solverInfo) `````` Praetorius, Simon committed Mar 21, 2016 46 `````` { `````` Praetorius, Simon committed Mar 22, 2016 47 `````` solveImpl(A, x, b, solverInfo); `````` Praetorius, Simon committed Mar 21, 2016 48 49 `````` } `````` Praetorius, Simon committed Mar 22, 2016 50 `````` // return the runner/worker corresponding to this solver (optional) `````` Praetorius, Simon committed Apr 29, 2016 51 `````` virtual std::shared_ptr getRunner() { return {}; }; `````` Praetorius, Simon committed Mar 21, 2016 52 53 54 55 `````` private: /// main methods that all solvers must implement virtual void solveImpl(Matrix const& A, VectorX& x, VectorB const& b, `````` Praetorius, Simon committed Mar 22, 2016 56 `````` SolverInfo& solverInfo) = 0; `````` Praetorius, Simon committed Mar 21, 2016 57 `````` }; `````` Praetorius, Simon committed Mar 22, 2016 58 59 60 61 `````` template struct SolverCreator; `````` Praetorius, Simon committed Mar 21, 2016 62 63 `````` } // end namespace AMDiS``````