Compare commits

...

3 Commits

Author SHA1 Message Date
127f4268af CONFIG: bump 2106 patch level to 211215 2021-12-15 11:08:43 +01:00
0bd1b0feac BACKPORT: config script bugfixes
- align with fixes for v2112

- align foamConfigurePaths with v2112 modifications

CONFIG: scan scotch-64.h as possible fallback (#1904)

- For RedHat 8, the /usr/include/scotch.h is actually wrapped
  with a condition check based on LP64 vs ILP32, so need to check
  with those headers if the first one failed.
2021-12-10 14:00:10 +01:00
42178fdd5d BACKPORT: simpler hashing of string-types
includes:

    ENH: simplify hashing overloads of string-types

    - this revises the changes made in 95cd8ee75c to replace the
      SFINAE-type of handling of string hashes with direct definitions.

      This places a bit more burden on the developer if creating hashable
      classes derived from std::string or variants of Foam::string, but
      improves reliability when linking.

    STYLE: drop template key defaulting from HashSet

    - this was never used and `HashSet<>` is much less transparent
      than writing `HashSet<word>` or `wordHashSet`

    STYLE: use Hash<word> instead of string::hasher for runTimeSelectionTables
2021-12-09 18:00:59 +01:00
21 changed files with 725 additions and 379 deletions

View File

@ -1,2 +1,2 @@
api=2106 api=2106
patch=0 patch=211215

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd. # Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -42,11 +42,11 @@ printHelp() {
Obsolete options: Obsolete options:
-foamInstall DIR [obsolete] -foamInstall DIR [obsolete]
-projectName NAME [obsolete] -projectName NAME [obsolete]
-sigfpe|-no-sigfpe [obsolete - now under etc/controlDict] -sigfpe|-no-sigfpe [obsolete] now under etc/controlDict
-archOption 32|64 [obsolete setting of 'WM_ARCH_OPTION' - edit manually] -archOption 32|64 [obsolete] now edit WM_ARCH_OPTION manually
Equivalent options: Equivalent options:
-version -foamVersion --projectVersion -version --projectVersion | -foamVersion
-archOption --archOption -archOption --archOption
-third -ThirdParty -third -ThirdParty
-paraview --paraviewVersion | -paraviewVersion -paraview --paraviewVersion | -paraviewVersion
@ -55,6 +55,8 @@ Equivalent options:
-scotch-path --scotchArchPath | -scotchArchPath -scotch-path --scotchArchPath | -scotchArchPath
-system-compiler -system -system-compiler -system
-third-compiler -third -third-compiler -third
-sys-openmpi -openmpi-system
-openmpi -openmpi-third
HELP_COMPAT HELP_COMPAT
exit 0 # A clean exit exit 0 # A clean exit
@ -89,10 +91,9 @@ Compiler
mpc-VERSION For ThirdParty gcc (mpc-system for system library) mpc-VERSION For ThirdParty gcc (mpc-system for system library)
MPI MPI
-mpi NAME specify 'WM_MPLIB' type (eg, INTELMPI, etc) -mpi=NAME Specify 'WM_MPLIB' type (eg, INTELMPI, etc)
-openmpi VER use ThirdParty openmpi, with version for 'FOAM_MPI' -openmpi[=VER] Use ThirdParty openmpi, with version for 'FOAM_MPI'
-openmpi-system use system openmpi -sys-openmpi[=MAJ] Use system openmpi, with specified major version
-openmpi-third use ThirdParty openmpi (using default version)
Components versions (ThirdParty) Components versions (ThirdParty)
-adios VER specify 'adios2_version' -adios VER specify 'adios2_version'
@ -120,12 +121,12 @@ Components specified by absolute path
-scotch-path DIR Path for 'SCOTCH_ARCH_PATH' (overrides -scotch) -scotch-path DIR Path for 'SCOTCH_ARCH_PATH' (overrides -scotch)
Graphics Graphics
-paraview VER specify 'ParaView_VERSION' (eg, 5.4.1 or system) -paraview VER specify 'ParaView_VERSION' (eg, 5.9.0 or system)
-paraview-qt VER specify 'ParaView_QT' (eg, qt-system) -paraview-qt VER specify 'ParaView_QT' (eg, qt-system)
-paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.4.1) -paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.9.0)
-llvm VER specify 'mesa_llvm' -llvm VER specify 'mesa_llvm'
-mesa VER specify 'mesa_version' (eg, mesa-13.0.1) -mesa VER specify 'mesa_version' (eg, mesa-13.0.1)
-vtk VER specify 'vtk_version' (eg, VTK-7.1.0) -vtk VER specify 'vtk_version' (eg, VTK-9.0.0)
-llvm-path DIR Path for 'LLVM_ARCH_PATH' (overrides -llvm) -llvm-path DIR Path for 'LLVM_ARCH_PATH' (overrides -llvm)
-mesa-path DIR Path for 'MESA_ARCH_PATH' (overrides -mesa) -mesa-path DIR Path for 'MESA_ARCH_PATH' (overrides -mesa)
-vtk-path DIR Path for 'VTK_DIR' (overrides -vtk) -vtk-path DIR Path for 'VTK_DIR' (overrides -vtk)
@ -212,12 +213,13 @@ _inlineSed()
# Local filename (for reporting) # Local filename (for reporting)
localFile="$(echo "$file" | sed -e "s#^$projectDir/##")" localFile="$(echo "$file" | sed -e "s#^$projectDir/##")"
grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file" || { \ if grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file"
then
[ -n "$msg" ] && echo " $msg ($localFile)"
else
echo "Failed: ${msg:-replacement} in $localFile" echo "Failed: ${msg:-replacement} in $localFile"
return 1 return 1
} fi
[ -n "$msg" ] && echo " $msg ($localFile)"
return 0 return 0
} }
@ -278,8 +280,8 @@ replaceEtc()
local file="$1" local file="$1"
shift shift
file=$(_foamEtc "$file") file="$(_foamEtc "$file")"
replace $file "$@" replace "$file" "$@"
} }
@ -289,24 +291,36 @@ replaceEtcCsh()
local file="$1" local file="$1"
shift shift
file=$(_foamEtc "$file") file="$(_foamEtc "$file")"
replaceCsh $file "$@" replaceCsh "$file" "$@"
} }
# Get the option's value (argument), or die on missing or empty argument # Get the option's value (argument), or die on missing or empty argument
# $1 option # $1 option
# $2 value # $2 value
# Returns values via optValue, nOptArgs variables!!
optValue=""
nOptArgs=0 # The number of args to shift
getOptionValue() getOptionValue()
{ {
local value="$2" optValue="${1#*=}"
[ -n "$value" ] || die "'$1' option requires an argument" if [ "$optValue" = "$1" ]
then
# Eg, -option value
optValue="$2"
[ -n "$optValue" ] || die "'$1' option requires an argument"
nOptArgs=1
else
# Eg, -option=value
nOptArgs=0
fi
# Remove any surrounding double quotes # Remove any surrounding double quotes
value="${value%\"}" optValue="${optValue%\"}"
value="${value#\"}" optValue="${optValue#\"}"
echo "$value"
} }
@ -366,7 +380,7 @@ removeCshMagic()
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset adjusted optMpi unset adjusted
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
@ -421,26 +435,37 @@ CONFIG_CSH
[ -n "$FOAM_CONFIG_ETC" ] || unset FOAM_CONFIG_ETC [ -n "$FOAM_CONFIG_ETC" ] || unset FOAM_CONFIG_ETC
;; ;;
-project-path) -project-path=* | -project-path)
# Replace WM_PROJECT_DIR=... # Replace WM_PROJECT_DIR=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc bashrc WM_PROJECT_DIR "\"$optionValue\"" shift "${nOptArgs:-0}"
replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optionValue\""
removeBashMagic $(_foamEtc bashrc) if [ -n "$optValue" ]
removeCshMagic $(_foamEtc cshrc) then
replaceEtc bashrc WM_PROJECT_DIR "\"$optValue\""
replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optValue\""
adjusted=true removeBashMagic "$(_foamEtc bashrc)"
shift removeCshMagic "$(_foamEtc cshrc)"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-version | -foamVersion | --projectVersion) -version=* | -version | -foamVersion | --projectVersion)
# Replace WM_PROJECT_VERSION=... # Replace WM_PROJECT_VERSION=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc bashrc WM_PROJECT_VERSION "$optionValue" shift "${nOptArgs:-0}"
replaceEtcCsh cshrc WM_PROJECT_VERSION "$optionValue"
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc bashrc WM_PROJECT_VERSION "$optValue"
replaceEtcCsh cshrc WM_PROJECT_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-sp | -SP | -float32) -sp | -SP | -float32)
@ -466,131 +491,168 @@ CONFIG_CSH
-int32 | -int64) -int32 | -int64)
# Replace WM_LABEL_SIZE=... # Replace WM_LABEL_SIZE=...
optionValue="${1#-int}" optValue="${1#-int}"
replaceEtc bashrc WM_LABEL_SIZE "$optionValue" replaceEtc bashrc WM_LABEL_SIZE "$optValue"
replaceEtcCsh cshrc WM_LABEL_SIZE "$optionValue" replaceEtcCsh cshrc WM_LABEL_SIZE "$optValue"
adjusted=true adjusted=true
;; ;;
## Compiler ## ## Compiler ##
-clang) -clang=* | -clang)
# Replace default_clang_version=... # Replace default_clang_version=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/compiler default_clang_version "$optionValue" shift "${nOptArgs:-0}"
replaceEtc config.csh/compiler default_clang_version "$optionValue"
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/compiler default_clang_version "$optValue"
replaceEtc config.csh/compiler default_clang_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-gcc) -gcc=* | -gcc)
# Replace default_gcc_version=... # Replace default_gcc_version=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/compiler default_gcc_version "$optionValue" shift "${nOptArgs:-0}"
replaceEtc config.csh/compiler default_gcc_version "$optionValue"
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/compiler default_gcc_version "$optValue"
replaceEtc config.csh/compiler default_gcc_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-system-compiler | -system) -system-compiler | -system)
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=... # Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc bashrc \ shift "${nOptArgs:-0}"
WM_COMPILER_TYPE system \
WM_COMPILER "$optionValue" if [ -n "$optValue" ]
replaceEtcCsh cshrc \ then
WM_COMPILER_TYPE system \ replaceEtc bashrc \
WM_COMPILER "$optionValue" WM_COMPILER_TYPE system \
adjusted=true WM_COMPILER "$optValue"
shift replaceEtcCsh cshrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-third-compiler | -third | -ThirdParty) -third-compiler | -third | -ThirdParty)
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=... # Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc bashrc \ shift "${nOptArgs:-0}"
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optionValue" if [ -n "$optValue" ]
replaceEtcCsh cshrc \ then
WM_COMPILER_TYPE ThirdParty \ replaceEtc bashrc \
WM_COMPILER "$optionValue" WM_COMPILER_TYPE ThirdParty \
adjusted=true WM_COMPILER "$optValue"
shift replaceEtcCsh cshrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
gmp-[4-9]* | gmp-system) gmp-[4-9]* | gmp-system)
# gcc-related package # gcc-related package
replaceEtc config.sh/compiler default_gmp_version "$1" optValue="${1#-}"
replaceEtc config.csh/compiler default_gmp_version "$1" replaceEtc config.sh/compiler default_gmp_version "$optValue"
replaceEtc config.csh/compiler default_gmp_version "$optValue"
adjusted=true adjusted=true
;; ;;
mpfr-[2-9]* | mpfr-system) mpfr-[2-9]* | mpfr-system)
# gcc-related package # gcc-related package
replaceEtc config.sh/compiler default_mpfr_version "$1" optValue="${1#-}"
replaceEtc config.csh/compiler default_mpfr_version "$1" replaceEtc config.sh/compiler default_mpfr_version "$optValue"
replaceEtc config.csh/compiler default_mpfr_version "$optValue"
adjusted=true adjusted=true
;; ;;
mpc-[0-9]* | mpc-system) mpc-[0-9]* | mpc-system)
# gcc-related package # gcc-related package
replaceEtc config.sh/compiler default_mpc_version "$1" optValue="${1#-}"
replaceEtc config.csh/compiler default_mpc_version "$1" replaceEtc config.sh/compiler default_mpc_version "$optValue"
replaceEtc config.csh/compiler default_mpc_version "$optValue"
adjusted=true adjusted=true
;; ;;
## MPI ## ## MPI ##
-mpi) -mpi=* | -mpi)
# Explicitly set WM_MPLIB=... # Explicitly set WM_MPLIB=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc bashrc WM_MPLIB "$optionValue" shift "${nOptArgs:-0}"
replaceEtcCsh cshrc WM_MPLIB "$optionValue"
optMpi=system if [ -n "$optValue" ]
adjusted=true then
shift replaceEtc bashrc WM_MPLIB "$optValue"
replaceEtcCsh cshrc WM_MPLIB "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-openmpi) -sys-openmpi=* | -sys-openmpi | -openmpi-system)
# Replace FOAM_MPI=openmpi-<digits>.. and set to use third-party optValue="$(echo "$1" | sed -ne 's/^.*mpi=\([1-9][0-9]*\).*/\1/p')"
# The edit is slightly fragile, but works
expected="openmpi-[1-9][.0-9]*"
optMpi=$(getOptionValue "$@")
_matches "$optMpi" "$expected" || \
die "'$1' has bad value: '$optMpi'"
_inlineSed $(_foamEtc config.sh/mpi) \
"FOAM_MPI=$expected" \
"FOAM_MPI=$optMpi" \
"Replaced 'FOAM_MPI=$expected' by 'FOAM_MPI=$optMpi'"
_inlineSed $(_foamEtc config.csh/mpi) \
"FOAM_MPI $expected" \
"FOAM_MPI $optMpi" \
"Replaced 'FOAM_MPI $expected' by 'FOAM_MPI $optMpi'"
replaceEtc bashrc WM_MPLIB OPENMPI
replaceEtcCsh cshrc WM_MPLIB OPENMPI
adjusted=true
shift
;;
-openmpi-system)
# Explicitly set WM_MPLIB=SYSTEMOPENMPI # Explicitly set WM_MPLIB=SYSTEMOPENMPI
replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI if [ -n "$optValue" ]
replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI then
optMpi=system replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI"$optValue"
adjusted=true replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI"$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-openmpi-third) -openmpi=* | -openmpi | -openmpi-third)
# Explicitly set WM_MPLIB=OPENMPI, using default setting for openmpi # Explicitly set WM_MPLIB=OPENMPI
# - use default setting for openmpi, or
# replace FOAM_MPI=openmpi-<digits>..
# The edit is slightly fragile, but works
expected="openmpi-[1-9][.0-9]*"
optValue="$(echo "$1" | sed -ne 's/^.*mpi=//p')"
if [ -n "$optValue" ]
then
if [ "${optValue#openmpi-}" = "$optValue" ]
then
optValue="openmpi-$optValue"
fi
_matches "$optValue" "$expected" || \
die "'${1%=*}' has bad value: '$optValue'"
_inlineSed "$(_foamEtc config.sh/mpi)" \
"FOAM_MPI=$expected" \
"FOAM_MPI=$optValue" \
"Replaced 'FOAM_MPI=$expected' by 'FOAM_MPI=$optValue'"
_inlineSed "$(_foamEtc config.csh/mpi)" \
"FOAM_MPI=$expected" \
"FOAM_MPI=$optValue" \
"Replaced 'FOAM_MPI $expected' by 'FOAM_MPI $optValue'"
fi
replaceEtc bashrc WM_MPLIB OPENMPI replaceEtc bashrc WM_MPLIB OPENMPI
replaceEtcCsh cshrc WM_MPLIB OPENMPI replaceEtcCsh cshrc WM_MPLIB OPENMPI
optMpi=third
adjusted=true adjusted=true
;; ;;
@ -599,146 +661,242 @@ CONFIG_CSH
-adios | -adios2) -adios | -adios2)
# Replace adios2_version=... # Replace adios2_version=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/adios2 adios2_version "$optionValue" shift "${nOptArgs:-0}"
replaceEtc config.csh/adios2 adios2_version "$optionValue"
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/adios2 adios2_version "$optValue"
replaceEtc config.csh/adios2 adios2_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-adios-path | -adios2-path) -adios-path | -adios2-path)
# Replace ADIOS2_ARCH_PATH=... # Replace ADIOS2_ARCH_PATH=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\"" shift "${nOptArgs:-0}"
replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optValue\""
replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-boost) -boost)
# Replace boost_version=... (config is cgal or CGAL) # Replace boost_version=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@") getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" boost_version "$optionValue" if [ -n "$optValue" ]
replaceEtc config.csh/"$cfgName" boost_version "$optionValue" then
adjusted=true replaceEtc config.sh/"$cfgName" boost_version "$optValue"
shift replaceEtc config.csh/"$cfgName" boost_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-boost-path) -boost-path)
# Replace BOOST_ARCH_PATH=... (config is cgal or CGAL) # Replace BOOST_ARCH_PATH=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@") getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" BOOST_ARCH_PATH "\"$optionValue\"" if [ -n "$optValue" ]
replaceEtc config.csh/"$cfgName" BOOST_ARCH_PATH "\"$optionValue\"" then
adjusted=true replaceEtc config.sh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\""
shift replaceEtc config.csh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-cgal) -cgal)
# Replace cgal_version=... (config is cgal or CGAL) # Replace cgal_version=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@") getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" cgal_version "$optionValue" if [ -n "$optValue" ]
replaceEtc config.csh/"$cfgName" cgal_version "$optionValue" then
adjusted=true replaceEtc config.sh/"$cfgName" cgal_version "$optValue"
shift replaceEtc config.csh/"$cfgName" cgal_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-cgal-path) -cgal-path)
# Replace CGAL_ARCH_PATH=... (config is cgal or CGAL) # Replace CGAL_ARCH_PATH=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@") getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" CGAL_ARCH_PATH "$optionValue" if [ -n "$optValue" ]
replaceEtcCsh config.csh/"$cfgName" CGAL_ARCH_PATH "$optionValue" then
adjusted=true replaceEtc config.sh/"$cfgName" CGAL_ARCH_PATH "$optValue"
shift replaceEtcCsh config.csh/"$cfgName" CGAL_ARCH_PATH "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-fftw) -fftw)
# Replace fftw_version=... # Replace fftw_version=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
shift "${nOptArgs:-0}"
# config.sh/fftw or config.sh/FFTW # config.sh/fftw or config.sh/FFTW
cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW
replaceEtc config.sh/"$cfgName" fftw_version "$optionValue" if [ -n "$optValue" ]
replaceEtc config.csh/"$cfgName" fftw_version "$optionValue" then
adjusted=true replaceEtc config.sh/"$cfgName" fftw_version "$optValue"
shift replaceEtc config.csh/"$cfgName" fftw_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-fftw-path) -fftw-path)
# Replace FFTW_ARCH_PATH=... # Replace FFTW_ARCH_PATH=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
shift "${nOptArgs:-0}"
# config.sh/fftw or config.sh/FFTW # config.sh/fftw or config.sh/FFTW
cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW
replaceEtc config.sh/"$cfgName" FFTW_ARCH_PATH "\"$optionValue\"" if [ -n "$optValue" ]
replaceEtcCsh config.csh/"$cfgName" FFTW_ARCH_PATH "\"$optionValue\"" then
adjusted=true replaceEtc config.sh/"$cfgName" FFTW_ARCH_PATH "\"$optValue\""
shift replaceEtcCsh config.csh/"$cfgName" FFTW_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-cmake) -cmake)
# Replace cmake_version=... # Replace cmake_version=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/cmake cmake_version "$optionValue" shift "${nOptArgs:-0}"
adjusted=true
shift if [ -n "$optValue" ]
then
replaceEtc config.sh/cmake cmake_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-cmake-path) -cmake-path)
# Replace CMAKE_ARCH_PATH=... # Replace CMAKE_ARCH_PATH=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/cmake CMAKE_ARCH_PATH "$optionValue" shift "${nOptArgs:-0}"
adjusted=true
shift if [ -n "$optValue" ]
then
replaceEtc config.sh/cmake CMAKE_ARCH_PATH "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-kahip) -kahip)
# Replace KAHIP_VERSION=... # Replace KAHIP_VERSION=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/kahip KAHIP_VERSION "$optionValue" shift "${nOptArgs:-0}"
adjusted=true
shift if [ -n "$optValue" ]
then
replaceEtc config.sh/kahip KAHIP_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-kahip-path) -kahip-path)
# Replace KAHIP_ARCH_PATH=... # Replace KAHIP_ARCH_PATH=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optionValue\"" shift "${nOptArgs:-0}"
adjusted=true
shift if [ -n "$optValue" ]
then
replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-metis) -metis)
# Replace METIS_VERSION=... # Replace METIS_VERSION=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/metis METIS_VERSION "$optionValue" shift "${nOptArgs:-0}"
adjusted=true
shift if [ -n "$optValue" ]
then
replaceEtc config.sh/metis METIS_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-metis-path) -metis-path)
# Replace METIS_ARCH_PATH=... # Replace METIS_ARCH_PATH=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optionValue\"" shift "${nOptArgs:-0}"
adjusted=true
shift if [ -n "$optValue" ]
then
replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-scotch | -scotchVersion | --scotchVersion) -scotch | -scotchVersion | --scotchVersion)
# Replace SCOTCH_VERSION=... # Replace SCOTCH_VERSION=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/scotch SCOTCH_VERSION "$optionValue" shift "${nOptArgs:-0}"
adjusted=true
shift if [ -n "$optValue" ]
then
replaceEtc config.sh/scotch SCOTCH_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-scotch-path | -scotchArchPath | --scotchArchPath) -scotch-path | -scotchArchPath | --scotchArchPath)
# Replace SCOTCH_ARCH_PATH=... # Replace SCOTCH_ARCH_PATH=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optionValue\"" shift "${nOptArgs:-0}"
adjusted=true
shift if [ -n "$optValue" ]
then
replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
@ -747,107 +905,156 @@ CONFIG_CSH
-paraview | -paraviewVersion | --paraviewVersion) -paraview | -paraviewVersion | --paraviewVersion)
# Replace ParaView_VERSION=... # Replace ParaView_VERSION=...
expected="[5-9][.0-9]*" # but also accept system expected="[5-9][.0-9]*" # but also accept system
optionValue=$(getOptionValue "$@") getOptionValue "$@"
_matches "$optionValue" "$expected" || \ _matches "$optValue" "$expected" || \
[ "$optionValue" != "${optionValue%system}" ] || \ [ "$optValue" != "${optValue%system}" ] || \
die "'$1' has bad value: '$optionValue'" die "'${1%=*}' has bad value: '$optValue'"
replaceEtc config.sh/paraview ParaView_VERSION "$optionValue"
replaceEtc config.csh/paraview ParaView_VERSION "$optionValue" shift "${nOptArgs:-0}"
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/paraview ParaView_VERSION "$optValue"
replaceEtc config.csh/paraview ParaView_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-paraview-qt) -paraview-qt)
# Replace ParaView_QT=... # Replace ParaView_QT=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/paraview ParaView_QT "$optionValue" shift "${nOptArgs:-0}"
replaceEtc config.csh/paraview ParaView_QT "$optionValue"
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/paraview ParaView_QT "$optValue"
replaceEtc config.csh/paraview ParaView_QT "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-paraview-path | -paraviewInstall | --paraviewInstall) -paraview-path | -paraviewInstall | --paraviewInstall)
# Replace ParaView_DIR=... # Replace ParaView_DIR=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/paraview ParaView_DIR \""$optionValue\"" shift "${nOptArgs:-0}"
replaceEtcCsh config.csh/paraview ParaView_DIR \""$optionValue\""
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/paraview ParaView_DIR \""$optValue\""
replaceEtcCsh config.csh/paraview ParaView_DIR \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-llvm) -llvm)
# Replace mesa_llvm=... # Replace mesa_llvm=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/vtk mesa_llvm "$optionValue" shift "${nOptArgs:-0}"
replaceEtc config.csh/vtk mesa_llvm "$optionValue"
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/vtk mesa_llvm "$optValue"
replaceEtc config.csh/vtk mesa_llvm "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-mesa) -mesa)
# Replace mesa_version=... # Replace mesa_version=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/vtk mesa_version "$optionValue" shift "${nOptArgs:-0}"
replaceEtc config.csh/vtk mesa_version "$optionValue"
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/vtk mesa_version "$optValue"
replaceEtc config.csh/vtk mesa_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-vtk) -vtk)
# Replace vtk_version=... # Replace vtk_version=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/vtk vtk_version "$optionValue" shift "${nOptArgs:-0}"
replaceEtc config.csh/vtk vtk_version "$optionValue"
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/vtk vtk_version "$optValue"
replaceEtc config.csh/vtk vtk_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-llvm-path) -llvm-path)
# Replace LLVM_ARCH_PATH=... # Replace LLVM_ARCH_PATH=...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/vtk LLVM_ARCH_PATH \""$optionValue\"" shift "${nOptArgs:-0}"
replaceEtcCsh config.csh/vtk LLVM_ARCH_PATH \""$optionValue\""
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/vtk LLVM_ARCH_PATH \""$optValue\""
replaceEtcCsh config.csh/vtk LLVM_ARCH_PATH \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-mesa-path) -mesa-path)
# Replace MESA_ARCH_PATH... # Replace MESA_ARCH_PATH...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/vtk MESA_ARCH_PATH \""$optionValue\"" shift "${nOptArgs:-0}"
replaceEtcCsh config.csh/vtk MESA_ARCH_PATH \""$optionValue\""
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/vtk MESA_ARCH_PATH \""$optValue\""
replaceEtcCsh config.csh/vtk MESA_ARCH_PATH \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
-vtk-path) -vtk-path)
# Replace VTK_DIR... # Replace VTK_DIR...
optionValue=$(getOptionValue "$@") getOptionValue "$@"
replaceEtc config.sh/vtk VTK_DIR \""$optionValue\"" shift "${nOptArgs:-0}"
replaceEtcCsh config.csh/vtk VTK_DIR \""$optionValue\""
adjusted=true if [ -n "$optValue" ]
shift then
replaceEtc config.sh/vtk VTK_DIR \""$optValue\""
replaceEtcCsh config.csh/vtk VTK_DIR \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;; ;;
## Misc ## ## Misc ##
# Obsolete flags
-sigfpe | -no-sigfpe) -sigfpe | -no-sigfpe)
echo "Enable/disable FOAM_SIGFPE now via controlDict" 1>&2 echo "Enable/disable FOAM_SIGFPE now via controlDict" 1>&2
;; ;;
-archOption | --archOption) # Obsolete options
# Replace WM_ARCH_OPTION=... -archOption | --archOption | \
optionValue=$(getOptionValue "$@")
echo "Ignoring $1 option: no longer supported" 1>&2
shift
;;
-foamInstall | --foamInstall | -projectName | --projectName) -foamInstall | --foamInstall | -projectName | --projectName)
# Removed for 1812 echo "Ignoring obsolete option: $1" 1>&2
optionValue=$(getOptionValue "$@") getOptionValue "$@"
echo "Ignoring $1 option: obsolete" 1>&2 shift "${nOptArgs:-0}"
shift
;; ;;
*) *)

