An abstract class for specifying the interface for an analysis plugin. More...
#include <Analysis.h>
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 Object * | copy () const |
virtual copy constructor | |
Analysis & | operator= (const Analysis &aAnalysis) |
Assignment operator. | |
virtual int | begin (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, int stepNumber) |
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 (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 |
An abstract class for specifying the interface for an analysis plugin.
Analysis::Analysis | ( | Model * | aModel = 0 |
) |
Default constructor.
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.
aFileName | File name of the document. |
Analysis::Analysis | ( | const Analysis & | aAnalysis | ) |
Copy constructor.
aAnalysis | Object to be copied. |
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 (
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.).
aAnalysis | Object to be copied. |
Analysis::~Analysis | ( | ) | [virtual] |
Destructor.
int Analysis::begin | ( | 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.
s | SimTK state |
Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointLoadOptimization, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, OpenSim::StatesReporter, and OpenSim::StaticOptimization.
Object * Analysis::copy | ( | ) | const [virtual] |
virtual copy constructor
Reimplemented from OpenSim::Object.
Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointLoadOptimization, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, OpenSim::StatesReporter, and OpenSim::StaticOptimization.
int Analysis::end | ( | 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.
s | SimTK State |
Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointLoadOptimization, 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.
double Analysis::getEndTime | ( | ) | const |
Get the time at which to end executing the callback, expressed in normalized time units, not real time units.
bool Analysis::getInDegrees | ( | ) | const |
Get whether or not output of angles will be in degrees or radians.
bool Analysis::getOn | ( | ) | const |
Get whether or not this analysis is on.
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.
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.
int OpenSim::Analysis::getStorageInterval | ( | ) | const |
ArrayPtrs< Storage > & Analysis::getStorageList | ( | ) | [virtual] |
Assignment operator.
Reimplemented from OpenSim::Object.
Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointLoadOptimization, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, OpenSim::StatesReporter, and OpenSim::StaticOptimization.
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.
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. |
Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointLoadOptimization, 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
void OpenSim::Analysis::setColumnLabels | ( | const Array< std::string > & | aLabels | ) |
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.
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.
aTureFalse | Output will be in degrees if "true" and in radians if "false". |
void Analysis::setModel | ( | Model & | aModel | ) | [virtual] |
set pointer to model to be analyzed.
aModel |
Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointLoadOptimization, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, and OpenSim::StaticOptimization.
void Analysis::setOn | ( | bool | aTrueFalse | ) |
Turn this callback on or off.
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.
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.
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.
aStepInterval | Step interval. Should be 1 or greater. |
void OpenSim::Analysis::setStorageInterval | ( | int | aInterval | ) |
int Analysis::step | ( | const SimTK::State & | s, | |
int | stepNumber | |||
) | [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.
s | SimTK State |
Reimplemented in OpenSim::Actuation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointLoadOptimization, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, OpenSim::StatesReporter, and OpenSim::StaticOptimization.
double& OpenSim::Analysis::_endTime [protected] |
PropertyDbl OpenSim::Analysis::_endTimeProp [protected] |
End time for the callback in normalized time.
bool& OpenSim::Analysis::_on [protected] |
PropertyBool OpenSim::Analysis::_onProp [protected] |
On, off flag.
bool OpenSim::Analysis::_printResultFiles [protected] |
double& OpenSim::Analysis::_startTime [protected] |
PropertyDbl OpenSim::Analysis::_startTimeProp [protected] |
Start time for the callback in normalized time.
Reimplemented in OpenSim::StatesReporter.
int& OpenSim::Analysis::_stepInterval [protected] |
PropertyInt OpenSim::Analysis::_stepIntervalProp [protected] |
Step interval.
ArrayPtrs<Storage> OpenSim::Analysis::_storageList [protected] |