From 34395ddcd468f49e12a3f975cf92fba46a0dbdeb Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 20 Aug 2012 18:02:22 +0100 Subject: [PATCH] COMP: scotchDecomp: floating point error checking --- .../decompose/ptscotchDecomp/ptscotchDecomp.C | 18 +++++------------ .../decompose/scotchDecomp/scotchDecomp.C | 20 ++++++------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C index 56a669b119..8736987ca9 100644 --- a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C @@ -129,17 +129,9 @@ extern "C" // Hack: scotch generates floating point errors so need to switch of error // trapping! -#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64) -# define LINUX -#endif - -#if defined(LINUX) && defined(__GNUC__) -# define LINUX_GNUC -#endif - -#ifdef LINUX_GNUC -# ifndef __USE_GNU -# define __USE_GNU +#ifdef __GLIBC__ +# ifndef _GNU_SOURCE +# define _GNU_SOURCE # endif # include #endif @@ -651,7 +643,7 @@ Foam::label Foam::ptscotchDecomp::decompose // Hack:switch off fpu error trapping -# ifdef LINUX_GNUC +# ifdef FE_NOMASK_ENV int oldExcepts = fedisableexcept ( FE_DIVBYZERO @@ -681,7 +673,7 @@ Foam::label Foam::ptscotchDecomp::decompose "SCOTCH_graphMap" ); -# ifdef LINUX_GNUC +# ifdef FE_NOMASK_ENV feenableexcept(oldExcepts); # endif diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C index d81af37b00..e8bfe1aa10 100644 --- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C +++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -135,17 +135,9 @@ extern "C" // Hack: scotch generates floating point errors so need to switch of error // trapping! -#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64) -# define LINUX -#endif - -#if defined(LINUX) && defined(__GNUC__) -# define LINUX_GNUC -#endif - -#ifdef LINUX_GNUC -# ifndef __USE_GNU -# define __USE_GNU +#ifdef __GLIBC__ +# ifndef _GNU_SOURCE +# define _GNU_SOURCE # endif # include #endif @@ -503,7 +495,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc // Hack:switch off fpu error trapping -# ifdef LINUX_GNUC +# ifdef FE_NOMASK_ENV int oldExcepts = fedisableexcept ( FE_DIVBYZERO @@ -526,7 +518,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc "SCOTCH_graphMap" ); -# ifdef LINUX_GNUC +# ifdef FE_NOMASK_ENV feenableexcept(oldExcepts); # endif