source: src/solver/solver.hpp@ d7de94

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

Merge recent changes of the vmg library into ScaFaCos.

Includes a fix for the communication problems on Jugene.

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

  • Property mode set to 100644
File size: 1.2 KB
Line 
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
13#include <vector>
14
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 VMG
23{
24
25class Solver : public Object
26{
27public:
28 Solver()
29 {
30 size = 0;
31 }
32
33 Solver(int size) :
34 size(size)
35 {
36 this->Realloc(size);
37 }
38
39 virtual ~Solver()
40 {
41 }
42
43 void Run(Grid& sol, Grid& rhs);
44
45 void Realloc(int n);
46 void Realloc(Grid& x);
47
48 vmg_float& Mat(int i, int j)
49 {
50 return A[j+size*i];
51 }
52
53 vmg_float& Rhs(int i)
54 {
55 return b[i];
56 }
57
58 vmg_float& Sol(int i)
59 {
60 return x[i];
61 }
62
63 const int& Size() const {return size;}
64
65protected:
66 virtual void Compute() = 0; ///< Solves the system of equations
67
68private:
69 virtual void AssembleMatrix(const Grid& rhs) = 0; ///< Assembles all matrices and vectors.
70 virtual void ExportSol(Grid& sol, Grid& rhs) = 0; ///< Exports the solution back to a given mesh.
71
72 std::vector<vmg_float> A, b, x;
73 int size;
74};
75
76}
77
78#endif
Note: See TracBrowser for help on using the repository browser.