Commit 97ea0202 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

adapted main

parent 85330575
......@@ -8,16 +8,14 @@ void MainProgram::Initialize() {
disc = createDiscretization();
problem = createStochasticProblem();
assemble = createStochasticAssemble();
pdeSolver = createPDESolver();
plotter = new MultilevelPlotter(*meshes);
mlmc = new MultilevelMonteCarlo(initSampleCount, meshes, assemble, pdeSolver);
mlmc = new MultilevelMonteCarlo(initLevels, initSampleAmount, meshes, pdeSolver);
meshes->PrintInfo();
mlmc->PrintInfo();
problem->PrintInfo();
assemble->PrintInfo();
}
int MainProgram::Run() {
......@@ -99,7 +97,7 @@ IStochasticProblem *MainProgram::createStochasticProblem() {
return new StochasticLaplace1D(*meshes);
if (problemName == "StochasticLaplace2D")
return new StochasticLaplace2D(*meshes);
// if (problemName == "StochasticPollution1D")
if (problemName == "StochasticPollution1D")
// return new StochasticPollution1D(*meshes);
// if (problemName == "StochasticPollutionCosHat1D")
// return new StochasticPollutionCosHat1D(*meshes);
......@@ -114,34 +112,33 @@ IStochasticProblem *MainProgram::createStochasticProblem() {
Exit("\nProblem field not found in " + problemName + "\n")
}
IStochasticAssemble *MainProgram::createStochasticAssemble() {
PDESolver *MainProgram::createPDESolver() {
IStochasticEllipticProblem *ellipticProblem =
dynamic_cast<IStochasticEllipticProblem * >(problem);
// IStochasticTransportProblem *transportProblem =
// dynamic_cast<IStochasticTransportProblem * >(problem);
IStochasticTransportProblem *transportProblem =
dynamic_cast<IStochasticTransportProblem * >(problem);
if (ellipticProblem != nullptr) {
if (modelName == "LagrangeFEM")
return new LagrangeEllipticAssemble(disc, ellipticProblem);
return new EllipticPDESolver(new LagrangeEllipticAssemble(disc,
ellipticProblem));
if (modelName == "MixedFEM")
return new MixedEllipticAssemble(disc, ellipticProblem);
return new EllipticPDESolver(new MixedEllipticAssemble(disc,
ellipticProblem));
if (modelName == "HybridFEM")
return new HybridEllipticAssemble(disc, ellipticProblem);
// if (modelName == "DGFEM")
// return new DGEllipticAssemble(disc, ellipticProblem);
return new EllipticPDESolver(new HybridEllipticAssemble(disc,
ellipticProblem));
if (modelName == "DGFEM")
return new EllipticPDESolver(new DGEllipticAssemble(disc,
ellipticProblem));
}
//// if (transportProblem != nullptr) {
//// if (modelName == "DGTransport")
//// return new DGTransportAssemble(disc, transportProblem, nullptr);
//// if (modelName == "PGTransport")
//// return nullptr; // Todo open research question
// if (transportProblem != nullptr) {
// if (modelName == "DGTransport")
// return new TransportPDESolver(new DGTransportAssemble(disc,
// transportProblem));
// if (modelName == "PGTransport")
// return nullptr; // Todo open research question
// }
Exit(("\nAssembling for Problem=" + problemName + " with Model=" +
modelName + " not implemented\n"))
}
PDESolver *MainProgram::createPDESolver() {
return new EllipticPDESolver(static_cast<IStochasticEllipticAssemble *>(assemble));
}
#ifndef MLMC_MLMCMAIN_H
#define MLMC_MLMCMAIN_H
#include"assemble/LagrangeEllipticAssemble.hpp"
#include"assemble/MixedEllipticAssemble.hpp"
//#include"assemble/DGEllipticAssemble.hpp"
#include"assemble/HybridEllipticAssemble.hpp"
//#include"assemble/DGTransportAssemble.hpp"
//#include"assemble/DGReactionAssemble.hpp"
//#include"assemble/PGReactionAssemble.hpp"
#include "assemble/LagrangeEllipticAssemble.hpp"
#include "assemble/MixedEllipticAssemble.hpp"
#include "assemble/HybridEllipticAssemble.hpp"
#include "assemble/DGEllipticAssemble.hpp"
//#include "assemble/DGTransportAssemble.hpp"
//#include "assemble/DGReactionAssemble.hpp"
//#include "assemble/PGReactionAssemble.hpp"
#include "problem/StochasticEllipticProblem.hpp"
#include "montecarlo/MultilevelMonteCarlo.hpp"
......@@ -37,7 +37,6 @@ public:
Meshes *meshes;
IDiscretization *disc;
IStochasticProblem *problem;
IStochasticAssemble *assemble;
MultilevelMonteCarlo *mlmc;
PDESolver *pdeSolver;
......@@ -56,12 +55,11 @@ public:
config.get("Experiment", experimentName);
int index = 0;
for(auto &level: initLevels) {
for (auto &level: initLevels) {
initSampleCount[level] = initSampleAmount[index];
index++;
}
checkValues();
}
......@@ -69,7 +67,6 @@ public:
delete meshes;
delete disc;
delete problem;
delete assemble;
delete plotter; // Todo manage in another way
delete mlmc;
}
......@@ -92,8 +89,6 @@ private:
IStochasticProblem *createStochasticProblem();
IStochasticAssemble * createStochasticAssemble();
PDESolver *createPDESolver();
};
......
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