MLMCMain.h 2.99 KB
Newer Older
1
2
3
#ifndef MLMC_MLMCMAIN_H
#define MLMC_MLMCMAIN_H

4
5
6
#include "assemble/AssembleHeader.h"
#include "problem/StochasticEllipticProblem.h"
#include "problem/StochasticTransportProblem.h"
7
#include "MultilevelMonteCarlo.h"
8
#include "discgalerkin/DGDiscretization.h"
9

10
11
class MLMCMain {
public:
12
    int enablePython = 1;
13
    double epsilon = 0.1;
14
15
    int size_init = 3, plevel = 2, Lmax = 8, size_lst = 3;
    vector<int> l_init = {3, 4, 5}, M_init = {12, 6, 3};
16
17
18
    vector<double> epsilon_lst = {0.1, 0.05, 0.01};
    string problemName = "", modelName = "";
    string fieldName = "", experimentName = "";
19

20
21
22
23
24
25
    Meshes *meshes = nullptr;
    Discretization *disc = nullptr;
    StochasticFields *stochFields = nullptr;
    StochasticProblem *problem = nullptr;
    Assemble *assemble = nullptr;
    MatrixGraphs *graphs = nullptr;
26

27
    MultilevelMonteCarlo *mlmc = nullptr;
niklas.baumgarten's avatar
niklas.baumgarten committed
28

29
    MLMCMain() {
30
        ReadConfig(Settings, "enablePython", enablePython);
31
32
33
        ReadConfig(Settings, "epsilon", epsilon);
        ReadConfig(Settings, "plevel", plevel);
        ReadConfig(Settings, "Lmax", Lmax);
34
35
36
37
38
        ReadConfig(Settings, "size_init", size_init);
        ReadConfig(Settings, "l_init", l_init, size_init);
        ReadConfig(Settings, "M_init", M_init, size_init);
        ReadConfig(Settings, "size_lst", size_lst);
        ReadConfig(Settings, "epsilon_lst", epsilon_lst, size_lst);
39
40
41
42
        ReadConfig(Settings, "Problem", problemName);
        ReadConfig(Settings, "Model", modelName);
        ReadConfig(Settings, "StochasticField", fieldName);
        ReadConfig(Settings, "Experiment", experimentName);
niklas.baumgarten's avatar
niklas.baumgarten committed
43

44
45
        initialize();
    }
niklas.baumgarten's avatar
niklas.baumgarten committed
46

47
48
49
50
51
    ~MLMCMain() {
        delete meshes, delete disc, delete stochFields;
        delete problem, delete assemble, delete graphs;
        delete mlmc;
    }
niklas.baumgarten's avatar
niklas.baumgarten committed
52

53
    void initialize();
niklas.baumgarten's avatar
niklas.baumgarten committed
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    Meshes *getMeshes();

    Discretization *getDiscretization();

    StochasticFields *getStochasticFields();

    StochasticProblem *getStochasticProblem();

    Assemble *getAssemble();

    MatrixGraphs *getMatrixGraphs();

    void run();

    static void headConvergenceTest() {
        mout << endl << "**********************************************************"
             << endl << "*** Convergence tests, kurtosis, telescoping sum check ***"
             << endl << "**********************************************************"
             << endl;
    }

    static void headMLMCExperiment() {
        mout << endl << "**********************************************************"
             << endl << "***           MultilevelMonteCarlo test run            ***"
             << endl << "**********************************************************"
             << endl;
    }

    static void headMLMCOverEpsilon() {
        mout << endl << "**********************************************************"
             << endl << "***         MultilevelMonteCarlo over epsilon          ***"
             << endl << "**********************************************************"
             << endl;
    }
};
90
91

#endif //MLMC_MLMCMAIN_H