From f3f699396163440080e4a200884b4b8273faced3 Mon Sep 17 00:00:00 2001 From: Chris Cantwell Date: Fri, 27 May 2016 22:12:57 +0100 Subject: [PATCH] Updated CHANGELOG. Add code comments, tidy code. --- CHANGELOG.md | 2 ++ library/LibUtilities/BasicUtils/ErrorUtil.hpp | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37d1869f0..f7c04c2ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ v4.3.2 - Print error message for invalid equation also in release version (!634) - HistoryPoints filter now uses closest plane to requested z-coordinate and output is produced in physical space (!621). +- Fix bug in iterative solver where only root process would ASSERT when + exceeding the maximum number of iterations (!636) **FieldConvert**: - Fix appearence of duplicate messages when running in parallel (!626) diff --git a/library/LibUtilities/BasicUtils/ErrorUtil.hpp b/library/LibUtilities/BasicUtils/ErrorUtil.hpp index 8a7a5c7d8..051ba08bb 100644 --- a/library/LibUtilities/BasicUtils/ErrorUtil.hpp +++ b/library/LibUtilities/BasicUtils/ErrorUtil.hpp @@ -77,7 +77,6 @@ namespace ErrorUtil inline static void Error(ErrType type, const char *routine, int lineNumber, const char *msg, unsigned int level) { - int rank = 0; // The user of outStream is primarily for the unit tests. // The unit tests often generate errors on purpose to make sure // invalid usage is flagged appropriately. Printing the error @@ -91,6 +90,9 @@ namespace ErrorUtil #endif msg; + // Default rank is zero. If MPI used and initialised, populate with + // the correct rank. Messages are only printed on rank zero. + int rank = 0; #if defined(NEKTAR_USE_MPI) int flag; MPI_Initialized(&flag); @@ -99,7 +101,7 @@ namespace ErrorUtil MPI_Comm_rank(MPI_COMM_WORLD,&rank); } #endif - + std::string btMessage(""); #if defined(NEKTAR_FULLDEBUG) #ifndef _WIN32 @@ -118,12 +120,12 @@ namespace ErrorUtil #endif #endif - switch(type) + switch (type) { case efatal: - if(!rank) + if (!rank) { - if( outStream ) + if (outStream) { (*outStream) << btMessage; (*outStream) << "Fatal : " << baseMsg << std::endl; @@ -135,13 +137,12 @@ namespace ErrorUtil << std::endl; } } - throw NekError(baseMsg); break; case ewarning: - if(!rank) + if (!rank) { - if( outStream ) + if (outStream) { (*outStream) << btMessage; (*outStream) << "Warning: " << baseMsg << std::endl; @@ -153,7 +154,6 @@ namespace ErrorUtil } } break; - default: std::cerr << "Unknown warning type: " << baseMsg << std::endl; } -- GitLab