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

removing StochasticDummy Name

parent d245784b
Pipeline #157915 passed with stages
in 12 minutes and 54 seconds
...@@ -49,6 +49,7 @@ public: ...@@ -49,6 +49,7 @@ public:
// mout << "TODO" << endl; // mout << "TODO" << endl;
// aggregate. // aggregate.
} }
}; }
};
#endif //STOCHASTICCOLLOCATION_HPP #endif //STOCHASTICCOLLOCATION_HPP
#include "IStochasticProblem.hpp" #include "IStochasticProblem.hpp"
StochasticDummyProblem * StochasticDummyProblem *
CreateStochasticDummyProblem(const std::string &problemName, const Meshes &meshes) { CreateStochasticDummyProblem(const std::string &problemName, const Meshes &meshes) {
if (problemName == "StochasticDummyScalarGeneratorProblem") if (problemName == "ScalarGeneratorProblem")
return new StochasticDummyScalarGeneratorProblem(meshes); return new ScalarGeneratorProblem(meshes);
if (problemName == "StochasticDummyComplexGeneratorProblem") if (problemName == "ComplexGeneratorProblem")
return new StochasticDummyComplexGeneratorProblem(meshes); return new ComplexGeneratorProblem(meshes);
if (problemName == "StochasticDummyVectorFieldGeneratorProblem") if (problemName == "VectorFieldGeneratorProblem")
return new StochasticDummyVectorFieldGeneratorProblem(meshes); return new VectorFieldGeneratorProblem(meshes);
if (problemName == "StochasticDummyTensorGeneratorProblem") if (problemName == "TensorGeneratorProblem")
return new StochasticDummyTensorGeneratorProblem(meshes); return new TensorGeneratorProblem(meshes);
if (problemName == "StochasticDummyRVectorGeneratorProblem") if (problemName == "RVectorGeneratorProblem")
return new StochasticDummyRVectorGeneratorProblem(meshes); return new RVectorGeneratorProblem(meshes);
if (problemName == "StochasticDummyCVectorGeneratorProblem") if (problemName == "CVectorGeneratorProblem")
return new StochasticDummyCVectorGeneratorProblem(meshes); return new CVectorGeneratorProblem(meshes);
if (problemName == "StochasticDummyRMatrixGeneratorProblem") if (problemName == "RMatrixGeneratorProblem")
return new StochasticDummyRMatrixGeneratorProblem(meshes); return new RMatrixGeneratorProblem(meshes);
if (problemName == "StochasticDummyCMatrixGeneratorProblem") if (problemName == "CMatrixGeneratorProblem")
return new StochasticDummyCMatrixGeneratorProblem(meshes); return new CMatrixGeneratorProblem(meshes);
Exit(problemName + " not found") if (problemName == "SparseGrid1DGeneratorProblem")
return new SparseGrid1DGeneratorProblem(meshes);
Exit(problemName + " not found")
} }
\ No newline at end of file
...@@ -32,10 +32,10 @@ public: ...@@ -32,10 +32,10 @@ public:
virtual double FunctionEvaluation() = 0; virtual double FunctionEvaluation() = 0;
}; };
class StochasticDummyScalarGeneratorProblem : public StochasticDummyProblem { class ScalarGeneratorProblem : public StochasticDummyProblem {
NormalDistributionReal scalarGenerator; NormalDistributionReal scalarGenerator;
public: public:
explicit StochasticDummyScalarGeneratorProblem(const Meshes &meshes) : explicit ScalarGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes), StochasticDummyProblem(meshes),
scalarGenerator(NormalDistributionReal(meshes)) {} scalarGenerator(NormalDistributionReal(meshes)) {}
...@@ -48,14 +48,14 @@ public: ...@@ -48,14 +48,14 @@ public:
} }
string Name() const override { string Name() const override {
return "StochasticDummyScalarGeneratorProblem"; return "ScalarGeneratorProblem";
} }
}; };
class StochasticDummyComplexGeneratorProblem : public StochasticDummyProblem { class ComplexGeneratorProblem : public StochasticDummyProblem {
NormalDistributionComplex complexGenerator; NormalDistributionComplex complexGenerator;
public: public:
explicit StochasticDummyComplexGeneratorProblem(const Meshes &meshes) : explicit ComplexGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes), StochasticDummyProblem(meshes),
complexGenerator(NormalDistributionComplex(meshes)) {} complexGenerator(NormalDistributionComplex(meshes)) {}
...@@ -68,14 +68,14 @@ public: ...@@ -68,14 +68,14 @@ public:
} }
string Name() const override { string Name() const override {
return "StochasticDummyComplexGeneratorProblem"; return "ComplexGeneratorProblem";
} }
}; };
// TODO // TODO
class StochasticDummyVectorFieldGeneratorProblem : public StochasticDummyProblem { class VectorFieldGeneratorProblem : public StochasticDummyProblem {
public: public:
explicit StochasticDummyVectorFieldGeneratorProblem(const Meshes &meshes) explicit VectorFieldGeneratorProblem(const Meshes &meshes)
: StochasticDummyProblem(meshes) {} : StochasticDummyProblem(meshes) {}
void DrawSample(const SampleID &id) override {} void DrawSample(const SampleID &id) override {}
...@@ -85,14 +85,14 @@ public: ...@@ -85,14 +85,14 @@ public:
} }
string Name() const override { string Name() const override {
return "StochasticDummyVectorFieldGeneratorProblem"; return "VectorFieldGeneratorProblem";
} }
}; };
// TODO // TODO
class StochasticDummyTensorGeneratorProblem : public StochasticDummyProblem { class TensorGeneratorProblem : public StochasticDummyProblem {
public: public:
explicit StochasticDummyTensorGeneratorProblem(const Meshes &meshes) : explicit TensorGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes) {} StochasticDummyProblem(meshes) {}
void DrawSample(const SampleID &id) override {} void DrawSample(const SampleID &id) override {}
...@@ -102,14 +102,14 @@ public: ...@@ -102,14 +102,14 @@ public:
} }
string Name() const override { string Name() const override {
return "StochasticDummyTensorGeneratorProblem"; return "TensorGeneratorProblem";
} }
}; };
class StochasticDummyRVectorGeneratorProblem : public StochasticDummyProblem { class RVectorGeneratorProblem : public StochasticDummyProblem {
NormalDistributionRVector rVectorGenerator; NormalDistributionRVector rVectorGenerator;
public: public:
explicit StochasticDummyRVectorGeneratorProblem(const Meshes &meshes) : explicit RVectorGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes), StochasticDummyProblem(meshes),
rVectorGenerator(NormalDistributionRVector(meshes)) {} rVectorGenerator(NormalDistributionRVector(meshes)) {}
...@@ -122,14 +122,14 @@ public: ...@@ -122,14 +122,14 @@ public:
} }
string Name() const override { string Name() const override {
return "StochasticDummyRVectorGeneratorProblem"; return "RVectorGeneratorProblem";
} }
}; };
class StochasticDummyCVectorGeneratorProblem : public StochasticDummyProblem { class CVectorGeneratorProblem : public StochasticDummyProblem {
NormalDistributionCVector cVectorGenerator; NormalDistributionCVector cVectorGenerator;
public: public:
explicit StochasticDummyCVectorGeneratorProblem(const Meshes &meshes) : explicit CVectorGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes), StochasticDummyProblem(meshes),
cVectorGenerator(NormalDistributionCVector(meshes)) {} cVectorGenerator(NormalDistributionCVector(meshes)) {}
...@@ -142,14 +142,14 @@ public: ...@@ -142,14 +142,14 @@ public:
} }
string Name() const override { string Name() const override {
return "StochasticDummyCVectorGeneratorProblem"; return "CVectorGeneratorProblem";
} }
}; };
class StochasticDummyRMatrixGeneratorProblem : public StochasticDummyProblem { class RMatrixGeneratorProblem : public StochasticDummyProblem {
NormalDistributionRMatrix rMatrixGenerator; NormalDistributionRMatrix rMatrixGenerator;
public: public:
explicit StochasticDummyRMatrixGeneratorProblem(const Meshes &meshes) : explicit RMatrixGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes), StochasticDummyProblem(meshes),
rMatrixGenerator(NormalDistributionRMatrix(meshes)) {} rMatrixGenerator(NormalDistributionRMatrix(meshes)) {}
...@@ -162,14 +162,14 @@ public: ...@@ -162,14 +162,14 @@ public:
} }
string Name() const override { string Name() const override {
return "StochasticDummyRMatrixGeneratorProblem"; return "RMatrixGeneratorProblem";
} }
}; };
class StochasticDummyCMatrixGeneratorProblem : public StochasticDummyProblem { class CMatrixGeneratorProblem : public StochasticDummyProblem {
NormalDistributionCMatrix cMatrixGenerator; NormalDistributionCMatrix cMatrixGenerator;
public: public:
explicit StochasticDummyCMatrixGeneratorProblem(const Meshes &meshes) : explicit CMatrixGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes), StochasticDummyProblem(meshes),
cMatrixGenerator(NormalDistributionCMatrix(meshes)) {} cMatrixGenerator(NormalDistributionCMatrix(meshes)) {}
...@@ -182,7 +182,27 @@ public: ...@@ -182,7 +182,27 @@ public:
} }
string Name() const override { string Name() const override {
return "StochasticDummyCMatrixGeneratorProblem"; return "CMatrixGeneratorProblem";
}
};
class SparseGrid1DGeneratorProblem : public StochasticDummyProblem {
SparseGridGenerator generator;
public:
explicit SparseGrid1DGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes),
generator(SparseGridGenerator(meshes, 1, 0, 6)) {}
void DrawSample(const SampleID &id) override {
generator.DrawSample(id);
}
double FunctionEvaluation() override {
return std::exp(this->generator.EvalSample()*this->generator.EvalSample());
}
string Name() const override {
return "SparseGrid1DGeneratorProblem";
} }
}; };
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
INSTANTIATE_TEST_SUITE_P(TestMonteCarlo, TestMonteCarloWithoutEpsilon, Values( INSTANTIATE_TEST_SUITE_P(TestMonteCarlo, TestMonteCarloWithoutEpsilon, Values(
TestParams{"StochasticDummyScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"}, TestParams{"ScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"},
TestParams{"StochasticLaplace2DTest", "L2", "LagrangeElliptic"}, TestParams{"StochasticLaplace2DTest", "L2", "LagrangeElliptic"},
TestParams{"StochasticLaplace2DTest", "Outflow", "HybridElliptic"} TestParams{"StochasticLaplace2DTest", "Outflow", "HybridElliptic"}
// Todo add more test cases // Todo add more test cases
)); ));
INSTANTIATE_TEST_SUITE_P(TestMonteCarlo, TestMonteCarloWithEpsilon, Values( INSTANTIATE_TEST_SUITE_P(TestMonteCarlo, TestMonteCarloWithEpsilon, Values(
TestParams{"StochasticDummyScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"}, TestParams{"ScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"},
TestParams{"StochasticLaplace2DTest", "L2", "LagrangeElliptic"}, TestParams{"StochasticLaplace2DTest", "L2", "LagrangeElliptic"},
TestParams{"StochasticLaplace2DTest", "Outflow", "HybridElliptic"} TestParams{"StochasticLaplace2DTest", "Outflow", "HybridElliptic"}
// Todo add more test cases // Todo add more test cases
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
TestMultilevelMonteCarlo, TestMultilevelMonteCarloWithoutEpsilon, Values( TestMultilevelMonteCarlo, TestMultilevelMonteCarloWithoutEpsilon, Values(
TestParams{"StochasticDummyScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"}, TestParams{"ScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"},
TestParams{"StochasticLaplace2DTest", "L2", "LagrangeElliptic"}, TestParams{"StochasticLaplace2DTest", "L2", "LagrangeElliptic"},
TestParams{"StochasticLaplace2DTest", "Outflow", "HybridElliptic"} TestParams{"StochasticLaplace2DTest", "Outflow", "HybridElliptic"}
)); ));
......
...@@ -5,7 +5,21 @@ ...@@ -5,7 +5,21 @@
#include "TestEnvironment.hpp" #include "TestEnvironment.hpp"
class TestStochasticCollocation : public Test { struct TestParams {
std::string problemName;
std::string quantity;
std::string model;
};
Logging &operator<<(Logging &s, const TestParams &testParams) {
return s << "Problem Name: " << testParams.problemName << endl
<< "Quantity: " << testParams.quantity << endl
<< "Model: " << testParams.model << endl;
}
class TestStochasticCollocation : public TestWithParam<TestParams> {
protected: protected:
bool onlyFine = true; bool onlyFine = true;
......
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