OpenSim::Analysis Class Reference

An abstract class for specifying the interface for an analysis plugin. More...

#include <Analysis.h>

Inheritance diagram for OpenSim::Analysis:
OpenSim::Object OpenSim::Actuation OpenSim::BodyKinematics OpenSim::ForceReporter OpenSim::InverseDynamics OpenSim::JointReaction OpenSim::Kinematics OpenSim::MuscleAnalysis OpenSim::PointKinematics OpenSim::StatesReporter OpenSim::StaticOptimization

List of all members.

Public Member Functions

 Analysis (Model *aModel=0)
 Default constructor.
 Analysis (const std::string &aFileName, bool aUpdateFromXMLNode=true)
 Construct an object from file.
 Analysis (const Analysis &aAnalysis)
 Copy constructor.
virtual ~Analysis ()
 Destructor.
virtual Objectcopy () const
 virtual copy constructor
Analysisoperator= (const Analysis &aAnalysis)
 Assignment operator.
virtual int begin (const SimTK::State &s)
 This method is called at the beginning of an integration and is intended to be used for any initializations that are necessary.
virtual int step (const SimTK::State &s)
 This method is called after each successful integration time step and is intended to be used for conducting analyses, driving animations, etc.
virtual int end (const SimTK::State &s)
 This method is called after an integration has been completed and is intended to be used for performing any finalizations necessary.
virtual void setModel (Model &aModel)
 set pointer to model to be analyzed.
virtual void setStatesStore (const Storage &aStatesStore)
 set states storage for analysis.
void setOn (bool aTrueFalse)
 Turn this callback on or off.
bool getOn () const
 Get whether or not this analysis is on.
void setStartTime (double aStartTime)
 Set the time at which to begin executing the callback.
double getStartTime () const
 Get the time at which to begin executing the callback, expressed in normalized time units, not real time units.
void setEndTime (double aEndTime)
 Set the time at which to end executing the callback.
double getEndTime () const
 Get the time at which to end executing the callback, expressed in normalized time units, not real time units.
void setInDegrees (bool aTrueFalse)
 Set whether or not to write the output of angles in degrees.
bool getInDegrees () const
 Get whether or not output of angles will be in degrees or radians.
virtual bool proceed (int aStep=0)
 Return whether or not to proceed with this callback.
void setStepInterval (int aStepInterval)
 Set the step interval.
int getStepInterval () const
 Get the step interval.
void setColumnLabels (const Array< std::string > &aLabels)
 Set the column labels for this analysis.
const Array< std::string > & getColumnLabels () const
 Get the columns labels of this analysis.
void setStorageInterval (int aInterval)
int getStorageInterval () const
virtual ArrayPtrs< Storage > & getStorageList ()
void setPrintResultFiles (bool aToWrite)
bool getPrintResultFiles () const
virtual int printResults (const std::string &aBaseName, const std::string &aDir="", double aDT=-1.0, const std::string &aExtension=".sto")
 Print the results of the analysis.

Public Attributes

Model_model
const Storage_statesStore

Protected Attributes

PropertyInt _stepIntervalProp
 Step interval.
int & _stepInterval
PropertyBool _onProp
 On, off flag.
bool & _on
PropertyDbl _startTimeProp
 Start time for the callback in normalized time.
double & _startTime
PropertyDbl _endTimeProp
 End time for the callback in normalized time.
double & _endTime
ArrayPtrs< Storage_storageList
bool _printResultFiles

Detailed Description

An abstract class for specifying the interface for an analysis plugin.

Author:
Frank C. Anderson, Ajay Seth
Version:
1.0

Constructor & Destructor Documentation

Analysis::Analysis ( Model aModel = 0  ) 

Default constructor.

Parameters:
aModel Model on which the analysis is to be performed.
OpenSim::Analysis::Analysis ( const std::string &  aFileName,
bool  aUpdateFromXMLNode = true 
)

Construct an object from file.

The object is constructed from the root element of the XML document. The type of object is the tag name of the XML root element.

Parameters:
aFileName File name of the document.
Analysis::Analysis ( const Analysis aAnalysis  ) 

Copy constructor.

Parameters:
aAnalysis Object to be copied.
See also:
Analysis(const XMLDocument *aDocument)
Analysis(const char *aFileName)
generateXMLDocument()

Copy constructors for all Analysis's only copy the non-XML variable members of the object; that is, the object's DOMnode and XMLDocument are not copied but set to NULL. The reason for this is that for the object and all its derived classes to establish the correct connection to the XML document nodes, the the object would need to reconstruct based on the XML document not the values of the object's member variables.

There are three proper ways to generate an XML document for an Analysis:

1) Construction based on XML file (

See also:
Analysis(const char *aFileName)). In this case, the XML document is created by parsing the XML file.

2) Construction by Analysis(const XMLDocument *aDocument). This constructor explictly requests construction based on an XML document. In this way the proper connection between an object's node and the corresponding node within the XML document is established. This constructor is a copy constructor of sorts because all essential Analysis member variables should be held within the XML document. The advantage of this style of construction is that nodes within the XML document, such as comments that may not have any associated Analysis member variable, are preserved.

3) A call to generateXMLDocument(). This method generates an XML document for the Analysis from scratch. Only the essential document nodes are created (that is, nodes that correspond directly to member variables.).

Parameters:
aAnalysis Object to be copied.
See also:
Analysis(const XMLDocument *aDocument)
Analysis(const char *aFileName)
generateXMLDocument()
Analysis::~Analysis (  )  [virtual]

Destructor.


Member Function Documentation

