ProblemInstat.inc.hpp 1.28 KB
Newer Older
1
2
#pragma once

3
4
#include "ProblemInstat.hpp"

5
6
7
#include <string>
#include <vector>

8
#include <amdis/AdaptInfo.hpp>
9

10
11
namespace AMDiS {

12
13
template <class Traits>
void ProblemInstat<Traits>::transferInitialSolution(AdaptInfo& adaptInfo)
14
{
15
  AMDIS_FUNCNAME("ProblemInstat::transferInitialSolution()");
16

17
18
19
20
  test_exit(adaptInfo.getTime() == adaptInfo.getStartTime(),
            "after initial solution: time != start time");
  problemStat.writeFiles(adaptInfo, true);
}
21

22

23
24
template <class Traits>
void ProblemInstat<Traits>::closeTimestep(AdaptInfo& adaptInfo)
25
26
27
28
{
  bool force = (adaptInfo.getTime() >= adaptInfo.getEndTime());
  problemStat.writeFiles(adaptInfo, force);
}
29
30


31
32
template <class Traits>
void ProblemInstat<Traits>::initialize(Flag initFlag)
33
34
35
36
37
{
  // create vector for old solution
  if (initFlag.isSet(INIT_UH_OLD))
      createUhOld();
}
38

Praetorius, Simon's avatar
Praetorius, Simon committed
39

40
41
template <class Traits>
void ProblemInstat<Traits>::createUhOld()
42
43
{
  AMDIS_FUNCNAME("ProblemInstat::createUhOld()");
44

45
  if (oldSolution)
46
    warning("oldSolution already created\n");
47
  else // create oldSolution
48
    oldSolution.reset(new SystemVector(problemStat.globalBasis()));
49
}
50

51

52
53
template <class Traits>
void ProblemInstat<Traits>::initTimestep(AdaptInfo&)
54
55
{
  if (oldSolution)
56
    oldSolution->copy(problemStat.getSolutionVector());
57
}
58
59

} // end namespace AMDiS