Am Montag, 13. Mai 2022, finden Wartungsarbeiten am Gitlab-Server (Update auf neue Version statt). Der Dienst wird daher am Montag für einige Zeit nicht verfügbar sein.
On Monday, May 13th 2022, the Gitlab server will be updated. The service will therefore not be accessible for some time on Monday.

MTL4Solver.h 2.65 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  TU Dresden                                                            ==
// ==                                                                        ==
// ==  Institut für Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
// ==                                                                        ==
// ============================================================================

#ifndef MTL4SOLVER_H
#define MTL4SOLVER_H

#include "OEMSolver.h"
#include "MatrixStreams.h"
#include <iostream>

namespace AMDiS {

29
30
31
32
  template< typename MTLMatrix, typename MTLVector, typename Worker >
  class MTL4Solver : public OEMSolver {    
  protected:    
    Worker worker;
33

34
35
36
37
38
39
40
    template< typename Matrix, typename Vector, typename Mapper >
    int solve(const Matrix& A, Vector& x, Vector& b, Mapper& mapper) 
    {
      MTLMatrix matrix(mapper.nRow(), mapper.nCol());
      set_to_zero(matrix);
      MatMap< const Matrix, Mapper > matMap(A,mapper);
      matrix << matMap;
41

42
43
44
45
      MTLVector mtl_x(mapper.nRow());
      set_to_zero(mtl_x);
      VecMap< Vector, Mapper > xVecMap(x, mapper);
      mtl_x << xVecMap;
46

47
48
49
50
      MTLVector mtl_b(mapper.nRow());
      set_to_zero(mtl_b);
      VecMap< Vector, Mapper> bVecMap(b, mapper);
      mtl_b << bVecMap;
51

52
      error = worker.solve(matrix, mtl_x, mtl_b);
53

54
55
56
      mtl_x >> xVecMap;
      return error;
    }
57

58
59
60
61
62
  public:
    MTL4Solver(std::string n):
      OEMSolver(n),
      worker(this)
    {}
63

64
    virtual int solveSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A,
65
66
67
			    SystemVector& x, 
			    SystemVector& b,
			    VectorialMapper& m)
68
69
70
    {
      return solve(A,x,b,m);
    }
71
72
73
74
75

      
  };
}
#endif