Compare commits

...

18 Commits

Author SHA1 Message Date
c5f3491968 COMP: g++11: suppress optimisation. See #3024 2024-01-19 20:47:20 +01:00
9b0e0b074f BUG: mapFields: incorrect patches. Fixes #2944. 2023-08-30 16:38:40 +02:00
8f214f744c BUG: UPstream::shutdown misbehaves with external initialisation (fixes #2808)
- freeCommmunicatorComponents needs an additional bounds check.
  When MPI is initialized outside of OpenFOAM, there are no
  UPstream communicator equivalents
2023-06-20 09:30:18 +02:00
02b2b3a450 Revert "BUG: Fixing ray dAve and omega for 1D and 2D cases"
This reverts commit 5848b0afd5.
2023-05-22 09:39:09 +01:00
935186b854 BUG: VTK write pointSet fails in parallel (fixes #2773)
- de-referenced autoPtr with () instead of ref() will fail on
  non-master ranks.
2023-05-05 16:03:17 +02:00
26ce72568b COMP: code adjustments for gcc-13 (#2714) 2023-03-01 16:26:47 +01:00
725615039d CONFIG: improve handling of empty/non-empty ThirdParty directory 2023-03-01 16:26:47 +01:00
9a893e0c1b BUG: solitaryWaveModel: avoid reference access to an operand object (Fixes #2178) 2022-08-24 09:55:44 +01:00
a72ae125b9 BUG: incorrect order for output scaling (transformPoints, ...)
- the output write scaling should be applied *after* undoing the
  effects of the specified rotation centre. Fixes #2566

ENH: update option names for transformPoints and surfaceTransformPoints

- prefer  '-auto-centre' and '-centre', but also accept the previous
  options '-auto-origin' and '-origin' as aliases.

  Changing to '-centre' avoids possible confusion with
  coordinate system origin().
2022-08-18 12:34:21 +02:00
b2dce9dffb CONFIG: bump patch level 2022-06-23 09:44:12 +02:00
99cf52f453 COMP: Gcc 11+ potential fix - see #2434 2022-06-23 09:44:12 +02:00
ae6320c285 COMP: references to temporaries
COMP: include <limits>
2022-06-23 09:44:12 +02:00
5798c875d4 COMP: gcc-12 buffer check bypasses xsputn (#2481, #2496)
- add overflow() method to the SHA1 streambuf. Previously could rely
  on xsputn for adding to sha1 content, but streams now check pptr()
  first to test for the buffering range and thus overflow() is needed.
2022-06-23 09:44:12 +02:00
df86bef1bb BUG: decomposeParDict: operate with masterUncollated. Fixes #2368. 2022-02-16 16:46:03 +01:00
0b312195e4 BUG: sample/store surface field triggers dimension check (fixes #2361)
- when used for example with wallShearStress, the stress field is
  initially created as incompressible but later updated with the
  correct compressible/incompressible dimensions.

  If this field is sampled as a surface and stored on the registry
  the dimensions should be reset() and not '=' assigned, since that
  causes a dimension check which will obviously fail.
2022-02-11 14:31:43 +01:00
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
48 changed files with 906 additions and 491 deletions

View File

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

View File

@ -53,8 +53,8 @@ Usage
-rotate-angle (vector angle) -rotate-angle (vector angle)
Rotate angle degrees about vector axis. Rotate angle degrees about vector axis.
or -yawPitchRoll (yawdegrees pitchdegrees rolldegrees) or -yawPitchRoll : (yaw pitch roll) degrees
or -rollPitchYaw (rolldegrees pitchdegrees yawdegrees) or -rollPitchYaw : (roll pitch yaw) degrees
-scale scalar|vector -scale scalar|vector
Scale the points by the given scalar or vector on output. Scale the points by the given scalar or vector on output.
@ -259,15 +259,18 @@ int main(int argc, char *argv[])
); );
argList::addBoolOption argList::addBoolOption
( (
"auto-origin", "auto-centre",
"Use bounding box centre as origin for rotations" "Use bounding box centre as centre for rotations"
); );
argList::addOption argList::addOption
( (
"origin", "centre",
"point", "point",
"Use specified <point> as origin for rotations" "Use specified <point> as centre for rotations"
); );
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption argList::addOption
( (
"rotate", "rotate",
@ -411,18 +414,18 @@ int main(int argc, char *argv[])
points += v; points += v;
} }
vector origin; vector rotationCentre;
bool useOrigin = args.readIfPresent("origin", origin); bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-origin") && !useOrigin) if (args.found("auto-centre") && !useRotationCentre)
{ {
useOrigin = true; useRotationCentre = true;
origin = boundBox(points).centre(); rotationCentre = boundBox(points).centre();
} }
if (useOrigin) if (useRotationCentre)
{ {
Info<< "Set origin for rotations to " << origin << endl; Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= origin; points -= rotationCentre;
} }
if (args.found("rotate")) if (args.found("rotate"))
@ -503,15 +506,15 @@ int main(int argc, char *argv[])
} }
} }
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
// Output scaling // Output scaling
applyScaling(points, getScalingOpt("scale", args)); applyScaling(points, getScalingOpt("scale", args));
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));