View File

@ -99,7 +99,7 @@ case "none":
breaksw breaksw
case "system": case "system":
# Obtain major.minor from `paraview --version` # Obtain (major.minor) from `paraview --version`
set pv_api=`paraview --version | sed -ne 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'` set pv_api=`paraview --version | sed -ne 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'`
if ("${pv_api}" == "") then if ("${pv_api}" == "") then
@ -156,6 +156,7 @@ default:
if ( -r "$ParaView_DIR" ) then if ( -r "$ParaView_DIR" ) then
setenv PATH "${ParaView_DIR}/bin:${PATH}" setenv PATH "${ParaView_DIR}/bin:${PATH}"
set pvLibDir="unknown" set pvLibDir="unknown"
set pv_libdirs=""
# QT libraries as required, and Qt5_DIR for the root directory. # QT libraries as required, and Qt5_DIR for the root directory.
# Another possibility: "qtpaths --qt-version" # Another possibility: "qtpaths --qt-version"
@ -168,7 +169,7 @@ default:
endsw endsw
foreach libDir ("lib$WM_COMPILER_LIB_ARCH" "lib") foreach libDir ("lib$WM_COMPILER_LIB_ARCH" "lib")
if ( -d "${qtDir}/${libDir}" ) then if ( -d "${qtDir}/${libDir}" ) then
setenv LD_LIBRARY_PATH "${qtDir}/${libDir}:${LD_LIBRARY_PATH}" set pv_libdirs="${qtDir}/${libDir}"
break break
endif endif
end end
@ -182,11 +183,11 @@ default:
set pvLibDir="${libDir}/paraview-${pv_api}" set pvLibDir="${libDir}/paraview-${pv_api}"
if ( -d "${ParaView_DIR}/${pvLibDir}" ) then if ( -d "${ParaView_DIR}/${pvLibDir}" ) then
switch ("$pv_api") switch ("$pv_api")
case 5.[0-4]*: case 5.[0-4]:
set libDir="$pvLibDir" # Needs lib/paraview-X.X (not lib) set libDir="$pvLibDir" # Needs lib/paraview-X.X (not lib)
breaksw breaksw
endsw endsw
setenv LD_LIBRARY_PATH "${ParaView_DIR}/${libDir}:${LD_LIBRARY_PATH}" set pv_libdirs="${ParaView_DIR}/${libDir}:${pv_libdirs}"
break break
endif endif
set pvLibDir="unknown" set pvLibDir="unknown"
@ -200,6 +201,18 @@ default:
set pv_plugin_dir="${pv_plugin_dir} (missing)" # For message set pv_plugin_dir="${pv_plugin_dir} (missing)" # For message
endif endif
# Any extra library directories
if ( "$pv_libdirs" != "" ) then
switch ("$WM_ARCH")
case darwin*:
setenv DYLD_LIBRARY_PATH "${pv_libdirs}:$DYLD_LIBRARY_PATH"
breaksw
default:
setenv LD_LIBRARY_PATH "${pv_libdirs}:$LD_LIBRARY_PATH"
breaksw
endsw
endif
if ($?FOAM_VERBOSE && $?prompt) then if ($?FOAM_VERBOSE && $?prompt) then
echo "Using paraview" echo "Using paraview"
echo " ParaView_DIR : $ParaView_DIR" echo " ParaView_DIR : $ParaView_DIR"
@ -225,6 +238,6 @@ endif
unsetenv ParaView_VERSION ParaView_QT unsetenv ParaView_VERSION ParaView_QT
unset archDir libDir unset archDir libDir
unset pv_api pv_plugin_dir pvLibDir pvPython qtDir unset pv_api pv_plugin_dir pv_libdirs pvLibDir pvPython qtDir
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -82,11 +82,13 @@ case Linux:
endsw endsw
breaksw breaksw
# Presume x86_64, with clang (not gcc) as system compiler # arm64 or x86_64 architectures
case Darwin: case Darwin:
setenv WM_ARCH darwin64 setenv WM_ARCH darwin64
if ( "$WM_COMPILER" == Gcc ) setenv WM_COMPILER Clang if ( "$WM_COMPILER" == Gcc ) then
echo "openfoam: darwin support is clang/llvm only" setenv WM_COMPILER Clang
echo "openfoam (darwin): using clang instead of gcc"
endif
breaksw breaksw
# Presume x86_64, with mingw cross-compiled # Presume x86_64, with mingw cross-compiled
@ -96,7 +98,7 @@ case MSYS*:
if ( "$WM_COMPILER" == Gcc ) setenv WM_COMPILER Mingw if ( "$WM_COMPILER" == Gcc ) setenv WM_COMPILER Mingw
setenv WM_COMPILER_LIB_ARCH 64 # Consistent with linux64Mingw setenv WM_COMPILER_LIB_ARCH 64 # Consistent with linux64Mingw
echo "openfoam: windows support (mingw64) is runtime only" echo "openfoam: windows support (mingw64) is runtime only"
;; breaksw
case SunOS*: case SunOS*:
setenv WM_ARCH solaris64 setenv WM_ARCH solaris64
@ -146,12 +148,12 @@ setenv FOAM_USER_APPBIN "$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin"
setenv FOAM_USER_LIBBIN "$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib" setenv FOAM_USER_LIBBIN "$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib"
# Prepend wmake to the path - not required for runtime-only environment # Prepend wmake to the path - not required for runtime-only environment
set foundDir="${WM_PROJECT_DIR}/wmake" set _foamFoundDir="${WM_PROJECT_DIR}/wmake"
if ( $?WM_DIR ) then if ( $?WM_DIR ) then
if ( -d "${WM_DIR}" ) set foundDir="${WM_DIR}" if ( -d "${WM_DIR}" ) set _foamFoundDir="${WM_DIR}"
endif endif
if ( -d "$foundDir" ) then if ( -d "$_foamFoundDir" ) then
setenv PATH "${foundDir}:${PATH}" setenv PATH "${_foamFoundDir}:${PATH}"
else else
unsetenv WM_DIR unsetenv WM_DIR
endif endif
@ -321,7 +323,7 @@ endsw
# Cleanup # Cleanup
# ~~~~~~~ # ~~~~~~~
unset archDir siteDir foundDir archOption unset archOption archDir siteDir _foamFoundDir
unset gcc_version gccDir unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
unset clang_version clangDir unset clang_version clangDir

