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

Extrudes a one-dimensional function into a two-dimensional function. More...

#include <CompoundFunctions.h>

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

Public Member Functions

 Extruded2DFunction (const Ptr< const IFunction< R, Domain< Y >>> &function)
 
virtual R getValue (const Point< X, Y > &p) const override
 
virtual void partition (const Interval< X, Y > &i, std::function< void(const Interval< X, Y > &, const IFunction< R, Domain< X, Y >> *)> callback) const override
 
virtual bool isFinite (const Interval< X, Y > &i) const override
 
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, 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...
 
- 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< Y > > > function
 

Detailed Description

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

Extrudes a one-dimensional function into a two-dimensional function.

Constructor & Destructor Documentation

◆ Extruded2DFunction()

template<typename R , typename X , typename Y >
inet::math::Extruded2DFunction< R, X, Y >::Extruded2DFunction ( const Ptr< const IFunction< R, Domain< Y >>> &  function)
inline
487 : function(function) {}

Member Function Documentation

◆ getValue()

template<typename R , typename X , typename Y >
virtual R inet::math::Extruded2DFunction< R, X, Y >::getValue ( const Point< X, Y > &  p) const
inlineoverridevirtual
489  {
490  return function->getValue(Point<Y>(std::get<1>(p)));
491  }

◆ isFinite()

template<typename R , typename X , typename Y >
virtual bool inet::math::Extruded2DFunction< R, X, Y >::isFinite ( const Interval< X, Y > &  i) const
inlineoverridevirtual
514  {
515  Interval<Y> i1(Point<Y>(std::get<1>(i.getLower())), Point<Y>(std::get<1>(i.getUpper())), i.getUpperClosed() & 0b01);
516  return function->isFinite(i1);
517  }

◆ partition()

template<typename R , typename X , typename Y >
virtual void inet::math::Extruded2DFunction< R, X, Y >::partition ( const Interval< X, Y > &  i,
std::function< void(const Interval< X, Y > &, const IFunction< R, Domain< X, Y >> *)>  callback 
) const
inlineoverridevirtual
493  {
494  Interval<Y> i1(Point<Y>(std::get<1>(i.getLower())), Point<Y>(std::get<1>(i.getUpper())), i.getUpperClosed() & 0b01);
495  function->partition(i1, [&] (const Interval<Y>& i2, const IFunction<R, Domain<Y>> *f2) {
496  Point<X, Y> lower(std::get<0>(i.getLower()), std::get<0>(i2.getLower()));
497  Point<X, Y> upper(std::get<0>(i.getUpper()), std::get<0>(i2.getUpper()));
498  Interval<X, Y> i3(lower, upper, (i.getUpperClosed() & 0b10) | i2.getUpperClosed());
499  if (auto f2c = dynamic_cast<const ConstantFunction<R, Domain<Y>> *>(f2)) {
500  ConstantFunction<R, Domain<X, Y>> g(f2c->getConstantValue());
501  callback(i3, &g);
502  }
503  else if (auto f2l = dynamic_cast<const UnilinearFunction<R, Domain<Y>> *>(f2)) {
504  Point<X, Y> lower(std::get<0>(i.getLower()), std::get<0>(f2l->getLower()));
505  Point<X, Y> upper(std::get<0>(i.getUpper()), std::get<0>(f2l->getUpper()));
506  UnilinearFunction<R, Domain<X, Y>> g(lower, upper, f2l->getRLower(), f2l->getRUpper(), 1);
507  callback(i3, &g);
508  }
509  else
510  throw cRuntimeError("TODO");
511  });
512  }

◆ printStructure()

template<typename R , typename X , typename Y >
virtual void inet::math::Extruded2DFunction< R, X, Y >::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, Domain< X, Y > >.

519  {
520  os << "(Extruded\n" << std::string(level + 2, ' ');
521  function->printStructure(os, level + 2);
522  os << ")";
523  }

Member Data Documentation

◆ function

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

The documentation for this class was generated from the following file:
inet::units::units::g
milli< kg >::type g
Definition: Units.h:1071
inet::units::constants::R
const value< double, compose< units::J, compose< pow< units::mol, -1 >, pow< units::kg, -1 > > > > R(8.314472)