AdaptBase.h 3.75 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
// ============================================================================
// ==                                                                        ==
// == 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 ======================================================
  // ============================================================================

Thomas Witkowski's avatar
Thomas Witkowski committed
37
  /// Interface for adaption loops.
38
39
40
  class AdaptBase
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
41
    /// Constructor
Thomas Witkowski's avatar
Thomas Witkowski committed
42
    AdaptBase(std::string sname,
43
	      ProblemIterationInterface *problemIteration,
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
44
	      AdaptInfo *adapt,
45
46
	      ProblemTimeInterface *problemTime = NULL,
	      AdaptInfo *initialAdaptInfo = NULL)
Thomas Witkowski's avatar
Thomas Witkowski committed
47
      : name(sname),
48
	problemIteration_(problemIteration),
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
49
	adaptInfo(adapt),
50
51
	problemTime_(problemTime),
	initialAdaptInfo_(initialAdaptInfo)
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
52
    {}
53

Thomas Witkowski's avatar
Thomas Witkowski committed
54
    /// Destructor
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
55
    virtual ~AdaptBase() {}
56
57
58
59
60
61
62

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

Thomas Witkowski's avatar
Thomas Witkowski committed
63
    /// Returns \ref name
64
    inline const std::string& getName() const { 
Thomas Witkowski's avatar
Thomas Witkowski committed
65
      return name; 
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
66
    }
67

Thomas Witkowski's avatar
Thomas Witkowski committed
68
    /// Returns \ref problemIteration_
69
70
    inline ProblemIterationInterface *getProblemIteration() {
      return problemIteration_;
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
71
    }
72

Thomas Witkowski's avatar
Thomas Witkowski committed
73
    ///
74
75
    inline void setProblemIteration(ProblemIterationInterface *pii) {
      problemIteration_ = pii;
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
76
    }
77

Thomas Witkowski's avatar
Thomas Witkowski committed
78
    /// Returns \ref adaptInfo
79
    inline AdaptInfo *getAdaptInfo() { 
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
80
81
      return adaptInfo; 
    }
82

Thomas Witkowski's avatar
Thomas Witkowski committed
83
    /// Returns \ref problemTime_
84
85
    inline ProblemTimeInterface *getProblemTime() {
      return problemTime_;
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
86
    }
87

Thomas Witkowski's avatar
Thomas Witkowski committed
88
    ///
89
90
91
92
    inline void setProblemTime(ProblemTimeInterface *pti) {
      problemTime_ = pti;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
93
    /// Returns \ref initialAdaptInfo_
94
95
    inline AdaptInfo *getInitialAdaptInfo() { 
      return initialAdaptInfo_; 
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
96
    }
97
98

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
99
100
    /// Name of the adaption loop
    std::string name;
101

Thomas Witkowski's avatar
Thomas Witkowski committed
102
    /// Problem iteration interface
103
104
    ProblemIterationInterface *problemIteration_;

Thomas Witkowski's avatar
Thomas Witkowski committed
105
    /// Main adapt info
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
106
    AdaptInfo *adaptInfo;
107

Thomas Witkowski's avatar
Thomas Witkowski committed
108
    /// problem time interface
109
110
111
112
113
114
115
116
    ProblemTimeInterface *problemTime_;

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

Thomas Witkowski's avatar
Thomas Witkowski committed
117
    /// Info level
118
119
120
121
122
123
    static int info_;
  };

}

#endif