diff --git a/include/amici/model_dae.h b/include/amici/model_dae.h index 375ac018fd..b35cfa1d70 100644 --- a/include/amici/model_dae.h +++ b/include/amici/model_dae.h @@ -40,6 +40,8 @@ class Model_DAE : public Model { * @param ndxdotdp_explicit number of nonzero elements dxdotdp_explicit * @param ndxdotdx_explicit number of nonzero elements dxdotdx_explicit * @param w_recursion_depth Recursion depth of fw + * @param state_independent_events Map of events with state-independent + * triggers functions, mapping trigger timepoints to event indices. */ Model_DAE( ModelDimensions const& model_dimensions, @@ -47,12 +49,13 @@ class Model_DAE : public Model { const SecondOrderMode o2mode, std::vector const& idlist, std::vector const& z2event, bool const pythonGenerated = false, int const ndxdotdp_explicit = 0, int const ndxdotdx_explicit = 0, - int const w_recursion_depth = 0 + int const w_recursion_depth = 0, + std::map> state_independent_events = {} ) : Model( model_dimensions, simulation_parameters, o2mode, idlist, z2event, pythonGenerated, ndxdotdp_explicit, ndxdotdx_explicit, - w_recursion_depth + w_recursion_depth, state_independent_events ) { derived_state_.M_ = SUNMatrixWrapper(nx_solver, nx_solver); auto M_nnz = static_cast( diff --git a/src/forwardproblem.cpp b/src/forwardproblem.cpp index 50281c9188..ae22f42286 100644 --- a/src/forwardproblem.cpp +++ b/src/forwardproblem.cpp @@ -113,7 +113,10 @@ void ForwardProblem::workForwardProblem() { // get list of trigger timepoints for fixed-time triggered events auto trigger_timepoints = model->get_trigger_timepoints(); - auto it_trigger_timepoints = trigger_timepoints.begin(); + auto it_trigger_timepoints = std::find_if( + trigger_timepoints.begin(), trigger_timepoints.end(), + [this](auto t) { return t > this->t_; } + ); /* loop over timepoints */ for (it_ = 0; it_ < model->nt(); it_++) {