Commit 08655b06 authored by chinsp's avatar chinsp
Browse files

added test case that fails to check for the sparse grid level for exact integration of polynomials

parent ef8e632b
Pipeline #158278 failed with stages
in 11 minutes and 28 seconds
......@@ -25,7 +25,9 @@ CreateStochasticDummyProblem(const std::string &problemName, const Meshes &meshe
return new SparseGrid2DGeneratorProblem(meshes);
if (problemName == "SparseGrid2DPolyDeg2Problem")
return new SparseGrid2DPolyDeg2Problem(meshes);
if (problemName == "SparseGrid2DPD2qptotProblem")
return new SparseGrid2DPD2qptotProblem(meshes);
if (problemName == "SparseGrid2DPD2qptotProblem")
return new SparseGrid2DPD2qptotProblem(meshes);
if (problemName == "SparseGrid2DPD2qptotProblemFail")
return new SparseGrid2DPD2qptotProblemFail(meshes);
Exit(problemName + " not found")
}
\ No newline at end of file
......@@ -283,6 +283,24 @@ public:
}
};
// this test is meant to fail. We are using a sparse grid that only integrates functions exactly upto degree 1 or less
class SparseGrid2DPD2qptotProblemFail : public SparseGridGeneratorProblem {
public:
explicit SparseGrid2DPD2qptotProblemFail(const Meshes &meshes) :
SparseGridGeneratorProblem(meshes, SparseGridGenerator(meshes, 2, 0, 1, TasGrid::type_qptotal)) {}
double FunctionEvaluation() override {
RVector sample = this->generator.EvalSample();
double y1 = sample[0];
double y2 = sample[1];
return 3.0 * (1 + y1 + pow(y1,2) + y2 + pow(y1,2) + y1 * y2);
}
string Name() const override {
return "SparseGrid2DPD2qptotProblemFail";
}
};
// Todo find more test cases in tasmanian examples and write sparse grid problems
StochasticDummyProblem *
......
......@@ -12,9 +12,10 @@ INSTANTIATE_TEST_SUITE_P(
TestParams{"SparseGrid2DPolyDeg2Problem", "FunctionEvaluation",
"DummyPDESolver", 20.0},
TestParams{"SparseGrid2DPD2qptotProblem", "FunctionEvaluation",
"DummyPDESolver", 20.0},
TestParams{"SparseGrid2DPD2qptotProblemFail", "FunctionEvaluation",
"DummyPDESolver", 20.0}
// Todo add more test cases
));
......
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