Allows to work with piecewise-continous function defined over a scalar time interval.
More...
|
returnValue | add (double tStart, double tEnd, const DVector constant) |
|
returnValue | add (const VariablesGrid &sampledData, InterpolationMode mode=IM_LINEAR) |
|
returnValue | add (double tStart, double tEnd, const Function ¶meterization_) |
|
| Curve () |
|
| Curve (const Curve &arg) |
|
returnValue | discretize (const Grid &discretizationGrid, VariablesGrid &result) const |
|
returnValue | evaluate (double t, double *result) const |
|
returnValue | evaluate (double t, DVector &result) const |
|
returnValue | evaluate (double tStart, double tEnd, VariablesGrid &result) const |
|
int | getDim () const |
|
int | getNumIntervals () const |
|
returnValue | getTimeDomain (double tStart, double tEnd) const |
|
returnValue | getTimeDomain (const uint &idx, double tStart, double tEnd) const |
|
BooleanType | isContinuous () const |
|
BooleanType | isEmpty () const |
|
BooleanType | isInTimeDomain (double t) const |
|
Curve | operator() (uint idx) const |
|
Curve & | operator= (const Curve &arg) |
|
| ~Curve () |
|
Allows to work with piecewise-continous function defined over a scalar time interval.
The class Curve allows to setup and evaluate piecewise-continous functions that are defined over a scalar time interval and map into an Vectorspace of given dimension.
\author Boris Houska, Hans Joachim Ferreau
Definition at line 52 of file curve.hpp.
Adds a constant piece to the curve. If other pieces of the curve have previously
been added, the start time "tStart" of the time interval [tStart,tEnd] should
contain the last time-point of the curve piece which has been added before.
The curve is not required to be continous at the boundaries of its intervals.
Note that the dimension of the constant input vector should have the same
dimensions as previously added curve pieces. If no other piece has been added
before, only tStart < tEnd is required, while the dimension of the curve will
be set to the dimension of the vector, which is added.
- Parameters
-
tStart | start of the time interval of the curve piece to be added.
|
tEnd | end of the time interval to be added.
|
constant | the constant value of the curve on the interval [tStart,tEnd].
|
- Returns
- SUCCESSFUL_RETURN
RET_TIME_INTERVAL_NOT_VALID
RET_INPUT_DIMENSION_MISMATCH
Definition at line 143 of file curve.cpp.
Adds new curve pieces, which are given in a sampled form (VariablesGrid). In
order to store the curve pieces as continous functions the sampled data will be
interpolated depending on an interpolation mode. Note that the number of
intervals, which are added, will depend on this interpolation mode. The default
interpolation mode is "IM_LINEAR", i.e. linear interpolation. In this case the
number of added intervals is coinciding with the number of intervals of the
VariablesGrid, which is passed. For the dimension of the variables grid as well
the grid's start- and endpoint the same policy as for the other "add" functions
applies, i.e. the dimension should be equal to previously added pieces and the
time intervals should fit together.
- Parameters
-
sampledData | the data in sampled form to be interpolated and added.
|
mode | the interploation mode (default: linear interpolation)
|
- Returns
- SUCCESSFUL_RETURN
RET_TIME_INTERVAL_NOT_VALID
RET_INPUT_DIMENSION_MISMATCH
Definition at line 158 of file curve.cpp.
Adds a new piece to the curve, which is defined on the time interval
[tStart,tEnd] to be added. The function, which is passed as an argument of this
routine, should be the parameterization of the piece of curve to be added. Note
that the input function "parameterization" is only allowed to depend on the time.
If the parameterization depends e.g. on DifferentialStates, Controls etc. an
error message will be returned. As for the other "add" routines the dimension of
function as well as the time interval should fit to the previously added curve
pieces.
- Parameters
-
tStart | start of the interval to be added.
|
tEnd | end of the time interval to be added.
|
parameterization_ | the parameterization of the curve on this interval.
|
- Returns
- SUCCESSFUL_RETURN (if successful)
RET_TIME_INTERVAL_NOT_VALID (if the time interval is not valid)
RET_INPUT_DIMENSION_MISMATCH (if the dimension or dependencies are wrong)
Definition at line 215 of file curve.cpp.
returnValue Curve::evaluate |
( |
double |
t, |
|
|
double * |
result |
|
) |
| const |
Evaluates the curve at a given time point. This routine will store
the result of the evaluation into the double *result. Note that
this double pointer must be allocated by the user. Otherwise,
segmentation faults might occur, which can not be prevented by
this routine. For not time critical operations it is recommended to
use the routine
evaluate( const double t, const DVector &result )
instead, which will throw an error if a dimension mismatch occurs.
However, the routine based on double* is slightly more efficient.
In order to make the allocation correct, use the routines isEmpty()
and getDim() first to obtain (or check) the dimension.
- Parameters
-
t | (input) the time at which the curve should be evaluated.
|
result | (output) the result of the evaluation.
|
- Returns
- SUCCESSFUL_RETURN (if the evaluation was successful.)
RET_INVALID_ARGUMENTS (if the double* result is NULL.)
RET_INVALID_TIME_POINT (if the time point t is out of range.)
RET_MEMBER_NOT_INITIALISED (if the curve is empty)
Definition at line 314 of file curve.cpp.