StandardProblemIteration.hpp 1.52 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
#pragma once

#include <string>

#include "Flag.hpp"
#include "ProblemIterationInterface.hpp"

namespace AMDiS
{
  // forward declarations
  class AdaptInfo;
  class ProblemStatBase;
13

14
  /// A master problem for a single non coupled problem.
15
16
  class StandardProblemIteration
      : public virtual ProblemIterationInterface
17
18
19
  {
  public:
    /// constructor
20
    explicit StandardProblemIteration(ProblemStatBase& prob)
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
      : problem(prob)
    {}

    /// Implementation of \ref ProblemIterationIterface::beginIteration()
    virtual void beginIteration(AdaptInfo& adaptInfo) override;

    /// Implementation of \ref ProblemIterationInterface::oneIteration()
    virtual Flag oneIteration(AdaptInfo& adaptInfo, Flag toDo) override;

    /// Implementation of \ref ProblemIterationInterface::endIteration()
    virtual void endIteration(AdaptInfo& adaptInfo) override;

    /// Returns the name of the problem.
    virtual std::string getName() const override;

    virtual int getNumProblems() const override
    {
      return 1;
    }

    /// Return the managed ProblemStat \ref problem, by number
    virtual ProblemStatBase& getProblem(int number = 0) override;

    /// Return the managed ProblemStat \ref problem, by name
    virtual ProblemStatBase& getProblem(std::string name) override;
46

47
48
49
50
51
52
53
54
55
56
57
58
59
  protected:
    /// Nested assemblage and mesh adaption.
    Flag buildAndAdapt(AdaptInfo& adaptInfo, Flag toDo);

  protected:
    /// The problem to solve.
    ProblemStatBase& problem;

    /// Info level
    static int info;
  };

} // end namespace AMDiS