Description
Interface base class for scalar functions.
Base class for all Chrono scalar functions. The GetVal() and Clone() methods must be implemented by derived classes.
#include <ChFunctionBase.h>
Public Types | |
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. | |
Public Member Functions | |
ChFunction (const ChFunction &other) | |
virtual ChFunction * | Clone () const =0 |
"Virtual" copy constructor. | |
virtual Type | GetType () const |
Return the unique function type identifier. | |
virtual double | GetVal (double x) const =0 |
Return the function output for input x. More... | |
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. | |
virtual void | ArchiveOut (ChArchiveOut &archive_out) |
Method to allow serialization of transient data to archives. | |
virtual void | ArchiveIn (ChArchiveIn &archive_in) |
Method to allow de-serialization of transient data from archives. More... | |
Member Function Documentation
◆ ArchiveIn()
|
virtual |
Method to allow de-serialization of transient data from archives.
Method to allow de serialization of transient data from archives.
Reimplemented in chrono::ChFunctionSequence, chrono::ChFunctionConstJerk, chrono::ChFunctionBSpline, chrono::ChFunctionConstAcc, chrono::ChFunctionIntegral, chrono::ChFunctionFillet3, chrono::ChFunctionInterp, chrono::ChFunctionOperator, chrono::ChFunctionPoly23, chrono::ChFunctionSine, chrono::ChFunctionPoly345, chrono::ChFunctionPoly, chrono::ChFunctionSetpoint, chrono::ChFunctionCycloidal, chrono::ChFunctionDerivative, chrono::ChFunctionRamp, chrono::ChFunctionMirror, chrono::ChFunctionConst, chrono::ChFunctionSineStep, and chrono::ChFunctionRepeat.
◆ GetDer()
|
virtual |
Return the first derivative of the function.
Default implementation computes a numerical differentiation. Inherited classes may override this method with a more efficient implementation (e.g. analytical solution).
Reimplemented in chrono::ChFunctionConstJerk, chrono::ChFunctionBSpline, chrono::ChFunctionSequence, chrono::ChFunctionConstAcc, chrono::ChFunctionFillet3, chrono::ChFunctionPoly345, chrono::ChFunctionCycloidal, chrono::ChFunctionInterp, chrono::ChFunctionPoly23, chrono::ChFunctionSine, chrono::ChFunctionConst, chrono::ChFunctionRamp, chrono::ChFunctionPoly, chrono::ChFunctionSetpoint, and chrono::ChFunctionSineStep.
◆ GetDer2()
|
virtual |
Return the second derivative of the function.
Default implementation computes a numerical differentiation. Inherited classes may override this method with a more efficient implementation (e.g. analytical solution).
Reimplemented in chrono::ChFunctionConstJerk, chrono::ChFunctionBSpline, chrono::ChFunctionSequence, chrono::ChFunctionConstAcc, chrono::ChFunctionFillet3, chrono::ChFunctionPoly345, chrono::ChFunctionCycloidal, chrono::ChFunctionInterp, chrono::ChFunctionPoly23, chrono::ChFunctionSine, chrono::ChFunctionConst, chrono::ChFunctionRamp, chrono::ChFunctionPoly, chrono::ChFunctionSetpoint, and chrono::ChFunctionSineStep.
◆ GetDer3()
|
virtual |
Return the third derivative of the function.
Default implementation computes a numerical differentiation. Inherited classes may override this method with a more efficient implementation (e.g. analytical solution).
Reimplemented in chrono::ChFunctionConstJerk, chrono::ChFunctionBSpline, chrono::ChFunctionCycloidal, and chrono::ChFunctionPoly345.
◆ GetDerN()
|
virtual |
Return the Nth derivative of the function (up to 3rd derivative).
Alias for other GetDerX functions.
◆ GetIntegral()
|
virtual |
Estimate the integral of the function (or its der_order derivative) over the range [xmin, xmax].
The estimate is based on function evaluation at equally-spaced points.
◆ GetMax()
|
virtual |
Estimate the maximum of the function (or its der_order derivative) in the range [xmin, xmax].
The estimate is based on function evaluation at equally-spaced points.
◆ GetMean()
|
virtual |
Estimate the mean of the function (or its der_order derivative) in the range [xmin, xmax].
The estimate is based on function evaluation at equally-spaced points.
◆ GetMin()
|
virtual |
Estimate the minimum of the function (or its der_order derivative) in the range [xmin, xmax].
The estimate is based on function evaluation at equally-spaced points.
◆ GetNegativeAccelerationCoeff()
|
inlinevirtual |
Compute the negative acceleration coefficient.
(derived classes should override this).
Reimplemented in chrono::ChFunctionConstAcc, chrono::ChFunctionPoly23, and chrono::ChFunctionPoly345.
◆ GetPositiveAccelerationCoeff()
|
inlinevirtual |
Compute the positive acceleration coefficient.
(derived classes should override this).
Reimplemented in chrono::ChFunctionConstAcc, chrono::ChFunctionPoly23, and chrono::ChFunctionPoly345.
◆ GetSquaredMean()
|
virtual |
Estimate the squared mean of the function (or its der_order derivative) in the range [xmin, xmax].
The estimate is based on function evaluation at equally-spaced points.
◆ GetVal()
|
pure virtual |
Return the function output for input x.
Must be overridden by specialized classes.
Implemented in chrono::ChFunctionConstJerk, chrono::ChFunctionBSpline, chrono::ChFunctionSequence, chrono::ChFunctionConstAcc, chrono::ChFunctionOperator, chrono::ChFunctionFillet3, chrono::ChFunctionIntegral, chrono::ChFunctionPoly345, chrono::ChFunctionRepeat, chrono::ChFunctionDerivative, chrono::ChFunctionInterp, chrono::ChFunctionPoly23, chrono::ChFunctionSine, chrono::ChFunctionCycloidal, chrono::ChFunctionMirror, chrono::ChFunctionRamp, chrono::ChFunctionConst, chrono::ChFunctionPoly, chrono::ChFunctionSetpoint, chrono::ChFunctionLambda, and chrono::ChFunctionSineStep.
◆ GetVelocityCoefficient()
|
inlinevirtual |
Compute the velocity coefficient.
(derived classes must override this).
Reimplemented in chrono::ChFunctionConstAcc, chrono::ChFunctionPoly23, and chrono::ChFunctionPoly345.
◆ GetWeight()
|
inlinevirtual |
Return the weight of the function.
(useful for applications where you need to mix different weighted ChFunctions)
Reimplemented in chrono::ChFunctionSequence.
◆ OutputToASCIIFile()
|
virtual |
Store X-Y pairs to an ASCII File.
Values are separated by delimiter (default=','). The function is sampled samples times, from xmin to xmax.
◆ SampleUpToDerN()
|
virtual |
Sample function on given interval [xmin, xmax], up to derN derivative (0 being the function ouput itself).
Store interval x=[xmin:step:xmax] and function evaluations as columns into matrix.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono/functions/ChFunctionBase.h
- /builds/uwsbel/chrono/src/chrono/functions/ChFunctionBase.cpp