CG  Version 25
Public Types | Public Member Functions | List of all members
TimeFunction Class Reference

This class defines a function of time that can be used to rotate or translate a body. More...

#include <TimeFunction.h>

Inheritance diagram for TimeFunction:
Inheritance graph
[legend]
Collaboration diagram for TimeFunction:
Collaboration graph
[legend]

Public Types

enum  FunctionTypeEnum {
  linearFunction, sinusoidalFunction, rampFunction, mappingFunction,
  userDefinedFunction
}
 
enum  ComposeTypeEnum { composeWillMultiply, composeWillAdd }
 

Public Member Functions

 TimeFunction ()
 constructor. This class defines a function of time that can be used to rotate or translate a body
 
 TimeFunction (const TimeFunction &tf, const CopyType ct=DEEP)
 Copy constructor.
 
 ~TimeFunction ()
 destructor.
 
TimeFunctionoperator= (const TimeFunction &tf)
 Equals operator. Set this object to be equal to another.
 
int compose (TimeFunction *preFunc, const ComposeTypeEnum ct=composeWillMultiply)
 Compose this TimeFunction with another which is applied first.
 
int eval (const real t, real &f)
 Evaluate the time function.
 
int eval (const real t, real &f, real &ft)
 Evaluate the time function and its first derivative.
 
int evalDerivative (const real t, real &fp, int derivative, bool computeComposed=true)
 Evaluate the time function and an arbitraty derivative.
 
int setLinearFunction (const real a0, const real a1)
 Set the coefficients of the linear function, f(t)=a0 + a1*t.
 
int setSinusoidFunction (const real b0, const real f0, const real t0)
 Set the coefficients of the sinusoid function, f(t)=b0*sin(2.*Pi*f0*(t-t0));.
 
int update (GenericGraphicsInterface &gi)
 Interactively update the TimeFunction parameters:
 
int get (const GenericDataBase &dir, const aString &name)
 Get from a data base file.
 
int put (GenericDataBase &dir, const aString &name) const
 Put to a data base file.
 

Detailed Description

This class defines a function of time that can be used to rotate or translate a body.

Member Enumeration Documentation

Enumerator
composeWillMultiply 
composeWillAdd 
Enumerator
linearFunction 
sinusoidalFunction 
rampFunction 
mappingFunction 
userDefinedFunction 

Constructor & Destructor Documentation

TimeFunction::TimeFunction ( )

constructor. This class defines a function of time that can be used to rotate or translate a body

References composeWillMultiply, and linearFunction.

Referenced by get(), operator=(), and update().

TimeFunction::TimeFunction ( const TimeFunction tf,
const CopyType  ct = DEEP 
)

Copy constructor.

TimeFunction::~TimeFunction ( )

destructor.

Member Function Documentation

int TimeFunction::compose ( TimeFunction preFunc,
const ComposeTypeEnum  ct = composeWillMultiply 
)

Compose this TimeFunction with another which is applied first.

Parameters
motion(input) : apply this TimeFunction before the current. (set to NULL for none)
ct(input) : specify whether to multiply or add when composing.

Referenced by evalDerivative().

int TimeFunction::eval ( const real  t,
real &  f 
)

Evaluate the time function.

Parameters
t(input) : evaluate at this time.
f(output) : value at time t.

References evalDerivative().

Referenced by DomainSolver::computeBodyForcing(), evalDerivative(), RigidBodyMotion::getBodyForces(), MatrixMotion::getMotion(), DomainSolver::setVariableBoundaryValues(), and update().

int TimeFunction::eval ( const real  t,
real &  f,
real &  ft 
)

Evaluate the time function and its first derivative.

Parameters
t(input) : evaluate at this time.
f,ft(output) : function and derivative at time t.

References evalDerivative().

int TimeFunction::evalDerivative ( const real  t,
real &  fp,
int  derivative,
bool  computeComposed = true 
)

Evaluate the time function and an arbitraty derivative.

Parameters
t(input) : evaluate at this time.
f,ft(output) : function and derivative at time t.
derivative(input) : evaluate this derivative.
computeComposed(input) : if true (default) then evaluate the composed function, otherwise just evaluate the un-composed mapping.

References assert(), compose(), composeWillAdd, composeWillMultiply, eval(), evalDerivative(), linearFunction, mappingFunction, OV_ABORT(), printF(), r, ramp1, ramp1t, ramp1tt, ramp1ttt, ramp2, ramp2t, ramp2tt, ramp2ttt, ramp3, ramp3t, ramp3tt, ramp3ttt, ramp4, ramp4t, ramp4tt, ramp4ttt, rampFunction, scale, sinusoidalFunction, userDefinedFunction, and x.

Referenced by eval(), evalDerivative(), MatrixMotion::getMotion(), and update().

int TimeFunction::get ( const GenericDataBase &  dir,
const aString &  name 
)
TimeFunction & TimeFunction::operator= ( const TimeFunction tf)

Equals operator. Set this object to be equal to another.

References TimeFunction().

int TimeFunction::put ( GenericDataBase &  dir,
const aString &  name 
) const

Put to a data base file.

References put().

Referenced by MatrixMotion::put(), and put().

int TimeFunction::setLinearFunction ( const real  a0_,
const real  a1_ 
)

Set the coefficients of the linear function, f(t)=a0 + a1*t.

Parameters
a0,a1(input) parameters in the linear function

References linearFunction.

Referenced by MatrixMotion::MatrixMotion().

int TimeFunction::setSinusoidFunction ( const real  b0_,
const real  f0_,
const real  t0_ 
)

Set the coefficients of the sinusoid function, f(t)=b0*sin(2.*Pi*f0*(t-t0));.

Parameters
b0,f0,t0(input) parameters in the sinsoidal function

References sinusoidalFunction.

int TimeFunction::update ( GenericGraphicsInterface &  gi)

The documentation for this class was generated from the following files: