BiCGStab_M.h 3.04 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file BiCGStab_M.h */

#ifndef BICGStab_M_H
#define BICGStab_M_H

namespace AMDiS {

  // ============================================================================
  // ===== class BiCGStab_M =====================================================
  // ============================================================================

  /**
   * \ingroup Solver
   *
   * \brief
   * Solves a linear system by a stabilized BiCG method.
   * Can be used for general matrices.
   */
  template<typename VectorType>
  class BiCGStab_M : public OEMSolver<VectorType>
  {
  public:
    MEMORY_MANAGED(BiCGStab_M<VectorType>);

    /** \brief
     * Creator class used in the OEMSolverMap.
     */
    class Creator : public OEMSolverCreator<VectorType>
    {
    public:
      MEMORY_MANAGED(Creator);

      virtual ~Creator() {};

      /** \brief
       * Returns a new BiCGStab_M object.
       */
      OEMSolver<VectorType>* create()
      {
	return NEW BiCGStab_M<VectorType>(this->name);
      };
    };

    /** \brief
     * constructor
     */
    BiCGStab_M(::std::string name);

    /** \brief
     * destructor
     */
    ~BiCGStab_M();

  protected:
    /** \brief
     * Implements OEMSolver<VectorType>::init().
     */
    void init();

    /** \brief
     * Implements OEMSolver<VectorType>::exit().
     */
    void exit();

    /** \brief
     * Implements OEMSolver<VectorType>::solve().
     */
    int solveSystem(MatVecMultiplier<VectorType> *mv, VectorType *x, VectorType *b);

  private:
    // Pointers to memory needed for solveSystem
    VectorType *r, *rt, *p, *v, *t, *ph, *sh, *xmin;
  };

}

#include "BiCGStab_M.hh"

#endif // BICGStab_M_H