diff --git a/src/single_cell/AbstractActionPotentialMethod.cpp b/src/single_cell/AbstractActionPotentialMethod.cpp index 5106bd8..6d043c0 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); 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 b6fc16e..33ef7d6 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);