Commit ef8e632b authored by chinsp's avatar chinsp
Browse files

added 2nd test case for polynomial of total degree 2 using qptotal

parent 336e8bcd
......@@ -25,5 +25,7 @@ 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);
Exit(problemName + " not found")
}
\ No newline at end of file
......@@ -256,7 +256,7 @@ public:
double FunctionEvaluation() override {
RVector sample = this->generator.EvalSample();
return 1 + sample[0] + pow(sample[0],2) + sample[1] + pow(sample[1],2) + sample[0] * sample[1];
return 3.0 * (1 + sample[0] + pow(sample[0],2) + sample[1] + pow(sample[1],2) + sample[0] * sample[1]);
}
string Name() const override {
......@@ -264,6 +264,25 @@ public:
}
};
//integrating polynomials upto given exact degree n or less
class SparseGrid2DPD2qptotProblem : public SparseGridGeneratorProblem {
public:
explicit SparseGrid2DPD2qptotProblem(const Meshes &meshes) :
SparseGridGeneratorProblem(meshes, SparseGridGenerator(meshes, 2, 0, 2, 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 "SparseGrid2DPD2qptotProblem";
}
};
// Todo find more test cases in tasmanian examples and write sparse grid problems
StochasticDummyProblem *
......
......@@ -10,7 +10,10 @@ INSTANTIATE_TEST_SUITE_P(
TestParams{"SparseGrid2DGeneratorProblem", "FunctionEvaluation",
"DummyPDESolver", 2.513723354063905},
TestParams{"SparseGrid2DPolyDeg2Problem", "FunctionEvaluation",
"DummyPDESolver", 6.666666666666667}
"DummyPDESolver", 20.0},
TestParams{"SparseGrid2DPD2qptotProblem", "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