Commit fb0ea3d2 authored by Müller, Felix's avatar Müller, Felix Committed by Praetorius, Simon
Browse files

overload for treepath added in AdaptInfo

parent ea96696a
......@@ -11,7 +11,9 @@
// AMDiS includes
#include <amdis/Output.hpp>
#include <amdis/common/ConceptsBase.hpp>
#include <amdis/common/Math.hpp>
#include <amdis/utility/TreePath.hpp>
namespace AMDiS
{
......@@ -101,6 +103,12 @@ namespace AMDiS
return true;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
bool spaceToleranceReached(TP& tp) const
{
return spaceToleranceReached(to_string(tp));
}
/// Returns whether time tolerance is reached.
virtual bool timeToleranceReached() const
{
......@@ -120,6 +128,12 @@ namespace AMDiS
return true;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
bool timeToleranceReached(TP& tp) const
{
return timeToleranceReached(to_string(tp));
}
/// Returns whether time error is under its lower bound.
virtual bool timeErrorLow() const
{
......@@ -129,6 +143,7 @@ namespace AMDiS
return true;
}
/// Returns the time estimation as a combination
/// of maximal and integral time error
double getTimeEstCombined(std::string key) const
......@@ -138,6 +153,11 @@ namespace AMDiS
scalContents.at(key)->est_t_sum * scalContents.at(key)->fac_sum;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
double getTimeEstCombined(TP& tp) const
{
return getTimeEstCombined(to_string(tp));
}
/// Print debug information about time error and its bound.
void printTimeErrorLowInfo() const;
......@@ -268,24 +288,48 @@ namespace AMDiS
scalContents.at(key)->est_sum = e;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
void setEstSum(double e, TP& tp)
{
setEstSum(e, to_string(tp));
}
/// Sets \ref est_max.
void setEstMax(double e, std::string key)
{
scalContents.at(key)->est_max = e;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
void setEstMax(double e, TP& tp)
{
setEstMax(e, to_string(tp));
}
/// Sets \ref est_max.
void setTimeEstMax(double e, std::string key)
{
scalContents.at(key)->est_t_max = e;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
void setTimeEstMax(double e, TP& tp)
{
setTimeEstMax(e, to_string(tp));
}
/// Sets \ref est_t_sum.
void setTimeEstSum(double e, std::string key)
{
scalContents.at(key)->est_t_sum = e;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
void setTimeEstSum(double e, TP& tp)
{
setTimeEstSum(e, to_string(tp));
}
/// Returns \ref est_sum.
double getEstSum(std::string key) const
{
......@@ -295,12 +339,24 @@ namespace AMDiS
return scalContents.at(key)->est_sum;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
double getEstSum(TP& tp)
{
return getEstSum(to_string(tp));
}
/// Returns \ref est_t_sum.
double getEstTSum(std::string key) const
{
return scalContents.at(key)->est_t_sum;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
double getEstTSum(TP& tp)
{
return getEstTSum(to_string(tp));
}
/// Returns \ref est_max.
double getEstMax(std::string key) const
{
......@@ -310,18 +366,36 @@ namespace AMDiS
return scalContents.at(key)->est_max;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
double getEstMax(TP& tp)
{
return getEstMax(to_string(tp));
}
/// Returns \ref est_max.
double getTimeEstMax(std::string key) const
{
return scalContents.at(key)->est_t_max;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
double getTimeEstmax(TP& tp)
{
return getTimeEstMax(to_string(tp));
}
/// Returns \ref est_t_sum.
double getTimeEstSum(std::string key) const
{
return scalContents.at(key)->est_t_sum;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
double getTimeEstSum(TP& tp)
{
return getTimeEstSum(to_string(tp));
}
/// Returns \ref est_t the estimated overall time error
double getTimeEst() const
{
......@@ -339,24 +413,48 @@ namespace AMDiS
return scalContents.at(key)->spaceTolerance;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
double getSpaceTolerance(TP& tp)
{
return getSpaceTolerance(to_string(tp));
}
/// Sets \ref spaceTolerance.
void setSpaceTolerance(std::string key, double tol)
{
scalContents.at(key)->spaceTolerance = tol;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
void setSpaceTolerance(TP& tp, double tol)
{
return setSpaceTolerance(to_string(tp), tol);
}
/// Returns \ref timeTolerance.
double getTimeTolerance(std::string key) const
{
return scalContents.at(key)->timeTolerance;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
double getTimeTolerance(TP& tp)
{
return getTimeTolerance(to_string(tp));
}
/// Returns \ref timeRelativeTolerance.
double getTimeRelativeTolerance(std::string key) const
{
return scalContents.at(key)->timeRelativeTolerance;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
double getTimeRelativeTolerance(TP& tp)
{
return getTimeRelativeTolerance(to_string(tp));
}
/// Sets \ref time
double setTime(double t)
{
......@@ -481,30 +579,60 @@ namespace AMDiS
return scalContents.at(key)->timeErrLow;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
double getTimeErrLow(TP& tp)
{
return getTimeErrLow(to_string(tp));
}
/// Returns whether coarsening is allowed or not.
bool isCoarseningAllowed(std::string key) const
{
return (scalContents.at(key)->coarsenAllowed == 1);
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
bool isCoarseningAllowed(TP& tp)
{
return isCoarseningAllowed(to_string(tp));
}
/// Returns whether coarsening is allowed or not.
bool isRefinementAllowed(std::string key) const
{
return (scalContents.at(key)->refinementAllowed == 1);
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
bool isRefinementAllowed(TP& tp)
{
return isRefinementAllowed(to_string(tp));
}
///
void allowRefinement(bool allow, std::string key)
{
scalContents.at(key)->refinementAllowed = allow;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
void allowRefinement(bool allow, TP& tp)
{
return allowRefinement(allow, to_string(tp));
}
///
void allowCoarsening(bool allow, std::string key)
{
scalContents.at(key)->coarsenAllowed = allow;
}
template <class TP, REQUIRES( Concepts::PreTreePath<TP> )>
void allowCoarsening(bool allow, TP& tp)
{
return allowCoarsening(allow, to_string(tp));
}
int getSize() const
{
return int(scalContents.size());
......
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