TransportPDESolver.hpp 1.64 KB
Newer Older
niklas.baumgarten's avatar
niklas.baumgarten committed
1
2
3
#ifndef TRANSPORTPDESOLVER_HPP
#define TRANSPORTPDESOLVER_HPP

niklas.baumgarten's avatar
niklas.baumgarten committed
4
5
#include "DGTransportAssemble.hpp"

niklas.baumgarten's avatar
niklas.baumgarten committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "PDESolver.hpp"


class TransportPDESolver : public PDESolver {
private:
  TimeIntegrator *timeInt;

  IStochasticLinearTransportAssemble *assemble;

protected:
  void run(SampleSolution &solution) override;

  void computeQ(SampleSolution &solution) override;

  void computeCost(SampleSolution &solution) override;

  void plotSolution(SampleSolution &solution) override;

public:
  TransportPDESolver(IStochasticLinearTransportAssemble *assemble,
niklas.baumgarten's avatar
niklas.baumgarten committed
26
                     const Meshes &meshes,
niklas.baumgarten's avatar
niklas.baumgarten committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
                     const std::string &quantity = "L2",
                     const std::string &costMeasure = "size") :
    PDESolver(meshes, quantity, costMeasure), assemble(assemble),
    timeInt(TimeIntegratorCreator(IMPLICIT_MIDPOINT).
      WithLinearSolver(new GMRES(GetPC("PointBlockJacobi_dG"))).
      WithLinearSolver(new GMRES(GetPC("PointBlockJacobi_dG"))).
      WithLinearSolver(new GMRES(GetPC("PointBlockJacobi_dG"))).
      WithLinearSolver(new GMRES(GetPC("PointBlockJacobi_dG"))).
      Create()) {
    if (verbose)
      PrintInfo();
  }

  ~TransportPDESolver() {
    delete assemble;
    delete timeInt;
  }

  IAssemble *GetAssemble() const override {
    return nullptr;
//        return assemble;
  }

  IDiscretization *GetDisc() const override { return assemble->GetDisc(); }

  IStochasticProblem *GetProblem() const override { return assemble->GetProblem(); }

  void DrawSample(const SampleID &id) override { assemble->DrawSample(id); }

  std::string Name() const override { return "TransportPDESolver"; }
};

#endif //TRANSPORTPDESOLVER_HPP