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

Verifies that partitioning on a domain is correct in the sense that the original function and the function over the partition return the same values at the corners and center of the subdomain. More...

#include <FunctionChecker.h>

Public Member Functions

 FunctionChecker (const Ptr< const IFunction< R, D >> &function)
 
void check () const
 
void check (const typename D::I &i) const
 

Protected Attributes

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

Detailed Description

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

Verifies that partitioning on a domain is correct in the sense that the original function and the function over the partition return the same values at the corners and center of the subdomain.

Constructor & Destructor Documentation

◆ FunctionChecker()

template<typename R , typename D >
inet::math::FunctionChecker< R, D >::FunctionChecker ( const Ptr< const IFunction< R, D >> &  function)
inline
31 : function(function) {}

Member Function Documentation

◆ check() [1/2]

template<typename R , typename D >
void inet::math::FunctionChecker< R, D >::check ( ) const
inline
33  {
34  check(function->getDomain());
35  }

◆ check() [2/2]

template<typename R , typename D >
void inet::math::FunctionChecker< R, D >::check ( const typename D::I &  i) const
inline
37  {
38  function->partition(i, [&] (const typename D::I& i1, const IFunction<R, D> *f1) {
39  auto check = std::function<void(const typename D::P&)>([&] (const typename D::P& p) {
40  if (i1.contains(p)) {
41  R r = function->getValue(p);
42  R r1 = f1->getValue(p);
43  ASSERT(r == r1 || (std::isnan(toDouble(r)) && std::isnan(toDouble(r1))));
44  }
45  });
46  iterateCorners(i1, check);
47  check((i1.getLower() + i1.getUpper()) / 2);
48  });
49  }

Member Data Documentation

◆ function

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

The documentation for this class was generated from the following file:
inet::math::FunctionChecker::function
const Ptr< const IFunction< R, D > > function
Definition: FunctionChecker.h:28
inet::math::FunctionChecker::check
void check() const
Definition: FunctionChecker.h:33
inet::math::iterateCorners
void iterateCorners(const Interval<> &i, const std::function< void(const Point<> &)> f)
Definition: Interval.h:186