MULTIBODY SIMULATION SOFTWARE - API documentation
Public Member Functions | Static Public Member Functions
chrono::ChFunction Class Reference

#include <CHfunction_Base.h>

Inheritance diagram for chrono::ChFunction:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ChFunctionnew_Duplicate ()=0
virtual int Get_Type ()
virtual double Get_y (double x)=0
virtual double Get_y_dx (double x)
virtual double Get_y_dxdx (double x)
virtual double Get_weight (double x)
virtual void Extimate_x_range (double &xmin, double &xmax)
virtual void Extimate_y_range (double xmin, double xmax, double &ymin, double &ymax, int derivate)
virtual double Get_y_dN (double x, int derivate)
virtual double Compute_max (double xmin, double xmax, double sampling_step, int derivate)
virtual double Compute_min (double xmin, double xmax, double sampling_step, int derivate)
virtual double Compute_mean (double xmin, double xmax, double sampling_step, int derivate)
virtual double Compute_sqrmean (double xmin, double xmax, double sampling_step, int derivate)
virtual double Compute_int (double xmin, double xmax, double sampling_step, int derivate)
virtual double Get_Ca_pos ()
virtual double Get_Ca_neg ()
virtual double Get_Cv ()
virtual int MakeOptVariableTree (ChList< chjs_propdata > *mtree)
virtual int OptVariableCount ()
OPT_VARIABLES_START virtual
OPT_VARIABLES_END int 
HandleNumber ()
virtual int HandleAccess (int handle_id, double mx, double my, bool set_mode)
virtual void StreamOUT (ChStreamOutAscii &mstream)
virtual void StreamIN (ChStreamInBinary &mstream)
virtual void StreamOUT (ChStreamOutBinary &mstream)
virtual int FilePostscriptPlot (ChFile_ps *m_file, int plotY, int plotDY, int plotDDY)
virtual int FileAsciiPairsSave (ChStreamOutAscii &m_file, double xmin=0, double xmax=1, int msamples=200)

Static Public Member Functions

static int VariableTreeToFullNameVar (ChList< chjs_propdata > *mtree, ChList< chjs_fullnamevar > *mlist)

Detailed Description

THE INTERFACE BASE CLASS FOR SCALAR FUNCTIONS OF TYPE:

y= f(x)

The ChFunction class defines the base class for all Chrono functions of type y=f(x), that is scalar functions of an input variable x (usually, the time). ChFunctions are often used to set time-dependent properties, for example to set motion laws in linear actuators, engines, etc. This base class just represent a constant function of the type y= C. Inherited classes must override at least the Get_y() method, in order to represent more complex functions.


Member Function Documentation

virtual void chrono::ChFunction::Extimate_x_range ( double &  xmin,
double &  xmax 
) [virtual]
int chrono::ChFunction::FileAsciiPairsSave ( ChStreamOutAscii m_file,
double  xmin = 0,
double  xmax = 1,
int  msamples = 200 
) [virtual]

Save function as X-Y pairs separated by space, with CR at each pair, into an Ascii file. The output file can be later loaded into Excel, GnuPlot or other tools. The function is 'sampled' for nsteps times, from xmin to xmax.

int chrono::ChFunction::FilePostscriptPlot ( ChFile_ps m_file,
int  plotY,
int  plotDY,
int  plotDDY 
) [virtual]

Plot function in graph space of the ChFile_ps postscript file where zoom factor, centering, colour, thickness etc. are already defined. If plotDY=true, plots also the derivative, etc.

virtual int chrono::ChFunction::Get_Type ( ) [virtual]
virtual double chrono::ChFunction::Get_weight ( double  x) [virtual]

Returns the weight of the function (useful for applications where you need to mix different weighted ChFunctions)

Reimplemented in chrono::ChFunction_Sequence.

virtual double chrono::ChFunction::Get_y ( double  x) [pure virtual]
double chrono::ChFunction::Get_y_dN ( double  x,
int  derivate 
) [virtual]

Generic derivative: if derivate=0 is like Get_y(), if derivate=1 is like Get_y_dx(), etc. Note: in current release 'derivate' can be only 0,1,2

virtual double chrono::ChFunction::Get_y_dx ( double  x) [virtual]

Returns the dy/dx derivative of the function, at position x. Note that inherited classes may also avoid overriding this method, because this base method already provide a general-purpose numerical differentiation to get dy/dx only from the Get_y() function. (however, if the analytical derivative is known, it may better to implement a custom method).

Reimplemented in chrono::ChFunction_Sequence, chrono::ChFunction_Mocap, chrono::ChFunction_Fillet3, chrono::ChFunction_Recorder, chrono::ChFunction_ConstAcc, chrono::ChFunction_Ramp, chrono::ChFunction_Const, chrono::ChFunction_Sine, chrono::ChFunction_Sigma, chrono::ChFunction_Poly, chrono::ChFunction_Poly345, and chrono::ChFunction_Matlab.

virtual double chrono::ChFunction::Get_y_dxdx ( double  x) [virtual]

Returns the ddy/dxdx double derivative of the function, at position x. Note that inherited classes may also avoid overriding this method, because this base method already provide a general-purpose numerical differentiation to get ddy/dxdx only from the Get_y() function. (however, if the analytical derivative is known, it may be better to implement a custom method).

Reimplemented in chrono::ChFunction_Sequence, chrono::ChFunction_Mocap, chrono::ChFunction_Fillet3, chrono::ChFunction_Recorder, chrono::ChFunction_ConstAcc, chrono::ChFunction_Ramp, chrono::ChFunction_Const, chrono::ChFunction_Sine, chrono::ChFunction_Sigma, chrono::ChFunction_Poly, chrono::ChFunction_Poly345, and chrono::ChFunction_Matlab.

virtual int chrono::ChFunction::HandleAccess ( int  handle_id,
double  mx,
double  my,
bool  set_mode 
) [virtual]

Gets the x and y position of handle, given identifier. If set mode, x and y values are stored. Return false if handle not found.

Reimplemented in chrono::ChFunction_Sequence.

OPT_VARIABLES_START virtual OPT_VARIABLES_END int chrono::ChFunction::HandleNumber ( ) [virtual]

If the function has some handles (mouse-sensible markers on screen), implement these functions:

Reimplemented in chrono::ChFunction_Sequence.

void chrono::ChFunction::StreamIN ( ChStreamInBinary mstream) [virtual]
void chrono::ChFunction::StreamOUT ( ChStreamOutAscii mstream) [virtual]
void chrono::ChFunction::StreamOUT ( ChStreamOutBinary mstream) [virtual]

CHRONO::ENGINE
C++ library for multibody simulation, (C) Alessandro Tasora
This API documentation has been generated on Tue Jul 10 2012 by Doxygen