INET Framework for OMNeT++/OMNEST
inet::math::IntegratedFunction< R, D, DIMS, RI, DI > Class Template Reference

#include <CompoundFunctions.h>

Inheritance diagram for inet::math::IntegratedFunction< R, D, DIMS, RI, DI >:
inet::math::FunctionBase< RI, DI > inet::math::IFunction< RI, DI >

Public Member Functions

 IntegratedFunction (const Ptr< const IFunction< R, D >> &function)
 
virtual RI getValue (const typename DI::P &p) const override
 
virtual void partition (const typename DI::I &i, std::function< void(const typename DI::I &, const IFunction< RI, DI > *)> callback) 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< RI, DI >
virtual void partition (const typename DI ::I &i, const std::function< void(const typename DI ::I &, const IFunction< RI, DI > *)> 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< RI > getRange () const override
 Returns the valid range of the function as an interval. More...
 
virtual Interval< RI > getRange (const typename DI ::I &i) const override
 Returns the valid range of the function as an interval for the given domain. More...
 
virtual DI ::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 DI ::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 DI ::I &i) const override
 Returns true if the function value is non-zero in the given domain. More...
 
virtual RI getMin () const override
 Returns the minimum value for the whole domain. More...
 
virtual RI getMin (const typename DI ::I &i) const override
 Returns the minimum value for the given domain. More...
 
virtual RI getMax () const override
 Returns the maximum value for the whole domain. More...
 
virtual RI getMax (const typename DI ::I &i) const override
 Returns the maximum value for the given domain. More...
 
virtual RI getMean () const override
 Returns the mean value for the whole domain. More...
 
virtual RI getMean (const typename DI ::I &i) const override
 Returns the mean value for the given domain. More...
 
virtual RI getIntegral () const override
 Returns the integral value for the whole domain. More...
 
virtual RI getIntegral (const typename DI ::I &i) const override
 Returns the integral value for the given domain. More...
 
virtual const Ptr< const IFunction< RI, DI > > add (const Ptr< const IFunction< RI, DI >> &o) const override
 Adds the provided function to this function. More...
 
virtual const Ptr< const IFunction< RI, DI > > subtract (const Ptr< const IFunction< RI, DI >> &o) const override
 Substracts the provided function from this function. More...
 
virtual const Ptr< const IFunction< RI, DI > > multiply (const Ptr< const IFunction< double, DI >> &o) const override
 Multiplies the provided function with this function. More...
 
virtual const Ptr< const IFunction< double, DI > > divide (const Ptr< const IFunction< RI, DI >> &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 DI ::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 DI ::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 DI ::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< RI, DI >
virtual ~IFunction ()
 
virtual RI getValue (const typename DI ::P &p) const=0
 Returns the value of the function at the given point. More...
 

Private Attributes

const Ptr< const IFunction< R, D > > function
 

Constructor & Destructor Documentation

◆ IntegratedFunction()

template<typename R , typename D , int DIMS, typename RI , typename DI >
inet::math::IntegratedFunction< R, D, DIMS, RI, DI >::IntegratedFunction ( const Ptr< const IFunction< R, D >> &  function)
inline
822 : function(function) {}

Member Function Documentation

◆ getValue()

template<typename R , typename D , int DIMS, typename RI , typename DI >
virtual RI inet::math::IntegratedFunction< R, D, DIMS, RI, DI >::getValue ( const typename DI::P &  p) const
inlineoverridevirtual
824  {
825  auto l1 = D::P::getLowerBounds();
826  auto u1 = D::P::getUpperBounds();
827  p.template copyTo<typename D::P, DIMS>(l1);
828  p.template copyTo<typename D::P, DIMS>(u1);
829  RI ri(0);
830  typename D::I i1(l1, u1, DIMS, DIMS, DIMS);
831  function->partition(i1, [&] (const typename D::I& i2, const IFunction<R, D> *f2) {
832  R r = f2->getIntegral(i2);
833  ri += RI(toDouble(r));
834  });
835  return ri;
836  }

◆ partition()

template<typename R , typename D , int DIMS, typename RI , typename DI >
virtual void inet::math::IntegratedFunction< R, D, DIMS, RI, DI >::partition ( const typename DI::I &  i,
std::function< void(const typename DI::I &, const IFunction< RI, DI > *)>  callback 
) const
inlineoverridevirtual
838  {
839  throw cRuntimeError("TODO");
840  }

◆ printStructure()

template<typename R , typename D , int DIMS, typename RI , typename DI >
virtual void inet::math::IntegratedFunction< R, D, DIMS, RI, DI >::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< RI, DI >.

842  {
843  os << "(Integrated\n" << std::string(level + 2, ' ');
844  function->printStructure(os, level + 2);
845  os << ")";
846  }

Member Data Documentation

◆ function

template<typename R , typename D , int DIMS, typename RI , typename DI >
const Ptr<const IFunction<R, D> > inet::math::IntegratedFunction< R, D, DIMS, RI, DI >::function
private

The documentation for this class was generated from the following file:
inet::math::toDouble
double toDouble(const T v)
Definition: Point.h:28
inet::units::constants::R
const value< double, compose< units::J, compose< pow< units::mol, -1 >, pow< units::kg, -1 > > > > R(8.314472)