MULTIBODY SIMULATION SOFTWARE - API documentation

chrono::ChFunction Class Reference

#include <CHfunction.h>

Inheritance diagram for chrono::ChFunction:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 ChFunction (double y_constant)
virtual void Copy (ChFunction *source)
virtual ChFunctionnew_Duplicate ()
virtual int Get_Type ()
void Set_yconst (double y_constant)
double Get_yconst ()
virtual double Get_y (double x)
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 ()
virtual int OptVariablesToVector (ChMatrix<> *mv, int offset)
virtual int VectorToOptVariables (ChMatrix<> *mv, int offset)
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 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 int chrono::ChFunction::Get_Type (  )  [virtual]

Each class inherited from the ChFunction class must return an unique integer identifier with the virtual function Get_type(). This is useful for run-time downcasting etc.

Reimplemented in chrono::ChFunction_Ramp, chrono::ChFunction_Sine, chrono::ChFunction_Sigma, chrono::ChFunction_Mocap, chrono::ChFunction_Poly, chrono::ChFunction_ConstAcc, chrono::ChFunction_Poly345, chrono::ChFunction_Fillet3, chrono::ChFunction_Recorder, chrono::ChFunction_Oscilloscope, chrono::ChFunction_Sequence, chrono::ChFunction_Matlab, chrono::ChFunction_Jscript, chrono::ChFunction_Noise, chrono::ChFunction_Derive, chrono::ChFunction_Integrate, chrono::ChFunction_Mirror, and chrono::ChFunction_Repeat.

void chrono::ChFunction::Set_yconst ( double  y_constant  ) 

Set the constant C for the function, y=C.

double chrono::ChFunction::Get_yconst (  ) 

Get the constant C for the function, y=C.

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

Returns the y value of the function, at position x. (For this base class, it will be a constant value y=C).

Reimplemented in chrono::ChFunction_Ramp, chrono::ChFunction_Sine, chrono::ChFunction_Sigma, chrono::ChFunction_Mocap, chrono::ChFunction_Poly, chrono::ChFunction_ConstAcc, chrono::ChFunction_Poly345, chrono::ChFunction_Fillet3, chrono::ChFunction_Recorder, chrono::ChFunction_Oscilloscope, chrono::ChFunction_Sequence, chrono::ChFunction_Matlab, chrono::ChFunction_Jscript, chrono::ChFunction_Noise, chrono::ChFunction_Derive, chrono::ChFunction_Integrate, chrono::ChFunction_Mirror, and chrono::ChFunction_Repeat.

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_Ramp, chrono::ChFunction_Sine, chrono::ChFunction_Sigma, chrono::ChFunction_Mocap, chrono::ChFunction_Poly, chrono::ChFunction_ConstAcc, chrono::ChFunction_Poly345, chrono::ChFunction_Fillet3, chrono::ChFunction_Recorder, chrono::ChFunction_Sequence, 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_Ramp, chrono::ChFunction_Sine, chrono::ChFunction_Sigma, chrono::ChFunction_Mocap, chrono::ChFunction_Poly, chrono::ChFunction_ConstAcc, chrono::ChFunction_Poly345, chrono::ChFunction_Fillet3, chrono::ChFunction_Recorder, chrono::ChFunction_Sequence, and chrono::ChFunction_Matlab.

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 void chrono::ChFunction::Extimate_x_range ( double &  xmin,
double &  xmax 
) [virtual]

These functions can be used to implement automatic zooming on the most representative range of function (if GUI is implemented)

Reimplemented in chrono::ChFunction_Sigma, chrono::ChFunction_Mocap, chrono::ChFunction_ConstAcc, chrono::ChFunction_Poly345, chrono::ChFunction_Fillet3, chrono::ChFunction_Recorder, chrono::ChFunction_Oscilloscope, chrono::ChFunction_Sequence, chrono::ChFunction_Derive, chrono::ChFunction_Integrate, chrono::ChFunction_Mirror, and chrono::ChFunction_Repeat.

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

double chrono::ChFunction::Compute_max ( double  xmin,
double  xmax,
double  sampling_step,
int  derivate 
) [virtual]

Computes the maximum of y(x) in a range xmin-xmax, using a sampling method.

