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

added create functions

parent c2b46088
#include "StochasticCollocation.hpp"
#include "MultilevelEstimator.hpp"
#include "MonteCarlo.hpp"
#include "Estimator.hpp"
Estimator *CreateEstimator(const std::string &estimatorName) {
if (estimatorName == "StochasticCollocation")
return new StochasticCollocation();
if (estimatorName == "MultilevelMonteCarlo")
return new MultilevelEstimator();
if (estimatorName == "MonteCarlo")
return new MonteCarlo();
else Exit("Estimator is not implemented")
}
std::unique_ptr<Estimator> CreateEstimatorUniquePtr(const std::string &estimatorName) {
if (estimatorName == "StochasticCollocation")
return std::make_unique<StochasticCollocation>();
if (estimatorName == "MultilevelMonteCarlo")
return std::make_unique<MultilevelEstimator>();
if (estimatorName == "MonteCarlo")
return std::make_unique<MonteCarlo>();
else Exit("Estimator is not implemented")
}
......@@ -27,7 +27,6 @@ public:
double Epsilon() const { return epsilon; }
virtual void Method() {};
virtual std::string Name() const { return "Estimator"; };
......@@ -39,4 +38,8 @@ public:
virtual void ExponentResults() const {};
};
Estimator *CreateEstimator(const std::string &estimatorName);
std::unique_ptr<Estimator> CreateEstimatorUniquePtr(const std::string &estimatorName);
#endif //ESTIMATOR_HPP
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