AdaptStationary.cpp 1.22 KB
Newer Older
Praetorius, Simon's avatar
Praetorius, Simon committed
1
#include <config.h>
2

3
4
5
6
7
8
9
10
#include "AdaptStationary.hpp"

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

11
12
namespace AMDiS {

13
AdaptStationary::AdaptStationary(std::string const& name,
14
                                 ProblemIterationInterface& problemIteration,
15
                                 AdaptInfo& adaptInfo)
16
  : AdaptBase(name, &problemIteration, adaptInfo)
17
{}
18

19

20
21
22
int AdaptStationary::adapt()
{
  // initial iteration
Praetorius, Simon's avatar
Praetorius, Simon committed
23
  if (adaptInfo_.spaceIteration() == -1)
24
  {
25
26
27
28
    problemIteration_->beginIteration(adaptInfo_);
    problemIteration_->oneIteration(adaptInfo_, NO_ADAPTION);
    problemIteration_->endIteration(adaptInfo_);
    adaptInfo_.incSpaceIteration();
29
30
  }

31
  // adaption loop
32
  while (!adaptInfo_.spaceToleranceReached() &&
Praetorius, Simon's avatar
Praetorius, Simon committed
33
34
          (adaptInfo_.spaceIteration() < adaptInfo_.maxSpaceIteration() ||
          adaptInfo_.maxSpaceIteration() < 0) )
35
  {
36

37
38
39
    problemIteration_->beginIteration(adaptInfo_);
    Flag adapted = problemIteration_->oneIteration(adaptInfo_, FULL_ITERATION);
    problemIteration_->endIteration(adaptInfo_);
40
41
42
43

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

44
    adaptInfo_.incSpaceIteration();
45
46
  }

47
48
49
  return 0;
}

50
} // end namespace AMDiS