LinearSolverInterface.hpp 1.91 KB
Newer Older
 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. */ `````` 14 ``````#include `````` Praetorius, Simon committed Mar 22, 2016 15 16 17 18 19 ``````#include #include #include #include `````` Praetorius, Simon committed Mar 21, 2016 20 `````` `````` Praetorius, Simon committed Mar 22, 2016 21 22 23 ``````namespace AMDiS { /// Abstract base class for linear solvers `````` Praetorius, Simon committed Mar 21, 2016 24 25 `````` template class LinearSolverInterface `````` Praetorius, Simon committed Mar 22, 2016 26 `````` { `````` Praetorius, Simon committed Mar 22, 2016 27 `````` protected: `````` 28 29 `````` using RunnerBase = RunnerInterface, BaseVector_t>; `````` Praetorius, Simon committed Mar 22, 2016 30 31 `````` public: `````` Praetorius, Simon committed Mar 21, 2016 32 33 34 35 36 37 38 39 40 `````` /// 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 41 42 43 `````` * \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 44 45 `````` **/ void solve(Matrix const& A, VectorX& x, VectorB const& b, `````` Praetorius, Simon committed Mar 22, 2016 46 `````` SolverInfo& solverInfo) `````` Praetorius, Simon committed Mar 21, 2016 47 `````` { `````` Praetorius, Simon committed Mar 22, 2016 48 `````` solveImpl(A, x, b, solverInfo); `````` Praetorius, Simon committed Mar 21, 2016 49 50 `````` } `````` Praetorius, Simon committed Mar 22, 2016 51 `````` // return the runner/worker corresponding to this solver (optional) `````` 52 `````` virtual shared_ptr getRunner() { return {}; }; `````` Praetorius, Simon committed Mar 21, 2016 53 54 55 56 `````` 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 57 `````` SolverInfo& solverInfo) = 0; `````` Praetorius, Simon committed Mar 21, 2016 58 `````` }; `````` Praetorius, Simon committed Mar 22, 2016 59 60 61 62 `````` template struct SolverCreator; `````` Praetorius, Simon committed Mar 21, 2016 63 64 `````` } // end namespace AMDiS``````