INET Framework for OMNeT++/OMNEST
inet::math::RightCurryingFunction< R, C, DIMSC, D, DIMSD, E > Class Template Reference

Fixes the parameters of a function from the right. More...

#include <CompoundFunctions.h>

Inheritance diagram for inet::math::RightCurryingFunction< R, C, DIMSC, D, DIMSD, E >:
inet::math::FunctionBase< R, C > inet::math::IFunction< R, C >

Public Member Functions

 RightCurryingFunction (const typename D::P &point, const Ptr< const IFunction< R, E >> &function)
 
virtual R getValue (const typename C::P &p) const override
 
virtual void partition (const typename C::I &i, const std::function< void(const typename C::I &, const IFunction< R, C > *)> callback) const override
 
- Public Member Functions inherited from inet::math::FunctionBase< R, C >
virtual void partition (const typename C ::I &i, const std::function< void(const typename C ::I &, const IFunction< R, C > *)> callback) const override
 Subdivides the provided domain and calls back f with the subdomains and the corresponding potentially simpler domain limited functions. More...
 
virtual Interval< R > getRange () const override
 Returns the valid range of the function as an interval. More...
 
virtual Interval< R > getRange (const typename C ::I &i) const override
 Returns the valid range of the function as an interval for the given domain. More...
 
virtual C ::I getDomain () const override
 Returns the valid domain of the function as an interval. More...
 
virtual bool isFinite () const override
 Returns true if the function value is finite in the whole domain. More...
 
virtual bool isFinite (const typename C ::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 C ::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 getMin (const typename C ::I &i) const override
 Returns the minimum value for the given domain. More...
 
virtual R getMax () const override
 Returns the maximum value for the whole domain. More...
 
virtual R getMax (const typename C ::I &i) const override
 Returns the maximum value for the given domain. More...
 
virtual R getMean () const override
 Returns the mean value for the whole domain. More...
 
virtual R getMean (const typename C ::I &i) const override
 Returns the mean value for the given domain. More...
 
virtual R getIntegral () const override
 Returns the integral value for the whole domain. More...
 
virtual R getIntegral (const typename C ::I &i) const override
 Returns the integral value for the given domain. More...
 
virtual const Ptr< const IFunction< R, C > > add (const Ptr< const IFunction< R, C >> &o) const override
 Adds the provided function to this function. More...
 
virtual const Ptr< const IFunction< R, C > > subtract (const Ptr< const IFunction< R, C >> &o) const override
 Substracts the provided function from this function. More...
 
virtual const Ptr< const IFunction< R, C > > multiply (const Ptr< const IFunction< double, C >> &o) const override
 Multiplies the provided function with this function. More...
 
virtual const Ptr< const IFunction< double, C > > divide (const Ptr< const IFunction< R, C >> &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 C ::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 C ::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 C ::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...
 
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::IFunction< R, C >
virtual ~IFunction ()
 
virtual R getValue (const typename C ::P &p) const=0
 Returns the value of the function at the given point. More...
 

Protected Attributes

const D::P point
 
const Ptr< const IFunction< R, E > > function
 

Detailed Description

template<typename R, typename C, int DIMSC, typename D, int DIMSD, typename E>
class inet::math::RightCurryingFunction< R, C, DIMSC, D, DIMSD, E >

Fixes the parameters of a function from the right.

Constructor & Destructor Documentation

◆ RightCurryingFunction()

template<typename R , typename C , int DIMSC, typename D , int DIMSD, typename E >
inet::math::RightCurryingFunction< R, C, DIMSC, D, DIMSD, E >::RightCurryingFunction ( const typename D::P &  point,
const Ptr< const IFunction< R, E >> &  function 
)
inline
702 : point(point), function(function) {}

Member Function Documentation

◆ getValue()

template<typename R , typename C , int DIMSC, typename D , int DIMSD, typename E >
virtual R inet::math::RightCurryingFunction< R, C, DIMSC, D, DIMSD, E >::getValue ( const typename C::P &  p) const
inlineoverridevirtual
704  {
705  return function->getValue(concat(p, point));
706  }

◆ partition()

template<typename R , typename C , int DIMSC, typename D , int DIMSD, typename E >
virtual void inet::math::RightCurryingFunction< R, C, DIMSC, D, DIMSD, E >::partition ( const typename C::I &  i,
const std::function< void(const typename C::I &, const IFunction< R, C > *)>  callback 
) const
inlineoverridevirtual
708  {
709  auto size = std::tuple_size<typename D::P::type>::value;
710  const typename E::P lower = concat(i.getLower(), point);
711  const typename E::P upper = concat(i.getUpper(), point);
712  const typename E::I interval(lower, upper, (i.getLowerClosed() << size) + DIMSD, (i.getUpperClosed() << size) + DIMSD, (i.getFixed() << size) + DIMSD);
713  function->partition(interval, [&] (const typename E::I& i1, const IFunction<R, E> *f) {
714  const auto& l1 = i1.getLower();
715  const auto& u1 = i1.getUpper();
716  typename C::P l2 = C::P::getZero();
717  typename C::P u2 = C::P::getZero();
718  l2.template copyFrom<typename E::P, DIMSC>(l1);
719  u2.template copyFrom<typename E::P, DIMSC>(u1);
720  const typename C::I i2(l2, u2, (i1.getLowerClosed() & DIMSC) >> size, (i1.getUpperClosed() & DIMSD) >> size, (i1.getFixed() & DIMSD) >> size);
721  if (auto cf = dynamic_cast<const ConstantFunction<R, E> *>(f)) {
722  ConstantFunction<R, C> h(cf->getConstantValue());
723  callback(i2, &h);
724  }
725  else if (auto lf = dynamic_cast<const UnilinearFunction<R, E> *>(f)) {
726  const auto& l3 = lf->getLower();
727  const auto& u3 = lf->getUpper();
728  typename C::P l4 = C::P::getZero();
729  typename C::P u4 = C::P::getZero();
730  l4.template copyFrom<typename E::P, DIMSC>(l3);
731  u4.template copyFrom<typename E::P, DIMSC>(u3);
732  UnilinearFunction<R, C> h(l4, u4, lf->getRLower(), lf->getRUpper(), lf->getDimension() - 3);
733  callback(i2, &h);
734  }
735  else
736  throw cRuntimeError("TODO");
737  });
738  }

Member Data Documentation

◆ function

template<typename R , typename C , int DIMSC, typename D , int DIMSD, typename E >
const Ptr<const IFunction<R, E> > inet::math::RightCurryingFunction< R, C, DIMSC, D, DIMSD, E >::function
protected

◆ point

template<typename R , typename C , int DIMSC, typename D , int DIMSD, typename E >
const D::P inet::math::RightCurryingFunction< R, C, DIMSC, D, DIMSD, E >::point
protected

The documentation for this class was generated from the following file:
inet::math::concat
Point< TS1 ..., TS2 ... > concat(const Point< TS1 ... > &p1, const Point< TS2 ... > &p2)
Returns a point by concatenating the coordinates of p1 and p2.
Definition: Point.h:234
inet::math::RightCurryingFunction::point
const D::P point
Definition: CompoundFunctions.h:698
inet::units::constants::h
const value< double, compose< units::J, units::s > > h(6.62606896e-34)