View File

@ -591,7 +591,7 @@ int main(int argc, char *argv[])
{ {
for for
( (
const word& opt const char * const opt
: { "cellSet", "cellZone", "faceSet", "pointSet" } : { "cellSet", "cellZone", "faceSet", "pointSet" }
) )
{ {

View File

@ -92,7 +92,7 @@ bool setCellFieldType
fieldType field(fieldHeader, mesh, false); fieldType field(fieldHeader, mesh, false);
const Type& value = pTraits<Type>(fieldValueStream); const Type value = pTraits<Type>(fieldValueStream);
if (selectedCells.size() == field.size()) if (selectedCells.size() == field.size())
{ {
@ -244,7 +244,7 @@ bool setFaceFieldType
fieldType field(fieldHeader, mesh); fieldType field(fieldHeader, mesh);
const Type& value = pTraits<Type>(fieldValueStream); const Type value = pTraits<Type>(fieldValueStream);
// Create flat list of selected faces and their value. // Create flat list of selected faces and their value.
Field<Type> allBoundaryValues(mesh.nBoundaryFaces()); Field<Type> allBoundaryValues(mesh.nBoundaryFaces());

View File

@ -188,15 +188,18 @@ int main(int argc, char *argv[])
); );
argList::addBoolOption argList::addBoolOption
( (
"auto-origin", "auto-centre",
"Use bounding box centre as origin for rotations" "Use bounding box centre as centre for rotations"
); );
argList::addOption argList::addOption
( (
"origin", "centre",
"point", "point",
"Use specified <point> as origin for rotations" "Use specified <point> as centre for rotations"
); );
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption argList::addOption
( (
"rotate", "rotate",
@ -334,18 +337,18 @@ int main(int argc, char *argv[])
points += v; points += v;
} }
vector origin; vector rotationCentre;
bool useOrigin = args.readIfPresent("origin", origin); bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-origin") && !useOrigin) if (args.found("auto-centre") && !useRotationCentre)
{ {
useOrigin = true; useRotationCentre = true;
origin = boundBox(points).centre(); rotationCentre = boundBox(points).centre();
} }
if (useOrigin) if (useRotationCentre)
{ {
Info<< "Set origin for rotations to " << origin << endl; Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= origin; points -= rotationCentre;
} }
if (args.found("rotate")) if (args.found("rotate"))
@ -406,15 +409,15 @@ int main(int argc, char *argv[])
points = transform(rot, points); points = transform(rot, points);
} }
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
// Output scaling // Output scaling
applyScaling(points, getScalingOpt("write-scale", args)); applyScaling(points, getScalingOpt("write-scale", args));
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
surf1.movePoints(points); surf1.movePoints(points);
surf1.write(exportName, writeFileType); surf1.write(exportName, writeFileType);

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

@ -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.
@ -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
@ -174,12 +176,13 @@ _foamAddPath "${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}"
# Dummy versions of external libraries. To be found last in library path # Dummy versions of external libraries. To be found last in library path
_foamAddLib "$FOAM_LIBBIN/dummy" _foamAddLib "$FOAM_LIBBIN/dummy"
# External (ThirdParty) libraries. Also allowed to be unset # External (ThirdParty) libraries:
if ( -d "$WM_THIRD_PARTY_DIR" ) then # - check if already compiled, or will be compiled.
# can also be unset
unsetenv FOAM_EXT_LIBBIN
if ( -d "$WM_THIRD_PARTY_DIR/platforms" || -f "$WM_THIRD_PARTY_DIR/Allwmake" ) then
setenv FOAM_EXT_LIBBIN "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib" setenv FOAM_EXT_LIBBIN "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib"
_foamAddLib "$FOAM_EXT_LIBBIN" _foamAddLib "$FOAM_EXT_LIBBIN"
else
unsetenv FOAM_EXT_LIBBIN
endif endif
# OpenFOAM libraries (user, group, standard) # OpenFOAM libraries (user, group, standard)
@ -321,7 +324,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

@ -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.
@ -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
@ -174,13 +178,14 @@ _foamAddPath "$FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN"
# Dummy versions of external libraries. To be found last in library path # Dummy versions of external libraries. To be found last in library path
_foamAddLib "$FOAM_LIBBIN/dummy" _foamAddLib "$FOAM_LIBBIN/dummy"
# External (ThirdParty) libraries. Also allowed to be unset # External (ThirdParty) libraries:
if [ -d "$WM_THIRD_PARTY_DIR" ] # - check if already compiled, or will be compiled.
# can also be unset
unset FOAM_EXT_LIBBIN
if [ -d "$WM_THIRD_PARTY_DIR/platforms" ] || [ -f "$WM_THIRD_PARTY_DIR/Allwmake" ]
then then
export FOAM_EXT_LIBBIN="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib" export FOAM_EXT_LIBBIN="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib"
_foamAddLib "$FOAM_EXT_LIBBIN" _foamAddLib "$FOAM_EXT_LIBBIN"
else
unset FOAM_EXT_LIBBIN
fi fi
# OpenFOAM libraries (user, group, standard) # OpenFOAM libraries (user, group, standard)
@ -264,7 +269,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 +317,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

@ -32,8 +32,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef OSHA1stream_H #ifndef Foam_OSHA1stream_H
#define OSHA1stream_H #define Foam_OSHA1stream_H
#include "OSstream.H" #include "OSstream.H"
#include "SHA1.H" #include "SHA1.H"
@ -63,10 +63,17 @@ class osha1stream
protected: protected:
//- Handle overflow
virtual int overflow(int c = EOF)
{
if (c != EOF) sha1_.append(c);
return c;
}
//- Put sequence of characters //- Put sequence of characters
virtual std::streamsize xsputn(const char* s, std::streamsize n) virtual std::streamsize xsputn(const char* s, std::streamsize n)
{ {
sha1_.append(s, n); if (n) sha1_.append(s, n);
return n; return n;
} }

View File

@ -283,7 +283,7 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
result.writeField(toks); result.writeField(toks);
} }
return std::move(toks); return tokenList(std::move(toks.tokens()));
} }

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

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -1284,7 +1284,9 @@ void Foam::argList::parse
// Disable any parallel comms happening inside the fileHandler // Disable any parallel comms happening inside the fileHandler
// since we are on master. This can happen e.g. inside // since we are on master. This can happen e.g. inside
// the masterUncollated/collated handler. // the masterUncollated/collated handler. Note that we
// also have to protect the actual dictionary parsing since
// it might trigger file access (e.g. #include, #codeStream)
const bool oldParRun = Pstream::parRun(false); const bool oldParRun = Pstream::parRun(false);
autoPtr<ISstream> dictStream autoPtr<ISstream> dictStream
@ -1292,8 +1294,6 @@ void Foam::argList::parse
fileHandler().NewIFstream(source) fileHandler().NewIFstream(source)
); );
Pstream::parRun(oldParRun); // Restore parallel state
if (dictStream && dictStream->good()) if (dictStream && dictStream->good())
{ {
dictionary decompDict(*dictStream); dictionary decompDict(*dictStream);
@ -1342,6 +1342,8 @@ void Foam::argList::parse
} }
} }
Pstream::parRun(oldParRun); // Restore parallel state
if (Pstream::nProcs() == 1) if (Pstream::nProcs() == 1)
{ {
Warning Warning

View File

@ -202,7 +202,8 @@ inline Foam::Matrix<Form, Type>::Matrix
) )
: :
mRows_(Mb.m()), mRows_(Mb.m()),
nCols_(Mb.n()) nCols_(Mb.n()),
v_(nullptr)
{ {
doAlloc(); doAlloc();
@ -224,7 +225,8 @@ inline Foam::Matrix<Form, Type>::Matrix
) )
: :
mRows_(Mb.m()), mRows_(Mb.m()),
nCols_(Mb.n()) nCols_(Mb.n()),
v_(nullptr)
{ {
doAlloc(); doAlloc();

View File

@ -513,6 +513,10 @@ inline Foam::Tensor<Cmpt> Foam::Tensor<Cmpt>::T() const
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt> inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
{ {
@ -536,6 +540,10 @@ Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt> inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const
{ {
@ -971,6 +979,10 @@ operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
//- Inner-product of a SphericalTensor and a Tensor //- Inner-product of a SphericalTensor and a Tensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2) operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{ {
@ -985,6 +997,10 @@ operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SphericalTensor //- Inner-product of a Tensor and a SphericalTensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2) operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
{ {
@ -999,6 +1015,10 @@ operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
//- Inner-product of a SymmTensor and a Tensor //- Inner-product of a SymmTensor and a Tensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2) operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{ {
@ -1021,6 +1041,10 @@ operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SymmTensor //- Inner-product of a Tensor and a SymmTensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2) operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
{ {
@ -1043,7 +1067,11 @@ operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
//- Inner-product of a Tensor and a Vector //- Inner-product of a Tensor and a Vector
template<class Cmpt> template<class Cmpt>
inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt>>::type #if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Vector<Cmpt>
operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v) operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
{ {
return Vector<Cmpt> return Vector<Cmpt>
@ -1057,7 +1085,11 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
//- Inner-product of a Vector and a Tensor //- Inner-product of a Vector and a Tensor
template<class Cmpt> template<class Cmpt>
inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>::type #if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Vector<Cmpt>
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t) operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
{ {
return Vector<Cmpt> return Vector<Cmpt>

View File

@ -28,6 +28,8 @@ License
#include "MathFunctions.H" #include "MathFunctions.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "error.H" #include "error.H"
#include <cmath>
#include <limits>
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //

View File

@ -36,6 +36,7 @@ Description
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "error.H" #include "error.H"
#include <cmath> #include <cmath>
#include <limits>
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //

View File

@ -35,6 +35,8 @@ Description
#include "MathFunctions.H" #include "MathFunctions.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "error.H" #include "error.H"
#include <cmath>
#include <limits>
using namespace Foam::constant::mathematical; using namespace Foam::constant::mathematical;

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

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -42,8 +42,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef SHA1_H #ifndef Foam_SHA1_H
#define SHA1_H #define Foam_SHA1_H
#include <string> #include <string>
#include <cstdint> #include <cstdint>
@ -113,6 +113,9 @@ public:
//- Reset the hashed data before appending more //- Reset the hashed data before appending more
void clear(); void clear();
//- Append single character
inline void append(char c);
//- Append data for processing //- Append data for processing
inline SHA1& append(const char* str); inline SHA1& append(const char* str);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,6 +53,12 @@ inline Foam::SHA1::SHA1(const std::string& str)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline void Foam::SHA1::append(char c)
{
processBytes(&c, 1);
}
inline Foam::SHA1& Foam::SHA1::append(const char* data, size_t len) inline Foam::SHA1& Foam::SHA1::append(const char* data, size_t len)
{ {
processBytes(data, len); processBytes(data, len);

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

@ -29,6 +29,7 @@ License
#include "word.H" #include "word.H"
#include "debug.H" #include "debug.H"
#include <cctype> #include <cctype>
#include <cstdint>
#include <sstream> #include <sstream>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

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

@ -1129,7 +1129,17 @@ void Foam::UPstream::allocatePstreamCommunicator
void Foam::UPstream::freePstreamCommunicator(const label communicator) void Foam::UPstream::freePstreamCommunicator(const label communicator)
{ {
if (communicator != 0) // Not touching the first communicator (WORLD)
// or anything out-of bounds.
//
// No UPstream communicator indices when MPI is initialized outside
// of OpenFOAM - thus needs a bounds check too!
if
(
communicator > 0
&& (communicator < PstreamGlobals::MPICommunicators_.size())
)
{ {
if (PstreamGlobals::MPICommunicators_[communicator] != MPI_COMM_NULL) if (PstreamGlobals::MPICommunicators_[communicator] != MPI_COMM_NULL)
{ {

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

@ -161,38 +161,38 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::indexPairs()
void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
{ {
const vectorField& faceCentres = this->patch().patch().faceCentres(); label badFacei = -1;
forAll(R_, facei) forAll(R_, facei)
{ {
if (R_[facei].xx() <= 0) if (R_[facei].xx() <= 0)
{ {
badFacei = facei;
FatalErrorInFunction FatalErrorInFunction
<< "Reynolds stress tensor component Rxx cannot be negative" << "Reynolds stress tensor component Rxx cannot be negative"
<< " or zero, where Rxx = " << R_[facei].xx() << " or zero, where Rxx = " << R_[facei].xx();
<< " at the face centre = " << faceCentres[facei] break;
<< exit(FatalError);
} }
if (R_[facei].yy() < 0 || R_[facei].zz() < 0) if (R_[facei].yy() < 0 || R_[facei].zz() < 0)
{ {
badFacei = facei;
FatalErrorInFunction FatalErrorInFunction
<< "Reynolds stress tensor components Ryy or Rzz cannot be" << "Reynolds stress tensor components Ryy or Rzz cannot be"
<< " negative where Ryy = " << R_[facei].yy() << " negative where Ryy = " << R_[facei].yy()
<< ", and Rzz = " << R_[facei].zz() << ", and Rzz = " << R_[facei].zz();
<< " at the face centre = " << faceCentres[facei] break;
<< exit(FatalError);
} }
const scalar x0 = R_[facei].xx()*R_[facei].yy() - sqr(R_[facei].xy()); const scalar x0 = R_[facei].xx()*R_[facei].yy() - sqr(R_[facei].xy());
if (x0 <= 0) if (x0 <= 0)
{ {
badFacei = facei;
FatalErrorInFunction FatalErrorInFunction
<< "Reynolds stress tensor component group, Rxx*Ryy - Rxy^2" << "Reynolds stress tensor component group, Rxx*Ryy - Rxy^2"
<< " cannot be negative or zero" << " cannot be negative or zero";
<< " at the face centre = " << faceCentres[facei] break;
<< exit(FatalError);
} }
const scalar x1 = R_[facei].zz() - sqr(R_[facei].xz())/R_[facei].xx(); const scalar x1 = R_[facei].zz() - sqr(R_[facei].xz())/R_[facei].xx();
@ -202,15 +202,23 @@ void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
if (x3 < 0) if (x3 < 0)
{ {
badFacei = facei;
FatalErrorInFunction FatalErrorInFunction
<< "Reynolds stress tensor component group, " << "Reynolds stress tensor component group, "
<< "Rzz - Rxz^2/Rxx - (Ryz - Rxy*Rxz/(Rxx*(Rxx*Ryy - Rxy^2)))^2" << "Rzz - Rxz^2/Rxx - (Ryz - Rxy*Rxz/(Rxx*(Rxx*Ryy - Rxy^2)))^2"
<< " cannot be negative at the face centre = " << " cannot be negative";
<< faceCentres[facei] break;
<< exit(FatalError);
} }
} }
if (badFacei >= 0)
{
FatalError
<< " at the face centre = "
<< this->patch().patch().faceCentres()[badFacei]
<< exit(FatalError);
}
Info<< " # Reynolds stress tensor on patch is consistent #" << endl; Info<< " # Reynolds stress tensor on patch is consistent #" << endl;
} }

View File

@ -79,7 +79,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
const vectorField nf(patch.nf()); const vectorField nf(patch.nf());
const vectorField faceCellCentres(patch.patch().faceCellCentres()); const vectorField faceCellCentres(patch.patch().faceCellCentres());
const labelUList& faceCells = patch.patch().faceCells(); const labelUList& faceCells = patch.patch().faceCells();
const vectorField::subField& faceCentres = patch.patch().faceCentres(); const vectorField::subField faceCentres = patch.patch().faceCentres();
forAll(patch, patchFacei) forAll(patch, patchFacei)
{ {

View File

@ -37,7 +37,7 @@ Description
Typical use might be to e.g. average face centres to points on a patch Typical use might be to e.g. average face centres to points on a patch
const labelListList& pointFaces = pp.pointFaces(); const labelListList& pointFaces = pp.pointFaces();
const pointField& faceCentres = pp.faceCentres(); const vectorField::subField faceCentres = pp.faceCentres();
Field<weightedPosition> avgBoundary(pointFaces.size()); Field<weightedPosition> avgBoundary(pointFaces.size());

View File

@ -155,7 +155,7 @@ bool Foam::vtk::writePointSet
if (parallel) if (parallel)
{ {
vtk::writeListParallel(format(), mesh.points(), pointLabels); vtk::writeListParallel(format.ref(), mesh.points(), pointLabels);
} }
else else
{ {

View File

@ -843,15 +843,15 @@ Foam::meshToMesh::mapTgtToSrc
label srcPatchi = srcPatchID_[i]; label srcPatchi = srcPatchID_[i];
label tgtPatchi = tgtPatchID_[i]; label tgtPatchi = tgtPatchID_[i];
if (!srcPatchFields.set(tgtPatchi)) if (!srcPatchFields.set(srcPatchi))
{ {
srcPatchFields.set srcPatchFields.set
( (
srcPatchi, srcPatchi,
fvPatchField<Type>::New fvPatchField<Type>::New
( (
tgtBfld[srcPatchi], tgtBfld[tgtPatchi],
srcMesh.boundary()[tgtPatchi], srcMesh.boundary()[srcPatchi],
DimensionedField<Type, volMesh>::null(), DimensionedField<Type, volMesh>::null(),
directFvPatchFieldMapper directFvPatchFieldMapper
( (

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -107,7 +107,7 @@ void Foam::polySurface::storeField
if (dimfield) if (dimfield)
{ {
dimfield->dimensions() = dims; dimfield->dimensions().reset(dims); // Dimensions may have changed
dimfield->field() = values; dimfield->field() = values;
} }
else else
@ -148,7 +148,7 @@ void Foam::polySurface::storeField
if (dimfield) if (dimfield)
{ {
dimfield->dimensions() = dims; dimfield->dimensions().reset(dims); // Dimensions may have changed
dimfield->field() = std::move(values); dimfield->field() = std::move(values);
} }
else else

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -45,7 +45,7 @@ void Foam::surfMesh::storeField
if (dimfield) if (dimfield)
{ {
dimfield->dimensions() = dims; dimfield->dimensions().reset(dims); // Dimensions may have changed
dimfield->field() = values; dimfield->field() = values;
} }
else else
@ -85,7 +85,7 @@ void Foam::surfMesh::storeField
if (dimfield) if (dimfield)
{ {
dimfield->dimensions() = dims; dimfield->dimensions().reset(dims); // Dimensions may have changed
dimfield->field() = std::move(values); dimfield->field() = std::move(values);
} }
else else

View File

@ -140,17 +140,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
if (mesh_.nSolutionD() == 2) if (mesh_.nSolutionD() == 2)
{ {
// Omega for 2D
omega_ = deltaPhi;
// dAve for 2D
dAve_ = vector
(
2*sinPhi*Foam::sin(0.5*deltaPhi),
2*cosPhi*Foam::sin(0.5*deltaPhi),
0
);
vector meshDir(Zero); vector meshDir(Zero);
if (dom_.meshOrientation() != vector::zero) if (dom_.meshOrientation() != vector::zero)
{ {
@ -172,7 +161,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
dAve_ = coordRot & dAve_; dAve_ = coordRot & dAve_;
d_ = coordRot & d_; d_ = coordRot & d_;
} }
else if (mesh_.nSolutionD() == 1) else if (mesh_.nSolutionD() == 1)
{ {
@ -195,9 +183,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
dAve_ = (dAve_ & normal)*meshDir; dAve_ = (dAve_ & normal)*meshDir;
d_ = (d_ & normal)*meshDir; d_ = (d_ & normal)*meshDir;
// Omega normalization for 1D
omega_ /= 2;
} }
autoPtr<volScalarField> IDefaultPtr; autoPtr<volScalarField> IDefaultPtr;

View File

@ -136,7 +136,7 @@ void Foam::faceReflecting::initialise(const dictionary& coeffs)
forAll(patches, patchI) forAll(patches, patchI)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
const pointField& cf = pp.faceCentres(); const vectorField::subField cf = pp.faceCentres();
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp)) if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{ {

View File

@ -155,7 +155,7 @@ void Foam::faceShading::calculate()
forAll(patches, patchI) forAll(patches, patchI)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
const pointField& cf = pp.faceCentres(); const vectorField::subField cf = pp.faceCentres();
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp)) if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015 IH-Cantabria Copyright (C) 2015 IH-Cantabria
Copyright (C) 2016-2017 OpenCFD Ltd. Copyright (C) 2016-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,7 +63,7 @@ protected:
scalar waveAngle_; scalar waveAngle_;
//- //-
const scalarField& x_; const scalarField x_;
const scalar x0_; const scalar x0_;

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