View File

@ -6,7 +6,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd. # Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -106,6 +106,11 @@ unsetenv FOAM_USER_APPBIN
unsetenv FOAM_USER_LIBBIN unsetenv FOAM_USER_LIBBIN
unsetenv FOAM_UTILITIES unsetenv FOAM_UTILITIES
# Build related
unsetenv FOAM_BUILDROOT
unsetenv FOAM_THIRD_PARTY_BUILDROOT
unsetenv FOAM_THIRD_PARTY_SOURCES
# Older, unused variables # Older, unused variables
# Before 1812 # Before 1812
@ -116,7 +121,14 @@ unsetenv FOAM_INST_DIR
unsetenv MPI_ARCH_PATH unsetenv MPI_ARCH_PATH
unsetenv MPI_BUFFER_SIZE unsetenv MPI_BUFFER_SIZE
unsetenv OPAL_PREFIX
# Cleanup mpi prefix values if set to one of the paths on foamOldDirs
if ( $?foamClean ) then
# openmpi:
if ( "`$foamClean -env=OPAL_PREFIX $foamOldDirs`" == "" ) unsetenv OPAL_PREFIX
# intelmpi:
if ( "`$foamClean -env=I_MPI_ROOT $foamOldDirs`" == "" ) unsetenv I_MPI_ROOT
endif
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -153,21 +165,30 @@ unsetenv SCOTCH_ARCH_PATH
# PATH, LD_LIBRARY_PATH, MANPATH # PATH, LD_LIBRARY_PATH, MANPATH
if ( $?foamClean ) then if ( $?foamClean ) then
eval `$foamClean -csh-env=PATH "$foamOldDirs"` eval `$foamClean -csh-env=PATH "$foamOldDirs"`
if ($?LD_LIBRARY_PATH) then
eval `$foamClean -csh-env=LD_LIBRARY_PATH "$foamOldDirs"`
if ("${LD_LIBRARY_PATH}" == "") unsetenv LD_LIBRARY_PATH
endif
if ($?MANPATH) then if ($?MANPATH) then
eval `$foamClean -csh-env=MANPATH "$foamOldDirs"` eval `$foamClean -csh-env=MANPATH "$foamOldDirs"`
if ("${MANPATH}" == "") unsetenv MANPATH
endif endif
if ($?LD_LIBRARY_PATH) then
eval `$foamClean -csh-env=LD_LIBRARY_PATH "$foamOldDirs"`
endif
if ($?DYLD_LIBRARY_PATH) then
eval `$foamClean -csh-env=DYLD_LIBRARY_PATH "$foamOldDirs"`
endif
endif endif
if ($?MANPATH) then
if ("${MANPATH}" == "") unsetenv MANPATH
endif
if ($?LD_LIBRARY_PATH) then
if ("${LD_LIBRARY_PATH}" == "") unsetenv LD_LIBRARY_PATH
endif
if ($?DYLD_LIBRARY_PATH) then
if ("${DYLD_LIBRARY_PATH}" == "") unsetenv DYLD_LIBRARY_PATH
endif
# Remove any shadow env variables
unsetenv FOAM_DYLD_LIBRARY_PATH
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Cleanup aliases # Cleanup aliases
@ -214,6 +235,6 @@ endif
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Intermediate variables (do as last for a clean exit code) # Intermediate variables (do as last for a clean exit code)
unset cleaned foamClean foamOldDirs unset cleaned foamClean foamOldDirs _foamFoundDir
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -118,7 +118,7 @@ case "$ParaView_VERSION" in
;; ;;
([0-9]*) ([0-9]*)
# Extract API from VERSION # Extract API (major.minor) from VERSION
pv_api=$(echo "$ParaView_VERSION" | \ pv_api=$(echo "$ParaView_VERSION" | \
sed -ne 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p') sed -ne 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p')
;; ;;
@ -131,6 +131,7 @@ case "$ParaView_VERSION" in
if [ -r "$ParaView_DIR" ] if [ -r "$ParaView_DIR" ]
then then
export PATH="$ParaView_DIR/bin:$PATH" export PATH="$ParaView_DIR/bin:$PATH"
unset pv_libdirs
# QT libraries as required, and Qt5_DIR for the root directory. # QT libraries as required, and Qt5_DIR for the root directory.
# Another possibility: "qtpaths --qt-version" # Another possibility: "qtpaths --qt-version"
@ -146,7 +147,7 @@ case "$ParaView_VERSION" in
do do
if [ -d "$qtDir/$libDir" ] if [ -d "$qtDir/$libDir" ]
then then
export LD_LIBRARY_PATH="$qtDir/$libDir:$LD_LIBRARY_PATH" pv_libdirs="$qtDir/$libDir"
break break
fi fi
done done
@ -161,11 +162,11 @@ case "$ParaView_VERSION" in
if [ -d "$ParaView_DIR/$pvLibDir" ] if [ -d "$ParaView_DIR/$pvLibDir" ]
then then
case "$pv_api" in case "$pv_api" in
(5.[0-4]*) (5.[0-4])
libDir="$pvLibDir" # Needs lib/paraview-X.X (not lib) libDir="$pvLibDir" # Needs lib/paraview-X.X (not lib)
;; ;;
esac esac
export LD_LIBRARY_PATH="$ParaView_DIR/$libDir:$LD_LIBRARY_PATH" pv_libdirs="$ParaView_DIR/$libDir:${pv_libdirs}"
break break
fi fi
unset pvLibDir unset pvLibDir
@ -180,6 +181,16 @@ case "$ParaView_VERSION" in
pv_plugin_dir="${pv_plugin_dir} (missing)" # For message pv_plugin_dir="${pv_plugin_dir} (missing)" # For message
fi fi
# Any extra library directories
if [ -n "$pv_libdirs" ]
then
case "$WM_ARCH" in
(darwin*)
export DYLD_LIBRARY_PATH="${pv_libdirs}:$DYLD_LIBRARY_PATH" ;;
(*) export LD_LIBRARY_PATH="${pv_libdirs}:$LD_LIBRARY_PATH" ;;
esac
fi
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then then
echo "Using paraview" 1>&2 echo "Using paraview" 1>&2
@ -208,6 +219,6 @@ then
fi fi
unset archDir libDir unset archDir libDir
unset pv_api pv_plugin_dir pvLibDir pvPython qtDir unset pv_api pv_plugin_dir pv_libdirs pvLibDir pvPython qtDir
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -78,11 +78,15 @@ Linux)
esac esac
;; ;;
# Presume x86_64, with clang (not gcc) as system compiler # arm64 or x86_64 architectures
Darwin) Darwin)
WM_ARCH=darwin64 WM_ARCH=darwin64
[ "$WM_COMPILER" = Gcc ] && WM_COMPILER=Clang # Defult to clang (not gcc) as system compiler
echo "openfoam: darwin support is clang/llvm only" 1>&2 if [ "$WM_COMPILER" = Gcc ]
then
WM_COMPILER=Clang
echo "openfoam (darwin): using clang instead of gcc" 1>&2
fi
;; ;;
# Presume x86_64, with mingw cross-compiled # Presume x86_64, with mingw cross-compiled
@ -143,14 +147,14 @@ export FOAM_USER_LIBBIN="$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib"
# Prepend wmake to the path - not required for runtime-only environment # Prepend wmake to the path - not required for runtime-only environment
foundDir="$WM_PROJECT_DIR/wmake" _foamFoundDir="$WM_PROJECT_DIR/wmake"
if [ -d "$WM_DIR" ] if [ -d "$WM_DIR" ]
then then
foundDir="${WM_DIR}" _foamFoundDir="${WM_DIR}"
fi fi
if [ -d "$foundDir" ] if [ -d "$_foamFoundDir" ]
then then
PATH="$foundDir:$PATH" PATH="$_foamFoundDir:$PATH"
else else
unset WM_DIR unset WM_DIR
fi fi
@ -264,7 +268,7 @@ GCC_NOT_FOUND
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then then
echo "Using ThirdParty compiler" echo "Using ThirdParty compiler"
echo " ${gccDir##*/} (${gmpDir##*/} $${mpfrDir##*/} ${mpcDir##*/})" echo " ${gccDir##*/} (${gmpDir##*/} ${mpfrDir##*/} ${mpcDir##*/})"
fi fi
;; ;;
@ -312,7 +316,7 @@ esac
# Cleanup # Cleanup
# ~~~~~~~ # ~~~~~~~
unset archDir siteDir foundDir archOption unset archOption archDir siteDir _foamFoundDir
unset gcc_version gccDir unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
unset clang_version clangDir unset clang_version clangDir

