AdaptStationary.cpp 1.21 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
namespace AMDiS {

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

17

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

29
  // adaption loop
30
31
32
  while (!adaptInfo_.spaceToleranceReached() &&
          (adaptInfo_.getSpaceIteration() < adaptInfo_.getMaxSpaceIteration() ||
          adaptInfo_.getMaxSpaceIteration() < 0) )
33
  {
34

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

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

42
    adaptInfo_.incSpaceIteration();
43
44
  }

45
46
47
  return 0;
}

48
} // end namespace AMDiS