AdaptBase.h 4.02 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
// ============================================================================
// ==                                                                        ==
// == 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
     */
46
    AdaptBase(const std::string& name,
47
	      ProblemIterationInterface *problemIteration,
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
48
	      AdaptInfo *adapt,
49
50
	      ProblemTimeInterface *problemTime = NULL,
	      AdaptInfo *initialAdaptInfo = NULL)
51
52
      : name_(name),
	problemIteration_(problemIteration),
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
53
	adaptInfo(adapt),
54
55
	problemTime_(problemTime),
	initialAdaptInfo_(initialAdaptInfo)
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
56
    {}
57
58
59
60

    /** \brief
     * Destructor
     */
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
61
    virtual ~AdaptBase() {}
62
63
64
65
66
67
68
69
70
71

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

    /** \brief
     * Returns \ref name_
     */
72
    inline const std::string& getName() const { 
73
      return name_; 
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
74
    }
75
76
77
78
79
80

    /** \brief
     * Returns \ref problemIteration_
     */
    inline ProblemIterationInterface *getProblemIteration() {
      return problemIteration_;
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
81
    }
82
83
84

    inline void setProblemIteration(ProblemIterationInterface *pii) {
      problemIteration_ = pii;
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
85
    }
86
87

    /** \brief
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
88
     * Returns \ref adaptInfo
89
     */
90
    inline AdaptInfo *getAdaptInfo() { 
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
91
92
      return adaptInfo; 
    }
93
94
95
96
97
98

    /** \brief
     * Returns \ref problemTime_
     */
    inline ProblemTimeInterface *getProblemTime() {
      return problemTime_;
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
99
    }
100
101
102
103
104
105
106
107

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

    /** \brief
     * Returns \ref initialAdaptInfo_
     */
108
109
    inline AdaptInfo *getInitialAdaptInfo() { 
      return initialAdaptInfo_; 
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
110
    }
111
112
113
114
115

  protected:
    /** \brief
     * Name of the adaption loop
     */
116
    std::string name_;
117
118
119
120
121
122
123
124
125

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

    /** \brief
     * Main adapt info
     */
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
126
    AdaptInfo *adaptInfo;
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147

    /** \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