Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer, es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Ein Anmelden über dieses erzeugt ein neues Konto. Das alte Konto ist über den Reiter "Standard" erreichbar. Die Administratoren

Dear Gitlab user, it is now possible to log in to our service using the ZIH login/LDAP. Logging in via this will create a new account. The old account can be accessed via the "Standard" tab. The administrators

ProblemInstat.h 6.56 KB
Newer Older
1 2 3 4 5 6
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
7
// ==  TU Dresden                                                            ==
8
// ==                                                                        ==
9 10 11
// ==  Institut fr Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
12 13 14 15
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
16
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
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
// ==                                                                        ==
// ============================================================================

/** \file ProblemInstat.h */

#ifndef AMDIS_PROBLEM_INSTAT_H_
#define AMDIS_PROBLEM_INSTAT_H_

#include "ProblemScal.h"
#include "ProblemVec.h"
#include "ProblemTimeInterface.h"
#include "AdaptInstationary.h"

namespace AMDiS {

  /**
   * \ingroup Problem
   *
   * \brief
   * Base class for ProblemInstatScal and ProblemInstatVec.
   */
  class ProblemInstat : public ProblemTimeInterface,
			public ProblemStatBase
  {
  public:
42 43
    /// Constructor.
    ProblemInstat(std::string probName,
44
		  ProblemStatBase *initialProb)
45
      : name(probName),
46
	initialProblem(initialProb ? initialProb : this)
47
    {}
48

49
    /// Destructor.
50 51
    virtual ~ProblemInstat();

52
    /// Initialisation of the problem.
53 54 55 56
    virtual void initialize(Flag initFlag,
			    ProblemInstat *adoptProblem = NULL,
			    Flag adoptFlag = INIT_NOTHING);

57 58
    virtual void solve(AdaptInfo* adaptInfo) {}

59 60
    virtual void solve(AdaptInfo *adaptInfo, bool fixedMatrix) 
    {
61 62
      solve(adaptInfo);
    }
63

64
    virtual void estimate(AdaptInfo *adaptInfo) {}
65

66
    virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {}
67

68
    virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}
69

70
    virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag, bool, bool) {}
71

72 73
    virtual Flag markElements(AdaptInfo *adaptInfo) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
74
      return 0; 
75
    }
76

77 78
    virtual Flag refineMesh(AdaptInfo *adaptInfo) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
79
      return 0; 
80
    }
81

82 83
    virtual Flag coarsenMesh(AdaptInfo *adaptInfo) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
84
      return 0; 
85
    }
86

87
    /// Implementation of ProblemTimeInterface::closeTimestep().
88
    virtual void closeTimestep() {}
89

90
    /// Returns \ref name.
Thomas Witkowski's avatar
Thomas Witkowski committed
91
    inline std::string getName() 
92
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
93
      return name; 
94
    }
95

96
    /// Used by \ref problemInitial
97 98
    virtual void solveInitialProblem(AdaptInfo *adaptInfo);  

Thomas Witkowski's avatar
Thomas Witkowski committed
99

100
  protected:
101
    /// Name of the problem.
102
    std::string name;
