1 #ifndef SimTK_SIMMATH_INTEGRATOR_H_
2 #define SimTK_SIMMATH_INTEGRATOR_H_
123 class InitializationFailed;
124 class StepSizeTooSmall;
126 class TriedToAdvancePastFinalTime;
127 class CantAskForEventInfoWhenNoEventTriggered;
130 const char* getMethodName()
const;
132 int getMethodMinOrder()
const;
134 int getMethodMaxOrder()
const;
138 bool methodHasErrorControl()
const;
143 void initialize(
const State& state);
156 void reinitialize(
Stage stage,
bool shouldTerminate);
160 const State& getState()
const;
166 bool isStateInterpolated()
const;
171 const State& getAdvancedState()
const;
176 State& updAdvancedState();
180 Real getAccuracyInUse()
const;
183 Real getConstraintToleranceInUse()
const;
204 ReachedReportTime =1,
206 ReachedEventTrigger =2,
208 ReachedScheduledEvent=3,
217 StartOfContinuousInterval=7,
218 InvalidSuccessfulStepStatus = -1
221 static String getSuccessfulStepStatusString(SuccessfulStepStatus);
226 SuccessfulStepStatus stepTo(
Real reportTime,
Real scheduledEventTime=
Infinity);
230 SuccessfulStepStatus stepBy(
Real interval,
Real scheduledEventTime=
Infinity);
235 Vec2 getEventWindow()
const;
252 ReachedFinalTime = 1,
254 AnUnrecoverableErrorOccurred = 2,
256 EventHandlerRequestedTermination = 3,
258 InvalidTerminationReason = -1
263 bool isSimulationOver()
const;
267 TerminationReason getTerminationReason()
const;
270 static String getTerminationReasonString(TerminationReason);
273 void resetAllStatistics();
276 Real getActualInitialStepSizeTaken()
const;
279 Real getPreviousStepSizeTaken()
const;
282 Real getPredictedNextStepSize()
const;
286 int getNumStepsAttempted()
const;
288 int getNumStepsTaken()
const;
290 int getNumRealizations()
const;
293 int getNumQProjections()
const;
296 int getNumUProjections()
const;
299 int getNumProjections()
const;
302 int getNumErrorTestFailures()
const;
307 int getNumConvergenceTestFailures()
const;
310 int getNumRealizationFailures()
const;
314 int getNumQProjectionFailures()
const;
318 int getNumUProjectionFailures()
const;
322 int getNumProjectionFailures()
const;
325 int getNumConvergentIterations()
const;
328 int getNumDivergentIterations()
const;
332 int getNumIterations()
const;
336 void setFinalTime(
Real tFinal);
339 void setInitialStepSize(
Real hinit);
342 void setMinimumStepSize(
Real hmin);
345 void setMaximumStepSize(
Real hmax);
352 void setFixedStepSize(
Real stepSize);
357 void setAccuracy(
Real accuracy);
359 void setConstraintTolerance(
Real consTol);
364 void setUseInfinityNorm(
bool useInfinityNorm);
366 bool isInfinityNormInUse()
const;
373 void setInternalStepLimit(
int nSteps);
378 void setReturnEveryInternalStep(
bool shouldReturn);
383 void setProjectEveryStep(
bool forceProject);
394 void setAllowInterpolation(
bool shouldInterpolate);
398 void setProjectInterpolatedStates(
bool shouldProject);
402 void setForceFullNewton(
bool forceFullNewton);
406 {
return getSuccessfulStepStatusString(stat); }
409 const IntegratorRep&
getRep()
const {assert(rep);
return *rep;}
410 IntegratorRep&
updRep() {assert(rep);
return *rep;}
414 friend class IntegratorRep;
419 #endif // SimTK_SIMMATH_INTEGRATOR_H_