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:
// mout << "TODO" << endl;
// aggregate.
}
};
}
};
#endif //STOCHASTICCOLLOCATION_HPP
#include "IStochasticProblem.hpp"
StochasticDummyProblem *
CreateStochasticDummyProblem(const std::string &problemName, const Meshes &meshes) {
if (problemName == "StochasticDummyScalarGeneratorProblem")
return new StochasticDummyScalarGeneratorProblem(meshes);
if (problemName == "StochasticDummyComplexGeneratorProblem")
return new StochasticDummyComplexGeneratorProblem(meshes);
if (problemName == "StochasticDummyVectorFieldGeneratorProblem")
return new StochasticDummyVectorFieldGeneratorProblem(meshes);
if (problemName == "StochasticDummyTensorGeneratorProblem")
return new StochasticDummyTensorGeneratorProblem(meshes);
if (problemName == "StochasticDummyRVectorGeneratorProblem")
return new StochasticDummyRVectorGeneratorProblem(meshes);
if (problemName == "StochasticDummyCVectorGeneratorProblem")
return new StochasticDummyCVectorGeneratorProblem(meshes);
if (problemName == "StochasticDummyRMatrixGeneratorProblem")
return new StochasticDummyRMatrixGeneratorProblem(meshes);
if (problemName == "StochasticDummyCMatrixGeneratorProblem")
return new StochasticDummyCMatrixGeneratorProblem(meshes);
if (problemName == "ScalarGeneratorProblem")
return new ScalarGeneratorProblem(meshes);
if (problemName == "ComplexGeneratorProblem")
return new ComplexGeneratorProblem(meshes);
if (problemName == "VectorFieldGeneratorProblem")
return new VectorFieldGeneratorProblem(meshes);
if (problemName == "TensorGeneratorProblem")
return new TensorGeneratorProblem(meshes);
if (problemName == "RVectorGeneratorProblem")
return new RVectorGeneratorProblem(meshes);
if (problemName == "CVectorGeneratorProblem")
return new CVectorGeneratorProblem(meshes);
if (problemName == "RMatrixGeneratorProblem")
return new RMatrixGeneratorProblem(meshes);
if (problemName == "CMatrixGeneratorProblem")
return new CMatrixGeneratorProblem(meshes);
if (problemName == "SparseGrid1DGeneratorProblem")
return new SparseGrid1DGeneratorProblem(meshes);
Exit(problemName + " not found")
}
\ No newline at end of file
......@@ -32,10 +32,10 @@ public:
virtual double FunctionEvaluation() = 0;
};
class StochasticDummyScalarGeneratorProblem : public StochasticDummyProblem {
class ScalarGeneratorProblem : public StochasticDummyProblem {
NormalDistributionReal scalarGenerator;
public:
explicit StochasticDummyScalarGeneratorProblem(const Meshes &meshes) :
explicit ScalarGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes),
scalarGenerator(NormalDistributionReal(meshes)) {}
......@@ -48,14 +48,14 @@ public:
}
string Name() const override {
return "StochasticDummyScalarGeneratorProblem";
return "ScalarGeneratorProblem";
}
};
class StochasticDummyComplexGeneratorProblem : public StochasticDummyProblem {
class ComplexGeneratorProblem : public StochasticDummyProblem {
NormalDistributionComplex complexGenerator;
public:
explicit StochasticDummyComplexGeneratorProblem(const Meshes &meshes) :
explicit ComplexGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes),
complexGenerator(NormalDistributionComplex(meshes)) {}
......@@ -68,14 +68,14 @@ public:
}
string Name() const override {
return "StochasticDummyComplexGeneratorProblem";
return "ComplexGeneratorProblem";
}
};
// TODO
class StochasticDummyVectorFieldGeneratorProblem : public StochasticDummyProblem {
class VectorFieldGeneratorProblem : public StochasticDummyProblem {
public:
explicit StochasticDummyVectorFieldGeneratorProblem(const Meshes &meshes)
explicit VectorFieldGeneratorProblem(const Meshes &meshes)
: StochasticDummyProblem(meshes) {}
void DrawSample(const SampleID &id) override {}
......@@ -85,14 +85,14 @@ public:
}
string Name() const override {
return "StochasticDummyVectorFieldGeneratorProblem";
return "VectorFieldGeneratorProblem";
}
};
// TODO
class StochasticDummyTensorGeneratorProblem : public StochasticDummyProblem {
class TensorGeneratorProblem : public StochasticDummyProblem {
public:
explicit StochasticDummyTensorGeneratorProblem(const Meshes &meshes) :
explicit TensorGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes) {}
void DrawSample(const SampleID &id) override {}
......@@ -102,14 +102,14 @@ public:
}
string Name() const override {
return "StochasticDummyTensorGeneratorProblem";
return "TensorGeneratorProblem";
}
};
class StochasticDummyRVectorGeneratorProblem : public StochasticDummyProblem {
class RVectorGeneratorProblem : public StochasticDummyProblem {
NormalDistributionRVector rVectorGenerator;
public:
explicit StochasticDummyRVectorGeneratorProblem(const Meshes &meshes) :
explicit RVectorGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes),
rVectorGenerator(NormalDistributionRVector(meshes)) {}
......@@ -122,14 +122,14 @@ public:
}
string Name() const override {
return "StochasticDummyRVectorGeneratorProblem";
return "RVectorGeneratorProblem";
}
};
class StochasticDummyCVectorGeneratorProblem : public StochasticDummyProblem {
class CVectorGeneratorProblem : public StochasticDummyProblem {
NormalDistributionCVector cVectorGenerator;
public:
explicit StochasticDummyCVectorGeneratorProblem(const Meshes &meshes) :
explicit CVectorGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes),
cVectorGenerator(NormalDistributionCVector(meshes)) {}
......@@ -142,14 +142,14 @@ public:
}
string Name() const override {
return "StochasticDummyCVectorGeneratorProblem";
return "CVectorGeneratorProblem";
}
};
class StochasticDummyRMatrixGeneratorProblem : public StochasticDummyProblem {
class RMatrixGeneratorProblem : public StochasticDummyProblem {
NormalDistributionRMatrix rMatrixGenerator;
public:
explicit StochasticDummyRMatrixGeneratorProblem(const Meshes &meshes) :
explicit RMatrixGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes),
rMatrixGenerator(NormalDistributionRMatrix(meshes)) {}
......@@ -162,14 +162,14 @@ public:
}
string Name() const override {
return "StochasticDummyRMatrixGeneratorProblem";
return "RMatrixGeneratorProblem";
}
};
class StochasticDummyCMatrixGeneratorProblem : public StochasticDummyProblem {
class CMatrixGeneratorProblem : public StochasticDummyProblem {
NormalDistributionCMatrix cMatrixGenerator;
public:
explicit StochasticDummyCMatrixGeneratorProblem(const Meshes &meshes) :
explicit CMatrixGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes),
cMatrixGenerator(NormalDistributionCMatrix(meshes)) {}
......@@ -182,7 +182,27 @@ public:
}
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 @@
INSTANTIATE_TEST_SUITE_P(TestMonteCarlo, TestMonteCarloWithoutEpsilon, Values(
TestParams{"StochasticDummyScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"},
TestParams{"ScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"},
TestParams{"StochasticLaplace2DTest", "L2", "LagrangeElliptic"},
TestParams{"StochasticLaplace2DTest", "Outflow", "HybridElliptic"}
// Todo add more test cases
));
INSTANTIATE_TEST_SUITE_P(TestMonteCarlo, TestMonteCarloWithEpsilon, Values(
TestParams{"StochasticDummyScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"},
TestParams{"ScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"},
TestParams{"StochasticLaplace2DTest", "L2", "LagrangeElliptic"},
TestParams{"StochasticLaplace2DTest", "Outflow", "HybridElliptic"}
// Todo add more test cases
......
......@@ -3,7 +3,7 @@
INSTANTIATE_TEST_SUITE_P(
TestMultilevelMonteCarlo, TestMultilevelMonteCarloWithoutEpsilon, Values(
TestParams{"StochasticDummyScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"},
TestParams{"ScalarGeneratorProblem", "FunctionEvaluation", "DummyPDESolver"},
TestParams{"StochasticLaplace2DTest", "L2", "LagrangeElliptic"},
TestParams{"StochasticLaplace2DTest", "Outflow", "HybridElliptic"}
));
......
......@@ -5,7 +5,21 @@
#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:
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