103 104 105 106 107 108 109 110 111 112 113 114 115 116

    ProblemStatBase *initialProblem;
  };


  /**
   * \ingroup Problem
   *
   * \brief
   * Standard implementation of ProblemTimeInterface for a time dependent problems.
   */
  class ProblemInstatScal : public ProblemInstat
  {
  public:
117
    /// Constructs a ProblemInstatScal with prob as its stationary problem.
118
    ProblemInstatScal(std::string name,
119 120 121
		      ProblemScal *prob,
		      ProblemStatBase *initialProb = NULL);

122 123 124 125
    ProblemInstatScal(std::string name, ProblemScal& prob);

    ProblemInstatScal(std::string name, ProblemScal& prob, ProblemStatBase& initialProb);

126
    /// Destructor.
127 128
    virtual ~ProblemInstatScal();

129
    /// Initialisation of the problem.
130 131 132 133
    virtual void initialize(Flag initFlag,
			    ProblemInstat *adoptProblem = NULL,
			    Flag adoptFlag = INIT_NOTHING);

134
    /// Used in \ref initialize().
135
    virtual void createUhOld();
136
 
137
    /// Implementation of ProblemTimeInterface::initTimestep().
138 139
    virtual void initTimestep(AdaptInfo *adaptInfo);

140
    /// Implementation of ProblemTimeInterface::closeTimestep().
141 142
    virtual void closeTimestep(AdaptInfo *adaptInfo);
  
143 144 145
    /// Returns \ref problemStat.
    inline ProblemScal* getStatProblem() 
    { 
146
      return problemStat; 
147
    }
148

149 150 151
    /// Returns \ref oldSolution.
    inline DOFVector<double> *getOldSolution() 
    { 
152
      return oldSolution; 
153
    }
154

155
    /// Used by \ref problemInitial
156 157
    virtual void transferInitialSolution(AdaptInfo *adaptInfo);  

158
    virtual void serialize(std::ostream &out) {}
Thomas Witkowski's avatar
Thomas Witkowski committed
159

160
    virtual void deserialize(std::istream &in) {}
161 162
   
  protected:
163
    /// Space problem solved in each timestep.
164 165
    ProblemScal* problemStat;

166
    /// Solution of the last timestep.
167 168 169 170 171 172 173 174 175 176 177 178 179 180
    DOFVector<double>* oldSolution;
  };


  /**
   * \ingroup Problem
   *
   * \brief
   * Standard implementation of ProblemTimeInterface for a time dependent 
   * vector valued problems.
   */
  class ProblemInstatVec : public ProblemInstat
  {
  public:
181
    /// Constructs a ProblemInstatVec with prob as its stationary problem.
182
    ProblemInstatVec(std::string name, 
183 184 185
		     ProblemVec *prob,
		     ProblemStatBase *initialProb = NULL);

186 187 188 189
    ProblemInstatVec(std::string name, ProblemVec &prob);

    ProblemInstatVec(std::string name, ProblemVec &prob, ProblemStatBase &initialProb);

190
    /// Destructor.
191 192
    virtual ~ProblemInstatVec();

193
    /// Initialisation of the problem.
194 195 196 197
    virtual void initialize(Flag initFlag,
			    ProblemInstat *adoptProblem = NULL,
			    Flag adoptFlag = INIT_NOTHING);

198
    /// Used in \ref initialize().
199 200
    virtual void createUhOld();

201
    /// Implementation of ProblemTimeInterface::initTimestep().
202 203
    virtual void initTimestep(AdaptInfo *adaptInfo);

204
    /// Implementation of ProblemTimeInterface::closeTimestep().
205 206
    virtual void closeTimestep(AdaptInfo *adaptInfo);
  
207 208 209
    /// Returns \ref problemStat.
    inline ProblemVec* getStatProblem() 
    {
210
      return problemStat; 
Thomas Witkowski's avatar
Thomas Witkowski committed
211
    }
212

213 214 215
    /// Returns \ref oldSolution.
    inline SystemVector *getOldSolution() 
    { 
216
      return oldSolution; 
Thomas Witkowski's avatar
Thomas Witkowski committed
217
    }
218

219
    /// Used by \ref problemInitial
220 221
    virtual void transferInitialSolution(AdaptInfo *adaptInfo);  

Thomas Witkowski's avatar
Thomas Witkowski committed
222
    virtual void serialize(std::ostream &out) {}
Thomas Witkowski's avatar
Thomas Witkowski committed
223

Thomas Witkowski's avatar
Thomas Witkowski committed
224
    virtual void deserialize(std::istream &in) {}
225 226

  protected:
227
    /// Space problem solved in each timestep.
228 229
    ProblemVec* problemStat;

230
    /// Solution of the last timestep.
231 232 233 234 235 236
    SystemVector *oldSolution;
  };

}

#endif