#include <ControlSet.h>
Public Member Functions | |
ControlSet () | |
Default constructor. | |
ControlSet (const std::string &aFileName) | |
ControlSet (const ControlSet &aSet) | |
Copy constructor. | |
virtual | ~ControlSet () |
Destructor. | |
virtual Object * | copy () const |
Copy this ControlSet and return a pointer to the copy. | |
ControlSet (const Storage &aStorage, int nControlsToConvert=0, int aStartIndex=0) | |
Constructor from a storage. | |
ControlSet & | operator= (const ControlSet &aSet) |
Assign this set to another set. | |
int | getSize (bool aForModelControls=true) const |
Get the size of the control set. | |
void | getControlList (const char *aType, Array< int > &rList, bool aForModelControls=true) const |
Get the list of controls of a specified type. | |
void | getControlValues (double aT, double rX[], bool aForModelControls=true) const |
Get the values of the control curves held in this set at a specified time. | |
void | getControlValues (double aT, Array< double > &rX, bool aForModelControls=true) const |
Get the values of the control curves held in this set at a specified time. | |
void | setControlValues (double aT, const double aX[], bool aForModelControls=true) |
Set the values of the control curves held in this set at a specified time. | |
void | setControlValues (double aT, const Array< double > &aX, bool aForModelControls=true) |
Set the values of the control curves held in this set at a specified time. | |
int | getNumParameters (bool aForModelControls=true) const |
Get the number of control parameters. | |
void | getParameterList (Array< int > &rList, bool aForModelControls=true) const |
Get a list of parameters for all controls or just the controls that are model controls. | |
void | getParameterList (double aT, Array< int > &rList, bool aForModelControls=true) const |
Get the list of parameters that affect the control curves at a specified time. | |
void | getParameterList (double aTLower, double aTUpper, Array< int > &rList, bool aForModelControls=true) const |
Get the list of parameters that affect the control curves between two specified times and that do NOT affect the control curve below the lower of these two times. | |
void | getParameterMins (Array< double > &rMins, const Array< int > *aList=NULL) const |
Get the minimum values allowed for the control parameters. | |
void | getParameterMaxs (Array< double > &rMaxs, const Array< int > *aList=NULL) const |
Get the maximum values allowed for the control parameters. | |
void | getParameterValues (double rP[], const Array< int > *aList=NULL) const |
Get the values of the control parameters. | |
void | getParameterValues (Array< double > &rP, const Array< int > *aList=NULL) const |
Get the values of the control parameters. | |
void | setParameterValues (const double aP[], const Array< int > *aList=NULL) |
void | setParameterValues (const Array< double > &aP, const Array< int > *aList=NULL) |
Set the values of the control parameters. | |
void | simplify (const PropertySet &aProperties) |
Simplify all the control curves in a control set. | |
void | filter (double aT) |
Filter all the control curves in a control set. | |
Storage * | constructStorage (int aN, double aT1, double aT2, bool aForModelControls) |
Construct a storage object from the controls in the set over a specified interval using a specified number of points. | |
int | mapParameterToControl (int aIndex) const |
Map a control-set parameter to a control. | |
int | mapParameterToParameter (int aIndex) const |
Map a control-set parameter to a parameter of a particular control. | |
void | generateParameterMaps () |
Generate the maps relating a parmeter in the control set to a control and a parameter of a control. | |
Protected Attributes | |
Array< int > | _ptcMap |
Map from parameters to controls. | |
Array< int > | _ptpMap |
Map from set parameters to control parameters. |
ControlSet::ControlSet | ( | ) |
Default constructor.
OpenSim::ControlSet::ControlSet | ( | const std::string & | aFileName | ) |
ControlSet::ControlSet | ( | const ControlSet & | aSet | ) |
Copy constructor.
aSet | Analysis set to be copied. |
ControlSet::~ControlSet | ( | ) | [virtual] |
Destructor.
ControlSet::ControlSet | ( | const Storage & | aStorage, | |
int | numControls = 0 , |
|||
int | startIndex = 0 | |||
) |
Constructor from a storage.
aStorage | to get the data from | |
numControls | number of columns to convert into controls, 0 for all | |
startIndex | or columns to convert, default to all |
Storage * ControlSet::constructStorage | ( | int | aN, | |
double | aT1, | |||
double | aT2, | |||
bool | aForModelControls | |||
) |
Construct a storage object from the controls in the set over a specified interval using a specified number of points.
aN | Number of times to sample the time interval. | |
aT1 | Start of the interval. | |
aT2 | End of the interval. | |
aForModelControls |
Object * ControlSet::copy | ( | ) | const [virtual] |
Copy this ControlSet and return a pointer to the copy.
The copy constructor for this class is used.
Reimplemented from OpenSim::Set< Control >.
void ControlSet::filter | ( | double | aT | ) |
Filter all the control curves in a control set.
Currently implemented only for ControlLinear controls.
aT | Time at which each control's value is filtered. |
void ControlSet::generateParameterMaps | ( | ) |
Generate the maps relating a parmeter in the control set to a control and a parameter of a control.
This method should be called any time there is a change in the number or types of controls held in the control set.
void ControlSet::getControlList | ( | const char * | aType, | |
Array< int > & | rList, | |||
bool | aForModelControls = true | |||
) | const |
Get the list of controls of a specified type.
This method can be slow, so minimize its use.
aType | Type of the control (e.g., ControlLinear). | |
aList | Array of indices of the controls of type aType. | |
aForModelControls | If true, only model controls are considered. If false, all controls are considered. |
void ControlSet::getControlValues | ( | double | aT, | |
Array< double > & | rX, | |||
bool | aForModelControls = true | |||
) | const |
Get the values of the control curves held in this set at a specified time.
This is the bread-and-butter method of the controls class; it is called repeatedly throughout an integration.
aT | Time at which to get the values of the control curves. | |
rX | Array of control curve values. | |
aForModelControls | If true, only model controls are considered. If false, all controls are considered. |
void ControlSet::getControlValues | ( | double | aT, | |
double | rX[], | |||
bool | aForModelControls = true | |||
) | const |
Get the values of the control curves held in this set at a specified time.
This is the bread-and-butter method of the controls class; it is called repeatedly throughout an integration.
aT | Time at which to get the values of the control curves. | |
rX | Array of control curve values. | |
aForModelControls | If true, only model controls are considered. If false, all controls are considered. |
int ControlSet::getNumParameters | ( | bool | aForModelControls = true |
) | const |
Get the number of control parameters.
aForModelControls | If true, only model controls are considered. If false, all controls are considered. |
void ControlSet::getParameterList | ( | double | aTLower, | |
double | aTUpper, | |||
Array< int > & | rList, | |||
bool | aForModelControls = true | |||
) | const |
Get the list of parameters that affect the control curves between two specified times and that do NOT affect the control curve below the lower of these two times.
This method is useful when solving for a set of controls for a dynamic simulation. When solving for a set of controls, one always wants to go forward in time. Therefore, one does not want to change control parameters that affect the control curve at past times.
A control parameter is included in the list only if it affects the control curve in the specified time interval AND does NOT affect the control curve below the lower bound of the specified time interval. So, it is possible that some of the parameters on the returned list could affect the control curve at times greater than the upper bound of the specified time interval.
aTLower | Lower time bound. The control curves are not affected below this time by any of the returned parameters. | |
aTUpper | Upper time bound. The control curves may be affected for times greater than this time. | |
rList | List of control parameters (their indices to be exact) that affect the curve between aTLower and aTUpper but not before aTLower. | |
aForModelControls | If true, only model controls are considered. If false, all controls are considered. |
void ControlSet::getParameterList | ( | double | aT, | |
Array< int > & | rList, | |||
bool | aForModelControls = true | |||
) | const |
Get the list of parameters that affect the control curves at a specified time.
This list can be used to get parameter mins, maxs, and values.
aT | Time in question. | |
rList | List of parameters. | |
aForModelControls | If true, only model controls are considered. If false, all controls are considered. |
void ControlSet::getParameterList | ( | Array< int > & | rList, | |
bool | aForModelControls = true | |||
) | const |
Get a list of parameters for all controls or just the controls that are model controls.
This list can be used to get parameter mins, maxs, and values.
rList | List of parameters. | |
aForModelControls | If true, only model controls are considered. If false, all controls are considered. |
void ControlSet::getParameterMaxs | ( | Array< double > & | rMaxs, | |
const Array< int > * | aList = NULL | |||
) | const |
Get the maximum values allowed for the control parameters.
rMaxs | Array of maximum allowed values. | |
aList | List of controls. If NULL, the values for all parameters for all controls in the control set are gotten. Otherwise, the parameters for the controls in the list are gotten. |
void ControlSet::getParameterMins | ( | Array< double > & | rMins, | |
const Array< int > * | aList = NULL | |||
) | const |
Get the minimum values allowed for the control parameters.
rMins | Array of minimum allowed values. | |
aList | List of controls. If NULL, the values for all parameters for all controls in the control set are gotten. Otherwise, the parameters for the controls in the list are gotten. |
void ControlSet::getParameterValues | ( | Array< double > & | rP, | |
const Array< int > * | aList = NULL | |||
) | const |
Get the values of the control parameters.
rP | Array of parameters values, the length of which should equal the total number of parameters or the size of aList. | |
aList | List of controls. If NULL, the values for all parameters for all controls in the control set are gotten. Otherwise, the parameters for the controls in the list are gotten. |
void ControlSet::getParameterValues | ( | double | rP[], | |
const Array< int > * | aList = NULL | |||
) | const |
Get the values of the control parameters.
rP | Array of parameters values, the length of which should equal the total number of parameters or the size of aList. | |
aList | List of controls. If NULL, the values for all parameters for all controls in the control set are gotten. Otherwise, the parameters for the controls in the list are gotten. |
int ControlSet::getSize | ( | bool | aForModelControls = true |
) | const |
Get the size of the control set.
aForModelControls | Flag indicating whether or not to get the size for only model controls or all controls in the set. Model controls are controls that are involved in controlling a model; Example of non-model controls include the final time of a simulation or an initial value for a joint angle; these quantities are for setting up a simulation, they are not involved in controlling a model. If aForModelControls is true, the number of model controls in the set is returned; if false, the total number of controls in the set is returned. |
int ControlSet::mapParameterToControl | ( | int | aIndex | ) | const |
Map a control-set parameter to a control.
In the control set, the paramters for each of the controls are concatenated into an array. Since there is not a one-to-one correspondence between control-set parameters and controls (i.e., a particular control may have many parameters), it is necessary both to map to which control each control-set parameter belongs and to map to which parameter within a particular control a control-set parameter corresponds.
aIndex | Index of the parameter in this control set. |
int ControlSet::mapParameterToParameter | ( | int | aIndex | ) | const |
Map a control-set parameter to a parameter of a particular control.
In the control set, the paramters for each of the controls are concatenated into an array. Since there is not a one-to-one correspondence between control-set parameters and controls (i.e., a particular control may have many parameters), it is necessary both to map to which control each control-set parameter belongs and to map to which parameter within a particular control a control-set parameter corresponds.
aIndex | Index of the parameter in the control set. |
ControlSet & ControlSet::operator= | ( | const ControlSet & | aSet | ) |
Assign this set to another set.
This operator makes a complete copy of the specified set; all member variables and objects in the set are copied. Because all objects are copied, this set takes ownership of the newly allocated objects (i.e., _memoryOwner is set to true. So, the result is two independent, identical sets, with the possible exception of the _memoryOwner flag.
aSet | Set to be copied. |
Reimplemented from OpenSim::Object.
void ControlSet::setControlValues | ( | double | aT, | |
const Array< double > & | aX, | |||
bool | aForModelControls = true | |||
) |
Set the values of the control curves held in this set at a specified time.
Normally to modify the value of a control curve setParameterValues() would be used. The shape of the control curve is determined by the parameters.
If parameters exist at the specified time, these parameters are modified to give the control curve the specified value. Otherwise, new parameters are added to the control curve.
aT | Time at which the value of the control curve is to be set. | |
aX | Array of control curve values, the length of which should equal the number of controls. | |
aForModelControls | If true, only model controls are considered. If false, all controls are considered. |
void ControlSet::setControlValues | ( | double | aT, | |
const double | aX[], | |||
bool | aForModelControls = true | |||
) |
Set the values of the control curves held in this set at a specified time.
Normally to modify the value of a control curve setParameterValues() would be used. The shape of the control curve is determined by the parameters.
If parameters exist at the specified time, these parameters are modified to give the control curve the specified value. Otherwise, new parameters are added to the control curve.
aT | Time at which the value of the control curve is to be set. | |
aX | Array of control curve values, the length of which should equal the number of controls. | |
aForModelControls | If true, only model controls are considered. If false, all controls are considered. |
void ControlSet::setParameterValues | ( | const Array< double > & | aP, | |
const Array< int > * | aList = NULL | |||
) |
Set the values of the control parameters.
aP | Array of control parameters, the length of which should be either the total number of parameters (if aList=NULL) or the same length as aList. | |
aList | List of controls. If NULL, the values for all parameters for all controls in the control set are gotten. Otherwise, the parameters for the controls in the list are gotten. |
void OpenSim::ControlSet::setParameterValues | ( | const double | aP[], | |
const Array< int > * | aList = NULL | |||
) |
void ControlSet::simplify | ( | const PropertySet & | aProperties | ) |
Simplify all the control curves in a control set.
aProperties | Set of properties containing the parameters used to carry out the simplifications. See each control class for the list of properties needed to perform the simplification. |
Array<int> OpenSim::ControlSet::_ptcMap [protected] |
Map from parameters to controls.
Array<int> OpenSim::ControlSet::_ptpMap [protected] |
Map from set parameters to control parameters.