#include <rdStorage.h>
Inheritance diagram for rdStorage:

Public Member Functions | |
| rdStorage (int aCapacity=rdStorage_DEFAULT_CAPACITY, const char *aName="UNKNOWN") | |
| Default constructor. | |
| rdStorage (const char *aFileName) | |
| Construct an rdStorage instance from file. | |
| rdStorage (const rdStorage &aStorage, bool aCopyData=true) | |
| Copy constructor. | |
| rdStorage (const rdStorage &aStorage, int aStateIndex, int aN, const char *aDelimiter="\t") | |
| Construct a copy of a specified storage taking only a subset of the states. | |
| virtual | ~rdStorage () |
| Destructor. | |
| void | setWriteSIMMHeader (bool aTrueFalse) |
| Set the whether or not to write a header appropriate for a SIMM motion file. | |
| bool | getWriteSIMMHeader () const |
| Get the whether or not to write a header appropriate for a SIMM motion file. | |
| void | setHeaderToken (const char *aToken) |
| Set the header token. | |
| const char * | getHeaderToken () const |
| Get the header token of this storage. | |
| void | setColumnLabels (const char *aLabels=NULL) |
| Set a labels string for the columns in this rdStorage instance. | |
| const char * | getColumnLabels () const |
| Get column labels string. | |
| void | setStepInterval (int aStepInterval) |
| Set the step interval. | |
| int | getStepInterval () const |
| Get the step interval. | |
| int | getSmallestNumberOfStates () |
| Get the smallest number of states. | |
| rdStateVector * | getStateVector (int aTimeIndex) const |
| Get the rdStateVector at a spcified time index. | |
| rdStateVector * | getLastStateVector () const |
| Get the last states stored. | |
| double | getFirstTime () |
| Get the time of the first stored states. | |
| double | getLastTime () |
| Get the time of the last states. | |
| int | getTime (int aTimeIndex, double &rTime, int aStateIndex=-1) const |
| Get the time at a specified time index for a specified state. | |
| int | getTimeColumn (double *&rTimes, int aStateIndex=-1) |
| Get the times for a specified state. | |
| int | getData (int aTimeIndex, int aStateIndex, double &rValue) const |
| Get a data value of a specified state at a specified time index. | |
| int | getData (int aTimeIndex, int aStateIndex, int aN, double *rData) const |
| At a specified time index, get a number of state values starting at a specified state. | |
| int | getData (int aTimeIndex, int aN, double **rData) const |
| Get the first aN states at a specified time index. | |
| int | getData (int aTimeIndex, int aN, double *rData) const |
| Get the first aN states at a specified time index. | |
| int | getData (double aTime, int aN, double **rData) |
| Get the first aN states at a specified time. | |
| int | getData (double aTime, int aN, double *rData) |
| Get the first aN states at a specified time. | |
| int | getDataColumn (int aStateIndex, double *&rData) const |
| Get the data corresponding to a specified state. | |
| void | resetStorage (double aT) |
| Reset the storage to start storing at the index which occurs at or just prior to time aT. | |
| virtual int | append (void *aVec) |
| Append a copy of an rdStateVector. | |
| virtual int | append (rdPtrArray *aArray) |
| Append copies of all state vectors in an rdStorage object. | |
| virtual int | append (double aT, int aN, double *aY) |
| Append an array of data that occured at a specified time. | |
| virtual int | store (int aStep, double aT, int aN, double *aY) |
| Store a simulation vector. | |
| void | shiftTime (double aValue) |
| Shift the times of all state vectors. | |
| void | scaleTime (double aValue) |
| Scale the times of all state vectors. | |
| void | add (double aValue) |
| Add a value to all state vectors in this storage instance. | |
| void | add (int aN, double aY[]) |
| Add an array to all state vectors in this storage instance. | |
| void | add (rdStateVector *aStateVector) |
| Add a state vector to the all state vectors in this storage instance. | |
| void | add (rdStorage *aStorage) |
| Add a storage instance to this storage instance. | |
| void | subtract (double aValue) |
| Subtract a value from all state vectors in this storage instance. | |
| void | subtract (int aN, double aY[]) |
| Subtract an array from all state vectors in this storage instance. | |
| void | subtract (rdStateVector *aStateVector) |
| Subtract a state vector from all state vectors in this storage instance. | |
| void | subtract (rdStorage *aStorage) |
| Subtract a storage instance to this storage instance. | |
| void | multiply (double aValue) |
| Multiply all state vectors in this storage instance by a value. | |
| void | multiply (int aN, double aY[]) |
| Multiply all state vectors in this storage instance by an array. | |
| void | multiply (rdStateVector *aStateVector) |
| Multiply all state vectors in this storage instance by a state vector. | |
| void | multiply (rdStorage *aStorage) |
| Multipy this storage instance by a storage instance. | |
| void | divide (double aValue) |
| Divide all state vectors in this storage instance by a value. | |
| void | divide (int aN, double aY[]) |
| Divide all state vectors in this storage instance by an array. | |
| void | divide (rdStateVector *aStateVector) |
| Divide all state vectors in this storage instance by a state vector. | |
| void | divide (rdStorage *aStorage) |
| Divide this storage instance by a storage instance. | |
| rdStorage * | integrate (int aI1=-2, int aI2=-1) |
| Integrate the state vectors between aI1 and aI2. | |
| rdStorage * | integrate (double aT1, double aT2) |
| Integrate the state vectors between times aTI and aTF. | |
| int | computeArea (int aN, double *aArea) |
| Compute the area of the first aN states stored for all state vectors stored in this storage instance. | |
| int | computeArea (double aTI, double aTF, int aN, double *aArea) |
| Compute the area of the first aN states stored between the times aTI and aTF. | |
| int | computeAverage (int aN, double *aAve) |
| Compute the average value of the first aN states stored for all state vectors stored in this storage instance. | |
| int | computeAverage (double aTI, double aTF, int aN, double *aAve) |
| Compute the average value of the first aN states stored between the times aTI and aTF. | |
| int | findIndex (double aT) |
| Find the index of the storage element that occured immediately before or at a specified time ( aT <= getTime(index) ). | |
| int | findIndex (int aI, double aT) |
| Find the index of the storage element that occured immediately before or at time aT ( aT <= getTime(index) ). | |
| void | print () |
| Print the contents of this storage instance to standard output. | |
| int | print (const char *aFileName, const char *aMode="w") |
| Print the contents of this storage instance to a file. | |
| int | print (const char *aFileName, double aDT, const char *aMode="w") |
| Print the contents of this storage instance to a file named by the argument aFileaName using uniform time spacing. | |
Static Public Attributes | |
| const double | LARGE_NEGATIVE = -1.0e-30 |
| Large negative number. | |
| const double | LARGE_POSITIVE = 1.0e-30 |
| Large positive number. | |
| const char * | DEFAULT_HEADER_TOKEN = "endheader" |
| Default token used to mark the end of the storage description in a file. | |
Protected Attributes | |
| char | _headerToken [rdObject_NAME_LENGTH] |
| Token used to mark the end of the description in a file. | |
| char * | _columnLabels |
| Column labels for the states, usually tab delimited. | |
| int | _stepInterval |
| Step interval at which states in a simulation are stored. | |
| int | _lastI |
| Last index at which a search was started. | |
| bool | _writeSIMMHeader |
| Flag for whether or not to insert a SIMM style header. | |
Private Member Functions | |
| void | allocateCapacity () |
| void | setNull () |
| Set all states to their null or default values. | |
| void | copyData (const rdStorage &aStorage) |
| Copy the data stored by another storage instance. | |
| int | writeHeader (FILE *rFP, double aDT=-1) |
| Write the header. | |
| int | writeSIMMHeader (FILE *rFP, double aDT=-1) |
| Write a header appropriate for SIMM motion files. | |
| int | writeDescription (FILE *rFP) |
| Write the description. | |
| int | writeColumnLabels (FILE *rFP) |
| Write the column labels. | |
| int | writeDefaultColumnLabels (FILE *rFP) |
| Write default column labels. | |
A statevector is an array of data that has an associated time stamp (see rdStateVector). Generally, it is used to store the time histories of the states during an integration, but may be used for a variety of applications. Note that it is assumed by several methods in this class that the time stamps of stored statevectors are monotonically increasing.
When stored as a file, the statevectors are stored in rows. This first value in a row is the time stamp at which the states occured. The rest of the elements in a row are the states. Therefore, each column of data in a file corresponds to a particular state.
In an rdStorage object, statevectors (or rows) are indexed by the TimeIndex, and a particular state (or column) is indexed by the StateIndex.
|
|
Construct an rdStorage instance from file. This constructor is far from bullet proof.
|
|
||||||||||||||||||||
|
Construct a copy of a specified storage taking only a subset of the states.
|
|
|
Destructor. The stored rdStateVectors are deleted during destruction. |
|
|
Add a storage instance to this storage instance. Linear interpolation or extrapolation is used to get the values of the states that correspond in time to the states held in this storage instance.
|
|
|
Add a state vector to the all state vectors in this storage instance.
|
|
||||||||||||
|
Add an array to all state vectors in this storage instance. Only the first aN states of each state vector are altered.
|
|
|
Add a value to all state vectors in this storage instance.
|
|
||||||||||||||||
|
Append an array of data that occured at a specified time.
|
|
|
Append copies of all state vectors in an rdStorage object. This method overrides rdArray::append(rdArray). Currently, there is no difference. The override is done for completeness.
Reimplemented from rdPtrArray. |
|
|
Append a copy of an rdStateVector. This method overrides rdArray::append(void*). The difference is that the argument is assumed to an rdStateVector and a copy of the statevector is made before appending it.
Reimplemented from rdPtrArray. |
|
||||||||||||||||||||
|
Compute the area of the first aN states stored between the times aTI and aTF. It is assumed that there is enough memory at aArea to hold aN states. If aN exceeds the number of states held in storage, aN is disregarded. The number of valid states in aArea is returned. Note that if aTI and aTF do not fall exactly on the time stamp of a stored state, the states are linearly interpolated to provide an estimate of the state at aTI or at aTF. |
|
||||||||||||
|
Compute the area of the first aN states stored for all state vectors stored in this storage instance. It is assumed that there is enough memory at aArea to hold aN states. If aN exceeds the number of states held in storage, aN is disregarded. The number of valid states in aArea is returned. |
|
||||||||||||||||||||
|
Compute the average value of the first aN states stored between the times aTI and aTF. This method uses computeArea() to compute the area (integral) of each state on the interval [aTI,aTF] and then simply divides by the (aTF-aTI). It is assumed that there is enough memory at aAve to hold aN states. If aN exceeds the number of states held in storage, aN is disregarded. The number of valid states in aAve is returned. Note that if aTI and aTF do not fall exactly on the time stamp of a stored state, the states are linearly interpolated to provide an estimate of the state at aTI or at aTF. |
|
||||||||||||
|
Compute the average value of the first aN states stored for all state vectors stored in this storage instance. This method uses computeArea() to compute the area (integral) and then simply divides by the the time interval (tf-ti). It is assumed that there is enough memory at aAve to hold aN states. If aN exceeds the number of states held in storage, aN is disregarded. The number of valid states in aAve is returned. |
|
|
Copy the data stored by another storage instance. Note that this method only copies the stored data. It does not copy other members of aStorage such as the name and the description. To get a complete copy, the copy constructor should be used. If this instance does not have enough capicity to hold the states of the specified storage (aStorage), the capacity is increased. |
|
|
Divide this storage instance by a storage instance. Linear interpolation or extrapolation is used to get the values of the states that correspond in time to the states held in this storage instance.
|
|
|
Divide all state vectors in this storage instance by a state vector.
|
|
||||||||||||
|
Divide all state vectors in this storage instance by an array. Only the first aN states of each state vector are altered.
|
|
|
Divide all state vectors in this storage instance by a value.
|
|
||||||||||||
|
Find the index of the storage element that occured immediately before or at time aT ( aT <= getTime(index) ). This method can be much more efficient than findIndex(aT) if a good guess is made for aI. If aI corresponds to a state which occured later than aT, an exhaustive search is performed by calling findIndex(aT).
|
|
|
Find the index of the storage element that occured immediately before or at a specified time ( aT <= getTime(index) ). This method is not very efficient because it always starts its search with the first stored state.
|
|
|
Get column labels string.
|
|
||||||||||||||||
|
Get the first aN states at a specified time. The values of the states are determined by linear interpolation.
|
|
||||||||||||||||
|
Get the first aN states at a specified time. The values of the states are determined by linear interpolation.
|
|
||||||||||||||||
|
Get the first aN states at a specified time index.
|
|
||||||||||||||||
|
Get the first aN states at a specified time index.
|
|
||||||||||||||||||||
|
At a specified time index, get a number of state values starting at a specified state. The method simply gets part of a row of data from adjacent columns in the storage object.
|
|
||||||||||||||||
|
Get a data value of a specified state at a specified time index.
|
|
||||||||||||
|
Get the data corresponding to a specified state. This call is equivalent to getting a column of data from the storage file.
|
|
|
Get the time of the first stored states.
|
|
|
Get the header token of this storage.
|
|
|
Get the last states stored.
|
|
|
Get the time of the last states.
|
|
|
Get the smallest number of states. Ordinarily, the number of states is the same in each state vector; however, this is not required.
|
|
|
Get the rdStateVector at a spcified time index.
|
|
||||||||||||||||
|
Get the time at a specified time index for a specified state.
|
|
||||||||||||
|
Get the times for a specified state.
|
|
|
Get the whether or not to write a header appropriate for a SIMM motion file.
|
|
||||||||||||
|
Integrate the state vectors between times aTI and aTF. The integration results are returned in an rdStorage instance that is a copy of this instance except the name has been appended with "_integrated" and, of course, the state vectors have been integrated. The caller is responsible for deleting the returned storage instance. Note that if aTI and aTF do not fall exactly on the time stamp of a stored state, the states are linearly interpolated or extrapolated to provide an estimate of the state at aTI or at aTF.
|
|
||||||||||||
|
Integrate the state vectors between aI1 and aI2. The integration results are returned in an rdStorage instance that is a copy of this instance except the name has been appended with "_integrated" and, of course, the state vectors have been integrated. The caller is responsible for deleting the returned storage instance. If aI1 is negative, integrations starts at the first rdStateVector held by this rdStorage instance. If aI2 is negative, integration starts at the last rdStateVector held by this rdStorage instance. Note that aI1 and aI2 have negative default values, so that this method may be called without arguments to integrate all rdStateVectors held by this rdStorage instance.
|
|
|
Multipy this storage instance by a storage instance. Linear interpolation or extrapolation is used to get the values of the states that correspond in time to the states held in this storage instance.
|
|
|
Multiply all state vectors in this storage instance by a state vector.
|
|
||||||||||||
|
Multiply all state vectors in this storage instance by an array. Only the first aN states of each state vector are altered.
|
|
|
Multiply all state vectors in this storage instance by a value.
|
|
||||||||||||||||
|
Print the contents of this storage instance to a file named by the argument aFileaName using uniform time spacing. The argument aMode specifies whether the file is openned for writting, "w", or appending, "a". If a bad value for aMode is sent in, the file is openned for writing. The argument aDT specifies the time spacing. The total number of characters written is returned. If an error occured, a negative number is returned. |
|
||||||||||||
|
Print the contents of this storage instance to a file. The argument aMode specifies whether the file is openned for writting, "w", or appending, "a". If a bad value for aMode is sent in, the file is openned for writing. The total number of characters written is returned. If an error occured, a negative number is returned.
|
|
|
Scale the times of all state vectors.
|
|
|
Set a labels string for the columns in this rdStorage instance. A character string is used to label the columns. Each separate column label is usually delimited by a tab ("\t"), but any delimeter may be used. The first column is almost always "Time." The other columns correspond to the separate elements of a state vector (rdStateVector). If the labels string is set to NULL, the following default labels will be used when the rdStorage instance is saved to file: time state_0 state_1 state_2 ...
|
|
|
Set the header token. The header token is used to mark the end of the header portion of an rdStorage when an rdStorage is saved in a file. If the header token is NULL, a default header token is used.
|
|
|
Set the whether or not to write a header appropriate for a SIMM motion file.
|
|
|
Shift the times of all state vectors.
|
|
||||||||||||||||||||
|
Store a simulation vector. This method differs from append in that, if the integration step of a simulation is not a multiple of the step interval of this rdStorage class, the state is not appended. Note that if the step storage interval is 0, storage is turned off. The first empty storage location is returned. |
|
|
Subtract a storage instance to this storage instance. Linear interpolation or extrapolation is used to get the values of the states that correspond in time to the states held in this storage instance.
|
|
|
Subtract a state vector from all state vectors in this storage instance.
|
|
||||||||||||
|
Subtract an array from all state vectors in this storage instance. Only the first aN states of each state vector are altered.
|
|
|
Subtract a value from all state vectors in this storage instance.
|
|
|
Write the column labels.
|
|
|
Write default column labels.
|
|
||||||||||||
|
Write a header appropriate for SIMM motion files.
|
|
|
Step interval at which states in a simulation are stored. See store(). |
1.3