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

rmv meshes in monte carlo, only solMGraph now

parent f3bb3de7
......@@ -3,7 +3,7 @@
void MonteCarlo::Method() {
mout.StartBlock("MC Method");
vout(1) << "l=" << level << " dM=" << ctr.dM << " fine=" << onlyFine << endl;
vout(1) << "l=" << level.fine << " dM=" << ctr.dM << " fine=" << onlyFine << endl;
method();
avgs.Update(sums, ctr.M);
vars.Update(avgs);
......@@ -14,15 +14,15 @@ void MonteCarlo::Method() {
void MonteCarlo::method() {
for (int m = ctr.M; m < ctr.M + ctr.dM; m++) {
findSampleSolution(m, fineId, fineSolution);
computeSampleSolution(m, fineId, fineSolution);
if (onlyFine) coarseSolution.Init();
else findSampleSolution(m, coarseId, coarseSolution);
else computeSampleSolution(m, coarseId, coarseSolution);
sums.Update(fineSolution, coarseSolution);
ctr.Update();
}
}
void MonteCarlo::findSampleSolution(int m, SampleID &id, SampleSolution &solution) {
void MonteCarlo::computeSampleSolution(int m, SampleID &id, SampleSolution &solution) {
id.number = m;
solution.id = id;
plotter->SetDirectory(id);
......
......@@ -12,13 +12,12 @@ protected:
int plotting = 0;
int verbose = 1;
virtual void method();
void method();
void findSampleSolution(int m, SampleID &id, SampleSolution &solution);
void computeSampleSolution(int m, SampleID &id, SampleSolution &solution);
public:
int level;
int pLevel;
Level level;
bool onlyFine;
SampleCounter ctr;
......@@ -28,18 +27,19 @@ public:
Kurtosis kurtosis;
PDESolver *pdeSolver;
MatrixGraphs solMGraphs;
MatrixGraphs *solMGraphs;
SampleID coarseId;
SampleID fineId;
SampleSolution coarseSolution;
SampleSolution fineSolution;
MonteCarlo(int level, int dM, bool onlyFine, Meshes &meshes, PDESolver *pdeSolver) :
level(level), onlyFine(onlyFine), pdeSolver(pdeSolver),
solMGraphs(MatrixGraphs(meshes, *pdeSolver->GetDisc())),
coarseSolution(SampleSolution(solMGraphs, level - meshes.pLevel() - 1)),
fineSolution(SampleSolution(solMGraphs, level - meshes.pLevel())) {
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)) {
config.get("MCPlotting", plotting);
config.get("MCVerbose", verbose);
......@@ -51,8 +51,6 @@ public:
coarseId.coarse = true;
}
virtual ~MonteCarlo() {};
void Method();
};
......
......@@ -13,7 +13,9 @@ void MultilevelMonteCarlo::initializeMapMonteCarlo() {
}
MonteCarlo *MultilevelMonteCarlo::createMonteCarlo(int l, int dM, bool onlyFine) {
return new MonteCarlo(l, dM, onlyFine, *meshes, pdeSolver);
Level level;
level.Update(l, meshes->pLevel());
return new MonteCarlo(level, dM, onlyFine, &solMGraphs, pdeSolver);
// return new MonteCarlo(l, onlyFine, *meshes, assemble, new TransportPDESolver());
Exit("Wrong Assembly Class")
}
......
......@@ -18,6 +18,7 @@ public:
MonteCarloMap mcMap;
Meshes *meshes;
MatrixGraphs solMGraphs;
PDESolver *pdeSolver;
vector<int> levels = {};
......@@ -42,6 +43,7 @@ public:
PDESolver *pdeSolver) :
initLevels(initLevels),
initSampleAmount(initSampleAmount),
solMGraphs(MatrixGraphs(*meshes, *pdeSolver->GetDisc())),
meshes(meshes),
pdeSolver(pdeSolver) {
......
Supports Markdown
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