From 704620aea1b08be4f3712df8f1a2e3d99ed845f0 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Sun, 13 Nov 2016 19:53:11 +0100
Subject: [PATCH] ENH: simplify check for metis sizes (issue #290)

- Now that the metisDecomp uses the metis definition for float/double,
  do not need to verify the scalar sizes.

Note:
- could drop precision qualifier for metis, scotch installation
  (include, lib) as being unneeded, but it is simpler to keep them
  and continue to use the FOAM_EXT_LIBBIN path
  (in case other ThirdParty software is compiled with different
  precisions).
---
 etc/config.sh/scotch            |  2 +-
 src/parallel/decompose/Allwmake | 27 +++------------------------
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/etc/config.sh/scotch b/etc/config.sh/scotch
index 203f394eb93..bb5e12bced0 100644
--- a/etc/config.sh/scotch
+++ b/etc/config.sh/scotch
@@ -28,7 +28,7 @@
 #     Setup file for scotch include/libraries.
 #     Sourced during wmake process only.
 #
-#     Normally used to specify the metis version and location for a
+#     Normally used to specify the scotch version and location for a
 #     ThirdParty installation.
 #
 #     If using system-wide installations, use the following setting:
diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake
index cf42f4c0bee..c32e09fc7e0 100755
--- a/src/parallel/decompose/Allwmake
+++ b/src/parallel/decompose/Allwmake
@@ -4,19 +4,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Parse arguments for library compilation
 . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
 
-
-# Extract an integer value from '#define NAME ...'
-getIntDefine()
-{
-    local name="$1"
-    local file="$2"
-    local val=$(sed -ne \
-        's/^[ tab]*#[ tab]*define[ tab][ tab]*'"$name"'[ tab][ tab]*\([1-9][0-9]\).*/\1/p' \
-        "$file")
-    echo "${val:-0}"
-}
-
-
 # Test for metis.
 # - return 0 and export METIS_ARCH_PATH on success
 hasMetis()
@@ -62,24 +49,16 @@ hasMetis()
     }
 
     # Ensure consistent sizes between OpenFOAM and metis header
-    local label=$(getIntDefine  IDXTYPEWIDTH  $header)
-    local scalar=$(getIntDefine REALTYPEWIDTH $header)
-
+    # Extract IDXTYPEWIDTH from metis.h: regex as per ThirdParty Allwmake
+    local label=$(sed -ne 's/^.*#define  *IDXTYPEWIDTH  *\([1-9][0-9]\).*/\1/p' $header)
     [ "$WM_LABEL_SIZE" = "$label" ] || {
         echo "   skipping - label=$WM_LABEL_SIZE, metis.h has '$label'"
         echo
         return 1
     }
 
-    [ "$WM_PRECISION_OPTION" = SP -a "$scalar" = 32 ] || \
-    [ "$WM_PRECISION_OPTION" = DP -a "$scalar" = 64 ] || {
-        echo "   skipping - scalar='$WM_PRECISION_OPTION', metis.h has '$scalar'"
-        echo
-        return 1
-    }
-
     echo "using METIS_ARCH_PATH=$METIS_ARCH_PATH"
-    echo "    label=$label, scalar=$scalar"
+    echo "    label=$label"
     echo
     export METIS_ARCH_PATH
     return 0 # success
-- 
GitLab