Simbody
3.3
|
This is an Integrator based on the CPODES library. More...
#include <CPodesIntegrator.h>
Public Member Functions | |
CPodesIntegrator (const System &sys, CPodes::LinearMultistepMethod method=CPodes::BDF) | |
Create a CPodesIntegrator for integrating a System. More... | |
CPodesIntegrator (const System &sys, CPodes::LinearMultistepMethod method, CPodes::NonlinearSystemIterationType iterationType) | |
Create a CPodesIntegrator for integrating a System. More... | |
void | setUseCPodesProjection () |
CPODES provides its own mechanism for projecting the system onto the constraint manifold. More... | |
void | setOrderLimit (int order) |
Restrict the integrator to lower orders than it is otherwise capable of (up to 12 for Adams, 5 for BDF). More... | |
Public Member Functions inherited from SimTK::Integrator | |
Integrator () | |
~Integrator () | |
const char * | getMethodName () const |
Get the name of this integration method. More... | |
int | getMethodMinOrder () const |
Get the minimum order this Integrator may use. More... | |
int | getMethodMaxOrder () const |
Get the maximum order this Integrator may use. More... | |
bool | methodHasErrorControl () const |
Get whether this Integrator provides error control. More... | |
void | initialize (const State &state) |
Supply the integrator with a starting state. More... | |
void | reinitialize (Stage stage, bool shouldTerminate) |
After an event handler has made a discontinuous change to the Integrator's "advanced state", this method must be called to reinitialize the Integrator. More... | |
const State & | getState () const |
Return a State corresponding to the "current" time at the end of the last call to stepTo() or stepBy(). More... | |
Real | getTime () const |
Get the time of the current State. This is equivalent to calling getState().getTime(). More... | |
bool | isStateInterpolated () const |
Get whether getState() will return an interpolated state or just the same thing as getAdvancedState() does. More... | |
const State & | getAdvancedState () const |
Return the state representing the trajectory point to which the integrator has irreversibly advanced. More... | |
Real | getAdvancedTime () const |
Get the time of the advanced State. This is equivalent to calling getAdvancedState().getTime(). More... | |
State & | updAdvancedState () |
Get a non-const reference to the advanced state. More... | |
Real | getAccuracyInUse () const |
Get the accuracy which is being used for error control. More... | |
Real | getConstraintToleranceInUse () const |
Get the constraint tolerance which is being used for error control. More... | |
SuccessfulStepStatus | stepTo (Real reportTime, Real scheduledEventTime=Infinity) |
Integrate the System until something happens which requires outside processing, and return a status code describing what happened. More... | |
SuccessfulStepStatus | stepBy (Real interval, Real scheduledEventTime=Infinity) |
Integrate the System until something happens which requires outside processing, and return a status code describing what happened. More... | |
Vec2 | getEventWindow () const |
Get the window (tLow, tHigh] within which one or more events have been localized. More... | |
const Array_< EventId > & | getTriggeredEvents () const |
Get the IDs of all events which have been localized within the event window. More... | |
const Array_< Real > & | getEstimatedEventTimes () const |
Get the estimated times of all events which have been localized within the event window. More... | |
const Array_< Event::Trigger > & | getEventTransitionsSeen () const |
Get EventTriggers describing the events which have been localized within the event window. More... | |
bool | isSimulationOver () const |
Get whether the simulation has terminated. More... | |
TerminationReason | getTerminationReason () const |
Get the reason the simulation terminated. More... | |
void | resetAllStatistics () |
Reset all statistics to zero. More... | |
Real | getActualInitialStepSizeTaken () const |
Get the size of the first successful step after the last initialize() call. More... | |
Real | getPreviousStepSizeTaken () const |
Get the size of the most recent successful step. More... | |
Real | getPredictedNextStepSize () const |
Get the step size that will be attempted first on the next call to stepTo() or stepBy(). More... | |
int | getNumStepsAttempted () const |
Get the total number of steps that have been attempted (successfully or unsuccessfully) since the last call to resetAllStatistics(). More... | |
int | getNumStepsTaken () const |
Get the total number of steps that have been successfully taken since the last call to resetAllStatistics(). More... | |
int | getNumRealizations () const |
Get the total number of state realizations that have been performed since the last call to resetAllStatistics(). More... | |
int | getNumQProjections () const |
Get the total number of times a state positions Q have been projected since the last call to resetAllStatistics(). More... | |
int | getNumUProjections () const |
Get the total number of times a state velocities U have been projected since the last call to resetAllStatistics(). More... | |
int | getNumProjections () const |
Get the total number of times a state has been projected (counting both Q and U projections) since the last call to resetAllStatistics(). More... | |
int | getNumErrorTestFailures () const |
Get the number of attempted steps that have failed due to the error being unacceptably high since the last call to resetAllStatistics(). More... | |
int | getNumConvergenceTestFailures () const |
Get the number of attempted steps that failed due to non-convergence of internal step iterations. More... | |
int | getNumRealizationFailures () const |
Get the number of attempted steps that have failed due to an error when realizing the state since the last call to resetAllStatistics(). More... | |
int | getNumQProjectionFailures () const |
Get the number of attempted steps that have failed due to an error when projecting the state positions (Q) since the last call to resetAllStatistics(). More... | |
int | getNumUProjectionFailures () const |
Get the number of attempted steps that have failed due to an error when projecting the state velocities (U) since the last call to resetAllStatistics(). More... | |
int | getNumProjectionFailures () const |
Get the number of attempted steps that have failed due to an error when projecting the state (either a Q- or U-projection) since the last call to resetAllStatistics(). More... | |
int | getNumConvergentIterations () const |
For iterative methods, get the number of internal step iterations in steps that led to convergence (not necessarily successful steps). More... | |
int | getNumDivergentIterations () const |
For iterative methods, get the number of internal step iterations in steps that did not lead to convergence. More... | |
int | getNumIterations () const |
For iterative methods, this is the total number of internal step iterations taken regardless of whether those iterations led to convergence or to successful steps. More... | |
void | setFinalTime (Real tFinal) |
Set the time at which the simulation should end. More... | |
void | setInitialStepSize (Real hinit) |
Set the initial step size that should be attempted. More... | |
void | setMinimumStepSize (Real hmin) |
Set the minimum step size that should ever be used. More... | |
void | setMaximumStepSize (Real hmax) |
Set the maximum step size that should ever be used. More... | |
void | setFixedStepSize (Real stepSize) |
Set the integrator to use a single fixed step size for all steps. More... | |
void | setAccuracy (Real accuracy) |
Set the overall accuracy that should be used for integration. More... | |
void | setConstraintTolerance (Real consTol) |
Set the tolerance within which constraints must be satisfied. More... | |
void | setUseInfinityNorm (bool useInfinityNorm) |
(Advanced) Use infinity norm (maximum absolute value) instead of default RMS norm to evaluate whether accuracy has been achieved for states and for constraint tolerance. More... | |
bool | isInfinityNormInUse () const |
(Advanced) Are we currently using the infinity norm? More... | |
void | setInternalStepLimit (int nSteps) |
Set the maximum number of steps that may be taken within a single call to stepTo() or stepBy(). More... | |
void | setReturnEveryInternalStep (bool shouldReturn) |
Set whether the Integrator should return from stepTo() or stepBy() after every internal step, even if no event has occurred and the report time has not been reached. More... | |
void | setProjectEveryStep (bool forceProject) |
Set whether the system should be projected back to the constraint manifold after every step. More... | |
void | setAllowInterpolation (bool shouldInterpolate) |
Set whether the Integrator is permitted to return interpolated states for reporting purposes which may be less accurate than the "real" states that form the trajectory. More... | |
void | setProjectInterpolatedStates (bool shouldProject) |
Set whether interpolated states should be projected back to the constraint manifold after interpolation is performed. More... | |
void | setForceFullNewton (bool forceFullNewton) |
(Advanced) Constraint projection may use an out-of-date iteration matrix for efficiency. More... | |
Additional Inherited Members | |
Public Types inherited from SimTK::Integrator | |
enum | SuccessfulStepStatus { ReachedReportTime =1, ReachedEventTrigger =2, ReachedScheduledEvent =3, TimeHasAdvanced =4, ReachedStepLimit =5, EndOfSimulation =6, StartOfContinuousInterval =7, InvalidSuccessfulStepStatus = -1 } |
When a step is successful, it will return an indication of what caused it to stop where it did. More... | |
enum | TerminationReason { ReachedFinalTime = 1, AnUnrecoverableErrorOccurred = 2, EventHandlerRequestedTermination = 3, InvalidTerminationReason = -1 } |
Once the simulation has ended, getTerminationReason() may be called to find out what caused it to end. More... | |
Static Public Member Functions inherited from SimTK::Integrator | |
static String | getSuccessfulStepStatusString (SuccessfulStepStatus) |
Get a human readable description of the reason a step returned. More... | |
static String | getTerminationReasonString (TerminationReason) |
Get a human readable description of the termination reason. More... | |
static String | successfulStepStatusString (SuccessfulStepStatus stat) |
OBSOLETE: use getSuccessfulStepStatusString(). More... | |
Protected Member Functions inherited from SimTK::Integrator | |
const IntegratorRep & | getRep () const |
IntegratorRep & | updRep () |
Protected Attributes inherited from SimTK::Integrator | |
IntegratorRep * | rep |
This is an Integrator based on the CPODES library.
It is an error controlled, variable order implicit integrator. It provides a good combination of accuracy, stability, and speed, and is a good choice for integrating stiff problems.
When creating a CPodesIntegrator, you can specify various options for how to perform the implicit integration: the linear multistep method to use (Adams or BDF), and the nonlinear system iteration type (Newton iteration or functional iteration). For stiff problems, the recommended choices are BDF with Newton iteration. For non-stiff problems, using Adams and/or functional iteration may provide better performance. Note that Adams is never recommended for systems that include constraints.
|
explicit |
Create a CPodesIntegrator for integrating a System.
SimTK::CPodesIntegrator::CPodesIntegrator | ( | const System & | sys, |
CPodes::LinearMultistepMethod | method, | ||
CPodes::NonlinearSystemIterationType | iterationType | ||
) |
Create a CPodesIntegrator for integrating a System.
The nonlinear system iteration type is chosen automatically based on the linear multistep method: Newton iteration for BDF (the default), and functional iteration for Adams.
void SimTK::CPodesIntegrator::setUseCPodesProjection | ( | ) |
CPODES provides its own mechanism for projecting the system onto the constraint manifold.
By default, CPodesIntegrator uses the System's project() method for doing projection, which is usually more efficient. Invoking this method tells it to use the CPODES mechanism instead.
This method must be invoked before the integrator is initialized. Invoking it after initialization will produce an exception.
void SimTK::CPodesIntegrator::setOrderLimit | ( | int | order | ) |
Restrict the integrator to lower orders than it is otherwise capable of (up to 12 for Adams, 5 for BDF).
This method may only be used to decrease the maximum order permitted, never to increase it. Once you specify an order limit, calling it again with a larger value will fail.