OpenSim::StateVector Class Reference

A class which stores a vector of states or data at a specified time. More...

#include <StateVector.h>

List of all members.

Public Member Functions

 StateVector (double aT=0.0, int aN=0, const double *aData=NULL)
 StateVector (const StateVector &aVector)
 Copy constructor.
virtual ~StateVector ()
 Destructor.
StateVectoroperator= (const StateVector &aStateVector)
 Assign this statevector to the values of another.
bool operator== (const StateVector &aStateVector) const
 Determine if two statevectors are equal.
bool operator< (const StateVector &aStateVector) const
 Determine if this statevector is less than another.
void setStates (double aT, int aN, const double aY[])
int getSize () const
 Get the size of the data vector.
void setTime (double aT)
 Set the time stamp of this vector.
double getTime () const
 Get the time stamp of this vector.
int getDataValue (int aIndex, double &rValue)
 Get the data value at a specified index.
void setDataValue (int aIndex, double &aValue)
 Set the data value at a specified index.
Array< double > & getData ()
 Get the data values of this vector.
const Array< double > & getData () const
 Get the data values of this vector.
void shiftTime (double aValue)
 Shift the time of this state vector.
void scaleTime (double aValue)
 Scale the time of this state vector.
void add (double aValue)
 Add a value to each state.
void add (int aN, double aY[])
 Add the values held in an array to the corresponding states.
void add (int aN, double aValue)
 Add a value to a state.
void add (StateVector *aStateVector)
 Add the values held in a state vector to the corresponding states.
void subtract (double aValue)
 Subtract a value from each state.
void subtract (int aN, double aY[])
 Subtract the values held in an array from the corresponding states.
void subtract (StateVector *aStateVector)
 Subtract the values held in a state vector from the corresponding states.
void multiply (double aValue)
 Multiply the states by a value.
void multiply (int aN, double aY[])
 Multiply the states by the corresponding values in an array.
void multiply (StateVector *aStateVector)
 Multiply the states by the corresponding values in a state vector.
void divide (double aValue)
 Divide the states by a value.
void divide (int aN, double aY[])
 Divide the states by the corresponding values in an array.
void divide (StateVector *aStateVector)
 Divide the states by the corresponding values in a state vector.
void print () const
 Print the contents of this StateVector to standard out.
int print (FILE *fp) const
 Print the contents of this StateVector to file.

Friends

std::ostream & operator<< (std::ostream &aOut, const StateVector &aStateVector)

Detailed Description

A class which stores a vector of states or data at a specified time.

Generally, it is used to store the time histories of the states during an integration.

The format of the numerical output for this class is specified by the settings in IO.

Author:
Frank C. Anderson
Version:
1.0
See also:
IO

Constructor & Destructor Documentation

OpenSim::StateVector::StateVector ( double  aT = 0.0,
int  aN = 0,
const double *  aData = NULL 
)
StateVector::StateVector ( const StateVector aVector  ) 

Copy constructor.

StateVector::~StateVector (  )  [virtual]

Destructor.


Member Function Documentation

void StateVector::add ( StateVector aStateVector  ) 

Add the values held in a state vector to the corresponding states.

Parameters:
aStateVector State vector to add to the states.
void StateVector::add ( int  aN,
double  aValue 
)

Add a value to a state.

Only one state is altered. This function was implemented so that a value could be added to an entire column of a Storage.

Parameters:
aN Index of state to be altered.
aValue Values to add to the state.
void StateVector::add ( int  aN,
double  aY[] 
)

Add the values held in an array to the corresponding states.

Only the first aN states are altered.

Parameters:
aN Length of aY.
aY Array of values to add to the states.
void StateVector::add ( double  aValue  ) 

Add a value to each state.

Parameters:
aValue Value to add to each state.
void StateVector::divide ( StateVector aStateVector  ) 

Divide the states by the corresponding values in a state vector.

Parameters:
aStateVector State vector by which to divide the states.
void StateVector::divide ( int  aN,
double  aY[] 
)

Divide the states by the corresponding values in an array.

Only the first aN states are altered.

Parameters:
aN Length of aY.
aY Array of values the states are divided by.
void StateVector::divide ( double  aValue  ) 

Divide the states by a value.

Parameters:
aValue Value each state is to be divided by.
const Array< double > & StateVector::getData (  )  const

Get the data values of this vector.

Array< double > & StateVector::getData (  ) 

Get the data values of this vector.

int StateVector::getDataValue ( int  aIndex,
double &  rValue 
)

Get the data value at a specified index.

Parameters:
aIndex Index of the desired value: 0 < aIndex < getSize().
rValue Value of the data point if it is defined.
Returns:
1 on success, 0 on failure.
int StateVector::getSize (  )  const

Get the size of the data vector.

double StateVector::getTime (  )  const

Get the time stamp of this vector.

void StateVector::multiply ( StateVector aStateVector  ) 

Multiply the states by the corresponding values in a state vector.

Parameters:
aStateVector State vector by which to multiply the states.
void StateVector::multiply ( int  aN,
double  aY[] 
)

Multiply the states by the corresponding values in an array.

Only the first aN states are altered.

Parameters:
aN Length of aY.
aY Array of values the states are multiplied by.
void StateVector::multiply ( double  aValue  ) 

Multiply the states by a value.

Parameters:
aValue Value each state is to be multiplied by.
bool StateVector::operator< ( const StateVector aStateVector  )  const

Determine if this statevector is less than another.

A statevector is less than another statevector if its time is less than the other's time.

Parameters:
aStateVector Statevector for which to make the less than test.
Returns:
True if this statevector is less than the specified; false otherwise.
StateVector & StateVector::operator= ( const StateVector aStateVector  ) 

Assign this statevector to the values of another.

Returns:
Reference to this statevector.
bool StateVector::operator== ( const StateVector aStateVector  )  const

Determine if two statevectors are equal.

Equality is very restrictive. To be equal, two statevectors must have the same values for time and all states.

Returns:
True if the two statevectors are equal; false otherwise.
int StateVector::print ( FILE *  fp  )  const

Print the contents of this StateVector to file.

The number of characters written to file is returned. If an error occurs, a negative value is returned.

void StateVector::print (  )  const

Print the contents of this StateVector to standard out.

void StateVector::scaleTime ( double  aValue  ) 

Scale the time of this state vector.

Parameters:
aValue Value by which to scale time.
void StateVector::setDataValue ( int  aIndex,
double &  aValue 
)

Set the data value at a specified index.

Parameters:
aIndex Index of the desired value: 0 < aIndex < getSize().
aValue Value of the data point if it is defined.
void OpenSim::StateVector::setStates ( double  aT,
int  aN,
const double  aY[] 
)
void StateVector::setTime ( double  aT  ) 

Set the time stamp of this vector.

void StateVector::shiftTime ( double  aValue  ) 

Shift the time of this state vector.

Parameters:
aValue Value by which to shift time.
void StateVector::subtract ( StateVector aStateVector  ) 

Subtract the values held in a state vector from the corresponding states.

Parameters:
aStateVector State vector to subtract from the states.
void StateVector::subtract ( int  aN,
double  aY[] 
)

Subtract the values held in an array from the corresponding states.

Only the first aN states are altered.

Parameters:
aN Length of aY.
aY Array of values to subtracted from the states.
void StateVector::subtract ( double  aValue  ) 

Subtract a value from each state.

Parameters:
aValue Value to subtract from each state.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  aOut,
const StateVector aStateVector 
) [friend]

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

Generated on Wed Dec 16 15:03:42 2009 for OpenSim by  doxygen 1.6.1