View File

@ -6,7 +6,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd. # Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -95,6 +95,11 @@ unset FOAM_USER_APPBIN
unset FOAM_USER_LIBBIN unset FOAM_USER_LIBBIN
unset FOAM_UTILITIES unset FOAM_UTILITIES
# Build related
unset FOAM_BUILDROOT
unset FOAM_THIRD_PARTY_BUILDROOT
unset FOAM_THIRD_PARTY_SOURCES
# Older, unused variables # Older, unused variables
# Before 1812 # Before 1812
@ -106,10 +111,13 @@ unset FOAM_INST_DIR
unset MPI_ARCH_PATH unset MPI_ARCH_PATH
unset MPI_BUFFER_SIZE unset MPI_BUFFER_SIZE
# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs # Cleanup mpi prefix values if set to one of the paths on foamOldDirs
if [ -n "$foamClean" ] && [ -z "$($foamClean -env=OPAL_PREFIX $foamOldDirs)" ] if [ -n "$foamClean" ]
then then
unset OPAL_PREFIX # openmpi:
[ -z "$($foamClean -env=OPAL_PREFIX $foamOldDirs)" ] && unset OPAL_PREFIX
# intelmpi:
[ -z "$($foamClean -env=I_MPI_ROOT $foamOldDirs)" ] && unset I_MPI_ROOT
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -154,12 +162,17 @@ unset SCOTCH_ARCH_PATH
if [ -n "$foamClean" ] if [ -n "$foamClean" ]
then then
eval "$($foamClean -sh-env=PATH $foamOldDirs)" eval "$($foamClean -sh-env=PATH $foamOldDirs)"
eval "$($foamClean -sh-env=LD_LIBRARY_PATH $foamOldDirs)"
eval "$($foamClean -sh-env=MANPATH $foamOldDirs)" eval "$($foamClean -sh-env=MANPATH $foamOldDirs)"
eval "$($foamClean -sh-env=LD_LIBRARY_PATH $foamOldDirs)"
eval "$($foamClean -sh-env=DYLD_LIBRARY_PATH $foamOldDirs)"
fi fi
[ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH
[ -n "$MANPATH" ] || unset MANPATH [ -n "$MANPATH" ] || unset MANPATH
[ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH
[ -n "$DYLD_LIBRARY_PATH" ] || unset DYLD_LIBRARY_PATH
# Remove any shadow env variables
unset FOAM_DYLD_LIBRARY_PATH
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Cleanup aliases and functions # Cleanup aliases and functions
@ -218,6 +231,6 @@ unset _of_complete_cache_
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Intermediate variables (do as last for a clean exit code) # Intermediate variables (do as last for a clean exit code)
unset cleaned foamClean foamOldDirs unset cleaned foamClean foamOldDirs _foamFoundDir
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -52,7 +52,7 @@ Typedef
Foam::wordHashSet Foam::wordHashSet
Description Description
A HashSet with (the default) word keys. A HashSet with word keys and string hasher.
Typedef Typedef
Foam::labelHashSet Foam::labelHashSet
@ -75,12 +75,22 @@ namespace Foam
// Forward Declarations // Forward Declarations
template<class T> class MinMax; template<class T> class MinMax;
template<class Key, class Hash> class HashSet;
// Common hash-set types
//- A HashSet of words, uses string hasher.
typedef HashSet<word, Hash<word>> wordHashSet;
//- A HashSet of labels, uses label hasher.
typedef HashSet<label, Hash<label>> labelHashSet;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class HashSet Declaration Class HashSet Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Key=word, class Hash=Foam::Hash<Key>> template<class Key, class Hash=Foam::Hash<Key>>
class HashSet class HashSet
: :
public HashTable<zero::null, Key, Hash> public HashTable<zero::null, Key, Hash>
@ -401,14 +411,7 @@ public:
}; };
// Typedefs // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- A HashSet with word keys.
typedef HashSet<word> wordHashSet;
//- A HashSet with label keys and label hasher.
typedef HashSet<label, Hash<label>> labelHashSet;
// Global Functions // Global Functions

