Commit 6c265c41 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

deploying pdesolvercreator and meshes creator as well as using new features from SampleCounter

parent d120d75a
......@@ -16,7 +16,8 @@ void MonteCarlo::Method() {
void MonteCarlo::method() {
SampleSolution coarseSolution(solMGraphs, coarseId);
SampleSolution fineSolution(solMGraphs, fineId);
for (int m = ctr.M; m < ctr.M + ctr.dM; m++) {
std::cout << ctr.dMComm << endl;
for (int m = ctr.M; m < ctr.M + ctr.dMComm * PPM->Size(commSplit); m++) {
computeSampleSolution(m, fineId, fineSolution);
if (onlyFine) coarseSolution.Init();
else computeSampleSolution(m, coarseId, coarseSolution);
......
......@@ -41,7 +41,7 @@ public:
SampleID coarseId;
SampleID fineId;
MonteCarlo(Level level, int dM, bool onlyFine, int commSplit = 0) :
MonteCarlo(Level level, int dM, bool onlyFine) :
level(level), ctr(SampleCounter(dM)), onlyFine(onlyFine) {
readConfigEntries();
......@@ -49,30 +49,30 @@ public:
// Todo make function problemName -> meshes
if (problemName.find("1D") != string::npos)
meshes = MeshesCreator("Interval").
WithCommSplit(commSplit).
WithCommSplit(ctr.commSplit).
WithPLevel(level.coarse).
WithLevel(level.fine).
Create();
else if (problemName.find("2D") != string::npos)
meshes = MeshesCreator("Square").
WithCommSplit(commSplit).
WithCommSplit(ctr.commSplit).
WithPLevel(level.coarse).
WithLevel(level.fine).
Create();
else
meshes = MeshesCreator("Square").
WithCommSplit(commSplit).
WithCommSplit(ctr.commSplit).
WithPLevel(level.coarse).
WithLevel(level.fine).
Create();
pdeSolver = PDESolverCreator(*meshes).
pdeSolver = PDESolverCreator().
WithProblem(problemName).
WithModel(modelName).
WithDegree(degree).
Create();
Create(*meshes);
solMGraphs = pdeSolver->CreateSolutionMatrixGraphs(*meshes);
......@@ -80,16 +80,26 @@ public:
fineId.coarse = false;
coarseId.level = level;
coarseId.coarse = true;
this->commSplit = meshes->CommSplit();
}
MonteCarlo(Level level, int dM, bool onlyFine, Meshes *meshes, PDESolver *pdeSolver) :
level(level), ctr(SampleCounter(dM)), onlyFine(onlyFine),
meshes(meshes), pdeSolver(pdeSolver) {
MonteCarlo(Level level, int dM, bool onlyFine,
MeshesCreator meshesCreator, PDESolverCreator pdeCreator) :
level(level), ctr(SampleCounter(dM)), onlyFine(onlyFine) {
readConfigEntries();
meshes = meshesCreator.
WithCommSplit(ctr.commSplit).
WithPLevel(level.coarse).
WithLevel(level.fine).
Create();
pdeSolver = pdeCreator.
WithProblem(problemName).
WithModel(modelName).
WithDegree(degree).
Create(*meshes);
solMGraphs = pdeSolver->CreateSolutionMatrixGraphs(*meshes);
fineId.level = level;
......
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