From 7c2b120609c2e5b524a41b5187769486aa3ee8be Mon Sep 17 00:00:00 2001 From: Jeffrey Reep Date: Wed, 17 Jul 2024 17:06:54 -1000 Subject: [PATCH] fix bug with integer --- source/main.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index 6a2804c..612d3e7 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -14,7 +14,6 @@ int main(int argc, char *argv[]) { //Declarations int num_steps; - int fail = 1; state_type state; char config[256]; LOOP loop; @@ -75,6 +74,7 @@ int main(int argc, char *argv[]) // Start integration loop while(tparameters.total_time) { + int fail = 1; int num_failures = 0; while(fail>0) { @@ -106,8 +106,7 @@ int main(int argc, char *argv[]) { // Constant timestep integration num_steps = boost::numeric::odeint::integrate_const( controlled_stepper, loop->CalculateDerivs, state, loop->parameters.tau, loop->parameters.total_time, loop->parameters.tau, obs->Observe); - fail = obs->CheckNan(state); - if(fail) + if(obs->CheckNan(state)) { throw std::runtime_error("NaNs were detected in the output. Check the input configuration."); }