View File

@ -39,9 +39,10 @@ Description
namespace Foam namespace Foam
{ {
template<class Key, class Hash> class HashSet;
template<class T, class Key, class Hash> class HashTable; template<class T, class Key, class Hash> class HashTable;
template<class T, class Key, class Hash> class HashPtrTable; template<class T, class Key, class Hash> class HashPtrTable;
template<class Key, class Hash> class HashSet;
template<class T> class Map; template<class T> class Map;
template<class T> class PtrMap; template<class T> class PtrMap;

View File

@ -56,7 +56,7 @@ Description
< \ < \
argNames##ConstructorPtr, \ argNames##ConstructorPtr, \
::Foam::word, \ ::Foam::word, \
::Foam::string::hasher \ ::Foam::Hash<::Foam::word> \
> argNames##ConstructorTable; \ > argNames##ConstructorTable; \
\ \
/* Construct from argList function pointer table pointer */ \ /* Construct from argList function pointer table pointer */ \

View File

@ -5,8 +5,8 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Original code Copyright (C) 2012-2018 Bernhard Gschaider Copyright (C) 2012-2018 Bernhard Gschaider
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -65,7 +65,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
exprString() = default; exprString() = default;
//- Copy construct //- Copy construct
@ -189,6 +189,16 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace expressions } // End namespace expressions
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Hashing for exprString is the same as string
template<> struct Hash<expressions::exprString> : string::hasher {};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -30,12 +30,9 @@ Class
Description Description
Hash function class. Hash function class.
The default definition is for primitives. The default definition is for primitives.
Non-primitives used to hash entries on hash tables will likely need Non-primitives used to hash entries on hash tables will need
a specialized version. a specialized version.
Note
The second template parameter (bool) is used for SFINAE overloading,
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef Hash_H #ifndef Hash_H
@ -43,8 +40,6 @@ Note
#include "Hasher.H" #include "Hasher.H"
#include <cstdint> #include <cstdint>
#include <string>
#include <type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,7 +50,7 @@ namespace Foam
Class Hash Declaration Class Hash Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class T, class SFINAEType=bool> template<class T>
struct Hash struct Hash
{ {
unsigned operator()(const T& obj, unsigned seed=0) const unsigned operator()(const T& obj, unsigned seed=0) const
@ -67,35 +62,7 @@ struct Hash
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Specialization for trivial (integer) types //- Hashing of nullptr, always 0
#undef FOAM_INTHASHER
#define FOAM_INTHASHER(IntType) \
/*! \brief Hashing specialization for IntType */ \
/*! Unseeded (single value) uses natural order, otherwise incremental */ \
template<> struct Hash<IntType> \
{ \
unsigned operator()(const IntType val) const \
{ \
return static_cast<unsigned>(val); \
} \
unsigned operator()(const IntType val, unsigned seed) const \
{ \
return Foam::Hasher(&val, sizeof(IntType), seed); \
} \
}
FOAM_INTHASHER(bool);
FOAM_INTHASHER(char);
FOAM_INTHASHER(int32_t);
FOAM_INTHASHER(int64_t);
FOAM_INTHASHER(uint32_t);
#undef FOAM_INTHASHER
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Hashing specialization for nullptr. Always 0
template<> template<>
struct Hash<std::nullptr_t> struct Hash<std::nullptr_t>
{ {
@ -105,7 +72,7 @@ struct Hash<std::nullptr_t>
} }
}; };
//- Hashing specialization for pointers, interpret pointer as a integer type //- Hashing of pointers, treat as unsigned integer
template<> template<>
struct Hash<void*> struct Hash<void*>
{ {
@ -119,20 +86,32 @@ struct Hash<void*>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Hashing partial specialization for derived string types // Specialization for common integral types
template<class StringType>
struct Hash #undef FOAM_HASH_SPECIALIZATION
< #define FOAM_HASH_SPECIALIZATION(Type) \
StringType, \
typename std::enable_if /*! \brief Hashing of integral type: Type */ \
<std::is_base_of<std::string, StringType>::value, bool>::type /*! Unseeded (single value) uses natural order, otherwise incremental */ \
> template<> \
{ struct Hash<Type> \
unsigned operator()(const std::string& str, unsigned seed=0) const { \
{ unsigned operator()(const Type val) const \
return Foam::Hasher(str.data(), str.length(), seed); { \
return static_cast<unsigned>(val); \
} \
unsigned operator()(const Type val, unsigned seed) const \
{ \
return Foam::Hasher(&val, sizeof(Type), seed); \
} \
} }
};
FOAM_HASH_SPECIALIZATION(bool);
FOAM_HASH_SPECIALIZATION(char);
FOAM_HASH_SPECIALIZATION(int32_t);
FOAM_HASH_SPECIALIZATION(int64_t);
FOAM_HASH_SPECIALIZATION(uint32_t);
#undef FOAM_HASH_SPECIALIZATION
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -58,10 +58,15 @@ namespace Foam
// Forward Declarations // Forward Declarations
class fileName; class fileName;
class token; class token;
template<class T> class List; template<class T> class List;
template<class T> class UList; template<class T> class UList;
typedef List<word> wordList; typedef List<word> wordList;
//- Hashing for fileName
template<> struct Hash<fileName> : string::hasher {};
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class fileName Declaration Class fileName Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -58,6 +58,10 @@ class token;
Istream& operator>>(Istream& is, keyType& val); Istream& operator>>(Istream& is, keyType& val);
Ostream& operator<<(Ostream& os, const keyType& val); Ostream& operator<<(Ostream& os, const keyType& val);
//- Hashing for keyType
template<> struct Hash<keyType> : string::hasher {};
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class keyType Declaration Class keyType Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -237,6 +241,8 @@ public:
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// IOstream Operators // IOstream Operators
//- Read operator //- Read operator

View File

@ -62,11 +62,14 @@ namespace Foam
{ {
// Forward Declarations // Forward Declarations
class string;
class word; class word;
class wordRe; class wordRe;
class Istream; class Istream;
class Ostream; class Ostream;
template<class T> struct Hash;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class string Declaration Class string Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -150,7 +153,8 @@ public:
} }
}; };
//- Hashing functor for string and derived string classes //- Deprecated hashing functor - use hasher
// \deprecated(2021-04) - use hasher
struct hash : string::hasher {}; struct hash : string::hasher {};
@ -333,6 +337,17 @@ public:
}; };
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
//- Hashing for Foam::string
template<> struct Hash<string> : string::hasher {};
//- Hashing for std:::string
template<> struct Hash<std::string> : string::hasher {};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// IOstream Operators // IOstream Operators
//- Read operator //- Read operator

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -55,6 +55,10 @@ class word;
Istream& operator>>(Istream& is, word& val); Istream& operator>>(Istream& is, word& val);
Ostream& operator<<(Ostream& os, const word& val); Ostream& operator<<(Ostream& os, const word& val);
//- Hashing for word
template<> struct Hash<word> : string::hasher {};
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class word Declaration Class word Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -204,6 +208,8 @@ public:
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// IOstream Operators // IOstream Operators
//- Read operator //- Read operator

