source: src/solver/solver.hpp@ d24c2f

Last change on this file since d24c2f was dfed1c, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Major vmg update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1136 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[48b662]1/**
2 * @file solver.hpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Apr 18 13:11:14 2011
5 *
6 * @brief VMG::Solver
7 *
8 */
9
10#ifndef SOLVER_HPP_
11#define SOLVER_HPP_
12
[dfed1c]13#include <vector>
14
[48b662]15#include "base/discretization.hpp"
16#include "base/object.hpp"
17#include "base/stencil.hpp"
18#include "comm/comm.hpp"
19#include "grid/grid.hpp"
20#include "mg.hpp"
21
22namespace VMGTests
23{
24class SolverTestSuite;
25}
26
27namespace VMG
28{
29
30class Solver : public Object
31{
32public:
33 friend class VMGTests::SolverTestSuite;
34
35 Solver()
36 {
[dfed1c]37 size = 0;
[48b662]38 }
39
40 virtual ~Solver()
41 {
42 }
43
[dfed1c]44 void Run(Grid& sol, Grid& rhs);
[48b662]45
46private:
47
48 virtual void Compute() = 0; ///< Solves the system of equations
49 virtual void AssembleMatrix(const Grid& rhs) = 0; ///< Assembles all matrices and vectors.
50 virtual void ExportSol(Grid& sol, Grid& rhs) = 0; ///< Exports the solution back to a given mesh.
51
[dfed1c]52 std::vector<vmg_float> A, b, x;
53 int size;
[48b662]54
55protected:
56 void Realloc(int n);
57 void Realloc(Grid& x);
58
59 vmg_float& Mat(int i, int j)
60 {
[dfed1c]61 return A[j+size*i];
[48b662]62 }
63
64 vmg_float& Rhs(int i)
65 {
66 return b[i];
67 }
68
69 vmg_float& Sol(int i)
70 {
71 return x[i];
72 }
73
[dfed1c]74 const int& Size() const {return size;}
[48b662]75};
76
77}
78
79#endif
Note: See TracBrowser for help on using the repository browser.