INET Framework for OMNeT++/OMNEST
inet::math::DomainModulated2DFunction< R, X, Y > Class Template Reference

Modulates the domain of a two-dimensional function with the values of a one-dimensional function. More...

#include <CompoundFunctions.h>

Inheritance diagram for inet::math::DomainModulated2DFunction< R, X, Y >:
inet::math::FunctionBase< R, Domain< X, Y > > inet::math::IFunction< R, Domain< X, Y > >

Public Member Functions

 DomainModulated2DFunction (const Ptr< const IFunction< R, Domain< X, Y >>> &function, const Ptr< const IFunction< Y, Domain< X >>> &modulator)
 
virtual R getValue (const Point< X, Y > &p) const override
 
virtual void partition (const Interval< X, Y > &i, const std::function< void(const Interval< X, Y > &, const IFunction< R, Domain< X, Y >> *)> callback) const override
 
- Public Member Functions inherited from inet::math::FunctionBase< R, Domain< X, Y > >
virtual void partition (const typename Domain< X, Y > ::I &i, const std::function< void(const typename Domain< X, Y > ::I &, const IFunction< R, Domain< X, Y > > *)> 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 Domain< X, Y > ::I &i) const override
 Returns the valid range of the function as an interval for the given domain. More...
 
virtual Domain< X, Y > ::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 Domain< X, Y > ::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 Domain< X, Y > ::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 Domain< X, Y > ::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 Domain< X, Y > ::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 Domain< X, Y > ::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 Domain< X, Y > ::I &i) const override
 Returns the integral value for the given domain. More...
 
virtual const Ptr< const IFunction< R, Domain< X, Y > > > add (const Ptr< const IFunction< R, Domain< X, Y > >> &o) const override
 Adds the provided function to this function. More...
 
virtual const Ptr< const IFunction< R, Domain< X, Y > > > subtract (const Ptr< const IFunction< R, Domain< X, Y > >> &o) const override
 Substracts the provided function from this function. More...
 
virtual const Ptr< const IFunction< R, Domain< X, Y > > > multiply (const Ptr< const IFunction< double, Domain< X, Y > >> &o) const override
 Multiplies the provided function with this function. More...
 
virtual const Ptr< const IFunction< double, Domain< X, Y > > > divide (const Ptr< const IFunction< R, Domain< X, Y > >> &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 Domain< X, Y > ::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 Domain< X, Y > ::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 Domain< X, Y > ::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, Domain< X, Y > >
virtual ~IFunction ()
 
virtual R getValue (const typename Domain< X, Y > ::P &p) const=0
 Returns the value of the function at the given point. More...
 

Protected Attributes

const Ptr< const IFunction< R, Domain< X, Y > > > function
 
const Ptr< const IFunction< Y, Domain< X > > > modulator
 

Detailed Description

template<typename R, typename X, typename Y>
class inet::math::DomainModulated2DFunction< R, X, Y >

Modulates the domain of a two-dimensional function with the values of a one-dimensional function.

Constructor & Destructor Documentation

◆ DomainModulated2DFunction()

template<typename R , typename X , typename Y >
inet::math::DomainModulated2DFunction< R, X, Y >::DomainModulated2DFunction ( const Ptr< const IFunction< R, Domain< X, Y >>> &  function,
const Ptr< const IFunction< Y, Domain< X >>> &  modulator 
)
inline
275  :
276  function(function), modulator(modulator) {}

Member Function Documentation

◆ getValue()

template<typename R , typename X , typename Y >
virtual R inet::math::DomainModulated2DFunction< R, X, Y >::getValue ( const Point< X, Y > &  p) const
inlineoverridevirtual
278  {
279  auto x = std::get<0>(p);
280  auto y = std::get<1>(p);
281  auto mv = modulator->getValue({ x });
282  return function->getValue({ x, y - mv });
283  }

◆ partition()

template<typename R , typename X , typename Y >
virtual void inet::math::DomainModulated2DFunction< R, X, Y >::partition ( const Interval< X, Y > &  i,
const std::function< void(const Interval< X, Y > &, const IFunction< R, Domain< X, Y >> *)>  callback 
) const
inlineoverridevirtual
285  {
286  modulator->partition(i.template get<X, 0>(), [&] (const Interval<X>& i1, const IFunction<Y, Domain<X>> *f1) {
287  if (auto f1c = dynamic_cast<const ConstantFunction<Y, Domain<X>> *>(f1)) {
288  Point<X, Y> s(X(0), f1c->getConstantValue());
289  function->partition(i.template getReplaced<X, 0>(i1).getShifted(-s), [&] (const Interval<X, Y>& i2, const IFunction<R, Domain<X, Y>> *f2) {
290  if (auto f2c = dynamic_cast<const ConstantFunction<R, Domain<X, Y>> *>(f2))
291  callback(i2.getShifted(s), f2);
292  else if (auto f2l = dynamic_cast<const UnilinearFunction<R, Domain<X, Y>> *>(f2)) {
293  UnilinearFunction<R, Domain<X, Y>> g(i2.getLower() + s, i2.getUpper() + s, f2l->getValue(i2.getLower()), f2l->getValue(i2.getUpper()), f2l->getDimension());
294  simplifyAndCall(i2.getShifted(s), &g, callback);
295  }
296  else
297  throw cRuntimeError("TODO");
298  });
299  }
300  else
301  throw cRuntimeError("TODO");
302  });
303  }

Member Data Documentation

◆ function

template<typename R , typename X , typename Y >
const Ptr<const IFunction<R, Domain<X, Y> > > inet::math::DomainModulated2DFunction< R, X, Y >::function
protected

◆ modulator

template<typename R , typename X , typename Y >
const Ptr<const IFunction<Y, Domain<X> > > inet::math::DomainModulated2DFunction< R, X, Y >::modulator
protected

The documentation for this class was generated from the following file:
inet::math::DomainModulated2DFunction::modulator
const Ptr< const IFunction< Y, Domain< X > > > modulator
Definition: CompoundFunctions.h:271