ENH: add trapFpe and setNaN optimisationSwitch (issue #517)

- allows configuration without an environment variable.
  For compatibility still respect FOAM_SIGFPE and FOAM_SETNAN
  env-variables

- The env-variables are now treated as true/false switch values.
  Previously there was just a check for env exists or not, but this
  can be fairly fragile for a user's environment.
This commit is contained in:
Mark Olesen
2017-07-05 17:49:37 +02:00
parent e54a930dcc
commit c50368ecc6
14 changed files with 139 additions and 83 deletions

View File

@ -59,6 +59,7 @@ Usage
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "sigFpe.H"
#include "Time.H"
#include "fvMesh.H"
#include "fvMeshTools.H"
@ -2277,7 +2278,7 @@ int main(int argc, char *argv[])
bool newTimes = args.optionFound("newTimes");
if (env("FOAM_SIGFPE"))
if (Foam::sigFpe::requested())
{
WarningInFunction
<< "Detected floating point exception trapping (FOAM_SIGFPE)."
@ -2287,7 +2288,6 @@ int main(int argc, char *argv[])
}
const HashSet<word> selectedFields(0);
const HashSet<word> selectedLagrangianFields(0);