44 boost::shared_ptr<RegularStimulus> p_reg_stim = boost::static_pointer_cast<RegularStimulus>(
mpModel->GetStimulusFunction());
45 boost::shared_ptr<ZeroStimulus> p_zero_stim(
new ZeroStimulus);
46 const double pacing_cycle_length = p_reg_stim->GetPeriod();
47 double stimulus_duration = p_reg_stim->GetDuration();
48 double stimulus_start_time = p_reg_stim->GetStartTime();
49 double stimulus_end_time = stimulus_start_time + stimulus_duration;
50 double maximum_time_step = pacing_cycle_length;
52 bool force_reset_setting =
mpModel->GetForceReset();
53 bool minimal_reset_setting =
mpModel->GetMinimalReset();
59 std::vector<double> old_state_vars;
60 std::vector<double> new_state_vars;
63 const unsigned num_paces_to_analyse = (
mTwoPaceScan) ? 2u : 1u;
64 for (
unsigned i = 0; i <
mMaxNumPaces; i = i + num_paces_to_analyse)
67 for (
unsigned j = 0; j < num_paces_to_analyse; j++)
70 if (stimulus_start_time > 0)
73 mpModel->SetStimulusFunction(p_zero_stim);
74 mpModel->Solve((pacing_cycle_length) * (
double)(i + j), (pacing_cycle_length) * (
double)(i + j) + stimulus_start_time, maximum_time_step);
78 mpModel->SetStimulusFunction(p_reg_stim);
79 mpModel->Solve((pacing_cycle_length) * (
double)(i + j) + stimulus_start_time, (pacing_cycle_length) * (
double)(i + j) + stimulus_end_time, maximum_time_step);
82 mpModel->SetStimulusFunction(p_zero_stim);
83 mpModel->Solve((pacing_cycle_length) * (
double)(i + j) + stimulus_end_time, (pacing_cycle_length) * (
double)(i + j + 1), maximum_time_step);
91 for (
unsigned j = 0; j < old_state_vars.size(); j++)
93 temp += fabs(new_state_vars[j] - old_state_vars[j]);
101 old_state_vars = new_state_vars;
105 mpModel->SetStimulusFunction(p_reg_stim);
106 mpModel->SetForceReset(force_reset_setting);
107 mpModel->SetMinimalReset(minimal_reset_setting);