Compare commits
33 Commits
develop.me
...
maintenanc
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d37a8dd2c | |||
| d07c576d42 | |||
| 00ebd4c2ef | |||
| ca3ff906ea | |||
| a248f9c190 | |||
| 710c44b3d8 | |||
| 93704f9fe4 | |||
| aefd907333 | |||
| aab61cc6b3 | |||
| 53e91f12db | |||
| 8accf0cb60 | |||
| f8e4715e53 | |||
| 952d3b200b | |||
| fecd2c115a | |||
| 07ccd80afd | |||
| 6168f960f5 | |||
| 95cb2b97dd | |||
| 06aa5287c9 | |||
| d9bc7c09f5 | |||
| 78ecaa894e | |||
| ae871dc674 | |||
| 8fc44faf89 | |||
| be30a080a3 | |||
| 20b2bfe829 | |||
| 1d66a004df | |||
| 6f2ac4cab1 | |||
| 5f5903ce0f | |||
| 7b9c36ac24 | |||
| 10d53ff29e | |||
| cd7ce0a4c4 | |||
| eb31863d2c | |||
| d596ec6d49 | |||
| 713c18b654 |
4
Allwmake
4
Allwmake
@ -73,10 +73,10 @@ echo
|
|||||||
applications/Allwmake $targetType $*
|
applications/Allwmake $targetType $*
|
||||||
|
|
||||||
# Additional components/modules
|
# Additional components/modules
|
||||||
if [ "$FOAM_MODULE_PREFIX" = false ]
|
if [ "$FOAM_MODULE_PREFIX" = false ] || [ "$FOAM_MODULE_PREFIX" = none ]
|
||||||
then
|
then
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
echo "OpenFOAM modules disabled (prefix=false)"
|
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
|
||||||
echo
|
echo
|
||||||
elif [ -d "$WM_PROJECT_DIR/modules" ]
|
elif [ -d "$WM_PROJECT_DIR/modules" ]
|
||||||
then
|
then
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
api=2006
|
api=2006
|
||||||
patch=201012
|
patch=220610
|
||||||
|
|||||||
@ -169,14 +169,22 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
"translate",
|
"translate",
|
||||||
"vector",
|
"vector",
|
||||||
"Translate by specified <vector> - eg, '(1 0 0)' before rotations"
|
"Translate by specified <vector> before rotations"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"auto-centre",
|
||||||
|
"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",
|
||||||
@ -290,18 +298,24 @@ int main(int argc, char *argv[])
|
|||||||
if (args.readIfPresent("translate", v))
|
if (args.readIfPresent("translate", v))
|
||||||
{
|
{
|
||||||
Info<< "Translating points by " << v << endl;
|
Info<< "Translating points by " << v << endl;
|
||||||
|
|
||||||
points += v;
|
points += v;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector origin;
|
vector rotationCentre;
|
||||||
const bool useOrigin = args.readIfPresent("origin", origin);
|
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
|
||||||
if (useOrigin)
|
if (args.found("auto-centre") && !useRotationCentre)
|
||||||
{
|
{
|
||||||
Info<< "Set origin for rotations to " << origin << endl;
|
useRotationCentre = true;
|
||||||
points -= origin;
|
rotationCentre = boundBox(points).centre();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useRotationCentre)
|
||||||
|
{
|
||||||
|
Info<< "Set centre of rotation to " << rotationCentre << endl;
|
||||||
|
points -= rotationCentre;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (args.found("rotate"))
|
if (args.found("rotate"))
|
||||||
{
|
{
|
||||||
Pair<vector> n1n2
|
Pair<vector> n1n2
|
||||||
@ -380,6 +394,13 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useRotationCentre)
|
||||||
|
{
|
||||||
|
Info<< "Unset centre of rotation from " << rotationCentre << endl;
|
||||||
|
points += rotationCentre;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<scalar> scaling;
|
List<scalar> scaling;
|
||||||
if (args.readListIfPresent("scale", scaling))
|
if (args.readListIfPresent("scale", scaling))
|
||||||
{
|
{
|
||||||
@ -410,12 +431,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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()));
|
||||||
|
|||||||
@ -675,7 +675,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
const word& opt
|
const char * const opt
|
||||||
: { "cellSet", "cellZone", "faceSet", "pointSet" }
|
: { "cellSet", "cellZone", "faceSet", "pointSet" }
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -771,7 +771,7 @@ int main(int argc, char *argv[])
|
|||||||
expressions::exprString
|
expressions::exprString
|
||||||
expression
|
expression
|
||||||
(
|
(
|
||||||
args[expression],
|
args["expression"],
|
||||||
dictionary::null
|
dictionary::null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -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());
|
||||||
|
|||||||
@ -112,12 +112,20 @@ int main(int argc, char *argv[])
|
|||||||
"vector",
|
"vector",
|
||||||
"Translate by specified <vector> - eg, '(1 0 0)' before rotations"
|
"Translate by specified <vector> - eg, '(1 0 0)' before rotations"
|
||||||
);
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"auto-centre",
|
||||||
|
"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",
|
||||||
@ -229,18 +237,24 @@ int main(int argc, char *argv[])
|
|||||||
if (args.readIfPresent("translate", v))
|
if (args.readIfPresent("translate", v))
|
||||||
{
|
{
|
||||||
Info<< "Translating points by " << v << endl;
|
Info<< "Translating points by " << v << endl;
|
||||||
|
|
||||||
points += v;
|
points += v;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector origin(Zero);
|
vector rotationCentre;
|
||||||
const bool useOrigin = args.readIfPresent("origin", origin);
|
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
|
||||||
if (useOrigin)
|
if (args.found("auto-centre") && !useRotationCentre)
|
||||||
{
|
{
|
||||||
Info<< "Set origin for rotations to " << origin << endl;
|
useRotationCentre = true;
|
||||||
points -= origin;
|
rotationCentre = boundBox(points).centre();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useRotationCentre)
|
||||||
|
{
|
||||||
|
Info<< "Set centre of rotation to " << rotationCentre << endl;
|
||||||
|
points -= rotationCentre;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (args.found("rotate"))
|
if (args.found("rotate"))
|
||||||
{
|
{
|
||||||
Pair<vector> n1n2
|
Pair<vector> n1n2
|
||||||
@ -299,6 +313,13 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<scalar> scaling;
|
List<scalar> scaling;
|
||||||
if (args.readListIfPresent("scale", scaling))
|
if (args.readListIfPresent("scale", scaling))
|
||||||
{
|
{
|
||||||
@ -338,11 +359,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@ -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.
|
||||||
@ -140,8 +140,8 @@ do
|
|||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
echo "Ignore bad/invalid plugin-path: $pluginPath" 1>&2
|
echo "Ignore bad/invalid plugin-path: $pluginPath" 1>&2
|
||||||
unset pluginPath
|
|
||||||
fi
|
fi
|
||||||
|
unset pluginPath
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-block*) # Silently accepts -blockMesh
|
-block*) # Silently accepts -blockMesh
|
||||||
@ -238,8 +238,11 @@ then
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -n "$pluginError" ]
|
if [ -z "$pluginError" ]
|
||||||
then
|
then
|
||||||
|
# Ensure plugin is also in the lib-path
|
||||||
|
LD_LIBRARY_PATH="${PV_PLUGIN_PATH}:$LD_LIBRARY_PATH"
|
||||||
|
else
|
||||||
cat<< NO_PLUGIN 1>&2
|
cat<< NO_PLUGIN 1>&2
|
||||||
$pluginError
|
$pluginError
|
||||||
See '${0##*/} -help-build' for more information
|
See '${0##*/} -help-build' for more information
|
||||||
|
|||||||
@ -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.
|
||||||
@ -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
|
||||||
|
-openmpi-system -sys-openmpi
|
||||||
|
-openmpi-third -openmpi
|
||||||
|
|
||||||
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'
|
||||||
@ -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
|
||||||
@ -420,26 +434,37 @@ CONFIG_CSH
|
|||||||
export FOAM_CONFIG_ETC="${1#*=}"
|
export FOAM_CONFIG_ETC="${1#*=}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-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)
|
||||||
@ -465,131 +490,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
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -598,146 +660,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
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
@ -746,107 +904,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
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
430
bin/tools/install-dirs
Executable file
430
bin/tools/install-dirs
Executable file
@ -0,0 +1,430 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# ========= |
|
||||||
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
# \\ / O peration |
|
||||||
|
# \\ / A nd | www.openfoam.com
|
||||||
|
# \\/ M anipulation |
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# License
|
||||||
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
#
|
||||||
|
# Script
|
||||||
|
# install-dirs
|
||||||
|
#
|
||||||
|
# Example usage
|
||||||
|
# install-dirs -prefix=/opt/openfoam/openfoamVER -core
|
||||||
|
#
|
||||||
|
# Description
|
||||||
|
# Simple installer to copy architecture-independent directories.
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
printHelp() {
|
||||||
|
cat<<USAGE
|
||||||
|
|
||||||
|
Usage: ${0##*/} [OPTION]
|
||||||
|
|
||||||
|
input options:
|
||||||
|
-source=SOURCE Source directory
|
||||||
|
[\$WM_PROJECT_DIR ${WM_PROJECT_DIR:-''}]
|
||||||
|
-platform=PLATFORM OpenFOAM platform name [\$WM_OPTIONS ${WM_OPTIONS:-''}]
|
||||||
|
-foam-mpi=FOAM_MPI OpenFOAM mpi name [\$FOAM_MPI ${FOAM_MPI:-''}]
|
||||||
|
|
||||||
|
target options:
|
||||||
|
-prefix=PREFIX Top-level installation directory in PREFIX ['']
|
||||||
|
|
||||||
|
selections:
|
||||||
|
-[no-]common [do not] install (bin, etc, META-INFO)
|
||||||
|
-[no-]devel [do not] install (applications, src, wmake)
|
||||||
|
-[no-]doc [do not] install (doc)
|
||||||
|
-[no-]tut [do not] install (tutorials)
|
||||||
|
-no-app, -no-apps do not install (applications)
|
||||||
|
-no-src do not install (src)
|
||||||
|
-no-wmake do not install (wmake)
|
||||||
|
|
||||||
|
bundled selections:
|
||||||
|
-core Select: -common -devel
|
||||||
|
-default Select: -common -devel -doc -tut
|
||||||
|
|
||||||
|
tuning options:
|
||||||
|
-collate Collate modules (doc, tutorials)
|
||||||
|
-collate-doc Collate modules (doc) into doc/modules
|
||||||
|
-collate-tut Collate modules (tutorials) into tutorials/modules
|
||||||
|
|
||||||
|
general options:
|
||||||
|
-dry-run, -n Do not perform any operations
|
||||||
|
-force, -f Ignored
|
||||||
|
-verbose, -v Additional verbosity
|
||||||
|
-help Print the help and exit
|
||||||
|
|
||||||
|
|
||||||
|
Simple installer to copy OpenFOAM non-binary directories.
|
||||||
|
|
||||||
|
Example,
|
||||||
|
${0##*/} -prefix=/opt/openfoamVER
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
exit 0 # A clean exit
|
||||||
|
}
|
||||||
|
|
||||||
|
unset optDryRun hadError
|
||||||
|
# Report error and exit
|
||||||
|
die()
|
||||||
|
{
|
||||||
|
exec 1>&2
|
||||||
|
echo
|
||||||
|
echo "Error encountered:"
|
||||||
|
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||||
|
echo
|
||||||
|
echo "See '${0##*/} -help' for usage"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Report error and exit
|
||||||
|
warnOrDie()
|
||||||
|
{
|
||||||
|
if [ -n "$optDryRun" ]
|
||||||
|
then
|
||||||
|
hadError=true
|
||||||
|
while [ "$#" -ge 1 ]; do echo "Error: $1" 1>&2; shift; done
|
||||||
|
else
|
||||||
|
die "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Get the option's value (argument), or die on missing or empty value
|
||||||
|
# $1 option=value
|
||||||
|
getOptionValue()
|
||||||
|
{
|
||||||
|
local value="${1#*=}"
|
||||||
|
# Remove any surrounding double quotes
|
||||||
|
value="${value%\"}"
|
||||||
|
value="${value#\"}"
|
||||||
|
|
||||||
|
[ -n "$value" ] || die "'${1%=}' option requires a value"
|
||||||
|
echo "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test for '-no-' or '-without-' prefix. Return "false" or "true"
|
||||||
|
# $1 option
|
||||||
|
# [$2] truth value <true>
|
||||||
|
getBoolOption()
|
||||||
|
{
|
||||||
|
case "$1" in
|
||||||
|
(-no-* | -without-*) echo "false" ;;
|
||||||
|
(*) echo "${2:-true}" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Defaults from current OpenFOAM environment
|
||||||
|
sourceDir="$WM_PROJECT_DIR"
|
||||||
|
platform="$WM_OPTIONS"
|
||||||
|
foam_mpi="$FOAM_MPI"
|
||||||
|
|
||||||
|
unset install_common install_devel
|
||||||
|
unset install_app install_src install_wmake
|
||||||
|
unset install_doc optCollate_doc
|
||||||
|
unset install_tut optCollate_tut
|
||||||
|
unset optCollate
|
||||||
|
|
||||||
|
unset prefix exec_prefix bindir libdir libdir_mpi optVerbose
|
||||||
|
|
||||||
|
# Parse options
|
||||||
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h | -help*) printHelp ;;
|
||||||
|
-n | -dry-run) optDryRun="(dry-run) " ;;
|
||||||
|
-v | -verbose) optVerbose=true ;;
|
||||||
|
-f | -force) echo "Ignored option: ${1%%=*}" 1>&2 ;;
|
||||||
|
|
||||||
|
# Inputs
|
||||||
|
-source=*) sourceDir="$(getOptionValue "$1")" ;;
|
||||||
|
-platform=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
|
||||||
|
-foam-mpi=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
|
||||||
|
|
||||||
|
# Targets
|
||||||
|
-prefix=*) prefix="$(getOptionValue "$1")" ;;
|
||||||
|
-exec-prefix=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
|
||||||
|
|
||||||
|
# Selections
|
||||||
|
-common | -no-common) install_common="$(getBoolOption "$1")" ;;
|
||||||
|
-devel | -no-devel) install_devel="$(getBoolOption "$1")" ;;
|
||||||
|
-doc | -no-doc) install_doc="$(getBoolOption "$1")" ;;
|
||||||
|
-tut | -no-tut) install_tut="$(getBoolOption "$1")" ;;
|
||||||
|
-no-app | -no-apps) install_app="$(getBoolOption "$1")" ;;
|
||||||
|
-no-src) install_src="$(getBoolOption "$1")" ;;
|
||||||
|
-no-wmake) install_wmake="$(getBoolOption "$1")" ;;
|
||||||
|
|
||||||
|
-core)
|
||||||
|
install_common=true
|
||||||
|
install_devel=true
|
||||||
|
;;
|
||||||
|
|
||||||
|
-default | -all)
|
||||||
|
[ "$1" = "-all" ] && echo "Compat: treat $1 like -default" 1>&2
|
||||||
|
install_common=true
|
||||||
|
install_devel=true
|
||||||
|
install_doc=true
|
||||||
|
install_tut=true
|
||||||
|
;;
|
||||||
|
|
||||||
|
-collate | -no-collate)
|
||||||
|
optCollate="$(getBoolOption "$1")"
|
||||||
|
if [ "${optCollate:-false}" = false ]
|
||||||
|
then
|
||||||
|
unset optCollate optCollate_doc optCollate_tut
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
-collate-doc) optCollate_doc=true ;;
|
||||||
|
-collate-tut) optCollate_tut=true ;;
|
||||||
|
|
||||||
|
(*) die "Unknown option/argument: $1" ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
[ "${install_common:-false}" = false ] && unset install_common
|
||||||
|
if [ "${install_devel:-false}" = false ]
|
||||||
|
then
|
||||||
|
unset install_devel install_app install_src install_wmake
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${install_doc:-false}" = false ]
|
||||||
|
then
|
||||||
|
unset install_doc
|
||||||
|
elif [ "$optCollate_doc" = true ] || [ "$optCollate" = true ]
|
||||||
|
then
|
||||||
|
install_doc=collate
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${install_tut:-false}" = false ]
|
||||||
|
then
|
||||||
|
unset install_tut
|
||||||
|
elif [ "$optCollate_tut" = true ] || [ "$optCollate" = true ]
|
||||||
|
then
|
||||||
|
install_tut=collate
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Input checks
|
||||||
|
[ -d "$sourceDir" ] || warnOrDie "Invalid -source directory: $sourceDir"
|
||||||
|
|
||||||
|
# Installation sanity check
|
||||||
|
[ -n "$prefix" ] || warnOrDie "Must specify -prefix"
|
||||||
|
|
||||||
|
if [ -n "$hadError" ]
|
||||||
|
then
|
||||||
|
echo "Errors encounters in dry-run. Stopping" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${install_common}${install_devel}${install_doc}${install_tut}" ]
|
||||||
|
then
|
||||||
|
exec 1>&2
|
||||||
|
echo "Nothing specified to install"
|
||||||
|
echo
|
||||||
|
echo "See '${0##*/} -help' for usage"
|
||||||
|
echo
|
||||||
|
exit 0 # Treat as not an error
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Report settings
|
||||||
|
echo "Preparing install with the following parameters" 1>&2
|
||||||
|
echo "source:" 1>&2
|
||||||
|
echo " directory $sourceDir" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "target" 1>&2
|
||||||
|
echo " prefix ${prefix-[]}" 1>&2
|
||||||
|
##echo " binary ${install_binary:-[disabled]}" 1>&2
|
||||||
|
echo " common ${install_common:-[disabled]}" 1>&2
|
||||||
|
echo -n " devel " 1>&2
|
||||||
|
if [ -n "$install_devel" ]
|
||||||
|
then
|
||||||
|
echo -n "true" 1>&2
|
||||||
|
[ "$install_app" = false ] && echo -n " [app=disabled]" 1>&2
|
||||||
|
[ "$install_src" = false ] && echo -n " [src=disabled]" 1>&2
|
||||||
|
[ "$install_wmake" = false ] && echo -n " [wmake=disabled]" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
else
|
||||||
|
echo "[disabled]" 1>&2
|
||||||
|
fi
|
||||||
|
echo " doc ${install_doc:-[disabled]}" 1>&2
|
||||||
|
echo " tut ${install_tut:-[disabled]}" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Proper umask
|
||||||
|
umask 022
|
||||||
|
|
||||||
|
# The commands
|
||||||
|
copy_cmd="cp -a ${optVerbose:+-v}"
|
||||||
|
mkdir_cmd="mkdir -p"
|
||||||
|
|
||||||
|
if [ -n "$optDryRun" ]
|
||||||
|
then
|
||||||
|
if [ -n "$optVerbose" ]
|
||||||
|
then
|
||||||
|
copy_cmd="echo cp -a"
|
||||||
|
mkdir_cmd="echo mkdir -p"
|
||||||
|
else
|
||||||
|
copy_cmd="true"
|
||||||
|
mkdir_cmd="true"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Copy file or directory to <prefix>
|
||||||
|
doCopy()
|
||||||
|
{
|
||||||
|
$mkdir_cmd "$prefix" 2>/dev/null
|
||||||
|
|
||||||
|
for i in "$@"
|
||||||
|
do
|
||||||
|
if [ -e "$sourceDir/$i" ]
|
||||||
|
then
|
||||||
|
$copy_cmd "$sourceDir/$i" "$prefix"
|
||||||
|
nCopied="x$nCopied"
|
||||||
|
else
|
||||||
|
echo "Missing? $sourceDir/$i" 1>&2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "${optDryRun}${#nCopied} items copied" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Collate (doc | tutorials)
|
||||||
|
# Eg,
|
||||||
|
# modules/{NAME}/tutorials
|
||||||
|
# => tutorials/modules/{NAME}
|
||||||
|
collateModuleFiles()
|
||||||
|
{
|
||||||
|
local subDir="$1"
|
||||||
|
local subTarget="$prefix/$subDir/modules"
|
||||||
|
|
||||||
|
if [ -d "$sourceDir/modules" ]
|
||||||
|
then
|
||||||
|
(
|
||||||
|
cd "$sourceDir/modules" || exit
|
||||||
|
|
||||||
|
$mkdir_cmd "$subTarget"
|
||||||
|
|
||||||
|
for i in $(find . -mindepth 2 -maxdepth 2 -name "$subDir" -type d)
|
||||||
|
do
|
||||||
|
$mkdir_cmd "$subTarget/${i%/*}"
|
||||||
|
$copy_cmd "$i"/* "$subTarget/${i%/*}"
|
||||||
|
done
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# common
|
||||||
|
# ----
|
||||||
|
message="${optDryRun}Install common:"
|
||||||
|
if [ -n "$install_common" ]
|
||||||
|
then
|
||||||
|
echo "${message} bin etc META-INFO" 1>&2
|
||||||
|
doCopy bin etc META-INFO
|
||||||
|
else
|
||||||
|
echo "${message} [disabled]" 1>&2
|
||||||
|
fi
|
||||||
|
# ----
|
||||||
|
|
||||||
|
|
||||||
|
# develop (or source)
|
||||||
|
# ----
|
||||||
|
message="${optDryRun}Install devel:" 1>&2
|
||||||
|
unset dirNames blockMessage
|
||||||
|
if [ -n "$install_devel" ]
|
||||||
|
then
|
||||||
|
if [ "$install_wmake" = false ]
|
||||||
|
then
|
||||||
|
blockMessage="$blockMessage [wmake=disabled]"
|
||||||
|
else
|
||||||
|
dirNames="$dirNames wmake"
|
||||||
|
fi
|
||||||
|
if [ "$install_src" = false ]
|
||||||
|
then
|
||||||
|
blockMessage="$blockMessage [src=disabled]"
|
||||||
|
else
|
||||||
|
dirNames="$dirNames src"
|
||||||
|
fi
|
||||||
|
if [ "$install_app" = false ]
|
||||||
|
then
|
||||||
|
blockMessage="$blockMessage [app=disabled]"
|
||||||
|
else
|
||||||
|
dirNames="$dirNames applications"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$dirNames" ]
|
||||||
|
then
|
||||||
|
echo "${message}${dirNames}${blockMessage}" 1>&2
|
||||||
|
doCopy $dirNames # Unquoted - uses word splitting
|
||||||
|
else
|
||||||
|
echo "${message} [disabled]" 1>&2
|
||||||
|
fi
|
||||||
|
# ----
|
||||||
|
|
||||||
|
|
||||||
|
# doc
|
||||||
|
# ----
|
||||||
|
message="${optDryRun}Install doc:" 1>&2
|
||||||
|
if [ -n "$install_doc" ]
|
||||||
|
then
|
||||||
|
echo "${message}" 1>&2
|
||||||
|
doCopy doc
|
||||||
|
|
||||||
|
if [ "$install_doc" = collate ]
|
||||||
|
then
|
||||||
|
echo "${optDryRun}Collate module doc:" 1>&2
|
||||||
|
collateModuleFiles doc
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${message} [disabled]" 1>&2
|
||||||
|
fi
|
||||||
|
# ----
|
||||||
|
|
||||||
|
|
||||||
|
# tutorials
|
||||||
|
# ----
|
||||||
|
message="${optDryRun}Install tutorials:" 1>&2
|
||||||
|
if [ -n "$install_tut" ]
|
||||||
|
then
|
||||||
|
echo "${message}" 1>&2
|
||||||
|
doCopy tutorials
|
||||||
|
|
||||||
|
if [ "$install_tut" = collate ]
|
||||||
|
then
|
||||||
|
echo "${optDryRun}Collate module tutorials:" 1>&2
|
||||||
|
collateModuleFiles tutorials
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${message} [disabled]" 1>&2
|
||||||
|
fi
|
||||||
|
# ----
|
||||||
|
|
||||||
|
|
||||||
|
if [ -n "$optDryRun" ]
|
||||||
|
then
|
||||||
|
[ -n "$optVerbose" ] && echo 1>&2
|
||||||
|
echo "${optDryRun}Done" 1>&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
exit 0 # clean exit
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
375
bin/tools/install-platform
Executable file
375
bin/tools/install-platform
Executable file
@ -0,0 +1,375 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# ========= |
|
||||||
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
# \\ / O peration |
|
||||||
|
# \\ / A nd | www.openfoam.com
|
||||||
|
# \\/ M anipulation |
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# License
|
||||||
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
#
|
||||||
|
# Script
|
||||||
|
# install-platform
|
||||||
|
#
|
||||||
|
# Example usage
|
||||||
|
# install-platform -prefix=/opt/openfoam/openfoamVER
|
||||||
|
#
|
||||||
|
# Description
|
||||||
|
# Simple installer to copy OpenFOAM binary bin/, lib/ (platforms)
|
||||||
|
# directories.
|
||||||
|
#
|
||||||
|
# Note
|
||||||
|
# The platforms/tools directory still must be handled separately
|
||||||
|
#
|
||||||
|
# Layout of OpenFOAM platforms
|
||||||
|
#
|
||||||
|
# platforms
|
||||||
|
# |-- <WM_OPTIONS>
|
||||||
|
# |-- bin
|
||||||
|
# | |-- ...
|
||||||
|
# `-- lib
|
||||||
|
# |-- ...
|
||||||
|
# |-- dummy
|
||||||
|
# | `-- ...
|
||||||
|
# |-- sys-openmpi
|
||||||
|
# | |-- libPstream.so
|
||||||
|
# | `-- libptscotchDecomp.so
|
||||||
|
# `-- paraview-MAJ.MIN
|
||||||
|
# `-- ...
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
printHelp() {
|
||||||
|
cat<<USAGE
|
||||||
|
|
||||||
|
Usage: ${0##*/} [OPTION]
|
||||||
|
|
||||||
|
input options:
|
||||||
|
-source=SOURCE Source directory
|
||||||
|
[\$WM_PROJECT_DIR ${WM_PROJECT_DIR:-''}]
|
||||||
|
-platform=PLATFORM OpenFOAM platform name [\$WM_OPTIONS ${WM_OPTIONS:-''}]
|
||||||
|
-foam-mpi=FOAM_MPI OpenFOAM mpi name [\$FOAM_MPI ${FOAM_MPI:-''}]
|
||||||
|
|
||||||
|
target options:
|
||||||
|
-prefix=PREFIX Top-level installation directory in PREFIX ['']
|
||||||
|
-exec-prefix=EPREFIX Architecture-dependent in EPREFIX
|
||||||
|
[PREFIX/platforms/PLATFORM]
|
||||||
|
-bindir=DIR bin directory [EPREFIX/bin]
|
||||||
|
-libdir=DIR lib directory [EPREFIX/lib]
|
||||||
|
-mpi-libdir=DIR mpi libdir [<libdir>/FOAM_MPI]
|
||||||
|
|
||||||
|
tuning options:
|
||||||
|
-no-bin Do not install bin directory
|
||||||
|
-no-lib Do not install lib directory
|
||||||
|
-no-mpi Do not install mpi lib directory
|
||||||
|
-mpi-only Only install mpi lib directory
|
||||||
|
-mpi-mkdir Create foam-mpi directory within libdir
|
||||||
|
|
||||||
|
general options:
|
||||||
|
-dry-run, -n Do not perform any operations
|
||||||
|
-force, -f Ignored
|
||||||
|
-verbose, -v Additional verbosity
|
||||||
|
-help Print the help and exit
|
||||||
|
|
||||||
|
|
||||||
|
Simple installer to copy OpenFOAM binary bin/, lib/ (platforms) directories.
|
||||||
|
|
||||||
|
Example,
|
||||||
|
${0##*/} -prefix=/opt/openfoamVER
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
exit 0 # A clean exit
|
||||||
|
}
|
||||||
|
|
||||||
|
unset optDryRun hadError
|
||||||
|
# Report error and exit
|
||||||
|
die()
|
||||||
|
{
|
||||||
|
exec 1>&2
|
||||||
|
echo
|
||||||
|
echo "Error encountered:"
|
||||||
|
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||||
|
echo
|
||||||
|
echo "See '${0##*/} -help' for usage"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Report error and exit
|
||||||
|
warnOrDie()
|
||||||
|
{
|
||||||
|
if [ -n "$optDryRun" ]
|
||||||
|
then
|
||||||
|
hadError=true
|
||||||
|
while [ "$#" -ge 1 ]; do echo "Error: $1" 1>&2; shift; done
|
||||||
|
else
|
||||||
|
die "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Get the option's value (argument), or die on missing or empty value
|
||||||
|
# $1 option=value
|
||||||
|
getOptionValue()
|
||||||
|
{
|
||||||
|
local value="${1#*=}"
|
||||||
|
# Remove any surrounding double quotes
|
||||||
|
value="${value%\"}"
|
||||||
|
value="${value#\"}"
|
||||||
|
|
||||||
|
[ -n "$value" ] || die "'${1%=}' option requires a value"
|
||||||
|
echo "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Test for '-no-' or '-without-' prefix. Return "false" or "true"
|
||||||
|
# $1 option
|
||||||
|
# [$2] truth value <true>
|
||||||
|
getBoolOption()
|
||||||
|
{
|
||||||
|
case "$1" in
|
||||||
|
(-no-* | -without-*) echo "false" ;;
|
||||||
|
(*) echo "${2:-true}" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Defaults from current OpenFOAM environment
|
||||||
|
sourceDir="$WM_PROJECT_DIR"
|
||||||
|
platform="$WM_OPTIONS"
|
||||||
|
foam_mpi="$FOAM_MPI"
|
||||||
|
|
||||||
|
unset install_bin install_lib
|
||||||
|
unset optMkdir_mpi
|
||||||
|
install_mpi=true
|
||||||
|
|
||||||
|
unset prefix exec_prefix bindir libdir libdir_mpi optVerbose
|
||||||
|
|
||||||
|
# Parse options
|
||||||
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h | -help*) printHelp ;;
|
||||||
|
-n | -dry-run) optDryRun="(dry-run) " ;;
|
||||||
|
-v | -verbose) optVerbose=true ;;
|
||||||
|
-f | -force) echo "Ignored option: ${1%%=*}" 1>&2 ;;
|
||||||
|
|
||||||
|
# Inputs
|
||||||
|
-source=*) sourceDir="$(getOptionValue "$1")" ;;
|
||||||
|
-platform=*) platform="$(getOptionValue "$1")" ;;
|
||||||
|
-foam-mpi=*) foam_mpi="$(getOptionValue "$1")" ;;
|
||||||
|
|
||||||
|
# Targets
|
||||||
|
-prefix=*) prefix="$(getOptionValue "$1")" ;;
|
||||||
|
-exec-prefix=*) exec_prefix="$(getOptionValue "$1")" ;;
|
||||||
|
|
||||||
|
-bindir=*) bindir="$(getOptionValue "$1")" ;;
|
||||||
|
-libdir=*) libdir="$(getOptionValue "$1")" ;;
|
||||||
|
-mpi-libdir=*) libdir_mpi="$(getOptionValue "$1")" ;;
|
||||||
|
|
||||||
|
-no-bin) install_bin=false ;;
|
||||||
|
-no-lib) install_lib=false ;;
|
||||||
|
-no-mpi) install_mpi=false ;;
|
||||||
|
-mpi-only) install_mpi=exclusive ;;
|
||||||
|
-mpi-mkdir) optMkdir_mpi=true ;;
|
||||||
|
|
||||||
|
(*) die "Unknown option/argument: $1" ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Default <exec_prefix> based on <prefix>
|
||||||
|
if [ -z "$exec_prefix" ] && [ -n "$prefix" ]
|
||||||
|
then
|
||||||
|
exec_prefix="$prefix/platforms/$platform"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Default <bindir>, <libdir> based on <exec_prefix>
|
||||||
|
if [ -n "$exec_prefix" ]
|
||||||
|
then
|
||||||
|
[ -n "$bindir" ] || bindir="$exec_prefix/bin"
|
||||||
|
[ -n "$libdir" ] || libdir="$exec_prefix/lib"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Default <mpi-libdir> based on <libdir> and <foam-mpi>
|
||||||
|
if [ -z "$libdir_mpi" ] && [ -n "$libdir" ]
|
||||||
|
then
|
||||||
|
libdir_mpi="$libdir/$foam_mpi"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Exclusions
|
||||||
|
if [ "$install_bin" = false ] || [ "$install_mpi" = exclusive ]
|
||||||
|
then
|
||||||
|
unset bindir
|
||||||
|
fi
|
||||||
|
if [ "$install_lib" = false ] || [ "$install_mpi" = exclusive ]
|
||||||
|
then
|
||||||
|
unset libdir
|
||||||
|
fi
|
||||||
|
if [ "$install_mpi" = false ]
|
||||||
|
then
|
||||||
|
unset libdir_mpi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Input checks
|
||||||
|
|
||||||
|
sourcePlatform="$sourceDir/platforms/$platform"
|
||||||
|
|
||||||
|
[ -d "$sourceDir" ] || warnOrDie "Invalid -source directory: $sourceDir"
|
||||||
|
[ -n "$platform" ] || warnOrDie "No -platform detected or specified"
|
||||||
|
[ -n "$foam_mpi" ] || warnOrDie "No -foam-mpi detected or specified"
|
||||||
|
|
||||||
|
[ -d "$sourcePlatform" ] || \
|
||||||
|
warnOrDie "Missing platforms directory for: $platform"
|
||||||
|
|
||||||
|
|
||||||
|
# Installation sanity check
|
||||||
|
[ -n "$bindir$libdir$libdir_mpi" ] || \
|
||||||
|
warnOrDie "Must specify at least one of -prefix, -exec-prefix, -bindir, -libdir, -mpi-libdir"
|
||||||
|
|
||||||
|
|
||||||
|
if [ -n "$hadError" ]
|
||||||
|
then
|
||||||
|
echo "Errors encounters in dry-run. Stopping" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Report settings
|
||||||
|
echo "Preparing install with the following parameters" 1>&2
|
||||||
|
echo "source:" 1>&2
|
||||||
|
echo " directory $sourceDir" 1>&2
|
||||||
|
echo " platform $platform" 1>&2
|
||||||
|
echo " foam-mpi $foam_mpi" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "target (mpi-install: $install_mpi)" 1>&2
|
||||||
|
echo " prefix ${prefix-[]}" 1>&2
|
||||||
|
echo " exec-prefix ${exec_prefix:-[]}" 1>&2
|
||||||
|
echo " bindir ${bindir:-[]}" 1>&2
|
||||||
|
echo " libdir ${libdir:-[]}" 1>&2
|
||||||
|
echo " libdir(mpi) ${libdir_mpi:-[]}" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Proper umask
|
||||||
|
umask 022
|
||||||
|
|
||||||
|
# The commands
|
||||||
|
copy_cmd="cp -a ${optVerbose:+-v}"
|
||||||
|
mkdir_cmd="mkdir -p"
|
||||||
|
|
||||||
|
if [ -n "$optDryRun" ]
|
||||||
|
then
|
||||||
|
if [ -n "$optVerbose" ]
|
||||||
|
then
|
||||||
|
copy_cmd="echo cp -a"
|
||||||
|
mkdir_cmd="echo mkdir -p"
|
||||||
|
else
|
||||||
|
copy_cmd="true"
|
||||||
|
mkdir_cmd="true"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# bin/
|
||||||
|
# ----
|
||||||
|
message="${optDryRun}Install bindir:"
|
||||||
|
if [ -n "$bindir" ]
|
||||||
|
then
|
||||||
|
input="$sourcePlatform/bin"
|
||||||
|
|
||||||
|
echo "From $input" 1>&2
|
||||||
|
echo "${message} $bindir" 1>&2
|
||||||
|
|
||||||
|
$mkdir_cmd "$bindir" 2>/dev/null
|
||||||
|
|
||||||
|
for i in "$input/"*
|
||||||
|
do
|
||||||
|
if [ -e "$i" ]
|
||||||
|
then
|
||||||
|
$copy_cmd "$i" "$bindir"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "${message} [disabled]" 1>&2
|
||||||
|
fi
|
||||||
|
# ----
|
||||||
|
|
||||||
|
|
||||||
|
# lib/ without mpi
|
||||||
|
# ----
|
||||||
|
message="${optDryRun}Install libdir(non-mpi):"
|
||||||
|
if [ -n "$libdir" ]
|
||||||
|
then
|
||||||
|
input="$sourcePlatform/lib"
|
||||||
|
|
||||||
|
echo "From $input" 1>&2
|
||||||
|
echo "${message} $libdir" 1>&2
|
||||||
|
|
||||||
|
$mkdir_cmd "$libdir" 2>/dev/null
|
||||||
|
|
||||||
|
for i in "$input/"*
|
||||||
|
do
|
||||||
|
if [ "${i##*/}" = "$foam_mpi" ]
|
||||||
|
then
|
||||||
|
if [ "$optMkdir_mpi" = true ]
|
||||||
|
then
|
||||||
|
$mkdir_cmd "$libdir/$foam_mpi"
|
||||||
|
fi
|
||||||
|
elif [ -e "$i" ]
|
||||||
|
then
|
||||||
|
$copy_cmd "$i" "$libdir"
|
||||||
|
else
|
||||||
|
echo "bogus lib entry? $i" 1>&2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "${message} [disabled]" 1>&2
|
||||||
|
fi
|
||||||
|
# ----
|
||||||
|
|
||||||
|
|
||||||
|
# lib/mpi
|
||||||
|
# ----
|
||||||
|
message="${optDryRun}Install libdir(mpi):"
|
||||||
|
if [ -n "$libdir_mpi" ]
|
||||||
|
then
|
||||||
|
input="$sourcePlatform/lib/$foam_mpi"
|
||||||
|
|
||||||
|
echo "From $input" 1>&2
|
||||||
|
echo "${message} $libdir_mpi" 1>&2
|
||||||
|
|
||||||
|
$mkdir_cmd "$libdir_mpi" 2>/dev/null
|
||||||
|
|
||||||
|
for i in "$input"/*
|
||||||
|
do
|
||||||
|
if [ -e "$i" ]
|
||||||
|
then
|
||||||
|
# Always verbose (not many files anyhow)
|
||||||
|
$copy_cmd -v "$i" "$libdir_mpi"
|
||||||
|
else
|
||||||
|
echo "bogus mpi-lib entry? $i" 1>&2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "${message} [disabled]" 1>&2
|
||||||
|
fi
|
||||||
|
# ----
|
||||||
|
|
||||||
|
|
||||||
|
if [ -n "$optDryRun" ]
|
||||||
|
then
|
||||||
|
[ -n "$optVerbose" ] && echo 1>&2
|
||||||
|
echo "${optDryRun}Done" 1>&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
exit 0 # A clean exit
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
75
bin/tools/update-mpi-links.in
Normal file
75
bin/tools/update-mpi-links.in
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
FOAM_MPI="@FOAM_MPI@"
|
||||||
|
FOAM_SYSTEM_MPI_LIBBIN="@FOAM_SYSTEM_MPI_LIBBIN@"
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# ========= |
|
||||||
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
# \\ / O peration |
|
||||||
|
# \\ / A nd | www.openfoam.com
|
||||||
|
# \\/ M anipulation |
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# License
|
||||||
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
#
|
||||||
|
# Description
|
||||||
|
# Update of links from system mpi lib/ to local lib/mpi-name
|
||||||
|
#
|
||||||
|
# Note
|
||||||
|
# Normally located as a trigger within the platforms/ directory
|
||||||
|
# Uses hard-coded values (eg, generated with autoconfig).
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
|
||||||
|
# Local values
|
||||||
|
FOAM_LIBBIN="$(pwd -P)/lib"
|
||||||
|
FOAM_MPI_LIBBIN="$FOAM_LIBBIN/$FOAM_MPI"
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
echo "Link OpenFOAM ($FOAM_MPI) from system locations"
|
||||||
|
echo "Target: $FOAM_MPI_LIBBIN"
|
||||||
|
echo "Source: $FOAM_SYSTEM_MPI_LIBBIN"
|
||||||
|
|
||||||
|
if [ -z "$FOAM_MPI" ]
|
||||||
|
then
|
||||||
|
echo "FOAM_MPI not defined - skipping"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ -z "$FOAM_SYSTEM_MPI_LIBBIN" ]
|
||||||
|
then
|
||||||
|
echo "FOAM_SYSTEM_MPI_LIBBIN not defined - skipping"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ ! -d "$FOAM_SYSTEM_MPI_LIBBIN" ]
|
||||||
|
then
|
||||||
|
echo "No system mpi lib: $FOAM_SYSTEM_MPI_LIBBIN"
|
||||||
|
echo "... not updating"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ ! -d "$FOAM_LIBBIN" ]
|
||||||
|
then
|
||||||
|
echo "Missing $FOAM_LIBBIN"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
mkdir -p "$FOAM_MPI_LIBBIN"
|
||||||
|
|
||||||
|
# Create symlinks
|
||||||
|
(
|
||||||
|
cd "$FOAM_MPI_LIBBIN" || exit
|
||||||
|
|
||||||
|
for i in "$FOAM_SYSTEM_MPI_LIBBIN"/*
|
||||||
|
do
|
||||||
|
if [ -f "$i" ]
|
||||||
|
then
|
||||||
|
ln -svf "$i" "${i##*/}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
exit 0 # clean exit
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
@ -52,7 +52,7 @@ Foam::functionObjects::FUNCTIONOBJECT::FUNCTIONOBJECT
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
boolData_(dict.getOrDefault<bool>("boolData"), true),
|
boolData_(dict.getOrDefault<bool>("boolData", true)),
|
||||||
labelData_(dict.get<label>("labelData")),
|
labelData_(dict.get<label>("labelData")),
|
||||||
wordData_(dict.getOrDefault<word>("wordData", "defaultWord")),
|
wordData_(dict.getOrDefault<word>("wordData", "defaultWord")),
|
||||||
scalarData_(dict.getOrDefault<scalar>("scalarData", 1.0))
|
scalarData_(dict.getOrDefault<scalar>("scalarData", 1.0))
|
||||||
|
|||||||
@ -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.
|
||||||
@ -172,12 +172,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)
|
||||||
|
|||||||
@ -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.
|
||||||
@ -169,13 +169,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)
|
||||||
|
|||||||
@ -12,7 +12,13 @@ targetType=libso
|
|||||||
export FOAM_MODULE_PREFIX
|
export FOAM_MODULE_PREFIX
|
||||||
|
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
echo "Compile OpenFOAM modules"
|
if [ "$FOAM_MODULE_PREFIX" = false ] || [ "$FOAM_MODULE_PREFIX" = none ]
|
||||||
|
then
|
||||||
|
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
|
||||||
|
echo
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
echo "prefix = $FOAM_MODULE_PREFIX"
|
echo "prefix = $FOAM_MODULE_PREFIX"
|
||||||
echo
|
echo
|
||||||
echo " ignoring possible compilation errors"
|
echo " ignoring possible compilation errors"
|
||||||
|
|||||||
@ -50,6 +50,7 @@ void Foam::List<T>::doResize(const label newSize)
|
|||||||
{
|
{
|
||||||
if (newSize > 0)
|
if (newSize > 0)
|
||||||
{
|
{
|
||||||
|
// With sign-check to avoid spurious -Walloc-size-larger-than
|
||||||
T* nv = new T[newSize];
|
T* nv = new T[newSize];
|
||||||
|
|
||||||
const label overlap = min(this->size_, newSize);
|
const label overlap = min(this->size_, newSize);
|
||||||
|
|||||||
@ -31,8 +31,9 @@ License
|
|||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::List<T>::doAlloc()
|
inline void Foam::List<T>::doAlloc()
|
||||||
{
|
{
|
||||||
if (this->size_)
|
if (this->size_ > 0)
|
||||||
{
|
{
|
||||||
|
// With sign-check to avoid spurious -Walloc-size-larger-than
|
||||||
this->v_ = new T[this->size_];
|
this->v_ = new T[this->size_];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -158,7 +158,7 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
|
|||||||
OTstream toks;
|
OTstream toks;
|
||||||
result.writeValue(toks);
|
result.writeValue(toks);
|
||||||
|
|
||||||
return std::move(toks);
|
return tokenList(std::move(toks.tokens()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,7 +26,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||||
@ -55,20 +55,22 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
|||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
actualPatchType == word::null
|
actualPatchType.empty()
|
||||||
|| actualPatchType != p.type()
|
|| actualPatchType != p.type()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (pfPtr().constraintType() != p.constraintType())
|
if (pfPtr().constraintType() != p.constraintType())
|
||||||
{
|
{
|
||||||
// Use default constraint type
|
// Incompatible (constraint-wise) with the patch type
|
||||||
|
// - use default constraint type
|
||||||
|
|
||||||
auto patchTypeCstrIter =
|
auto patchTypeCstrIter =
|
||||||
pointPatchConstructorTablePtr_->cfind(p.type());
|
pointPatchConstructorTablePtr_->cfind(p.type());
|
||||||
|
|
||||||
if (!patchTypeCstrIter.found())
|
if (!patchTypeCstrIter.found())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "inconsistent patch and patchField types for \n"
|
<< "Inconsistent patch and patchField types for\n"
|
||||||
<< " patch type " << p.type()
|
<< " patch type " << p.type()
|
||||||
<< " and patchField type " << patchFieldType
|
<< " and patchField type " << patchFieldType
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -138,20 +140,17 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
|||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!dict.found("patchType")
|
!dict.found("patchType")
|
||||||
|| dict.get<word>("patchType") != p.type()
|
|| dict.get<word>("patchType") != p.type()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (pfPtr().constraintType() == p.constraintType())
|
if (pfPtr().constraintType() != p.constraintType())
|
||||||
{
|
{
|
||||||
// Compatible (constraint-wise) with the patch type
|
// Incompatible (constraint-wise) with the patch type
|
||||||
return pfPtr;
|
// - use default constraint type
|
||||||
}
|
|
||||||
else
|
auto patchTypeCstrIter =
|
||||||
{
|
dictionaryConstructorTablePtr_->cfind(p.type());
|
||||||
// Use default constraint type
|
|
||||||
auto patchTypeCstrIter
|
|
||||||
= dictionaryConstructorTablePtr_->cfind(p.type());
|
|
||||||
|
|
||||||
if (!patchTypeCstrIter.found())
|
if (!patchTypeCstrIter.found())
|
||||||
{
|
{
|
||||||
@ -166,7 +165,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cstrIter()(p, iF, dict);
|
return pfPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -1195,7 +1195,7 @@ void Foam::argList::parse
|
|||||||
{
|
{
|
||||||
parRunControl_.distributed(true);
|
parRunControl_.distributed(true);
|
||||||
source = "-roots";
|
source = "-roots";
|
||||||
if (roots.size() != 1)
|
if (roots.size() > 1)
|
||||||
{
|
{
|
||||||
dictNProcs = roots.size()+1;
|
dictNProcs = roots.size()+1;
|
||||||
}
|
}
|
||||||
@ -1204,6 +1204,7 @@ void Foam::argList::parse
|
|||||||
{
|
{
|
||||||
roots.resize(Pstream::nProcs()-1, fileName::null);
|
roots.resize(Pstream::nProcs()-1, fileName::null);
|
||||||
|
|
||||||
|
parRunControl_.distributed(true);
|
||||||
source = "-hostRoots";
|
source = "-hostRoots";
|
||||||
ITstream is(source, options_["hostRoots"]);
|
ITstream is(source, options_["hostRoots"]);
|
||||||
|
|
||||||
@ -1242,7 +1243,7 @@ void Foam::argList::parse
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roots.size() != 1)
|
if (roots.size() > 1)
|
||||||
{
|
{
|
||||||
dictNProcs = roots.size()+1;
|
dictNProcs = roots.size()+1;
|
||||||
}
|
}
|
||||||
@ -1270,6 +1271,12 @@ void Foam::argList::parse
|
|||||||
{
|
{
|
||||||
parRunControl_.distributed(true);
|
parRunControl_.distributed(true);
|
||||||
decompDict.readEntry("roots", roots);
|
decompDict.readEntry("roots", roots);
|
||||||
|
if (roots.empty())
|
||||||
|
{
|
||||||
|
DetailInfo
|
||||||
|
<< "WARNING: running distributed"
|
||||||
|
<< " but did not specify roots!" << nl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1337,8 +1344,8 @@ void Foam::argList::parse
|
|||||||
{
|
{
|
||||||
options_.set("case", roots[slave-1]/globalCase_);
|
options_.set("case", roots[slave-1]/globalCase_);
|
||||||
|
|
||||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
OPstream toProc(Pstream::commsTypes::scheduled, slave);
|
||||||
toSlave << args_ << options_ << roots.size();
|
toProc << args_ << options_ << parRunControl_.distributed();
|
||||||
}
|
}
|
||||||
options_.erase("case");
|
options_.erase("case");
|
||||||
|
|
||||||
@ -1388,24 +1395,24 @@ void Foam::argList::parse
|
|||||||
slave++
|
slave++
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
OPstream toProc(Pstream::commsTypes::scheduled, slave);
|
||||||
toSlave << args_ << options_ << roots.size();
|
toProc << args_ << options_ << parRunControl_.distributed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Collect the master's argument list
|
// Collect the master's argument list
|
||||||
label nroots;
|
bool isDistributed;
|
||||||
|
|
||||||
IPstream fromMaster
|
IPstream fromMaster
|
||||||
(
|
(
|
||||||
Pstream::commsTypes::scheduled,
|
Pstream::commsTypes::scheduled,
|
||||||
Pstream::masterNo()
|
Pstream::masterNo()
|
||||||
);
|
);
|
||||||
fromMaster >> args_ >> options_ >> nroots;
|
fromMaster >> args_ >> options_ >> isDistributed;
|
||||||
|
|
||||||
parRunControl_.distributed(nroots);
|
parRunControl_.distributed(isDistributed);
|
||||||
|
|
||||||
// Establish rootPath_/globalCase_/case_ for slave
|
// Establish rootPath_/globalCase_/case_ for slave
|
||||||
setCasePaths();
|
setCasePaths();
|
||||||
|
|||||||
@ -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();
|
||||||
|
|
||||||
|
|||||||
@ -35,8 +35,9 @@ inline void Foam::Matrix<Form, Type>::doAlloc()
|
|||||||
{
|
{
|
||||||
const label len = size();
|
const label len = size();
|
||||||
|
|
||||||
if (len)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
|
// With sign-check to avoid spurious -Walloc-size-larger-than
|
||||||
v_ = new Type[len];
|
v_ = new Type[len];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,9 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
|
#include "error.H"
|
||||||
|
#include <cmath>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
using namespace Foam::constant::mathematical;
|
using namespace Foam::constant::mathematical;
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,10 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
|
#include "error.H"
|
||||||
|
#include <cmath>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
using namespace Foam::constant::mathematical;
|
using namespace Foam::constant::mathematical;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -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
|
||||||
{
|
{
|
||||||
@ -970,6 +978,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)
|
||||||
{
|
{
|
||||||
@ -984,6 +996,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)
|
||||||
{
|
{
|
||||||
@ -998,6 +1014,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)
|
||||||
{
|
{
|
||||||
@ -1020,6 +1040,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)
|
||||||
{
|
{
|
||||||
@ -1042,7 +1066,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>
|
||||||
@ -1056,7 +1084,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>
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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 * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -976,7 +976,17 @@ void Foam::UPstream::allocatePstreamCommunicator
|
|||||||
|
|
||||||
void Foam::UPstream::freePstreamCommunicator(const label communicator)
|
void Foam::UPstream::freePstreamCommunicator(const label communicator)
|
||||||
{
|
{
|
||||||
if (communicator != UPstream::worldComm)
|
// 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)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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.
|
This file is part of OpenFOAM.
|
||||||
@ -199,6 +199,9 @@ void Foam::ensightMesh::correct()
|
|||||||
|
|
||||||
if (returnReduce(!zn.empty(), orOp<bool>()))
|
if (returnReduce(!zn.empty(), orOp<bool>()))
|
||||||
{
|
{
|
||||||
|
// Ensure full mesh coverage
|
||||||
|
cellSelection.resize(mesh_.nCells());
|
||||||
|
|
||||||
cellSelection.set(zn);
|
cellSelection.set(zn);
|
||||||
|
|
||||||
ensightCells& part = cellZoneParts_(zoneId);
|
ensightCells& part = cellZoneParts_(zoneId);
|
||||||
@ -267,6 +270,7 @@ void Foam::ensightMesh::correct()
|
|||||||
|
|
||||||
if (returnReduce(!cellSelection.empty(), orOp<bool>()))
|
if (returnReduce(!cellSelection.empty(), orOp<bool>()))
|
||||||
{
|
{
|
||||||
|
// Ensure full mesh coverage
|
||||||
excludeFace.resize(mesh_.nFaces());
|
excludeFace.resize(mesh_.nFaces());
|
||||||
|
|
||||||
const labelList& owner = mesh_.faceOwner();
|
const labelList& owner = mesh_.faceOwner();
|
||||||
@ -288,6 +292,7 @@ void Foam::ensightMesh::correct()
|
|||||||
|
|
||||||
if (fzoneIds.size())
|
if (fzoneIds.size())
|
||||||
{
|
{
|
||||||
|
// Ensure full mesh coverage
|
||||||
excludeFace.resize(mesh_.nFaces());
|
excludeFace.resize(mesh_.nFaces());
|
||||||
|
|
||||||
for (const polyPatch& p : mesh_.boundaryMesh())
|
for (const polyPatch& p : mesh_.boundaryMesh())
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -213,13 +213,16 @@ bool Foam::functionObjects::Curle::execute()
|
|||||||
|
|
||||||
forAll(observerPositions_, pointi)
|
forAll(observerPositions_, pointi)
|
||||||
{
|
{
|
||||||
const vectorField r(Cfp - observerPositions_[pointi]);
|
const vectorField r(observerPositions_[pointi] - Cfp);
|
||||||
const scalarField invMagR(1/(mag(r) + ROOTVSMALL));
|
const scalarField invMagR(1/(mag(r) + ROOTVSMALL));
|
||||||
|
|
||||||
pDash[pointi] +=
|
pDash[pointi] +=
|
||||||
sum((pp*sqr(invMagR) + invMagR/c0_*dpdtp)*(Sfp & r));
|
sum((pp*sqr(invMagR) + invMagR/c0_*dpdtp)*(Sfp & (r*invMagR)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pDash /= 4*mathematical::pi;
|
||||||
|
|
||||||
Pstream::listCombineGather(pDash, plusEqOp<scalar>());
|
Pstream::listCombineGather(pDash, plusEqOp<scalar>());
|
||||||
Pstream::listCombineScatter(pDash);
|
Pstream::listCombineScatter(pDash);
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -899,6 +899,16 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
|
|||||||
mesh_,
|
mesh_,
|
||||||
dict.subDict("sampledSurfaceDict")
|
dict.subDict("sampledSurfaceDict")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (sampledPtr_->interpolate())
|
||||||
|
{
|
||||||
|
// Should probably ignore interpolate entirely,
|
||||||
|
// but the oldest isoSurface algorithm requires it!
|
||||||
|
WarningInFunction
|
||||||
|
<< type() << ' ' << name() << ": "
|
||||||
|
<< "sampledSurface with interpolate = true "
|
||||||
|
<< "is likely incorrect" << nl << nl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< type() << " " << name() << ":" << nl
|
Info<< type() << " " << name() << ":" << nl
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -388,6 +388,15 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
|||||||
false // serial - already merged
|
false // serial - already merged
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Point data? Should probably disallow
|
||||||
|
if (sampledPtr_)
|
||||||
|
{
|
||||||
|
surfaceWriterPtr_->isPointData() =
|
||||||
|
sampledPtr_->interpolate();
|
||||||
|
}
|
||||||
|
|
||||||
|
surfaceWriterPtr_->nFields() = 1; // Needed for VTK legacy
|
||||||
|
|
||||||
surfaceWriterPtr_->write(fieldName, allValues);
|
surfaceWriterPtr_->write(fieldName, allValues);
|
||||||
|
|
||||||
surfaceWriterPtr_->clear();
|
surfaceWriterPtr_->clear();
|
||||||
|
|||||||
@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -419,8 +419,6 @@ void Foam::ParticleCollector<CloudType>::write()
|
|||||||
massTotal_[facei] += mass_[facei];
|
massTotal_[facei] += mass_[facei];
|
||||||
}
|
}
|
||||||
|
|
||||||
const label proci = Pstream::myProcNo();
|
|
||||||
|
|
||||||
Info<< type() << " output:" << nl;
|
Info<< type() << " output:" << nl;
|
||||||
|
|
||||||
Field<scalar> faceMassTotal(mass_.size(), Zero);
|
Field<scalar> faceMassTotal(mass_.size(), Zero);
|
||||||
@ -434,15 +432,11 @@ void Foam::ParticleCollector<CloudType>::write()
|
|||||||
scalar sumAverageMFR = 0.0;
|
scalar sumAverageMFR = 0.0;
|
||||||
forAll(faces_, facei)
|
forAll(faces_, facei)
|
||||||
{
|
{
|
||||||
scalarList allProcMass(Pstream::nProcs());
|
faceMassTotal[facei] +=
|
||||||
allProcMass[proci] = massTotal_[facei];
|
returnReduce(massTotal_[facei], sumOp<scalar>());
|
||||||
Pstream::gatherList(allProcMass);
|
|
||||||
faceMassTotal[facei] += sum(allProcMass);
|
|
||||||
|
|
||||||
scalarList allProcMassFlowRate(Pstream::nProcs());
|
faceMassFlowRate[facei] +=
|
||||||
allProcMassFlowRate[proci] = massFlowRate_[facei];
|
returnReduce(massFlowRate_[facei], sumOp<scalar>());
|
||||||
Pstream::gatherList(allProcMassFlowRate);
|
|
||||||
faceMassFlowRate[facei] += sum(allProcMassFlowRate);
|
|
||||||
|
|
||||||
sumTotalMass += faceMassTotal[facei];
|
sumTotalMass += faceMassTotal[facei];
|
||||||
sumAverageMFR += faceMassFlowRate[facei];
|
sumAverageMFR += faceMassFlowRate[facei];
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
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.
|
||||||
@ -396,22 +396,43 @@ Foam::AABBTree<Type>::AABBTree
|
|||||||
// transfer flattened tree to persistent storage
|
// transfer flattened tree to persistent storage
|
||||||
DynamicList<treeBoundBox> boundBoxes(2*bbs.size());
|
DynamicList<treeBoundBox> boundBoxes(2*bbs.size());
|
||||||
DynamicList<labelList> addressing(2*addr.size());
|
DynamicList<labelList> addressing(2*addr.size());
|
||||||
|
|
||||||
forAll(nodes, nodeI)
|
forAll(nodes, nodeI)
|
||||||
{
|
{
|
||||||
if (nodes[nodeI].first() < 0)
|
if (nodes[nodeI].first() < 0)
|
||||||
{
|
{
|
||||||
boundBoxes.append(bbs[nodeI].first());
|
boundBoxes.append(bbs[nodeI].first());
|
||||||
addressing.append(addr[nodeI + 1]);
|
addressing.append(addr[-(nodes[nodeI].first() + 1)]);
|
||||||
}
|
}
|
||||||
if (nodes[nodeI].second() < 0)
|
if (nodes[nodeI].second() < 0)
|
||||||
{
|
{
|
||||||
boundBoxes.append(bbs[nodeI].second());
|
boundBoxes.append(bbs[nodeI].second());
|
||||||
addressing.append(addr[nodeI + 1]);
|
addressing.append(addr[-(nodes[nodeI].second() + 1)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boundBoxes_.transfer(boundBoxes);
|
boundBoxes_.transfer(boundBoxes);
|
||||||
addressing_.transfer(addressing);
|
addressing_.transfer(addressing);
|
||||||
|
|
||||||
|
|
||||||
|
if (0)
|
||||||
|
{
|
||||||
|
bitSet checked(objects.size());
|
||||||
|
for (const auto& box : addressing_)
|
||||||
|
{
|
||||||
|
for (const auto& id : box)
|
||||||
|
{
|
||||||
|
checked.set(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const label unsetSize = checked.count(false);
|
||||||
|
|
||||||
|
if (unsetSize)
|
||||||
|
{
|
||||||
|
Info<< "*** Problem: IDs not set: " << unsetSize << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -142,8 +142,7 @@ public:
|
|||||||
AABBTree();
|
AABBTree();
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
// equalBinSize: divide into equal number of elements or
|
// equalBinSize: divide into equal number of elements or equal span
|
||||||
// equal span
|
|
||||||
AABBTree
|
AABBTree
|
||||||
(
|
(
|
||||||
const UList<Type>& objects,
|
const UList<Type>& objects,
|
||||||
@ -171,7 +170,7 @@ public:
|
|||||||
bool pointInside(const point& pt) const;
|
bool pointInside(const point& pt) const;
|
||||||
|
|
||||||
//- Determine whether a bounding box overlaps the tree bounding
|
//- Determine whether a bounding box overlaps the tree bounding
|
||||||
// boxes
|
//- boxes
|
||||||
bool overlaps(const boundBox& bbIn) const;
|
bool overlaps(const boundBox& bbIn) const;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@ -291,6 +291,7 @@ Foam::scalar surfaceNoise::writeSurfaceData
|
|||||||
false // serial - already merged
|
false // serial - already merged
|
||||||
);
|
);
|
||||||
|
|
||||||
|
writerPtr_->nFields() = 1; // Legacy VTK
|
||||||
writerPtr_->write(title, allData);
|
writerPtr_->write(title, allData);
|
||||||
|
|
||||||
writerPtr_->endTime();
|
writerPtr_->endTime();
|
||||||
@ -323,6 +324,7 @@ Foam::scalar surfaceNoise::writeSurfaceData
|
|||||||
false // serial - already merged
|
false // serial - already merged
|
||||||
);
|
);
|
||||||
|
|
||||||
|
writerPtr_->nFields() = 1; // Legacy VTK
|
||||||
writerPtr_->write(title, data);
|
writerPtr_->write(title, data);
|
||||||
|
|
||||||
writerPtr_->endTime();
|
writerPtr_->endTime();
|
||||||
|
|||||||
@ -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
|
||||||
(
|
(
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -106,6 +106,57 @@ Foam::surfaceWriters::boundaryDataWriter::boundaryDataWriter
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::surfaceWriters::boundaryDataWriter::serialWriteGeometry
|
||||||
|
(
|
||||||
|
const regIOobject& iopts,
|
||||||
|
const meshedSurf& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const pointField& points = surf.points();
|
||||||
|
const faceList& faces = surf.faces();
|
||||||
|
|
||||||
|
if (verbose_)
|
||||||
|
{
|
||||||
|
if (this->isPointData())
|
||||||
|
{
|
||||||
|
Info<< "Writing points: " << iopts.objectPath() << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Writing face centres: " << iopts.objectPath() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Like regIOobject::writeObject without instance() adaptation
|
||||||
|
// since this would write to e.g. 0/ instead of postProcessing/
|
||||||
|
|
||||||
|
OFstream osGeom(iopts.objectPath(), streamOpt_);
|
||||||
|
|
||||||
|
if (header_)
|
||||||
|
{
|
||||||
|
iopts.writeHeader(osGeom);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->isPointData())
|
||||||
|
{
|
||||||
|
// Just like writeData, but without copying beforehand
|
||||||
|
osGeom << points;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
primitivePatch pp(SubList<face>(faces), points);
|
||||||
|
|
||||||
|
// Just like writeData, but without copying beforehand
|
||||||
|
osGeom << pp.faceCentres();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (header_)
|
||||||
|
{
|
||||||
|
iopts.writeEndDivider(osGeom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
|
Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
|
||||||
{
|
{
|
||||||
checkOpen();
|
checkOpen();
|
||||||
@ -127,6 +178,7 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
|
|||||||
mkDir(surfaceDir);
|
mkDir(surfaceDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write sample locations
|
||||||
pointIOField iopts
|
pointIOField iopts
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -138,30 +190,9 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
|
|||||||
false
|
false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
iopts.note() = (this->isPointData() ? "point data" : "face data");
|
||||||
|
|
||||||
if (verbose_)
|
serialWriteGeometry(iopts, surf);
|
||||||
{
|
|
||||||
Info<< "Writing points: " << iopts.objectPath() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Like regIOobject::writeObject without instance() adaptation
|
|
||||||
// since this would write to e.g. 0/ instead of postProcessing/
|
|
||||||
|
|
||||||
OFstream osGeom(iopts.objectPath(), streamOpt_);
|
|
||||||
|
|
||||||
if (header_)
|
|
||||||
{
|
|
||||||
iopts.writeHeader(osGeom);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Just like writeData, but without copying beforehand
|
|
||||||
osGeom << surf.points();
|
|
||||||
|
|
||||||
if (header_)
|
|
||||||
{
|
|
||||||
iopts.writeEndDivider(osGeom);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wroteGeom_ = true;
|
wroteGeom_ = true;
|
||||||
@ -199,67 +230,29 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::writeTemplate
|
|||||||
|
|
||||||
if (Pstream::master() || !parallel_)
|
if (Pstream::master() || !parallel_)
|
||||||
{
|
{
|
||||||
const pointField& points = surf.points();
|
|
||||||
const faceList& faces = surf.faces();
|
|
||||||
|
|
||||||
if (!isDir(outputFile.path()))
|
if (!isDir(outputFile.path()))
|
||||||
{
|
{
|
||||||
mkDir(outputFile.path());
|
mkDir(outputFile.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
pointIOField iopts
|
// Write sample locations
|
||||||
(
|
{
|
||||||
IOobject
|
pointIOField iopts
|
||||||
(
|
(
|
||||||
surfaceDir/"points",
|
IOobject
|
||||||
*dummyTimePtr,
|
(
|
||||||
IOobject::NO_READ,
|
surfaceDir/"points",
|
||||||
IOobject::NO_WRITE,
|
*dummyTimePtr,
|
||||||
false
|
IOobject::NO_READ,
|
||||||
)
|
IOobject::NO_WRITE,
|
||||||
);
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
iopts.note() = (this->isPointData() ? "point data" : "face data");
|
||||||
|
|
||||||
if (verbose_)
|
serialWriteGeometry(iopts, surf);
|
||||||
{
|
|
||||||
if (this->isPointData())
|
|
||||||
{
|
|
||||||
Info<< "Writing points: " << iopts.objectPath() << endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< "Writing face centres: " << iopts.objectPath() << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like regIOobject::writeObject without instance() adaptation
|
|
||||||
// since this would write to e.g. 0/ instead of postProcessing/
|
|
||||||
|
|
||||||
OFstream osGeom(iopts.objectPath(), streamOpt_);
|
|
||||||
|
|
||||||
if (header_)
|
|
||||||
{
|
|
||||||
iopts.writeHeader(osGeom);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->isPointData())
|
|
||||||
{
|
|
||||||
// Just like writeData, but without copying beforehand
|
|
||||||
osGeom << points;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
primitivePatch pp(SubList<face>(faces), points);
|
|
||||||
|
|
||||||
// Just like writeData, but without copying beforehand
|
|
||||||
osGeom << pp.faceCentres();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (header_)
|
|
||||||
{
|
|
||||||
iopts.writeEndDivider(osGeom);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write field
|
// Write field
|
||||||
{
|
{
|
||||||
IOField<Type> iofld
|
IOField<Type> iofld
|
||||||
@ -273,6 +266,7 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::writeTemplate
|
|||||||
false
|
false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
iofld.note() = (this->isPointData() ? "point data" : "face data");
|
||||||
|
|
||||||
OFstream osField(iofld.objectPath(), streamOpt_);
|
OFstream osField(iofld.objectPath(), streamOpt_);
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -129,6 +129,10 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward Declarations
|
||||||
|
class regIOobject;
|
||||||
|
|
||||||
namespace surfaceWriters
|
namespace surfaceWriters
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -151,6 +155,9 @@ class boundaryDataWriter
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Write serial surface geometry to "points" file.
|
||||||
|
void serialWriteGeometry(const regIOobject&, const meshedSurf& surf);
|
||||||
|
|
||||||
//- Templated write field operation
|
//- Templated write field operation
|
||||||
template<class Type>
|
template<class Type>
|
||||||
fileName writeTemplate
|
fileName writeTemplate
|
||||||
|
|||||||
@ -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-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -416,11 +416,11 @@ bool Foam::surfaceWriter::empty() const
|
|||||||
|
|
||||||
Foam::label Foam::surfaceWriter::size() const
|
Foam::label Foam::surfaceWriter::size() const
|
||||||
{
|
{
|
||||||
const bool value =
|
const label value =
|
||||||
(
|
(
|
||||||
useComponents_
|
useComponents_
|
||||||
? surfComp_.faces().empty()
|
? surfComp_.faces().size()
|
||||||
: surf_.get().faces().empty()
|
: surf_.get().faces().size()
|
||||||
);
|
);
|
||||||
|
|
||||||
return (parallel_ ? returnReduce(value, sumOp<label>()) : value);
|
return (parallel_ ? returnReduce(value, sumOp<label>()) : value);
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -72,16 +72,16 @@ Foam::liquidProperties::liquidProperties
|
|||||||
Foam::liquidProperties::liquidProperties(const dictionary& dict)
|
Foam::liquidProperties::liquidProperties(const dictionary& dict)
|
||||||
:
|
:
|
||||||
thermophysicalProperties(dict),
|
thermophysicalProperties(dict),
|
||||||
Tc_(dict.get<label>("Tc")),
|
Tc_(dict.get<scalar>("Tc")),
|
||||||
Pc_(dict.get<label>("Pc")),
|
Pc_(dict.get<scalar>("Pc")),
|
||||||
Vc_(dict.get<label>("Vc")),
|
Vc_(dict.get<scalar>("Vc")),
|
||||||
Zc_(dict.get<label>("Zc")),
|
Zc_(dict.get<scalar>("Zc")),
|
||||||
Tt_(dict.get<label>("Tt")),
|
Tt_(dict.get<scalar>("Tt")),
|
||||||
Pt_(dict.get<label>("Pt")),
|
Pt_(dict.get<scalar>("Pt")),
|
||||||
Tb_(dict.get<label>("Tb")),
|
Tb_(dict.get<scalar>("Tb")),
|
||||||
dipm_(dict.get<label>("dipm")),
|
dipm_(dict.get<scalar>("dipm")),
|
||||||
omega_(dict.get<label>("omega")),
|
omega_(dict.get<scalar>("omega")),
|
||||||
delta_(dict.get<label>("delta"))
|
delta_(dict.get<scalar>("delta"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ include $(RULES)/c++$(WM_COMPILE_OPTION)
|
|||||||
|
|
||||||
c++FLAGS = $(c++ARCH) $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS)
|
c++FLAGS = $(c++ARCH) $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS)
|
||||||
|
|
||||||
Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -Wno-alloc-size-larger-than -c $< -o $@
|
Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $< -o $@
|
||||||
cxxtoo = $(Ctoo)
|
cxxtoo = $(Ctoo)
|
||||||
cctoo = $(Ctoo)
|
cctoo = $(Ctoo)
|
||||||
cpptoo = $(Ctoo)
|
cpptoo = $(Ctoo)
|
||||||
|
|||||||
@ -62,7 +62,7 @@ Executing ${0##*/} is equivalent to
|
|||||||
|
|
||||||
With additional options:
|
With additional options:
|
||||||
-l | -log Tee output to log.\$WM_OPTIONS
|
-l | -log Tee output to log.\$WM_OPTIONS
|
||||||
-log=NAME Tee output to given filename
|
-log=FILE Tee output to given filename
|
||||||
-prefix=... Define FOAM_MODULE_PREFIX (same as wmake -module-prefix)
|
-prefix=... Define FOAM_MODULE_PREFIX (same as wmake -module-prefix)
|
||||||
-no-recursion Prevent recursive call (do NOT call 'wmake -all')
|
-no-recursion Prevent recursive call (do NOT call 'wmake -all')
|
||||||
-fromWmake Same as -no-recursion
|
-fromWmake Same as -no-recursion
|
||||||
@ -79,7 +79,8 @@ USAGE
|
|||||||
# Parse the arguments and options
|
# Parse the arguments and options
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
unset optDebug optLog optNonRecursive optPrefix optQueue
|
unset optDebug optLog optNonRecursive optQueue
|
||||||
|
unset optWmakeFrontend
|
||||||
|
|
||||||
for arg in "$@"
|
for arg in "$@"
|
||||||
do
|
do
|
||||||
@ -98,27 +99,24 @@ do
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
-module-prefix=* | -prefix=* | --prefix=*)
|
-module-prefix=* | -prefix=* | --prefix=*)
|
||||||
optPrefix="${arg#*=}"
|
# As per setModulePrefix (wmakeFunctions)
|
||||||
case "$optPrefix" in
|
export FOAM_MODULE_PREFIX="${arg#*=}"
|
||||||
|
case "$FOAM_MODULE_PREFIX" in
|
||||||
# Prefix: user
|
# Prefix: user
|
||||||
(u | user)
|
(u | user) FOAM_MODULE_PREFIX="${FOAM_USER_LIBBIN%/*}" ;;
|
||||||
export FOAM_MODULE_PREFIX="${FOAM_USER_LIBBIN%/*}"
|
|
||||||
;;
|
|
||||||
|
|
||||||
# Prefix: group
|
# Prefix: group
|
||||||
(g | group)
|
(g | group) FOAM_MODULE_PREFIX="${FOAM_SITE_LIBBIN%/*}" ;;
|
||||||
export FOAM_MODULE_PREFIX="${FOAM_SITE_LIBBIN%/*}"
|
|
||||||
;;
|
|
||||||
|
|
||||||
# Prefix: openfoam (other)
|
# Prefix: openfoam (other)
|
||||||
(o | openfoam)
|
(o | openfoam) FOAM_MODULE_PREFIX="${FOAM_LIBBIN%/*}" ;;
|
||||||
export FOAM_MODULE_PREFIX="${FOAM_LIBBIN%/*}"
|
|
||||||
;;
|
|
||||||
|
|
||||||
# Prefix: custom (absolute or relative)
|
# Prefix: false | none (ie, 'disabled')
|
||||||
|
(false | none) FOAM_MODULE_PREFIX=false ;;
|
||||||
|
|
||||||
|
# Prefix: directory (absolute or relative)
|
||||||
(*)
|
(*)
|
||||||
export FOAM_MODULE_PREFIX="$optPrefix"
|
: "${FOAM_MODULE_PREFIX:=/usr/local}" # Fallback (autoconf-like)
|
||||||
: "${FOAM_MODULE_PREFIX:=/usr/local}" # Default (autoconf)
|
|
||||||
|
|
||||||
# Require absolute path
|
# Require absolute path
|
||||||
[ "${FOAM_MODULE_PREFIX#/}" != "${FOAM_MODULE_PREFIX}" ] || \
|
[ "${FOAM_MODULE_PREFIX#/}" != "${FOAM_MODULE_PREFIX}" ] || \
|
||||||
@ -126,20 +124,21 @@ do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Avoid potential conflicts
|
||||||
unset FOAM_MODULE_APPBIN FOAM_MODULE_LIBBIN
|
unset FOAM_MODULE_APPBIN FOAM_MODULE_LIBBIN
|
||||||
echo "Module prefix = $FOAM_MODULE_PREFIX" 1>&2
|
echo "Module prefix = ${FOAM_MODULE_PREFIX:-[]}" 1>&2
|
||||||
continue # Handled argument
|
continue # Argument handled, remove it
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-k | -keep-going | -non-stop)
|
-k | -keep-going | -non-stop)
|
||||||
# Keep going, ignoring errors
|
# Keep going, ignoring errors
|
||||||
export WM_CONTINUE_ON_ERROR=true
|
export WM_CONTINUE_ON_ERROR=true
|
||||||
continue # Permanently remove arg
|
continue # Argument handled, remove it
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-l | -log)
|
-l | -log)
|
||||||
optLog="log.${WM_OPTIONS:-build}"
|
optLog="log.${WM_OPTIONS:-build}"
|
||||||
continue # Permanently remove arg
|
continue # Argument handled, remove it
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-log=*)
|
-log=*)
|
||||||
@ -151,17 +150,17 @@ do
|
|||||||
then
|
then
|
||||||
optLog="log.${WM_OPTIONS:-build}"
|
optLog="log.${WM_OPTIONS:-build}"
|
||||||
fi
|
fi
|
||||||
continue # Permanently remove arg
|
continue # Argument handled, remove it
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-debug)
|
-debug)
|
||||||
optDebug="-debug"
|
optDebug="-debug"
|
||||||
continue # Permanently remove arg
|
continue # Argument handled, remove it
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-q | -queue)
|
-q | -queue)
|
||||||
optQueue="-queue"
|
optQueue="-queue"
|
||||||
continue # Permanently remove arg
|
continue # Argument handled, remove it
|
||||||
;;
|
;;
|
||||||
|
|
||||||
lib | libo | libso | dep | objects)
|
lib | libo | libso | dep | objects)
|
||||||
@ -183,12 +182,14 @@ if [ -z "$optNonRecursive" ]
|
|||||||
then
|
then
|
||||||
if [ -z "$optLog" ]
|
if [ -z "$optLog" ]
|
||||||
then
|
then
|
||||||
exec wmake -all $optDebug $optQueue $*
|
exec wmake $optWmakeFrontend -all \
|
||||||
|
$optDebug $optQueue $*
|
||||||
exit $? # Unneeded, but just in case something went wrong
|
exit $? # Unneeded, but just in case something went wrong
|
||||||
else
|
else
|
||||||
echo "Logging wmake -all output to '$optLog'" 1>&2
|
echo "Logging wmake -all output to '$optLog'" 1>&2
|
||||||
echo 1>&2
|
echo 1>&2
|
||||||
exec wmake -all $optDebug $optQueue $* 2>&1 | /usr/bin/tee $optLog
|
exec wmake $optWmakeFrontend -all \
|
||||||
|
$optDebug $optQueue $* 2>&1 | /usr/bin/tee $optLog
|
||||||
# Need to cleanup after the tee
|
# Need to cleanup after the tee
|
||||||
rc=$? # Error code from tee (not wmake), but not entirely important
|
rc=$? # Error code from tee (not wmake), but not entirely important
|
||||||
echo "Done logging to '$optLog'" 1>&2
|
echo "Done logging to '$optLog'" 1>&2
|
||||||
@ -211,7 +212,8 @@ fi
|
|||||||
# Cleanup local variables and functions
|
# Cleanup local variables and functions
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
unset optNonRecursive optDebug optLog optPrefix optQueue
|
unset optWmakeFrontend
|
||||||
|
unset optNonRecursive optDebug optLog optQueue
|
||||||
unset -f usage
|
unset -f usage
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2015-2016 OpenFOAM Foundation
|
# Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
# 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.
|
||||||
@ -55,6 +55,43 @@ checkEnv()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Set FOAM_MODULE_PREFIX according to
|
||||||
|
# - absolute/relative path
|
||||||
|
# - predefined type (u,user | g,group | o,openfoam)
|
||||||
|
setModulePrefix()
|
||||||
|
{
|
||||||
|
export FOAM_MODULE_PREFIX="$1"
|
||||||
|
case "$FOAM_MODULE_PREFIX" in
|
||||||
|
# Prefix: user
|
||||||
|
(u | user) FOAM_MODULE_PREFIX="${FOAM_USER_LIBBIN%/*}" ;;
|
||||||
|
|
||||||
|
# Prefix: group
|
||||||
|
(g | group) FOAM_MODULE_PREFIX="${FOAM_SITE_LIBBIN%/*}" ;;
|
||||||
|
|
||||||
|
# Prefix: openfoam (other)
|
||||||
|
(o | openfoam) FOAM_MODULE_PREFIX="${FOAM_LIBBIN%/*}" ;;
|
||||||
|
|
||||||
|
# Prefix: false | none (ie, 'disabled')
|
||||||
|
(false | none) FOAM_MODULE_PREFIX=false ;;
|
||||||
|
|
||||||
|
# Prefix: directory (absolute or relative)
|
||||||
|
(*)
|
||||||
|
: "${FOAM_MODULE_PREFIX:=/usr/local}" # Fallback (autoconf-like)
|
||||||
|
|
||||||
|
# Require absolute path
|
||||||
|
[ "${FOAM_MODULE_PREFIX#/}" != "${FOAM_MODULE_PREFIX}" ] || \
|
||||||
|
FOAM_MODULE_PREFIX="${PWD}/${FOAM_MODULE_PREFIX}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Avoid potential conflicts
|
||||||
|
unset FOAM_MODULE_APPBIN FOAM_MODULE_LIBBIN
|
||||||
|
echo "Module prefix = ${FOAM_MODULE_PREFIX:-[]}" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Return the absolute (physical) path for a directory or
|
# Return the absolute (physical) path for a directory or
|
||||||
# for a file's parent directory
|
# for a file's parent directory
|
||||||
# expandPath dirName
|
# expandPath dirName
|
||||||
|
|||||||
Reference in New Issue
Block a user