AdaptStationary.cpp 1.2 KB
Newer Older
1
2
3
4
5
6
7
8
#include "AdaptStationary.hpp"

// AMDiS includes
#include "AdaptInfo.hpp"
#include "Flag.hpp"
#include "Initfile.hpp"
#include "ProblemIterationInterface.hpp"

9
10
11
12
13
14
namespace AMDiS {

AdaptStationary::AdaptStationary(std::string name,
                                 ProblemIterationInterface& prob,
                                 AdaptInfo& adaptInfo)
  : AdaptBase(name, &prob, adaptInfo)
15
{
16
17
18
  Parameters::get(name + "->info", info);
}

19

20
21
22
23
int AdaptStationary::adapt()
{
  // initial iteration
  if (adaptInfo.getSpaceIteration() == -1)
24
  {
25
26
27
28
    problemIteration->beginIteration(adaptInfo);
    problemIteration->oneIteration(adaptInfo, NO_ADAPTION);
    problemIteration->endIteration(adaptInfo);
    adaptInfo.incSpaceIteration();
29
30
  }

31
32
33
34
  // adaption loop
  while (!adaptInfo.spaceToleranceReached() &&
          (adaptInfo.getSpaceIteration() < adaptInfo.getMaxSpaceIteration() ||
          adaptInfo.getMaxSpaceIteration() < 0) )
35
  {
36
37
38
39
40
41
42
43
44

    problemIteration->beginIteration(adaptInfo);
    Flag adapted = problemIteration->oneIteration(adaptInfo, FULL_ITERATION);
    problemIteration->endIteration(adaptInfo);

    if (adapted == Flag{0})
      break;

    adaptInfo.incSpaceIteration();
45
46
  }

47
48
49
  return 0;
}

50
} // end namespace AMDiS