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

added CreateUnique

parent 2bfbe2d2
......@@ -72,4 +72,8 @@ PDESolver *PDESolverCreator::Create(Meshes &meshes) {
);
Exit(_model + " not found")
}
\ No newline at end of file
}
std::unique_ptr<PDESolver> PDESolverCreator::CreateUnique(Meshes &meshes) {
return std::unique_ptr<PDESolver>(Create(meshes));
}
......@@ -6,60 +6,62 @@
class PDESolverCreator {
private:
int _degree = 1;
std::string _pc;
std::string _model = "DummyPDESolver";
std::string _problem = "StochasticDummyProblem";
std::string _quantity = "GeneratorValue";
std::string _costMeasure = "size";
std::string _linearSolver = "GMRES";
int _degree = 1;
std::string _pc;
std::string _model = "DummyPDESolver";
std::string _problem = "StochasticDummyProblem";
std::string _quantity = "GeneratorValue";
std::string _costMeasure = "size";
std::string _linearSolver = "GMRES";
public:
PDESolverCreator() {
config.get("Model", _model);
config.get("degree", _degree);
config.get("Problem", _problem);
config.get("Quantity", _quantity);
config.get("CostMeasure", _costMeasure);
}
PDESolverCreator() {
config.get("Model", _model);
config.get("degree", _degree);
config.get("Problem", _problem);
config.get("Quantity", _quantity);
config.get("CostMeasure", _costMeasure);
}
PDESolverCreator WithModel(const std::string &model) {
if (!model.empty())
_model = model;
return *this;
}
PDESolverCreator WithModel(const std::string &model) {
if (!model.empty())
_model = model;
return *this;
}
PDESolverCreator WithProblem(const std::string &problem) {
if (!problem.empty())
_problem = problem;
return *this;
}
PDESolverCreator WithProblem(const std::string &problem) {
if (!problem.empty())
_problem = problem;
return *this;
}
PDESolverCreator WithDegree(int degree) {
_degree = degree;
return *this;
}
PDESolverCreator WithDegree(int degree) {
_degree = degree;
return *this;
}
PDESolverCreator WithQuantity(const std::string &quantity) {
_quantity = quantity;
return *this;
}
PDESolverCreator WithQuantity(const std::string &quantity) {
_quantity = quantity;
return *this;
}
PDESolverCreator WithCostMeasure(const std::string &costMeasure) {
_costMeasure = costMeasure;
return *this;
}
PDESolverCreator WithCostMeasure(const std::string &costMeasure) {
_costMeasure = costMeasure;
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";
}
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);
std::unique_ptr<PDESolver> CreateUnique(Meshes &meshes);
};
#endif //PDESOLVERCREATOR_HPP
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