From 7cb56873eee5e26a774bd3d064dfb2a62a70de71 Mon Sep 17 00:00:00 2001 From: Andrew Heather <a.heather@opencfd.co.uk> Date: Thu, 26 Nov 2015 12:12:51 +0000 Subject: [PATCH] ENH: Foam abort - reading from env(FOAM_ABORT) instead of caching value on construction --- src/OpenFOAM/db/error/IOerror.C | 6 +++--- src/OpenFOAM/db/error/error.C | 9 +++------ src/OpenFOAM/db/error/error.H | 5 ++--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/OpenFOAM/db/error/IOerror.C b/src/OpenFOAM/db/error/IOerror.C index 08f490c0bd8..ee138d80c90 100644 --- a/src/OpenFOAM/db/error/IOerror.C +++ b/src/OpenFOAM/db/error/IOerror.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -174,7 +174,7 @@ void Foam::IOerror::exit(const int) jobInfo.exit(); } - if (abort_) + if (env("FOAM_ABORT")) { abort(); } @@ -215,7 +215,7 @@ void Foam::IOerror::abort() jobInfo.abort(); } - if (abort_) + if (env("FOAM_ABORT")) { Perr<< endl << *this << endl << "\nFOAM aborting (FOAM_ABORT set)\n" << endl; diff --git a/src/OpenFOAM/db/error/error.C b/src/OpenFOAM/db/error/error.C index 91ec556324b..f29eafb486d 100644 --- a/src/OpenFOAM/db/error/error.C +++ b/src/OpenFOAM/db/error/error.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,7 +40,6 @@ Foam::error::error(const string& title) functionName_("unknown"), sourceFileName_("unknown"), sourceFileLineNumber_(0), - abort_(env("FOAM_ABORT")), throwExceptions_(false), messageStreamPtr_(new OStringStream()) { @@ -61,7 +60,6 @@ Foam::error::error(const dictionary& errDict) functionName_(errDict.lookup("functionName")), sourceFileName_(errDict.lookup("sourceFileName")), sourceFileLineNumber_(readLabel(errDict.lookup("sourceFileLineNumber"))), - abort_(env("FOAM_ABORT")), throwExceptions_(false), messageStreamPtr_(new OStringStream()) { @@ -83,7 +81,6 @@ Foam::error::error(const error& err) functionName_(err.functionName_), sourceFileName_(err.sourceFileName_), sourceFileLineNumber_(err.sourceFileLineNumber_), - abort_(err.abort_), throwExceptions_(err.throwExceptions_), messageStreamPtr_(new OStringStream(*err.messageStreamPtr_)) { @@ -173,7 +170,7 @@ void Foam::error::exit(const int errNo) jobInfo.exit(); } - if (abort_) + if (env("FOAM_ABORT")) { abort(); } @@ -214,7 +211,7 @@ void Foam::error::abort() jobInfo.abort(); } - if (abort_) + if (env("FOAM_ABORT")) { Perr<< endl << *this << endl << "\nFOAM aborting (FOAM_ABORT set)\n" << endl; diff --git a/src/OpenFOAM/db/error/error.H b/src/OpenFOAM/db/error/error.H index 97a08b175c6..5626ba4db0d 100644 --- a/src/OpenFOAM/db/error/error.H +++ b/src/OpenFOAM/db/error/error.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -78,11 +78,10 @@ protected: string sourceFileName_; label sourceFileLineNumber_; - bool abort_; - bool throwExceptions_; OStringStream* messageStreamPtr_; + public: // Constructors -- GitLab