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

fixed epsilon

parent 85341af1
Pipeline #149203 passed with stages
in 54 minutes and 42 seconds
#ifndef IESTIMATOR_HPP
#define IESTIMATOR_HPP
#include "Config.hpp"
//#include "Errors.hpp"
struct Exponents;
......@@ -12,6 +14,10 @@ protected:
// Errors errors;
public:
IEstimator() {
config.get("epsilon", epsilon);
}
virtual double TotalError() const {
return 0.0;
}
......@@ -30,17 +36,4 @@ public:
};
class IMultilevelEstimator : public IEstimator {
public:
virtual void Method() = 0;
virtual void EstimatorResults() const = 0;
virtual void MultilevelResults() const {};
virtual void ExponentResults() const {};
};
#endif //IESTIMATOR_HPP
......@@ -18,6 +18,7 @@ protected:
bool parallel;
// Todo make unique pointer, there are issues with cleaning up this opject!
Meshes *meshes;
PDESolver *pdeSolver;
......@@ -92,8 +93,8 @@ public:
}
~MonteCarlo() {
if (!pdeSolver) delete pdeSolver;
if (!meshes) delete meshes;
if (!pdeSolver) delete pdeSolver;
}
void Method() override;
......
......@@ -10,7 +10,7 @@
class MultilevelMonteCarlo : public IMultilevelEstimator {
class MultilevelMonteCarlo : public IEstimator {
private:
int verbose = 1;
......@@ -34,10 +34,9 @@ public:
Errors errors;
MultilevelMonteCarlo() {
MultilevelMonteCarlo() : IEstimator() {
config.get("MLMCVerbose", verbose);
config.get("mcOnly", mcOnly);
config.get("epsilon", epsilon);
config.get("initLevels", initLevels);
config.get("initSampleAmount", initSampleAmount);
......
......@@ -4,7 +4,7 @@
#include "IEstimator.hpp"
class MultilevelStochasticCollocation : public IMultilevelEstimator {
class MultilevelStochasticCollocation : public IEstimator {
private:
public:
......
......@@ -60,10 +60,10 @@ struct Mean {
friend Logging &operator<<(Logging &s, const Mean &mean) {
return s << "MeanQ=" << mean.Q
<< " MeanY=" << mean.Y
<< " MeanC=" << mean.C
// << " MeanC=" << mean.C
<< " MeanQcomm=" << mean.Qcomm
<< " MeanYcomm=" << mean.Ycomm
<< " MeanCcomm=" << mean.Ccomm << endl;
<< " MeanYcomm=" << mean.Ycomm << endl;
// << " MeanCcomm=" << mean.Ccomm << endl;
}
};
......
......@@ -49,7 +49,7 @@ INSTANTIATE_TEST_SUITE_P(TestMainProgram, TestMainProgramElliptic, Values(
TEST_P(TestMainProgramElliptic, TestRun) {
EXPECT_EQ(mainProgram->Run(), 0);
EXPECT_TRUE(mainProgram->estimator->TotalError() < mainProgram->estimator->Epsilon());
EXPECT_LE(mainProgram->estimator->TotalError(), mainProgram->estimator->Epsilon());
// EXPECT_TRUE(mainProgram->estimator.exponents.alpha > 0);
// EXPECT_TRUE(mainProgram->estimator.exponents.beta > 0);
// EXPECT_TRUE(mainProgram->estimator.exponents.gamma > 0);
......
This diff is collapsed.
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