mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: avoid parse problems caused by #calc directives (fixes #722)
- The additional output generated by #calc directives in the controlDict or decomposeParDict causes issues for the RunFunctions extraction of 'application' and 'numberOfSubdomains'. Avoid by using -disableFunctionEntries, which also has the side-effect of disabling '#include'.
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -334,7 +334,11 @@ int main(int argc, char *argv[])
|
|||||||
const bool disableEntries = args.found("disableFunctionEntries");
|
const bool disableEntries = args.found("disableFunctionEntries");
|
||||||
if (disableEntries)
|
if (disableEntries)
|
||||||
{
|
{
|
||||||
Info<< "Not expanding variables or dictionary directives" << endl;
|
// Report on stderr (once) to avoid polluting the output
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
Serr<< "Not expanding variables or dictionary directives" << endl;
|
||||||
|
}
|
||||||
entry::disableFunctionEntries = true;
|
entry::disableFunctionEntries = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -56,6 +56,9 @@ notTest()
|
|||||||
# Extract 'numberOfSubdomains' from system/decomposeParDict
|
# Extract 'numberOfSubdomains' from system/decomposeParDict
|
||||||
# (or alternative location).
|
# (or alternative location).
|
||||||
#
|
#
|
||||||
|
# Note that '#include' and other directives are disabled - only entries that
|
||||||
|
# are in the dictionary are considered.
|
||||||
|
#
|
||||||
# On failure:
|
# On failure:
|
||||||
# return '1'
|
# return '1'
|
||||||
# exit status 1
|
# exit status 1
|
||||||
@ -65,13 +68,13 @@ getNumberOfProcessors()
|
|||||||
local dict="${1:-system/decomposeParDict}"
|
local dict="${1:-system/decomposeParDict}"
|
||||||
|
|
||||||
# Re-use positional parameters for automatic whitespace elimination
|
# Re-use positional parameters for automatic whitespace elimination
|
||||||
set -- $(foamDictionary -entry numberOfSubdomains -value "$dict" 2>/dev/null)
|
set -- $(foamDictionary -disableFunctionEntries -entry numberOfSubdomains -value "$dict" 2>/dev/null)
|
||||||
|
|
||||||
if [ "$#" -eq 1 ]
|
if [ "$#" -eq 1 ]
|
||||||
then
|
then
|
||||||
echo "$1"
|
echo "$1"
|
||||||
else
|
else
|
||||||
echo "Warning no 'numberOfSubdomains' in '$dict'" 1>&2
|
echo "Error getting 'numberOfSubdomains' from '$dict'" 1>&2
|
||||||
echo 1 # serial as fallback
|
echo 1 # serial as fallback
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -81,6 +84,9 @@ getNumberOfProcessors()
|
|||||||
#
|
#
|
||||||
# Extract 'application' from system/controlDict
|
# Extract 'application' from system/controlDict
|
||||||
#
|
#
|
||||||
|
# Note that '#include' and other directives are disabled - only entries that
|
||||||
|
# are in the dictionary are considered.
|
||||||
|
#
|
||||||
# On failure:
|
# On failure:
|
||||||
# return 'false' which is also a command (ie, shell builtin or /bin/false)
|
# return 'false' which is also a command (ie, shell builtin or /bin/false)
|
||||||
# exit status 1
|
# exit status 1
|
||||||
@ -88,13 +94,13 @@ getNumberOfProcessors()
|
|||||||
getApplication()
|
getApplication()
|
||||||
{
|
{
|
||||||
# Re-use positional parameters for automatic whitespace elimination
|
# Re-use positional parameters for automatic whitespace elimination
|
||||||
set -- $(foamDictionary -entry application -value system/controlDict)
|
set -- $(foamDictionary -disableFunctionEntries -entry application -value system/controlDict)
|
||||||
|
|
||||||
if [ "$#" -eq 1 ]
|
if [ "$#" -eq 1 ]
|
||||||
then
|
then
|
||||||
echo "$1"
|
echo "$1"
|
||||||
else
|
else
|
||||||
echo "Error retrieving 'application' from controlDict" 1>&2
|
echo "Error getting 'application' from system/controlDict" 1>&2
|
||||||
echo false
|
echo false
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user