19 template <
size_t STATE_DIM>
30 : maxNumSteps_(maxStepsPerSec), stepsTaken_(0)
38 virtual void reset()
override { stepsTaken_ = 0; };
46 virtual bool checkEvent(
const State_T& state,
const double& t)
override 49 return (stepsTaken_ > maxNumSteps_);
53 virtual void handleEvent(
const State_T& state,
const double& t)
override 55 throw std::runtime_error(
"integration terminated: max number of steps reached.\n");
virtual void handleEvent(const State_T &state, const double &t) override
throws a std::runtime_error to terminate the integration
Definition: MaxStepsEventHandler.h:53
MaxStepsEventHandler(const size_t &maxStepsPerSec=std::numeric_limits< size_t >::max())
default constructor
Definition: MaxStepsEventHandler.h:29
virtual ~MaxStepsEventHandler()
destructor
Definition: MaxStepsEventHandler.h:35
Event handler to kill a (variable step) Integrator after doing too many steps.
Definition: MaxStepsEventHandler.h:20
ct::core::StateVector< STATE_DIM > State_T
Definition: MaxStepsEventHandler.h:23
virtual void reset() override
resets the number of steps taken
Definition: MaxStepsEventHandler.h:38
virtual bool checkEvent(const State_T &state, const double &t) override
checks if number of steps is exceeded
Definition: MaxStepsEventHandler.h:46
void setMaxNumSteps(size_t maxNumSteps)
set maximum number of steps
Definition: MaxStepsEventHandler.h:62
Interface for an event handler for an Integrator.
Definition: EventHandler.h:24
virtual bool callOnSubsteps() override
Definition: MaxStepsEventHandler.h:36