ProblemInstat.inc.hpp 1.3 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

Praetorius, Simon's avatar
Praetorius, Simon committed
17
  test_exit(adaptInfo.time() == adaptInfo.startTime(),
18
            "after initial solution: time != start time");
19
  problemStat_->writeFiles(adaptInfo, true);
20
}
21

22

23
24
template <class Traits>
void ProblemInstat<Traits>::closeTimestep(AdaptInfo& adaptInfo)
25
{
Praetorius, Simon's avatar
Praetorius, Simon committed
26
  bool force = (adaptInfo.time() >= adaptInfo.endTime());
27
  problemStat_->writeFiles(adaptInfo, force);
28
}
29
30


31
32
template <class Traits>
void ProblemInstat<Traits>::initialize(Flag initFlag)
33
34
35
{
  // create vector for old solution
  if (initFlag.isSet(INIT_UH_OLD))
36
    createUhOld();
37
}
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(), DataTransferOperation::INTERPOLATE));
49
}
50

51

52
53
template <class Traits>
void ProblemInstat<Traits>::initTimestep(AdaptInfo&)
54
{
55
  if (oldSolution_)
56
    *oldSolution_ = *problemStat_->solutionVector();
57
}
58
59

} // end namespace AMDiS