EllipticPDESolver.hpp 1.28 KB
Newer Older
niklas.baumgarten's avatar
niklas.baumgarten committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
46
47
48
49
50
51
#ifndef ELLIPTICPDESOLVER_HPP
#define ELLIPTICPDESOLVER_HPP

#include "PDESolver.hpp"


class EllipticPDESolver : public PDESolver {
private:
  Newton *newton;

  IStochasticEllipticAssemble *assemble;

protected:
  void run(SampleSolution &solution) override;

  void computeQ(SampleSolution &solution) override;

  void computeCost(SampleSolution &solution) override;

  void plotSolution(SampleSolution &solution) override;

public:
  EllipticPDESolver(IStochasticEllipticAssemble *assemble, Meshes &meshes,
                    const std::string &quantity = "L2",
                    const std::string &costMeasure = "size") :
    PDESolver(meshes, quantity, costMeasure),
    newton(new Newton()), assemble(assemble) {
    if (verbose > 0) {
      PrintInfo();
      newton->PrintInfo();
      assemble->PrintInfo();
    }
  }

  ~EllipticPDESolver() {
    delete assemble;
    delete newton;
  }

  IAssemble *GetAssemble() const override { 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 "EllipticPDESolver"; }
};

#endif //ELLIPTICPDESOLVER_HPP