Commit db4eb4a9 authored by Müller, Felix's avatar Müller, Felix
Browse files

overload for treepath added in AdaptInfo

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