From ae974eba3556226fd855c0157e3c1208951e3c71 Mon Sep 17 00:00:00 2001 From: Gary Mirams Date: Tue, 19 May 2026 12:30:40 +0000 Subject: [PATCH 1/3] src/single_cell/AbstractActionPotentialMethod.cpp --- .../AbstractActionPotentialMethod.hpp | 10 +++++ src/single_cell/ApPredictMethods.cpp | 1 + .../SingleActionPotentialPrediction.hpp | 40 ++++++++++--------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/single_cell/AbstractActionPotentialMethod.hpp b/src/single_cell/AbstractActionPotentialMethod.hpp index 247c138..c06337a 100644 --- a/src/single_cell/AbstractActionPotentialMethod.hpp +++ b/src/single_cell/AbstractActionPotentialMethod.hpp @@ -149,6 +149,9 @@ class AbstractActionPotentialMethod /** Whether to suppress output to std::cout */ bool mSuppressOutput; + /** Whether to suppress warning messages when no AP is detected. */ + bool mSuppressWarnings; + /** The frequency in Hz at which to perform this run */ double mHertz; @@ -385,6 +388,13 @@ class AbstractActionPotentialMethod */ void SuppressOutput(bool suppress = true); + /** + * Tell the simulator whether to suppress warnings when no AP is detected. + * + * @param suppress Whether to suppress no-AP warnings (defaults to true). + */ + void SuppressWarnings(bool suppress = true); + /** * Tell this class to treat a lack of 1:1 correspondence between stimuli and * action potentials diff --git a/src/single_cell/ApPredictMethods.cpp b/src/single_cell/ApPredictMethods.cpp index 5d6e374..09344e5 100644 --- a/src/single_cell/ApPredictMethods.cpp +++ b/src/single_cell/ApPredictMethods.cpp @@ -1064,6 +1064,7 @@ void ApPredictMethods::CommonRunMethod() { SingleActionPotentialPrediction ap_runner(mpModel); ap_runner.SuppressOutput(); + ap_runner.SuppressWarnings(); // We expect this not to be converged and to cause AP failures, don't want warnings ap_runner.SetMaxNumPaces(100u); this->SetVoltageThresholdForRecordingAsActionPotential(ap_runner.DetectVoltageThresholdForActionPotential()); } diff --git a/src/single_cell/SingleActionPotentialPrediction.hpp b/src/single_cell/SingleActionPotentialPrediction.hpp index 62b8b0e..b7fc98a 100644 --- a/src/single_cell/SingleActionPotentialPrediction.hpp +++ b/src/single_cell/SingleActionPotentialPrediction.hpp @@ -69,15 +69,15 @@ class SingleActionPotentialPrediction : public AbstractActionPotentialMethod OdeSolution RunSteadyPacingExperiment() { double printing_timestep = 0.1; - return AbstractActionPotentialMethod::SteadyStatePacingExperiment(mpModel, - mApd90, - mApd50, - mUpstroke, - mPeak, - mPeakTime, - mCaMax, - mCaMin, - printing_timestep); + return this->SteadyStatePacingExperiment(mpModel, + mApd90, + mApd50, + mUpstroke, + mPeak, + mPeakTime, + mCaMax, + mCaMin, + printing_timestep); } /** @@ -89,16 +89,16 @@ class SingleActionPotentialPrediction : public AbstractActionPotentialMethod OdeSolution RunSteadyPacingExperiment(double conc) { double printing_timestep = 0.1; - return AbstractActionPotentialMethod::SteadyStatePacingExperiment(mpModel, - mApd90, - mApd50, - mUpstroke, - mPeak, - mPeakTime, - mCaMax, - mCaMin, - printing_timestep, - conc); + return this->SteadyStatePacingExperiment(mpModel, + mApd90, + mApd50, + mUpstroke, + mPeak, + mPeakTime, + mCaMax, + mCaMin, + printing_timestep, + conc); } /** @@ -217,7 +217,9 @@ class SingleActionPotentialPrediction : public AbstractActionPotentialMethod // Remember state variables N_Vector steady_full_conductance_state_vars = mpModel->GetStateVariables(); + this->SuppressWarnings(true); OdeSolution solution = RunSteadyPacingExperiment(); + this->SuppressWarnings(false); // Put conductances back where they were! mpModel->SetParameter(fast_sodium_name, original_na_conductance); From 7460d2b7ae5c1aafed461791834ac89e4ece8a4e Mon Sep 17 00:00:00 2001 From: Gary Mirams Date: Tue, 19 May 2026 12:31:06 +0000 Subject: [PATCH 2/3] add warnings --- .../AbstractActionPotentialMethod.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/single_cell/AbstractActionPotentialMethod.cpp b/src/single_cell/AbstractActionPotentialMethod.cpp index 8b36869..85b5665 100644 --- a/src/single_cell/AbstractActionPotentialMethod.cpp +++ b/src/single_cell/AbstractActionPotentialMethod.cpp @@ -56,6 +56,7 @@ AbstractActionPotentialMethod::AbstractActionPotentialMethod() mRepeat(false), mRepeatNumber(0u), mSuppressOutput(false), + mSuppressWarnings(false), mHertz(1.0), // default to 1 Hz, replaced by suitable command line // argument if present. mSuccessful(false), @@ -157,8 +158,12 @@ unsigned AbstractActionPotentialMethod::GetErrorCode() void AbstractActionPotentialMethod::WriteMessageToFile( const std::string &rMessage) { - WARNING(rMessage); // Send the message to std::cout as well as any message - // file in subclasses. + if (!mSuppressWarnings) + { + // Send the message to std::cout as well as any message + // file in subclasses. + WARNING(rMessage); + } } void AbstractActionPotentialMethod::SuppressOutput(bool suppress) @@ -166,6 +171,11 @@ void AbstractActionPotentialMethod::SuppressOutput(bool suppress) mSuppressOutput = suppress; } +void AbstractActionPotentialMethod::SuppressWarnings(bool suppress) +{ + mSuppressWarnings = suppress; +} + OdeSolution AbstractActionPotentialMethod::SteadyStatePacingExperiment( boost::shared_ptr pModel, double &rApd90, @@ -292,6 +302,10 @@ OdeSolution AbstractActionPotentialMethod::SteadyStatePacingExperiment( { steady_runner.SuppressOutput(); } + if (mSuppressWarnings) + { + steady_runner.SuppressWarnings(); + } if (mMaxNumPaces != UNSIGNED_UNSET) { steady_runner.SetMaxNumPaces(mMaxNumPaces - num_paces_analysed_elsewhere); From 0bbc999b67f91495366ebce7f26fafb01fb6ba86 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 12:06:08 +0000 Subject: [PATCH 3/3] Remove trailing whitespace in warning block --- src/single_cell/AbstractActionPotentialMethod.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/single_cell/AbstractActionPotentialMethod.cpp b/src/single_cell/AbstractActionPotentialMethod.cpp index e3eee87..6d043c0 100644 --- a/src/single_cell/AbstractActionPotentialMethod.cpp +++ b/src/single_cell/AbstractActionPotentialMethod.cpp @@ -163,7 +163,7 @@ void AbstractActionPotentialMethod::WriteMessageToFile( // Send the message to std::cout as well as any message // file in subclasses. WARNING(rMessage); - } + } } void AbstractActionPotentialMethod::SuppressOutput(bool suppress)