double chrono::ChFunction::Compute_min ( double  xmin,
double  xmax,
double  sampling_step,
int  derivate 
) [virtual]

Computes the minimum of y(x) in a range xmin-xmax, using a sampling method.

double chrono::ChFunction::Compute_mean ( double  xmin,
double  xmax,
double  sampling_step,
int  derivate 
) [virtual]

Computes the mean value of y(x) in a range xmin-xmax, using a sampling method.

double chrono::ChFunction::Compute_sqrmean ( double  xmin,
double  xmax,
double  sampling_step,
int  derivate 
) [virtual]

Computes the square mean val. of y(x) in a range xmin-xmax, using sampling.

double chrono::ChFunction::Compute_int ( double  xmin,
double  xmax,
double  sampling_step,
int  derivate 
) [virtual]

Computes the integral of y(x) in a range xmin-xmax, using a sampling method.

virtual double chrono::ChFunction::Get_Ca_pos (  )  [virtual]

Computes the positive acceleration coefficient (inherited classes should customize this).

Reimplemented in chrono::ChFunction_Sigma, chrono::ChFunction_ConstAcc, and chrono::ChFunction_Poly345.

virtual double chrono::ChFunction::Get_Ca_neg (  )  [virtual]

Computes the positive acceleration coefficient (inherited classes should customize this).

Reimplemented in chrono::ChFunction_Sigma, chrono::ChFunction_ConstAcc, and chrono::ChFunction_Poly345.

virtual double chrono::ChFunction::Get_Cv (  )  [virtual]

Computes the speed coefficient (inherited classes must customize this).

Reimplemented in chrono::ChFunction_Sigma, chrono::ChFunction_ConstAcc, and chrono::ChFunction_Poly345.

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.

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.

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

Method to allow serialization of transient data in ascii, as a readable item, for example "chrono::GetLog() << myobject;"

Reimplemented in chrono::ChFunction_Ramp, chrono::ChFunction_Sine, chrono::ChFunction_Sigma, chrono::ChFunction_Mocap, chrono::ChFunction_Poly, chrono::ChFunction_ConstAcc, chrono::ChFunction_Poly345, chrono::ChFunction_Fillet3, chrono::ChFunction_Recorder, chrono::ChFunction_Oscilloscope, chrono::ChFunction_Sequence, chrono::ChFunction_Matlab, chrono::ChFunction_Jscript, chrono::ChFunction_Noise, chrono::ChFunction_Derive, chrono::ChFunction_Integrate, chrono::ChFunction_Mirror, and chrono::ChFunction_Repeat.

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

Method to allow deserializing a persistent binary archive (ex: a file) into transient data.

Reimplemented in chrono::ChFunction_Ramp, chrono::ChFunction_Sine, chrono::ChFunction_Sigma, chrono::ChFunction_Mocap, chrono::ChFunction_Poly, chrono::ChFunction_ConstAcc, chrono::ChFunction_Poly345, chrono::ChFunction_Fillet3, chrono::ChFunction_Recorder, chrono::ChFunction_Oscilloscope, chrono::ChFunction_Sequence, chrono::ChFunction_Matlab, chrono::ChFunction_Jscript, chrono::ChFunction_Noise, chrono::ChFunction_Derive, chrono::ChFunction_Integrate, chrono::ChFunction_Mirror, and chrono::ChFunction_Repeat.

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

Method to allow serializing transient data into a persistent binary archive (ex: a file).

Reimplemented in chrono::ChFunction_Ramp, chrono::ChFunction_Sine, chrono::ChFunction_Sigma, chrono::ChFunction_Mocap, chrono::ChFunction_Poly, chrono::ChFunction_ConstAcc, chrono::ChFunction_Poly345, chrono::ChFunction_Fillet3, chrono::ChFunction_Recorder, chrono::ChFunction_Oscilloscope, chrono::ChFunction_Sequence, chrono::ChFunction_Matlab, chrono::ChFunction_Jscript, chrono::ChFunction_Noise, chrono::ChFunction_Derive, chrono::ChFunction_Integrate, chrono::ChFunction_Mirror, and chrono::ChFunction_Repeat.

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.

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.


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