Commit 4608ce07 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

deleted factory

parent d5217807
#ifndef STOCHASTICPROBLEMFACTORY_HPP
#define STOCHASTICPROBLEMFACTORY_HPP
#include "StochasticProblem.hpp"
#include "StochasticEllipticProblem.hpp"
#include "StochasticTransportProblem.hpp"
enum EStochasticProblem {
DefaultProblem,
StochasticLaplace1D,
StochasticLaplace2D,
StochasticPollution1D,
StochasticPollution2D,
StochasticPollutionCosHat2D,
StochasticPollutionCosHat1D,
DeterministicPollutionCosHat1D,
StochasticPollutionMollifiedBar2D,
DeterministicLaplace1D,
DeterministicLaplace2D,
DeterministicPollution1D,
DeterministicPollution2D,
DeterministicPollutionCosHat2D,
DeterministicPollutionMollifiedBar2D
};
class StochasticProblemFactory {
public:
template<class T>
static T *CreateFrom(EStochasticProblem eStochasticProblem) {
switch(eStochasticProblem) {
case StochasticLaplace1D:
case DeterministicLaplace1D:
return (T *) new class StochasticLaplace1D();
case StochasticLaplace2D:
case DeterministicLaplace2D:
return (T *) new class StochasticLaplace2D();
case StochasticPollution1D:
case DeterministicPollution1D:
return (T *) new class StochasticPollution1D();
case StochasticPollutionCosHat1D:
case DeterministicPollutionCosHat1D:
return (T *) new class StochasticPollutionCosHat1D;
case StochasticPollution2D:
case DeterministicPollution2D:
return (T *) new class StochasticPollution2D();
case StochasticPollutionCosHat2D:
case DeterministicPollutionCosHat2D:
return (T *) new class StochasticPollutionCosHat2D();
case StochasticPollutionMollifiedBar2D:
case DeterministicPollutionMollifiedBar2D:
return (T *) new class StochasticPollutionMollifiedBar2D();
}
}
static StochasticProblem *CreateStochasticProblemFrom(const string &problemName) {
EStochasticProblem eStochasticProblem = problemMap()[problemName];
if (!eStochasticProblem) Exit("\nStochastic problem not implemented\n")
else return CreateFrom<StochasticProblem>(eStochasticProblem);
}
private:
static map<string, EStochasticProblem> problemMap() {
return {
{"DefaultProblem", DefaultProblem},
{"StochasticPollutionCosHat1D", StochasticPollutionCosHat1D},
{"DeterministicPollutionCosHat1D", DeterministicPollutionCosHat1D},
{"StochasticLaplace1D", StochasticLaplace1D},
{"DeterministicLaplace1D", DeterministicLaplace1D},
{"StochasticLaplace2D", StochasticLaplace2D},
{"DeterministicLaplace2D", DeterministicLaplace2D},
{"StochasticPollution1D", StochasticPollution1D},
{"DeterministicPollution1D", DeterministicPollution1D},
{"StochasticPollution2D", StochasticPollution2D},
{"DeterministicPollution2D", DeterministicPollution2D},
{"StochasticPollutionCosHat2D", StochasticPollutionCosHat2D},
{"DeterministicPollutionCosHat2D", DeterministicPollutionCosHat2D},
{"DeterministicPollutionMollifiedBar2D",
DeterministicPollutionMollifiedBar2D},
{"StochasticPollutionMollifiedBar2D", StochasticPollutionMollifiedBar2D}
};
}
};
#endif //STOCHASTICPROBLEMFACTORY_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