EllipticPDESolver.hpp 1.63 KB
Newer Older
niklas.baumgarten's avatar
niklas.baumgarten committed
1
2
3
#ifndef ELLIPTICPDESOLVER_HPP
#define ELLIPTICPDESOLVER_HPP

niklas.baumgarten's avatar
niklas.baumgarten committed
4
5
6
7
8
#include "LagrangeEllipticAssemble.hpp"
#include "MixedEllipticAssemble.hpp"
#include "HybridEllipticAssemble.hpp"
#include "DGEllipticAssemble.hpp"

niklas.baumgarten's avatar
niklas.baumgarten committed
9
10
11
12
13
#include "PDESolver.hpp"


class EllipticPDESolver : public PDESolver {
private:
niklas.baumgarten's avatar
niklas.baumgarten committed
14
15
16
17
18
  std::unique_ptr<Newton> newton;

  std::string quantity = "L2";

  std::string costMeasure = "size";
niklas.baumgarten's avatar
niklas.baumgarten committed
19
20
21
22
23
24
25
26
27
28
29
30
31

  IStochasticEllipticAssemble *assemble;

protected:
  void run(SampleSolution &solution) override;

  void computeQ(SampleSolution &solution) override;

  void computeCost(SampleSolution &solution) override;

  void plotSolution(SampleSolution &solution) override;

public:
niklas.baumgarten's avatar
niklas.baumgarten committed
32
33
  EllipticPDESolver(IStochasticEllipticAssemble *assemble,
                    const string &quantity, const string &costMeasure) :
niklas.baumgarten's avatar
niklas.baumgarten committed
34
35
36
37
    PDESolver(), assemble(assemble), quantity(quantity), costMeasure(costMeasure) {

    newton = std::make_unique<Newton>();

niklas.baumgarten's avatar
niklas.baumgarten committed
38
    if (verbose > 0) {
niklas.baumgarten's avatar
niklas.baumgarten committed
39
40
41
      mout.PrintInfo("EllipticPDESolver", verbose,
                     PrintInfoEntry("Quantity", quantity),
                     PrintInfoEntry("Cost measure", costMeasure));
niklas.baumgarten's avatar
niklas.baumgarten committed
42
43
44
45
46
      newton->PrintInfo();
      assemble->PrintInfo();
    }
  }

niklas.baumgarten's avatar
niklas.baumgarten committed
47
  ~EllipticPDESolver() override {
niklas.baumgarten's avatar
niklas.baumgarten committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
    delete assemble;
  }

  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