MonteCarlo.hpp 1.25 KB
Newer Older
1
2
3
#ifndef MLMC_MC_HPP
#define MLMC_MC_HPP

4
#include "main/MultilevelPlotter.hpp"
niklas.baumgarten's avatar
niklas.baumgarten committed
5
#include "EmpiricMeasures.hpp"
niklas.baumgarten's avatar
niklas.baumgarten committed
6
#include "PDESolver.hpp"
niklas.baumgarten's avatar
niklas.baumgarten committed
7
#include "Sample.hpp"
8
9


10
class MonteCarlo {
niklas.baumgarten's avatar
niklas.baumgarten committed
11
protected:
niklas.baumgarten's avatar
niklas.baumgarten committed
12
    int plotting = 0;
niklas.baumgarten's avatar
niklas.baumgarten committed
13
    int verbose = 1;
14

15
    void method();
16

17
    void computeSampleSolution(int m, SampleID &id, SampleSolution &solution);
niklas.baumgarten's avatar
niklas.baumgarten committed
18

niklas.baumgarten's avatar
niklas.baumgarten committed
19
public:
20
    Level level;
niklas.baumgarten's avatar
niklas.baumgarten committed
21
    bool onlyFine;
niklas.baumgarten's avatar
niklas.baumgarten committed
22
23
24
25
26
27
28
29

    SampleCounter ctr;
    Sums sums;
    Averages avgs;
    Variances vars;
    Kurtosis kurtosis;

    PDESolver *pdeSolver;
30
    MatrixGraphs *solMGraphs;
31

niklas.baumgarten's avatar
niklas.baumgarten committed
32
33
34
35
36
    SampleID coarseId;
    SampleID fineId;
    SampleSolution coarseSolution;
    SampleSolution fineSolution;

37
38
39
40
41
42
    MonteCarlo(Level level, int dM, bool onlyFine,
               MatrixGraphs *solMGraphs, PDESolver *pdeSolver) :
        level(level), onlyFine(onlyFine),
        solMGraphs(solMGraphs), pdeSolver(pdeSolver),
        coarseSolution(SampleSolution(*solMGraphs, level.mGcoarse)),
        fineSolution(SampleSolution(*solMGraphs, level.mGfine)) {
43

44
        config.get("MCPlotting", plotting);
45
        config.get("MCVerbose", verbose);
niklas.baumgarten's avatar
niklas.baumgarten committed
46
47
48
49

        ctr.dM = dM;
        fineId.level = level;
        fineId.coarse = false;
niklas.baumgarten's avatar
niklas.baumgarten committed
50
        coarseId.level = level;
niklas.baumgarten's avatar
niklas.baumgarten committed
51
        coarseId.coarse = true;
niklas.baumgarten's avatar
niklas.baumgarten committed
52
    }
53

54
    void Method();
55
56
57
};

#endif //MLMC_MC_HPP