int Analysis::begin ( const SimTK::State &  s  )  [virtual]

This method is called at the beginning of an integration and is intended to be used for any initializations that are necessary.

Override this method in derived classes.

Parameters:
s SimTK state
Returns:
-1 on error, 0 otherwise.

Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, OpenSim::StatesReporter, and OpenSim::StaticOptimization.

Object * Analysis::copy (  )  const [virtual]
int Analysis::end ( const SimTK::State &  s  )  [virtual]

This method is called after an integration has been completed and is intended to be used for performing any finalizations necessary.

Override this method in derived classes.

Parameters:
s SimTK State
Returns:
-1 on error, 0 otherwise.

Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, OpenSim::StatesReporter, and OpenSim::StaticOptimization.

const OpenSim::Array< string > & Analysis::getColumnLabels (  )  const

Get the columns labels of this analysis.

Returns:
Labels for this analysis.
double Analysis::getEndTime (  )  const

Get the time at which to end executing the callback, expressed in normalized time units, not real time units.

Returns:
End time expressed in NORMALIZED time units.
bool Analysis::getInDegrees (  )  const

Get whether or not output of angles will be in degrees or radians.

Returns:
"true" if the output will be in degrees, "false" in radians.
bool Analysis::getOn (  )  const

Get whether or not this analysis is on.

Returns:
True if on, false if off.
bool OpenSim::Analysis::getPrintResultFiles (  )  const [inline]
double Analysis::getStartTime (  )  const

Get the time at which to begin executing the callback, expressed in normalized time units, not real time units.

Returns:
Start time expressed in NORMALIZED time units.
int Analysis::getStepInterval (  )  const

Get the step interval.

The step interval is used to specify how many integration steps must go by before the Analysis::step() method is executed. Specifically, unless the step number divided by the step interval has no remainder (i.e., (step % stepInterval) == 0), the step method is not executed.

Returns:
Step interval.
int OpenSim::Analysis::getStorageInterval (  )  const
ArrayPtrs< Storage > & Analysis::getStorageList (  )  [virtual]
Analysis & Analysis::operator= ( const Analysis aAnalysis  ) 
virtual int OpenSim::Analysis::printResults ( const std::string &  aBaseName,
const std::string &  aDir = "",
double  aDT = -1.0,
const std::string &  aExtension = ".sto" 
) [virtual]

Print the results of the analysis.

Parameters:
aFileName File to which to print the data.
aDT Time interval between results (linear interpolation is used). If not included as an argument or negative, all time steps are printed without interpolation.
Returns:
-1 on error, 0 otherwise.

Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, OpenSim::StatesReporter, and OpenSim::StaticOptimization.

bool Analysis::proceed ( int  aStep = 0  )  [virtual]

Return whether or not to proceed with this callback.

The callback will not proceed (i.e., returns false) if either the analysis is turned off or if aStep is not an even multiple of the step interval set

See also:
rdStepAnalysis.
Returns:
True or False.
void OpenSim::Analysis::setColumnLabels ( const Array< std::string > &  aLabels  ) 

Set the column labels for this analysis.

Parameters:
aLabels an Array of strings (labels).
void Analysis::setEndTime ( double  aEndTime  ) 

Set the time at which to end executing the callback.

Note that the end time should be specified in normalized time units, not in real time units.

Parameters:
aEndTime Time at which the callback should end execution in NORMALIZED time units.
void Analysis::setInDegrees ( bool  aTrueFalse  ) 

Set whether or not to write the output of angles in degrees.

This flag must be set before an analysis is performed to ensure that the results are in the proper format.

Parameters:
aTureFalse Output will be in degrees if "true" and in radians if "false".
void Analysis::setModel ( Model aModel  )  [virtual]
void Analysis::setOn ( bool  aTrueFalse  ) 

Turn this callback on or off.

Parameters:
aTureFalse Turns analysis on if "true" and off if "false".
void OpenSim::Analysis::setPrintResultFiles ( bool  aToWrite  )  [inline]
void Analysis::setStartTime ( double  aStartTime  ) 

Set the time at which to begin executing the callback.

Note that the start time should be specified in normalized time units, not in real time units.

Parameters:
aStartTime Start time expressed in NORMALIZED time units.
void Analysis::setStatesStore ( const Storage aStatesStore  )  [virtual]

set states storage for analysis.

set pointer to states storage to be analyzed.

Parameters:
aStatesStore 
void Analysis::setStepInterval ( int  aStepInterval  ) 

Set the step interval.

The step interval is used to specify how many integration steps must go by before the Analysis::step() method is executed. Specifically, unless the step number divided by the step interval has no remainder (i.e., (step % stepInterval) == 0), the step method is not executed.

Parameters:
aStepInterval Step interval. Should be 1 or greater.
void OpenSim::Analysis::setStorageInterval ( int  aInterval  ) 
int Analysis::step ( const SimTK::State &  s  )  [virtual]

This method is called after each successful integration time step and is intended to be used for conducting analyses, driving animations, etc.

Override this method in derived classes.

Parameters:
s SimTK State
Returns:
-1 on error, 0 otherwise.

Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, OpenSim::StatesReporter, and OpenSim::StaticOptimization.


Member Data Documentation

double& OpenSim::Analysis::_endTime [protected]

End time for the callback in normalized time.

bool& OpenSim::Analysis::_on [protected]

On, off flag.

double& OpenSim::Analysis::_startTime [protected]

Start time for the callback in normalized time.

Reimplemented in OpenSim::StatesReporter.

Step interval.

ArrayPtrs<Storage> OpenSim::Analysis::_storageList [protected]

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

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