AdaptBase.h 4.05 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file AdaptBase.h */

#ifndef AMDIS_ADAPTBASE_H
#define AMDIS_ADAPTBASE_H

#include <string>

namespace AMDiS {

  class ProblemIterationInterface;
  class ProblemTimeInterface;
  class AdaptInfo;

  // ============================================================================
  // ===== class AdaptBase ======================================================
  // ============================================================================

  /** \brief
   * Interface for adaption loops.
   */
  class AdaptBase
  {
  public:
    /** \brief
     * Constructor
     */
    AdaptBase(const ::std::string&         name,
	      ProblemIterationInterface *problemIteration,
	      AdaptInfo                 *adaptInfo,
	      ProblemTimeInterface      *problemTime = NULL,
	      AdaptInfo                 *initialAdaptInfo = NULL)
      : name_(name),
	problemIteration_(problemIteration),
	adaptInfo_(adaptInfo),
	problemTime_(problemTime),
	initialAdaptInfo_(initialAdaptInfo)
    {};

    /** \brief
     * Destructor
     */
    virtual ~AdaptBase() {};

    /** \brief
     * Pure virtual method. Must be overloaded by sub classes to perform
     * a concrete adaption loop. 
     */
    virtual int adapt() = 0;

    /** \brief
     * Returns \ref name_
     */
    inline const ::std::string& getName() const { return name_; };

    /** \brief
     * Returns \ref problemIteration_
     */
    inline ProblemIterationInterface *getProblemIteration() {
      return problemIteration_;
    };

    inline void setProblemIteration(ProblemIterationInterface *pii) {
      problemIteration_ = pii;
    };

    /** \brief
     * Returns \ref adaptInfo_
     */
    inline AdaptInfo *getAdaptInfo() { return adaptInfo_; };

    /** \brief
     * Returns \ref problemTime_
     */
    inline ProblemTimeInterface *getProblemTime() {
      return problemTime_;
    };

    inline void setProblemTime(ProblemTimeInterface *pti) {
      problemTime_ = pti;
    }

    /** \brief
     * Returns \ref initialAdaptInfo_
     */
    inline AdaptInfo *getInitialAdaptInfo() { return initialAdaptInfo_; };

  protected:
    /** \brief
     * Name of the adaption loop
     */
    ::std::string name_;

    /** \brief
     * Problem iteration interface
     */
    ProblemIterationInterface *problemIteration_;

    /** \brief
     * Main adapt info
     */
    AdaptInfo *adaptInfo_;

    /** \brief
     * problem time interface
     */
    ProblemTimeInterface *problemTime_;

    /** \brief
     * Adapt info for initial adapt. Will be given to 
     * problemTime_->solveInitialProblem().
     */
    AdaptInfo *initialAdaptInfo_;

    /** \brief
     * Info level
     */
    static int info_;
  };

}

#endif