Commit 6d463004 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

added 2D dummy problem

parent 110af1a2
......@@ -21,5 +21,7 @@ CreateStochasticDummyProblem(const std::string &problemName, const Meshes &meshe
return new CMatrixGeneratorProblem(meshes);
if (problemName == "SparseGrid1DGeneratorProblem")
return new SparseGrid1DGeneratorProblem(meshes);
if (problemName == "SparseGrid2DGeneratorProblem")
return new SparseGrid2DGeneratorProblem(meshes);
Exit(problemName + " not found")
}
\ No newline at end of file
......@@ -206,6 +206,30 @@ public:
}
};
class SparseGrid2DGeneratorProblem : public StochasticDummyProblem {
SparseGridGenerator generator;
public:
explicit SparseGrid2DGeneratorProblem(const Meshes &meshes) :
StochasticDummyProblem(meshes),
generator(SparseGridGenerator(meshes, 2, 0, 6)) {}
void DrawSample(const SampleID &id) override {
generator.DrawSample(id);
}
double FunctionEvaluation() override {
RVector sample = this->generator.EvalSample();
double y1 = sample[0];
double y2 = sample[1];
return std::exp(-y1*y1) * std::cos(y2);
}
string Name() const override {
return "SparseGrid2DGeneratorProblem";
}
};
StochasticDummyProblem *
CreateStochasticDummyProblem(const std::string &problemName, const Meshes &meshes);
......
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