chrono::ChFunctionIntegral Class Reference

Description

Integral of a function.

y(x) = offset + \int{f(s) ds}_{x_start}^{x}. The integral is computed using trapezoidal integration over a given number of samples. The function returns a value equal to the offset for any value x<= x_start, while returns y(x_end) for any value x>= x_end. x_start and x_end are set through the SetStartArg() and SetEndArg() methods.

#include <ChFunctionIntegral.h>

Inheritance diagram for chrono::ChFunctionIntegral:
Collaboration diagram for chrono::ChFunctionIntegral:

Public Member Functions

 ChFunctionIntegral (const ChFunctionIntegral &other)
 
virtual ChFunctionIntegralClone () const override
 "Virtual" copy constructor (covariant return type).
 
virtual Type GetType () const override
 Return the unique function type identifier.
 
virtual double GetVal (double x) const override
 Return the function output for input x. More...
 
void Setup ()
 Precompute the integral values. More...
 
void SetOrder (int int_order)
 Set the order of integration.
 
int GetOrder () const
 Get the order of integration.
 
void SetNumSamples (int m_samples)
 Set the number of samples used for the numerical quadrature.
 
unsigned int GetNumSamples () const
 Get the number of samples used for the numerical quadrature.
 
void SetOffsetVal (double offset)
 Set the initial value of the integral.
 
double GetOffsetVal () const
 Get the initial value of the integral.
 
void SetInterval (double xstart, double xend)
 Set the integration interval.
 
void SetStartArg (double x_start)
 Set the integration interval starting point.
 
void SetEndArg (double x_end)
 Set the integration interval ending point.
 
double GetStart () const
 Get the integration interval starting point.
 
double GetEnd () const
 Get the integration interval ending point.
 
void SetIntegrandFunction (std::shared_ptr< ChFunction > integrand_fun)
 Set the function to be integrated.
 
std::shared_ptr< ChFunctionGetIntegrandFunction () const
 Get the function to be integrated.
 
virtual void ArchiveOut (ChArchiveOut &archive_out) override
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIn (ChArchiveIn &archive_in) override
 Method to allow de-serialization of transient data from archives.
 
- Public Member Functions inherited from chrono::ChFunction
 ChFunction (const ChFunction &other)
 
virtual double GetDer (double x) const
 Return the first derivative of the function. More...
 
virtual double GetDer2 (double x) const
 Return the second derivative of the function. More...
 
virtual double GetDer3 (double x) const
 Return the third derivative of the function. More...
 
virtual double GetDerN (double x, int der_order) const
 Return the Nth derivative of the function (up to 3rd derivative). More...
 
virtual double GetWeight (double x) const
 Return the weight of the function. More...
 
virtual void Update (double x)
 Update the function at the provided value of its argument.
 
virtual double GetMax (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the maximum of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetMin (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the minimum of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetMean (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the mean of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetSquaredMean (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the squared mean of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetIntegral (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the integral of the function (or its der_order derivative) over the range [xmin, xmax]. More...
 
virtual double GetPositiveAccelerationCoeff () const
 Compute the positive acceleration coefficient. More...
 
virtual double GetNegativeAccelerationCoeff () const
 Compute the negative acceleration coefficient. More...
 
virtual double GetVelocityCoefficient () const
 Compute the velocity coefficient. More...
 
virtual void OutputToASCIIFile (std::ostream &file, double xmin, double xmax, int samples, char delimiter)
 Store X-Y pairs to an ASCII File. More...
 
virtual ChMatrixDynamic SampleUpToDerN (double xmin, double xmax, double step, int derN=0)
 Sample function on given interval [xmin, xmax], up to derN derivative (0 being the function ouput itself). More...
 
double operator() (double arg) const
 Alias operator of the GetVal function.
 

Additional Inherited Members

- Public Types inherited from chrono::ChFunction
enum  Type {
  BSPLINE, CONSTANT, CONSTACC, CONSTJERK,
  CUSTOM, CYCLOIDAL, DERIVATIVE, FILLET3,
  INTEGRAL, INTERP, LAMBDA, MIRROR,
  OPERATOR, POLY, POLY23, POLY345,
  RAMP, REPEAT, SEQUENCE, SINE,
  SINE_STEP
}
 Enumeration of function types.
 

Member Function Documentation

◆ GetVal()

double chrono::ChFunctionIntegral::GetVal ( double  x) const
overridevirtual

Return the function output for input x.

Must be overridden by specialized classes.

Implements chrono::ChFunction.

◆ Setup()

void chrono::ChFunctionIntegral::Setup ( )

Precompute the integral values.

Need to be called after the settings are changed.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/functions/ChFunctionIntegral.h
  • /builds/uwsbel/chrono/src/chrono/functions/ChFunctionIntegral.cpp