@@ -61,12 +61,7 @@ void EventHandlingSimulator::run(
6161 ws_->t = t0;
6262 ws_->tlastroot = t0;
6363
64- // handle initial events
65- if (model_->ne && std::ranges::any_of (ws_->roots_found , [](int rf) {
66- return rf == 1 ;
67- })) {
68- handle_event (true , edata);
69- }
64+ handle_initial_events (edata);
7065
7166 // store initial state and sensitivity
7267 result.initial_state_ = get_simulation_state ();
@@ -137,7 +132,7 @@ void EventHandlingSimulator::run(
137132 ++it_trigger_timepoints;
138133 }
139134
140- handle_event (false , edata);
135+ handle_events (false , edata);
141136 }
142137 }
143138 }
@@ -221,7 +216,7 @@ void EventHandlingSimulator::run_steady_state(
221216 ++it_trigger_timepoints;
222217 }
223218
224- handle_event (false , nullptr );
219+ handle_events (false , nullptr );
225220 }
226221
227222 solver_->writeSolution (ws_->t , ws_->x , ws_->dx , ws_->sx );
@@ -365,7 +360,7 @@ void ForwardProblem::handlePostequilibration() {
365360 }
366361}
367362
368- void EventHandlingSimulator::handle_event (
363+ void EventHandlingSimulator::handle_events (
369364 bool const initial_event, ExpData const * edata
370365) {
371366 // Some event triggered. This may be due to some discontinuity, a bolus to
@@ -493,6 +488,14 @@ void EventHandlingSimulator::handle_event(
493488 }
494489}
495490
491+ void EventHandlingSimulator::handle_initial_events (ExpData const * edata) {
492+ if (model_->ne && std::ranges::any_of (ws_->roots_found , [](int const rf) {
493+ return rf == 1 ;
494+ })) {
495+ handle_events (true , edata);
496+ }
497+ }
498+
496499void EventHandlingSimulator::store_event (ExpData const * edata) {
497500 bool const is_last_timepoint
498501 = (ws_->t == model_->getTimepoint (model_->nt () - 1 ));
@@ -1063,8 +1066,7 @@ void SteadystateProblem::runSteadystateSimulationFwd() {
10631066 simulator_.emplace (model_, solver_, ws_, nullptr );
10641067 simulator_->result .initial_state_ = period_result_.initial_state_ ;
10651068
1066- // handle initial events
1067- simulator_->handle_event (true , nullptr );
1069+ simulator_->handle_initial_events (nullptr );
10681070
10691071 updateRightHandSide ();
10701072
@@ -1141,7 +1143,7 @@ void SteadystateProblem::findSteadyStateByNewtonsMethod(bool newton_retry) {
11411143 simulator_->result .initial_state_ .dx = ws_->dx ;
11421144 simulator_->result .initial_state_ .sx = ws_->sx ;
11431145
1144- simulator_->handle_event ( true , nullptr );
1146+ simulator_->handle_initial_events ( nullptr );
11451147 period_result_ = simulator_->result ;
11461148 }
11471149
0 commit comments