diff --git a/applications/test/dictionary/testDictEval3 b/applications/test/dictionary/testDictEval3 index 560b59d34e..79bebc9c20 100644 --- a/applications/test/dictionary/testDictEval3 +++ b/applications/test/dictionary/testDictEval3 @@ -68,4 +68,8 @@ apiMonth #eval{ ($FOAM_API % 100) }; empty #eval ""; +// Field of specified length +random #eval 4 { vector(rand(), 0, 0) ; /* trailing rubbish */ ; }; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/tools/foamCalc/foamCalc.C b/applications/tools/foamCalc/foamCalc.C index d96df259de..3ac3c86059 100644 --- a/applications/tools/foamCalc/foamCalc.C +++ b/applications/tools/foamCalc/foamCalc.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -97,6 +97,7 @@ int main(int argc, char *argv[]) argList::addBoolOption("rules", "Print parser rules and exit"); argList::addBoolOption("tokens", "Print token names and exit"); argList::addOption("precision", "int", "Output with specified precision"); + argList::addOption("size", "int", "Field output width (default: 1)"); // Flag arguments as optional so that -rules and -tokens works argList::noMandatoryArgs(); @@ -110,6 +111,7 @@ int main(int argc, char *argv[]) const bool printRules = args.found("rules"); const bool printNames = args.found("tokens"); + const label fieldWidth = args.getOrDefault