Commit 700d8de4 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

pdesolver creator taking more responsibility on how object is set up by also...

pdesolver creator taking more responsibility on how object is set up by also considering config entries
parent c99fada5
...@@ -7,7 +7,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) { ...@@ -7,7 +7,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) {
new LagrangeEllipticAssemble( new LagrangeEllipticAssemble(
new LagrangeDiscretization(meshes, _degree), new LagrangeDiscretization(meshes, _degree),
CreateStochasticEllipticProblem(_problem, meshes) CreateStochasticEllipticProblem(_problem, meshes)
), _quantity, _costMeasure, _verbose, _plotting ), meshes, _quantity, _costMeasure, _verbose, _plotting
); );
if (_model == "MixedElliptic") if (_model == "MixedElliptic")
...@@ -15,7 +15,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) { ...@@ -15,7 +15,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) {
new MixedEllipticAssemble( new MixedEllipticAssemble(
new RTLagrangeDiscretization(meshes, 0, 0), new RTLagrangeDiscretization(meshes, 0, 0),
CreateStochasticEllipticProblem(_problem, meshes) CreateStochasticEllipticProblem(_problem, meshes)
), _quantity, _costMeasure, _verbose, _plotting ), meshes, _quantity, _costMeasure, _verbose, _plotting
); );
if (_model == "HybridElliptic") if (_model == "HybridElliptic")
...@@ -23,7 +23,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) { ...@@ -23,7 +23,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) {
new HybridEllipticAssemble( new HybridEllipticAssemble(
new RTLagrangeDiscretization(meshes, 0, 0), new RTLagrangeDiscretization(meshes, 0, 0),
CreateStochasticEllipticProblem(_problem, meshes) CreateStochasticEllipticProblem(_problem, meshes)
), _quantity, _costMeasure, _verbose, _plotting ), meshes, _quantity, _costMeasure, _verbose, _plotting
); );
if (_model == "DGElliptic") if (_model == "DGElliptic")
...@@ -31,7 +31,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) { ...@@ -31,7 +31,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) {
new DGEllipticAssemble( new DGEllipticAssemble(
new DGDiscretization(meshes, _degree), new DGDiscretization(meshes, _degree),
CreateStochasticEllipticProblem(_problem, meshes) CreateStochasticEllipticProblem(_problem, meshes)
), _quantity, _costMeasure, _verbose, _plotting ), meshes, _quantity, _costMeasure, _verbose, _plotting
); );
if (_model == "DGTransport") if (_model == "DGTransport")
...@@ -39,7 +39,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) { ...@@ -39,7 +39,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) {
new DGTransportAssemble( new DGTransportAssemble(
new DGDiscretization(meshes, _degree), new DGDiscretization(meshes, _degree),
CreateStochasticTransportProblem(_problem, meshes) CreateStochasticTransportProblem(_problem, meshes)
), _quantity, _costMeasure, _verbose, _plotting ), meshes, _quantity, _costMeasure, _verbose, _plotting
); );
if (_model == "PGTransport") if (_model == "PGTransport")
...@@ -50,7 +50,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) { ...@@ -50,7 +50,7 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) {
new IStochasticDummyAssemble( new IStochasticDummyAssemble(
new LagrangeDiscretization(meshes, _degree), new LagrangeDiscretization(meshes, _degree),
CreateStochasticDummyProblem(_problem, meshes) CreateStochasticDummyProblem(_problem, meshes)
), _quantity, _costMeasure, _verbose, _plotting ), meshes, _quantity, _costMeasure, _verbose, _plotting
); );
Exit(_model + " not found") Exit(_model + " not found")
......
...@@ -9,7 +9,7 @@ private: ...@@ -9,7 +9,7 @@ private:
std::string _pc; std::string _pc;
std::string _model = "StochasticDummyProblem"; std::string _model = "StochasticDummyProblem";
std::string _problem = "DummyPDESolver"; std::string _problem = "DummyPDESolver";
std::string _quantity = "L2"; std::string _quantity = "GeneratorValue";
std::string _costMeasure = "size"; std::string _costMeasure = "size";
std::string _linearSolver; std::string _linearSolver;
...@@ -21,7 +21,15 @@ private: ...@@ -21,7 +21,15 @@ private:
public: public:
PDESolverCreator(int verbose = 1, int plotting = 1) PDESolverCreator(int verbose = 1, int plotting = 1)
:_verbose(verbose), _plotting(plotting) {} :_verbose(verbose), _plotting(plotting) {
config.get("Model", _model);
config.get("degree", _degree);
config.get("Problem", _problem);
config.get("Quantity", _quantity);
config.get("CostMeasure", _costMeasure);
config.get("PDESolverVerbose", _verbose);
config.get("PDESolverPlotting", _plotting);
}
PDESolverCreator WithModel(const std::string &model) { PDESolverCreator WithModel(const std::string &model) {
if (!model.empty()) if (!model.empty())
...@@ -50,6 +58,15 @@ public: ...@@ -50,6 +58,15 @@ public:
return *this; return *this;
} }
std::string GetMeshName() {
if (_problem.find("1D") != string::npos)
return "Interval";
else if (_problem.find("2D") != string::npos)
return "Square";
else
return "Interval";
}
PDESolver *Create(Meshes &meshes); PDESolver *Create(Meshes &meshes);
}; };
......
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