CG
Version 25
|
This class defines a function of time that can be used to rotate or translate a body. More...
#include <TimeFunction.h>
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. | |
TimeFunction & | operator= (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. | |
This class defines a function of time that can be used to rotate or translate a body.
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.
int TimeFunction::compose | ( | TimeFunction * | preFunc, |
const ComposeTypeEnum | ct = composeWillMultiply |
||
) |
Compose this TimeFunction with another which is applied first.
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.
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.
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.
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 | ||
) |
Get from a data base file.
References get(), and TimeFunction().
Referenced by DomainSolver::computeBodyForcing(), Parameters::defineVariableBoundaryValues(), MatrixMotion::get(), get(), Parameters::setupBodyForcing(), and DomainSolver::setVariableBoundaryValues().
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 |
int TimeFunction::setLinearFunction | ( | const real | a0_, |
const real | a1_ | ||
) |
Set the coefficients of the linear function, f(t)=a0 + a1*t.
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));.
b0,f0,t0 | (input) parameters in the sinsoidal function |
References sinusoidalFunction.
int TimeFunction::update | ( | GenericGraphicsInterface & | gi | ) |
Interactively update the TimeFunction parameters:
References assert(), composeWillAdd, composeWillMultiply, d, eval(), evalDerivative(), f, ft, h, i, linearFunction, mappingFunction, n, printF(), rampFunction, sinusoidalFunction, TimeFunction(), update(), userDefinedFunction, and xv.
Referenced by Parameters::defineVariableBoundaryValues(), RigidBodyMotion::getBodyForceOption(), Parameters::setupBodyForcing(), MatrixMotion::update(), and update().