AdaptBase.h 3.45 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
57
    inline const std::string& getName() const { 
Thomas Witkowski's avatar
Thomas Witkowski committed
58
      return name; 
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
59
    }
60

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
71
    /// Returns \ref adaptInfo
72
    inline AdaptInfo *getAdaptInfo() { 
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
73
74
      return adaptInfo; 
    }
75

Thomas Witkowski's avatar
Thomas Witkowski committed
76
    /// Returns \ref problemTime_
77
78
    inline ProblemTimeInterface *getProblemTime() {
      return problemTime_;
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
79
    }
80

Thomas Witkowski's avatar
Thomas Witkowski committed
81
    ///
82
83
84
85
    inline void setProblemTime(ProblemTimeInterface *pti) {
      problemTime_ = pti;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
86
    /// Returns \ref initialAdaptInfo_
87
88
    inline AdaptInfo *getInitialAdaptInfo() { 
      return initialAdaptInfo_; 
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
89
    }
90
91

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
92
93
    /// Name of the adaption loop
    std::string name;
94

Thomas Witkowski's avatar
Thomas Witkowski committed
95
    /// Problem iteration interface
96
97
    ProblemIterationInterface *problemIteration_;

Thomas Witkowski's avatar
Thomas Witkowski committed
98
    /// Main adapt info
Thomas Witkowski's avatar
* Bla    
Thomas Witkowski committed
99
    AdaptInfo *adaptInfo;
100

Thomas Witkowski's avatar
Thomas Witkowski committed
101
    /// problem time interface
102
103
104
105
106
107
108
109
    ProblemTimeInterface *problemTime_;

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

Thomas Witkowski's avatar
Thomas Witkowski committed
110
    /// Info level
111
112
113
114
115
116
    static int info_;
  };

}

#endif