NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
Interval Class Reference

This class represents a single interval in code providing reading access functionality. More...

#include <interval.hpp>

Collaboration diagram for Interval:

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...
 
Intervaloperator= (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
 

Detailed Description

This class represents a single interval in code providing reading access functionality.

Definition at line 33 of file interval.hpp.

Constructor & Destructor Documentation

◆ Interval() [1/4]

Interval::Interval ( )
inline

Definition at line 45 of file interval.hpp.

Referenced by combine().

◆ Interval() [2/4]

Interval::Interval ( const std::string &  sDef)

Construct an Interval object from an interval definition string.

Parameters
sDefconst std::string&
Note
Expects a plain interval definition string without brackets and variable names, e.g. "a:b"

Definition at line 106 of file interval.cpp.

References reset().

Here is the call graph for this function:

◆ Interval() [3/4]

Interval::Interval ( mu::value_type  dFront,
mu::value_type  dBack 
)

Constructor from the two interval boundaries.

Parameters
dFrontmu::value_type
dBackmu::value_type

Definition at line 120 of file interval.cpp.

References reset().

Here is the call graph for this function:

◆ Interval() [4/4]

Interval::Interval ( const Interval ivl)

Create a copy of an Interval object.

Parameters
ivlconst Interval&

Definition at line 132 of file interval.cpp.

References assign().

Here is the call graph for this function:

Member Function Documentation

◆ assign()

void Interval::assign ( const Interval ivl)
private

Assign a interval object to this instance.

Parameters
ivlconst Interval&
Returns
void

Definition at line 36 of file interval.cpp.

References m_sDefinition, m_vInterval, and name.

Referenced by Interval(), and operator=().

◆ back()

mu::value_type Interval::back ( ) const

Return the last element in the interval.

Returns
mu::value_type

Definition at line 200 of file interval.cpp.

References m_vInterval.

Referenced by log(), and PlotData::setAddAxis().

◆ cmax()

mu::value_type Interval::cmax ( ) const

Return the componentwise maximal element in the interval.

Returns
mu::value_type

Definition at line 226 of file interval.cpp.

References m_vInterval.

◆ cmin()

mu::value_type Interval::cmin ( ) const

Return the componentwise minimal element in the interval.

Returns
mu::value_type

Definition at line 213 of file interval.cpp.

References m_vInterval.

◆ combine()

Interval Interval::combine ( const Interval _ivl) const

Returns the (continous) interval, which contains this and the passed interval.

Parameters
_ivlconst Interval&
Returns
Interval

Definition at line 466 of file interval.cpp.

References Interval(), mu::isnan(), m_vInterval, max(), max, min(), and min.

Referenced by Plot::extractDataValues().

Here is the call graph for this function:

◆ contains()

bool Interval::contains ( const std::string &  sVarName) const

Check, whether a variable is part of the interval definition string to detect a possible dependency.

Parameters
sVarNameconst std::string&
Returns
bool

Definition at line 308 of file interval.cpp.

References findVariableInExpression(), and m_sDefinition.

Here is the call graph for this function:

◆ expand()

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.

Parameters
percdouble
dMindouble
Returns
void

Definition at line 434 of file interval.cpp.

References max(), min(), range(), and reset().

Here is the call graph for this function:

◆ front()

mu::value_type Interval::front ( ) const

Return the first element in the interval.

Returns
mu::value_type

Definition at line 187 of file interval.cpp.

References m_vInterval.

Referenced by applyNiceAxis(), Plot::CoordSettings(), hasSecAxisBox(), log(), and PlotData::setAddAxis().

◆ getSample()

double Interval::getSample ( size_t  n,
size_t  nSamples 
) const
private

Return the nth sample of the interval using the desired number of samples.

Parameters
nsize_t
nSamplessize_t
Returns
mu::value_type

Definition at line 53 of file interval.cpp.

References SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, m_sDefinition, and m_vInterval.

Referenced by operator()().

◆ getSamples()

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.

Returns
size_t

Definition at line 322 of file interval.cpp.

References m_vInterval.

◆ isInside()

bool Interval::isInside ( mu::value_type  val) const

Checks, whether the passed value is part of this interval.

Parameters
valmu::value_type
Returns
bool

Definition at line 292 of file interval.cpp.

References m_vInterval, max(), and min().

Here is the call graph for this function:

◆ log()

mu::value_type Interval::log ( size_t  n,
size_t  nSamples = 100 
) const

Return a sample in logarithmic scale.

Parameters
nsize_t
nSamplessize_t
Returns
mu::value_type

Definition at line 174 of file interval.cpp.

References back(), and front().

Here is the call graph for this function:

◆ max()

double Interval::max ( ) const

Return the maximal element in the interval.

Returns
double

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().

◆ middle()

double Interval::middle ( ) const

Calculates the middle point of the interval.

Returns
double

Definition at line 278 of file interval.cpp.

References max(), and min().

Here is the call graph for this function:

◆ min()

double Interval::min ( ) const

Return the minimal element in the interval.

Returns
double

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().

◆ operator()()

mu::value_type Interval::operator() ( size_t  n,
size_t  nSamples = 100 
) const

Parenthesis operator overload.

Parameters
nsize_t
nSamplessize_t
Returns
mu::value_type

Definition at line 160 of file interval.cpp.

References getSample().

Here is the call graph for this function:

◆ operator=()

Interval & Interval::operator= ( const Interval ivl)

Assignment operator overload.

Parameters
ivlconst Interval&
Returns
Interval&

Definition at line 145 of file interval.cpp.

References assign().

Here is the call graph for this function:

◆ range()

double Interval::range ( ) const

Return the real inteval range of this interval.

Returns
double

Definition at line 265 of file interval.cpp.

References max(), and min().

Referenced by applyNiceAxis(), expand(), scaleSecondaryToPrimaryInterval(), and PlotAssetManager::weightedRange().

Here is the call graph for this function:

◆ refresh()

void Interval::refresh ( )

Referesh the internal interval representation (e.g. after a dependency has been updated).

Returns
void

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().

Here is the call graph for this function:

◆ reset() [1/2]

void Interval::reset ( const std::string &  sDef)

Reset the interval with a new definition.

Parameters
sDefconst std::string&
Returns
void

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().

Here is the call graph for this function:

◆ reset() [2/2]

void Interval::reset ( mu::value_type  dFront,
mu::value_type  dBack 
)

Reset the interval with new boundaries.

Parameters
dFrontmu::value_type
dBackmu::value_type
Returns
void

Definition at line 417 of file interval.cpp.

References m_vInterval.

Member Data Documentation

◆ m_sDefinition

std::string Interval::m_sDefinition
private

Definition at line 36 of file interval.hpp.

Referenced by assign(), contains(), getSample(), refresh(), and reset().

◆ m_vInterval

std::vector<double> Interval::m_vInterval
private

◆ name

std::string Interval::name

Definition at line 43 of file interval.hpp.

Referenced by assign().


The documentation for this class was generated from the following files: