INET Framework for OMNeT++/OMNEST
inet::math::DomainLimitedFunction< R, D > Class Template Reference

Limits the domain of a multidimensional function. More...

#include <CompoundFunctions.h>

Inheritance diagram for inet::math::DomainLimitedFunction< R, D >:
inet::math::FunctionBase< R, D > inet::math::IFunction< R, D >

Public Member Functions

 DomainLimitedFunction (const Ptr< const IFunction< R, D >> &function, const typename D::I &domain)
 
virtual Interval< R > getRange () const override
 Returns the valid range of the function as an interval. More...
 
virtual D::I getDomain () const override
 Returns the valid domain of the function as an interval. More...
 
virtual R getValue (const typename D::P &p) const override
 Returns the value of the function at the given point. More...
 
virtual void partition (const typename D::I &i, const std::function< void(const typename D::I &, const IFunction< R, D > *)> callback) const override
 Subdivides the provided domain and calls back f with the subdomains and the corresponding potentially simpler domain limited functions. More...
 
virtual R getMin (const typename D::I &i) const override
 Returns the minimum value for the given domain. More...
 
virtual R getMax (const typename D::I &i) const override
 Returns the maximum value for the given domain. More...
 
virtual R getMean (const typename D::I &i) const override
 Returns the mean value for the given domain. More...
 
virtual R getIntegral (const typename D::I &i) const override
 Returns the integral value for the given domain. More...
 
virtual void printStructure (std::ostream &os, int level=0) const override
 Prints the internal data structure of this function in a human readable form to the provided stream. More...
 
- Public Member Functions inherited from inet::math::FunctionBase< R, D >
virtual Interval< R > getRange (const typename D::I &i) const override
 Returns the valid range of the function as an interval for the given domain. More...
 
virtual bool isFinite () const override
 Returns true if the function value is finite in the whole domain. More...
 
virtual bool isFinite (const typename D::I &i) const override
 Returns true if the function value is finite in the given domain. More...
 
virtual bool isNonZero () const override
 Returns true if the function value is non-zero in the whole domain. More...
 
virtual bool isNonZero (const typename D::I &i) const override
 Returns true if the function value is non-zero in the given domain. More...
 
virtual R getMin () const override
 Returns the minimum value for the whole domain. More...
 
virtual R getMax () const override
 Returns the maximum value for the whole domain. More...
 
virtual R getMean () const override
 Returns the mean value for the whole domain. More...
 
virtual R getIntegral () const override
 Returns the integral value for the whole domain. More...
 
virtual const Ptr< const IFunction< R, D > > add (const Ptr< const IFunction< R, D >> &o) const override
 Adds the provided function to this function. More...
 
virtual const Ptr< const IFunction< R, D > > subtract (const Ptr< const IFunction< R, D >> &o) const override
 Substracts the provided function from this function. More...
 
virtual const Ptr< const IFunction< R, D > > multiply (const Ptr< const IFunction< double, D >> &o) const override
 Multiplies the provided function with this function. More...
 
virtual const Ptr< const IFunction< double, D > > divide (const Ptr< const IFunction< R, D >> &o) const override
 Divides this function with the provided function. More...
 
virtual std::ostream & printOn (std::ostream &os) const override
 
virtual void print (std::ostream &os, int level=0) const override
 Prints this function in human readable form to the provided stream for the whole domain. More...
 
virtual void print (std::ostream &os, const typename D::I &i, int level=0) const override
 Prints this function in a human readable form to the provided stream for the given domain. More...
 
virtual void printPartitioning (std::ostream &os, const typename D::I &i, int level) const override
 Prints the partitioning of this function in a human readable form to the provided stream for the given domain. More...
 
virtual void printPartition (std::ostream &os, const typename D::I &i, int level=0) const override
 Prints a single partition of this function in a human readable form to the provided stream for the given domain. More...
 
- Public Member Functions inherited from inet::math::IFunction< R, D >
virtual ~IFunction ()
 

Protected Attributes

const Ptr< const IFunction< R, D > > function
 
const Interval< R > range
 
const D::I domain
 

Detailed Description

template<typename R, typename D>
class inet::math::DomainLimitedFunction< R, D >

Limits the domain of a multidimensional function.

Constructor & Destructor Documentation

◆ DomainLimitedFunction()

template<typename R , typename D >
inet::math::DomainLimitedFunction< R, D >::DomainLimitedFunction ( const Ptr< const IFunction< R, D >> &  function,
const typename D::I &  domain 
)
inline
29  :
30  function(function), range(Interval<R>(function->getMin(domain), function->getMax(domain), 0b1, 0b1, 0b0)), domain(domain)
31  {}

Member Function Documentation

◆ getDomain()

template<typename R , typename D >
virtual D::I inet::math::DomainLimitedFunction< R, D >::getDomain ( ) const
inlineoverridevirtual

Returns the valid domain of the function as an interval.

Reimplemented from inet::math::FunctionBase< R, D >.

34 { return domain; }

◆ getIntegral()

template<typename R , typename D >
virtual R inet::math::DomainLimitedFunction< R, D >::getIntegral ( const typename D::I &  i) const
inlineoverridevirtual

Returns the integral value for the given domain.

Reimplemented from inet::math::FunctionBase< R, D >.

59  {
60  return function->getIntegral(i.getIntersected(domain));
61  }

◆ getMax()

template<typename R , typename D >
virtual R inet::math::DomainLimitedFunction< R, D >::getMax ( const typename D::I &  i) const
inlineoverridevirtual

Returns the maximum value for the given domain.

Reimplemented from inet::math::FunctionBase< R, D >.

51  {
52  return function->getMax(i.getIntersected(domain));
53  }

◆ getMean()

template<typename R , typename D >
virtual R inet::math::DomainLimitedFunction< R, D >::getMean ( const typename D::I &  i) const
inlineoverridevirtual

Returns the mean value for the given domain.

Reimplemented from inet::math::FunctionBase< R, D >.

55  {
56  return function->getMean(i.getIntersected(domain));
57  }

◆ getMin()

template<typename R , typename D >
virtual R inet::math::DomainLimitedFunction< R, D >::getMin ( const typename D::I &  i) const
inlineoverridevirtual

Returns the minimum value for the given domain.

Reimplemented from inet::math::FunctionBase< R, D >.

47  {
48  return function->getMin(i.getIntersected(domain));
49  }

◆ getRange()

template<typename R , typename D >
virtual Interval<R> inet::math::DomainLimitedFunction< R, D >::getRange ( ) const
inlineoverridevirtual

Returns the valid range of the function as an interval.

Reimplemented from inet::math::FunctionBase< R, D >.

33 { return range; }

◆ getValue()

template<typename R , typename D >
virtual R inet::math::DomainLimitedFunction< R, D >::getValue ( const typename D::P &  p) const
inlineoverridevirtual

Returns the value of the function at the given point.

The returned value falls into the range of the function. The provided point must fall into the domain of the function.

Implements inet::math::IFunction< R, D >.

36  {
37  ASSERT(domain.contains(p));
38  return function->getValue(p);
39  }

◆ partition()

template<typename R , typename D >
virtual void inet::math::DomainLimitedFunction< R, D >::partition ( const typename D::I &  i,
const std::function< void(const typename D::I &, const IFunction< R, D > *)>  f 
) const
inlineoverridevirtual

Subdivides the provided domain and calls back f with the subdomains and the corresponding potentially simpler domain limited functions.

Reimplemented from inet::math::FunctionBase< R, D >.

41  {
42  const auto& i1 = i.getIntersected(domain);
43  if (!i1.isEmpty())
44  function->partition(i1, callback);
45  }

◆ printStructure()

template<typename R , typename D >
virtual void inet::math::DomainLimitedFunction< R, D >::printStructure ( std::ostream &  os,
int  level = 0 
) const
inlineoverridevirtual

Prints the internal data structure of this function in a human readable form to the provided stream.

Reimplemented from inet::math::FunctionBase< R, D >.

63  {
64  os << "(DomainLimited, domain = " << domain << "\n" << std::string(level + 2, ' ');
65  function->printStructure(os, level + 2);
66  os << ")";
67  }

Member Data Documentation

◆ domain

template<typename R , typename D >
const D::I inet::math::DomainLimitedFunction< R, D >::domain
protected

◆ function

template<typename R , typename D >
const Ptr<const IFunction<R, D> > inet::math::DomainLimitedFunction< R, D >::function
protected

◆ range

template<typename R , typename D >
const Interval<R> inet::math::DomainLimitedFunction< R, D >::range
protected

The documentation for this class was generated from the following file:
inet::math::DomainLimitedFunction::range
const Interval< R > range
Definition: CompoundFunctions.h:25
inet::math::DomainLimitedFunction::function
const Ptr< const IFunction< R, D > > function
Definition: CompoundFunctions.h:24
inet::math::DomainLimitedFunction::domain
const D::I domain
Definition: CompoundFunctions.h:26