Commit 62c898e6 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

adapted to new stochastic problem

parent 133788d3
......@@ -6,18 +6,15 @@ using namespace std;
void MainProgram::Initialize() {
meshes = createMeshes();
disc = createDiscretization();
stochField = createStochasticField();
problem = createStochasticProblem();
assemble = createAssemble();
plotter = make_shared<MultilevelPlotter>(*meshes);
mlmc = make_unique<MultilevelMonteCarlo>(initLevels, initSampleAmount,
meshes, stochField,
assemble);
meshes, assemble);
meshes->PrintInfo();
mlmc->PrintInfo();
stochField->PrintInfo();
assemble->PrintInfo();
}
......@@ -100,78 +97,54 @@ IDiscretization *MainProgram::createDiscretization() {
Exit("\nDiscretization not found in " + modelName + "\n")
}
StochasticField *MainProgram::createStochasticField() {
if (problemName.find("Stochastic") != string::npos) {
if (problemName.find("Laplace") != string::npos)
return new StochasticField(*meshes, "CirculantEmbedding");
if (problemName.find("Pollution") != string::npos)
return new StochasticField (*meshes, "HybridFluxGenerator");
if (problemName.find("Initial")) {
return nullptr; // Todo
}
}
if (problemName.find("Deterministic") != string::npos) {
if (problemName.find("Laplace") != string::npos)
return new StochasticField(
*meshes, "DeterministicPermeabilityGenerator");
if (problemName.find("Pollution") != string::npos)
return new StochasticField(
*meshes, "DeterministicHybridFluxGenerator");
}
Exit("\nStochastic field not found in " + problemName + "\n")
}
StochasticProblem *MainProgram::createStochasticProblem() {
if (problemName.find("StochasticLaplace1D") != string::npos ||
problemName.find("DeterministicLaplace1D") != string::npos)
return new StochasticLaplace1D();
if (problemName.find("StochasticLaplace2D") != string::npos ||
problemName.find("DeterministicLaplace2D") != string::npos)
return new StochasticLaplace2D();
if (problemName.find("StochasticPollution1D") != string::npos ||
problemName.find("DeterministicPollution1D") != string::npos)
return new StochasticPollution1D();
if (problemName.find("StochasticPollutionCosHat1D") != string::npos ||
problemName.find("DeterministicPollutionCosHat1D") != string::npos)
return new StochasticPollutionCosHat1D();
if (problemName.find("StochasticPollution2D") != string::npos ||
problemName.find("DeterministicPollution2D") != string::npos)
return new StochasticPollution2D();
if (problemName.find("StochasticPollutionCosHat2D") != string::npos ||
problemName.find("DeterministicPollutionCosHat2D") != string::npos)
return new StochasticPollutionCosHat2D();
if (problemName.find("StochasticPollutionMollifiedBar2D") != string::npos ||
problemName.find("DeterministicPollutionMollifiedBar2D") != string::npos)
return new StochasticPollutionMollifiedBar2D();
if (problemName.find("StochasticInitialConditions2D") != string::npos)
return nullptr;
IStochasticProblemT<Vector> *MainProgram::createStochasticProblem() {
if (problemName == "StochasticLaplace1D")
return new StochasticLaplace1D(*meshes);
if (problemName =="StochasticLaplace2D")
return new StochasticLaplace2D(*meshes);
// if (problemName.find("StochasticPollution1D") != string::npos ||
// problemName.find("DeterministicPollution1D") != string::npos)
// return new StochasticPollution1D();
// if (problemName.find("StochasticPollutionCosHat1D") != string::npos ||
// problemName.find("DeterministicPollutionCosHat1D") != string::npos)
// return new StochasticPollutionCosHat1D();
// if (problemName.find("StochasticPollution2D") != string::npos ||
// problemName.find("DeterministicPollution2D") != string::npos)
// return new StochasticPollution2D();
// if (problemName.find("StochasticPollutionCosHat2D") != string::npos ||
// problemName.find("DeterministicPollutionCosHat2D") != string::npos)
// return new StochasticPollutionCosHat2D();
// if (problemName.find("StochasticPollutionMollifiedBar2D") != string::npos ||
// problemName.find("DeterministicPollutionMollifiedBar2D") != string::npos)
// return new StochasticPollutionMollifiedBar2D();
// if (problemName.find("StochasticInitialConditions2D") != string::npos)
// return nullptr;
Exit("\nProblem field not found in " + problemName + "\n")
}
IAssemble *MainProgram::createAssemble() {
StochasticEllipticProblem *ellipticProblem =
dynamic_cast<StochasticEllipticProblem * >(problem);
StochasticTransportProblem *transportProblem =
dynamic_cast<StochasticTransportProblem * >(problem);
if (ellipticProblem != nullptr) {
if (modelName == "LagrangeFEM")
return new LagrangeEllipticAssemble(disc, ellipticProblem);
if (modelName == "MixedFEM")
return new MixedEllipticAssemble(disc, ellipticProblem);
if (modelName == "HybridFEM")
return new HybridEllipticAssemble(disc, ellipticProblem);
if (modelName == "DGFEM")
return 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
}
IStochasticEllipticProblemT<Vector> *ellipticProblem =
dynamic_cast<IStochasticEllipticProblemT<Vector> * >(problem);
// StochasticTransportProblem *transportProblem =
// dynamic_cast<StochasticTransportProblem * >(problem);
//
// if (ellipticProblem != nullptr) {
if (modelName == "LagrangeFEM")
return new LagrangeEllipticAssemble(disc, ellipticProblem);
// if (modelName == "MixedFEM")
// return new MixedEllipticAssemble(disc, ellipticProblem);
// if (modelName == "HybridFEM")
// return new HybridEllipticAssemble(disc, ellipticProblem);
// if (modelName == "DGFEM")
// return 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
// }
Exit(("\nAssembling for Problem=" + problemName + " with Model=" +
modelName + " not implemented\n"))
......
......@@ -3,15 +3,14 @@
#include"assemble/LagrangeEllipticAssemble.hpp"
#include"assemble/MixedEllipticAssemble.hpp"
#include"assemble/DGEllipticAssemble.hpp"
//#include"assemble/DGEllipticAssemble.hpp"
#include"assemble/HybridEllipticAssemble.hpp"
#include"assemble/DGTransportAssemble.hpp"
#include"assemble/DGReactionAssemble.hpp"
#include"assemble/PGReactionAssemble.hpp"
//#include"assemble/DGTransportAssemble.hpp"
//#include"assemble/DGReactionAssemble.hpp"
//#include"assemble/PGReactionAssemble.hpp"
#include "problem/StochasticEllipticProblem.hpp"
#include "montecarlo/MultilevelMonteCarlo.hpp"
#include "stochastics/StochasticField.hpp"
#include "MultilevelPlotter.hpp"
#include <memory>
......@@ -36,8 +35,7 @@ public:
Meshes *meshes;
IDiscretization *disc;
StochasticField *stochField;
StochasticProblem *problem;
IStochasticProblemT<Vector> *problem;
IAssemble *assemble;
unique_ptr<MultilevelMonteCarlo> mlmc;
......@@ -62,7 +60,6 @@ public:
~MainProgram() {
delete meshes;
delete disc;
delete stochField;
delete problem;
delete assemble;
}
......@@ -83,9 +80,7 @@ private:
IDiscretization *createDiscretization();
StochasticField *createStochasticField();
StochasticProblem *createStochasticProblem();
IStochasticProblemT<Vector> *createStochasticProblem();
IAssemble *createAssemble();
};
......
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