View File

@ -70,6 +70,10 @@ class wordRe;
Istream& operator>>(Istream& is, wordRe& val); Istream& operator>>(Istream& is, wordRe& val);
Ostream& operator<<(Ostream& os, const wordRe& val); Ostream& operator<<(Ostream& os, const wordRe& val);
//- Hashing for wordRe
template<> struct Hash<wordRe> : string::hasher {};
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class wordRe Declaration Class wordRe Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -249,6 +253,8 @@ public:
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// IOstream Operators // IOstream Operators
//- Read operator //- Read operator

View File

@ -106,6 +106,15 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace ensight } // End namespace ensight
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Hashing for FileName is the same as string
template<> struct Hash<ensight::FileName> : string::hasher {};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -104,6 +104,16 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace ensight } // End namespace ensight
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Hashing for VarName is the same as string
template<> struct Hash<ensight::VarName> : string::hasher {};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2020 OpenCFD Ltd. # Copyright (C) 2018-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -70,6 +70,10 @@
# when MPI_ARCH_PATH=/usr/lib64/openmpi # when MPI_ARCH_PATH=/usr/lib64/openmpi
# and mpicc --showme:compile -> -I/usr/include/openmpi-x86_64 # and mpicc --showme:compile -> -I/usr/include/openmpi-x86_64
# #
# NB: for RedHat (8+) /usr/include/scotch.h is a wrapper that includes
# /usr/include/scotch-64.h (LP64 mode)
# or /usr/include/scotch-32.h (ILP32 mode)
# In either case, int is 32 bits
# #
# openSUSE # openSUSE
# -------- # --------
@ -90,7 +94,7 @@
no_scotch() no_scotch()
{ {
unset HAVE_SCOTCH SCOTCH_ARCH_PATH SCOTCH_INC_DIR SCOTCH_LIB_DIR unset HAVE_SCOTCH SCOTCH_ARCH_PATH SCOTCH_INC_DIR SCOTCH_LIB_DIR
unset SCOTCH_VERSION unset SCOTCH_VERSION SCOTCH_LIBNAME_SUFFIX
unset HAVE_PTSCOTCH PTSCOTCH_ARCH_PATH PTSCOTCH_INC_DIR PTSCOTCH_LIB_DIR unset HAVE_PTSCOTCH PTSCOTCH_ARCH_PATH PTSCOTCH_INC_DIR PTSCOTCH_LIB_DIR
} }
@ -161,6 +165,36 @@ search_scotch()
return 2 return 2
} }
# ----------------------------------
# Extract 'typedef int64_t SCOTCH_Num' etc from header file
# - ensure consistent size between OpenFOAM and scotch header
# - for some systems, scotch.h includes scotch-64.h (for example).
local label
for hdr in \
"$header" \
"${header%/*}"/scotch-64.h \
"${header%/*}"/scotch-32.h \
;
do
if [ -f "$hdr" ]
then
label=$(sed -ne \
's/^.*typedef *\([^ ]*\) *SCOTCH_Num.*/\1/p' \
"$hdr")
if [ -n "$label" ]
then
header="$hdr" # Appears successful
break
fi
fi
done
: "${label:=unknown}" # Safety
# Transform (int32_t | int64_t) -> (int32 | int64)
case "$label" in (int32_t | int64_t) label="${label%_t}" ;; esac
# Library # Library
[ -n "$library" ] \ [ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName" -local="$localDir") \ || library=$(findLibrary -prefix="$prefix" -name="$libName" -local="$localDir") \
@ -171,16 +205,6 @@ search_scotch()
# ---------------------------------- # ----------------------------------
local label
# Ensure consistent sizes between OpenFOAM and scotch header
# extract 'typedef int64_t SCOTCH_Num' or equivalent
label=$(sed -ne \
's/^.*typedef *\([^ ]*\) *SCOTCH_Num.*/\1/p' \
"$header")
: "${label:=unknown}"
# No SCOTCH_VERSION set? Try to obtain from header # No SCOTCH_VERSION set? Try to obtain from header
# extract #define SCOTCH_VERSION, SCOTCH_RELEASE, SCOTCH_PATCHLEVEL # extract #define SCOTCH_VERSION, SCOTCH_RELEASE, SCOTCH_PATCHLEVEL
[ -n "$SCOTCH_VERSION" ] || \ [ -n "$SCOTCH_VERSION" ] || \
@ -198,7 +222,8 @@ search_scotch()
: "${SCOTCH_VERSION:=scotch}" # Failsafe value : "${SCOTCH_VERSION:=scotch}" # Failsafe value
case "$WM_LABEL_SIZE:$label" in case "$WM_LABEL_SIZE:$label" in
(32:int32_t | 32:int | 64:int64_t | 64:long) ( 32:int32 | 32:int \
| 64:int64 | 64:long )
;; ;;
(*) (*)
@ -212,7 +237,7 @@ search_scotch()
esac esac
# OK # OK
echo "scotch (label=$label) - $prefix" echo "scotch ($label) - $prefix"
export HAVE_SCOTCH=true export HAVE_SCOTCH=true
export SCOTCH_ARCH_PATH="$prefix" export SCOTCH_ARCH_PATH="$prefix"
export SCOTCH_INC_DIR="${header%/*}" # Basename export SCOTCH_INC_DIR="${header%/*}" # Basename