Commit e0516dfd authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

refactored MonteCarlo. creating PDESolver and Meshes here now

parent a5d8f72a
......@@ -40,3 +40,13 @@ void MonteCarlo::computeSampleSolution(int m, SampleID &id, SampleSolution &solu
pdeSolver->DrawSample(id);
pdeSolver->Run(solution);
}
void MonteCarlo::readConfigEntries() {
config.get("MCPlotting", plotting);
config.get("MCVerbose", verbose);
config.get("Problem", problemName);
config.get("Model", modelName);
config.get("degree", degree);
}
......@@ -2,7 +2,9 @@
#define MLMC_MC_HPP
#include "montecarlo/datastructure/EmpiricMeasures.hpp"
#include "pdesolver/PDESolver.hpp"
#include "pdesolver/PDESolverCreator.hpp"
#include "mesh/MeshesCreator.hpp"
class MonteCarlo {
......@@ -11,10 +13,18 @@ protected:
int plotting = 0;
std::string problemName = "DummyStochasticProblem1D";
std::string modelName = "DummyPDESolver";
int degree = 1;
void method();
void computeSampleSolution(int m, SampleID &id, SampleSolution &solution);
void readConfigEntries();
public:
Level level;
bool onlyFine;
......@@ -25,26 +35,40 @@ public:
Variances vars;
Kurtosis kurtosis;
Meshes *meshes;
PDESolver *pdeSolver;
MatrixGraphs *solMGraphs;
MonteCarlo(Level level, int dM, bool onlyFine) :
level(level), ctr(SampleCounter(dM)), onlyFine(onlyFine) {
readConfigEntries();
if (problemName.find("1D") != string::npos)
meshes = MeshesCreator("Interval").
WithPLevel(level.coarse).
WithLevel(level.fine).
Create();
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)) {
else if (problemName.find("2D") != string::npos)
meshes = MeshesCreator("Square").
WithPLevel(level.coarse).
WithLevel(level.fine).
Create();
config.get("MCPlotting", plotting);
config.get("MCVerbose", verbose);
pdeSolver = PDESolverCreator(*meshes).
WithProblem(problemName).
WithModel(modelName).
WithDegree(degree).
Create();
solMGraphs = pdeSolver->CreateSolutionMatrixGraphs(*meshes);
}
ctr.dM = dM;
// fineId.level = level;
// fineId.coarse = false;
// coarseId.level = level;
// coarseId.coarse = true;
~MonteCarlo() {
delete solMGraphs;
delete pdeSolver;
delete meshes;
}
void Method();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment