ENH: support true/false, yes/no values for FOAM_ABORT (#1896)

- consistent with FOAM_SIGFPE etc.

- centralize code as error::useAbort() static function to avoid
  scattering the logic throughout the code.

ENH: also accept "0" and "1" string values for Switch

- not the normal path for Switch input (eg, from a dictionary), but
  consistent with bool definitions and simplifies string parsing.

  This means that `FOAM_SIGFPE=1 application` will now also work.
This commit is contained in:
Mark Olesen
2020-10-23 16:55:21 +02:00
parent 9eb73a92e2
commit 410d38b9d9
8 changed files with 29 additions and 9 deletions

View File

@ -129,6 +129,10 @@ projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
# = true | false
#export FOAM_SETNAN=false
# [FOAM_ABORT] - Treat exit() on FatalError as abort()
# = true | false
#export FOAM_ABORT=false
# [FOAM_CODE_TEMPLATES] - dynamicCode templates
# - unset: uses 'foamEtcFile -list codeTemplates/dynamicCode'
##export FOAM_CODE_TEMPLATES="$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode"

View File

@ -131,6 +131,10 @@ set projectDir=`lsof +p $$ |& sed -ne 's#^[^/]*##;\@/'"$projectName"'[^/]*/etc/c
# = true | false
#setenv FOAM_SETNAN false
# [FOAM_ABORT] - Treat exit() on FatalError as abort()
# = true | false
#setenv FOAM_ABORT false
# [FOAM_CODE_TEMPLATES] - dynamicCode templates
# - unset: uses 'foamEtcFile -list codeTemplates/dynamicCode'
##setenv FOAM_CODE_TEMPLATES "$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode"