NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class represents a single interval in code providing reading access functionality. More...
#include <interval.hpp>
Public Member Functions | |
Interval () | |
Interval (const std::string &sDef) | |
Construct an Interval object from an interval definition string. More... | |
Interval (mu::value_type dFront, mu::value_type dBack) | |
Constructor from the two interval boundaries. More... | |
Interval (const Interval &ivl) | |
Create a copy of an Interval object. More... | |
Interval & | operator= (const Interval &ivl) |
Assignment operator overload. More... | |
mu::value_type | operator() (size_t n, size_t nSamples=100) const |
Parenthesis operator overload. More... | |
mu::value_type | log (size_t n, size_t nSamples=100) const |
Return a sample in logarithmic scale. More... | |
mu::value_type | front () const |
Return the first element in the interval. More... | |
mu::value_type | back () const |
Return the last element in the interval. More... | |
mu::value_type | cmin () const |
Return the componentwise minimal element in the interval. More... | |
mu::value_type | cmax () const |
Return the componentwise maximal element in the interval. More... | |
double | min () const |
Return the minimal element in the interval. More... | |
double | max () const |
Return the maximal element in the interval. More... | |
double | range () const |
Return the real inteval range of this interval. More... | |
double | middle () const |
Calculates the middle point of the interval. More... | |
bool | isInside (mu::value_type val) const |
Checks, whether the passed value is part of this interval. More... | |
bool | contains (const std::string &sVarName) const |
Check, whether a variable is part of the interval definition string to detect a possible dependency. More... | |
size_t | getSamples () const |
Returns the number of internal samples. Will return zero, if the internal samples are only interval start and end point. More... | |
void | refresh () |
Referesh the internal interval representation (e.g. after a dependency has been updated). More... | |
void | reset (const std::string &sDef) |
Reset the interval with a new definition. More... | |
void | reset (mu::value_type dFront, mu::value_type dBack) |
Reset the interval with new boundaries. More... | |
void | expand (double perc, double dMin=-INFINITY) |
Expand the interval by the corresponding percentage. The expansion is equally distributed to both ends keeping the minimal value. More... | |
Interval | combine (const Interval &_ivl) const |
Returns the (continous) interval, which contains this and the passed interval. More... | |
Public Attributes | |
std::string | name |
Private Member Functions | |
void | assign (const Interval &ivl) |
Assign a interval object to this instance. More... | |
double | getSample (size_t n, size_t nSamples) const |
Return the nth sample of the interval using the desired number of samples. More... | |
Private Attributes | |
std::string | m_sDefinition |
std::vector< double > | m_vInterval |
This class represents a single interval in code providing reading access functionality.
Definition at line 33 of file interval.hpp.
|
inline |
Definition at line 45 of file interval.hpp.
Referenced by combine().
Interval::Interval | ( | const std::string & | sDef | ) |
Construct an Interval object from an interval definition string.
sDef | const std::string& |
Definition at line 106 of file interval.cpp.
References reset().
Interval::Interval | ( | mu::value_type | dFront, |
mu::value_type | dBack | ||
) |
Constructor from the two interval boundaries.
dFront | mu::value_type |
dBack | mu::value_type |
Definition at line 120 of file interval.cpp.
References reset().
Interval::Interval | ( | const Interval & | ivl | ) |
Create a copy of an Interval object.
ivl | const Interval& |
Definition at line 132 of file interval.cpp.
References assign().
|
private |
Assign a interval object to this instance.
ivl | const Interval& |
Definition at line 36 of file interval.cpp.
References m_sDefinition, m_vInterval, and name.
Referenced by Interval(), and operator=().
mu::value_type Interval::back | ( | ) | const |
Return the last element in the interval.
Definition at line 200 of file interval.cpp.
References m_vInterval.
Referenced by log(), and PlotData::setAddAxis().
mu::value_type Interval::cmax | ( | ) | const |
Return the componentwise maximal element in the interval.
Definition at line 226 of file interval.cpp.
References m_vInterval.
mu::value_type Interval::cmin | ( | ) | const |
Return the componentwise minimal element in the interval.
Definition at line 213 of file interval.cpp.
References m_vInterval.
Returns the (continous) interval, which contains this and the passed interval.
_ivl | const Interval& |
Definition at line 466 of file interval.cpp.
References Interval(), mu::isnan(), m_vInterval, max(), max, min(), and min.
Referenced by Plot::extractDataValues().
bool Interval::contains | ( | const std::string & | sVarName | ) | const |
Check, whether a variable is part of the interval definition string to detect a possible dependency.
sVarName | const std::string& |
Definition at line 308 of file interval.cpp.
References findVariableInExpression(), and m_sDefinition.
void Interval::expand | ( | double | perc, |
double | dMin = -INFINITY |
||
) |
Expand the interval by the corresponding percentage. The expansion is equally distributed to both ends keeping the minimal value.
perc | double |
dMin | double |
Definition at line 434 of file interval.cpp.
References max(), min(), range(), and reset().
mu::value_type Interval::front | ( | ) | const |
Return the first element in the interval.
Definition at line 187 of file interval.cpp.
References m_vInterval.
Referenced by applyNiceAxis(), Plot::CoordSettings(), hasSecAxisBox(), log(), and PlotData::setAddAxis().
|
private |
Return the nth sample of the interval using the desired number of samples.
n | size_t |
nSamples | size_t |
Definition at line 53 of file interval.cpp.
References SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, m_sDefinition, and m_vInterval.
Referenced by operator()().
size_t Interval::getSamples | ( | ) | const |
Returns the number of internal samples. Will return zero, if the internal samples are only interval start and end point.
Definition at line 322 of file interval.cpp.
References m_vInterval.
bool Interval::isInside | ( | mu::value_type | val | ) | const |
Checks, whether the passed value is part of this interval.
val | mu::value_type |
Definition at line 292 of file interval.cpp.
References m_vInterval, max(), and min().
mu::value_type Interval::log | ( | size_t | n, |
size_t | nSamples = 100 |
||
) | const |
Return a sample in logarithmic scale.
n | size_t |
nSamples | size_t |
Definition at line 174 of file interval.cpp.
References back(), and front().
double Interval::max | ( | ) | const |
Return the maximal element in the interval.
Definition at line 252 of file interval.cpp.
References m_vInterval.
Referenced by applyNiceAxis(), combine(), Plot::CoordSettings(), Plot::defaultRanges(), expand(), Plot::fitPlotRanges(), isInside(), middle(), range(), and PlotAssetManager::weightedRange().
double Interval::middle | ( | ) | const |
Calculates the middle point of the interval.
Definition at line 278 of file interval.cpp.
double Interval::min | ( | ) | const |
Return the minimal element in the interval.
Definition at line 239 of file interval.cpp.
References m_vInterval.
Referenced by applyNiceAxis(), combine(), Plot::CoordSettings(), Plot::defaultRanges(), expand(), Plot::fitPlotRanges(), isInside(), middle(), range(), scaleSecondaryToPrimaryInterval(), and PlotAssetManager::weightedRange().
mu::value_type Interval::operator() | ( | size_t | n, |
size_t | nSamples = 100 |
||
) | const |
Parenthesis operator overload.
n | size_t |
nSamples | size_t |
Definition at line 160 of file interval.cpp.
References getSample().
Assignment operator overload.
ivl | const Interval& |
Definition at line 145 of file interval.cpp.
References assign().
double Interval::range | ( | ) | const |
Return the real inteval range of this interval.
Definition at line 265 of file interval.cpp.
Referenced by applyNiceAxis(), expand(), scaleSecondaryToPrimaryInterval(), and PlotAssetManager::weightedRange().
void Interval::refresh | ( | ) |
Referesh the internal interval representation (e.g. after a dependency has been updated).
Definition at line 339 of file interval.cpp.
References MemoryManager::containsTablesOrClusters(), mu::ParserBase::Eval(), getAllIndices(), getDataElements(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), NumeReKernel::getParser(), NumeReKernel::getSettings(), m_sDefinition, m_vInterval, mu::real(), and mu::ParserBase::SetExpr().
Referenced by reset().
void Interval::reset | ( | const std::string & | sDef | ) |
Reset the interval with a new definition.
sDef | const std::string& |
Definition at line 402 of file interval.cpp.
References m_sDefinition, and refresh().
Referenced by applyNiceAxis(), PlotData::deleteData(), expand(), PlotData::getAddAxis(), Interval(), PlotData::reset(), and PlotData::setParams().
void Interval::reset | ( | mu::value_type | dFront, |
mu::value_type | dBack | ||
) |
Reset the interval with new boundaries.
dFront | mu::value_type |
dBack | mu::value_type |
Definition at line 417 of file interval.cpp.
References m_vInterval.
|
private |
Definition at line 36 of file interval.hpp.
Referenced by assign(), contains(), getSample(), refresh(), and reset().
|
private |
Definition at line 37 of file interval.hpp.
Referenced by assign(), back(), cmax(), cmin(), combine(), front(), getSample(), getSamples(), isInside(), max(), min(), refresh(), and reset().
std::string Interval::name |
Definition at line 43 of file interval.hpp.
Referenced by assign().