AdaptBase.h 3.48 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
// ============================================================================
// ==                                                                        ==
// == 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>
26
#include "AMDiS_fwd.h"
27
28
29

namespace AMDiS {

Thomas Witkowski's avatar
Thomas Witkowski committed
30
  /// Interface for adaption loops.
31
32
33
  class AdaptBase
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
34
    /// Constructor
Thomas Witkowski's avatar
Thomas Witkowski committed
35
    AdaptBase(std::string sname,
36
	      ProblemIterationInterface *problemIteration,
Thomas Witkowski's avatar
* Bla  
Thomas Witkowski committed
37
	      AdaptInfo *adapt,
38
39
	      ProblemTimeInterface *problemTime = NULL,
	      AdaptInfo *initialAdaptInfo = NULL)
Thomas Witkowski's avatar
Thomas Witkowski committed
40
      : name(sname),
41
	problemIteration_(problemIteration),
Thomas Witkowski's avatar
* Bla  
Thomas Witkowski committed
42
	adaptInfo(adapt),
43
44
	problemTime_(problemTime),
	initialAdaptInfo_(initialAdaptInfo)
Thomas Witkowski's avatar
* Bla  
Thomas Witkowski committed
45
    {}
46

Thomas Witkowski's avatar
Thomas Witkowski committed
47
    /// Destructor
Thomas Witkowski's avatar
* Bla  
Thomas Witkowski committed
48
    virtual ~AdaptBase() {}
49
50
51
52
53
54
55

    /** \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
56
    /// Returns \ref name
Thomas Witkowski's avatar
Thomas Witkowski committed
57
    inline std::string getName() const 
58
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
59
      return name; 
Thomas Witkowski's avatar
* Bla  
Thomas Witkowski committed
60
    }
61

Thomas Witkowski's avatar
Thomas Witkowski committed
62
    /// Returns \ref problemIteration_
63
64
    inline ProblemIterationInterface *getProblemIteration() 
    {
65
      return problemIteration_;
Thomas Witkowski's avatar
* Bla  
Thomas Witkowski committed
66
    }
67

Thomas Witkowski's avatar
Thomas Witkowski committed
68
    ///
69
70
    inline void setProblemIteration(ProblemIterationInterface *pii) 
    {
71
      problemIteration_ = pii;
Thomas Witkowski's avatar
* Bla  
Thomas Witkowski committed
72
    }
73

Thomas Witkowski's avatar
Thomas Witkowski committed
74
    /// Returns \ref adaptInfo
75
76
    inline AdaptInfo *getAdaptInfo() 
    { 
Thomas Witkowski's avatar
* Bla  
Thomas Witkowski committed
77
78
      return adaptInfo; 
    }
79

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
92
    /// Returns \ref initialAdaptInfo_
93
94
    inline AdaptInfo *getInitialAdaptInfo() 
    { 
95
      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