| Rev | Line | |
|---|
| [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 |
|
|---|
| 22 | namespace VMG
|
|---|
| 23 | {
|
|---|
| 24 |
|
|---|
| 25 | class Solver : public Object
|
|---|
| 26 | {
|
|---|
| 27 | public:
|
|---|
| 28 | Solver()
|
|---|
| 29 | {
|
|---|
| [dfed1c] | 30 | size = 0;
|
|---|
| [48b662] | 31 | }
|
|---|
| 32 |
|
|---|
| [ac6d04] | 33 | Solver(int size) :
|
|---|
| 34 | size(size)
|
|---|
| 35 | {
|
|---|
| 36 | this->Realloc(size);
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| [48b662] | 39 | virtual ~Solver()
|
|---|
| 40 | {
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| [dfed1c] | 43 | void Run(Grid& sol, Grid& rhs);
|
|---|
| [48b662] | 44 |
|
|---|
| 45 | void Realloc(int n);
|
|---|
| 46 | void Realloc(Grid& x);
|
|---|
| 47 |
|
|---|
| 48 | vmg_float& Mat(int i, int j)
|
|---|
| 49 | {
|
|---|
| [dfed1c] | 50 | return A[j+size*i];
|
|---|
| [48b662] | 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 |
|
|---|
| [dfed1c] | 63 | const int& Size() const {return size;}
|
|---|
| [ac6d04] | 64 |
|
|---|
| 65 | protected:
|
|---|
| 66 | virtual void Compute() = 0; ///< Solves the system of equations
|
|---|
| 67 |
|
|---|
| 68 | private:
|
|---|
| 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;
|
|---|
| [48b662] | 74 | };
|
|---|
| 75 |
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.