ENH: support 'get()' for retrieving argList options

- previously only had 'opt<..>()' for options, but 'get<..>()'
  provides more similarity with dictionary methods.
  The 'opt<..>()' method is retained.
This commit is contained in:
Mark Olesen
2019-11-26 21:07:11 +01:00
committed by Andrew Heather
parent 29ccc00c7d
commit 1310e85225
81 changed files with 155 additions and 141 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2018 OpenCFD Ltd.
Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -126,7 +126,8 @@ int main(int argc, char *argv[])
Info<< nl;
if (args.found("label"))
{
Info<< "-label = " << args.opt<label>("label")
Info<< "-label = " << args.get<label>("label")
<< " or " << args.opt<label>("label")
#ifdef Foam_argList_1712
<< " or " << args.optionRead<label>("label") // old-compat
#endif
@ -136,7 +137,8 @@ int main(int argc, char *argv[])
if (args.found("scalar"))
{
Info<< "-scalar = " << args.opt<scalar>("scalar")
Info<< "-scalar = " << args.get<scalar>("scalar")
<< " or " << args.opt<scalar>("label")
#ifdef Foam_argList_1712
<< " or " << args.optionRead<scalar>("scalar") // old-compat
#endif
@ -146,7 +148,8 @@ int main(int argc, char *argv[])
if (args.found("string"))
{
Info<< "-string = " << args.opt("string")
Info<< "-string = " << args.get("string")
<< " or " << args.opt("string")
#ifdef Foam_argList_1712
<< " or " << args.optionRead<scalar>("string") // old-compat
#endif

View File

@ -86,7 +86,7 @@ int main(int argc, char *argv[])
instantList times = timeSelector::selectIfPresent(runTime, args);
// Allow override of decomposeParDict location
const fileName decompDictFile = args.opt<fileName>("decomposeParDict", "");
const fileName decompDictFile = args.get<fileName>("decomposeParDict", "");
wordList regionNames;
wordList regionDirs;

View File

@ -100,8 +100,8 @@ int main(int argc, char *argv[])
const bool allRegions = args.found("allRegions");
const bool verbose = args.found("verbose");
const label numSubdomains = args.opt<label>("domains", 0);
const word methodName = args.opt<word>("method", word::null);
const label numSubdomains = args.get<label>("domains", 0);
const word methodName = args.get<word>("method", word::null);
// Set time from database
#include "createTime.H"
@ -109,7 +109,7 @@ int main(int argc, char *argv[])
instantList times = timeSelector::selectIfPresent(runTime, args);
// Allow override of decomposeParDict location
const fileName decompDictFile = args.opt<fileName>("decomposeParDict", "");
const fileName decompDictFile = args.get<fileName>("decomposeParDict", "");
// Get all region names
wordList regionNames;
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
else
{
regionNames.resize(1);
regionNames.first() = args.opt<word>("region", fvMesh::defaultRegion);
regionNames.first() = args.get<word>("region", fvMesh::defaultRegion);
}
forAll(regionNames, regioni)

View File

@ -47,7 +47,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
const label maxCount = args.opt<label>("max", 1000);
const label maxCount = args.get<label>("max", 1000);
externalFileCoupler coupler;

View File

@ -198,7 +198,7 @@ int main(int argc, char *argv[])
}
{
const label celli = args.opt<label>("cell", 0);
const label celli = args.get<label>("cell", 0);
tensorField mI(momentOfInertia::meshInertia(mesh));

View File

@ -67,7 +67,7 @@ int main(int argc, char *argv[])
bool useBSpline = args.found("B");
bool useCatmullRom = args.found("CMR");
const label nSeg = args.opt<label>("n", 20);
const label nSeg = args.get<label>("n", 20);
if (!useCatmullRom && !useBSpline)
{

View File

@ -188,7 +188,7 @@ int main(int argc, char *argv[])
if (args.found("fixed"))
{
const label width = args.opt<label>("fixed");
const label width = args.get<label>("fixed");
Info<< "split on fixed width = " << width << nl
<< "~~~~~~~~~~~~~~" << nl;

View File

@ -130,7 +130,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
const scalar scaleFactor = args.opt<scalar>("scale", -1);
const scalar scaleFactor = args.get<scalar>("scale", -1);
const word outputFile(args.executable() + ".obj");
@ -194,7 +194,7 @@ int main(int argc, char *argv[])
word mergeOp;
if (args.found("mergePoints"))
{
cuts.mergePoints(args.opt<scalar>("mergePoints"));
cuts.mergePoints(args.get<scalar>("mergePoints"));
mergeOp = "mergePoints";
}
else if (args.found("mergeEdges"))

View File

@ -141,7 +141,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
const bool optStdout = args.found("stdout");
const scalar scaleFactor = args.opt<scalar>("scale", 0);
const scalar scaleFactor = args.get<scalar>("scale", 0);
const fileName importName = args[1];
const fileName exportName = optStdout ? "-stdout" : args[2];

View File

@ -53,7 +53,7 @@ int main(int argc, char *argv[])
argList args(argc, argv, false, true);
const label repeat = args.opt<label>("repeat", 1);
const label repeat = args.get<label>("repeat", 1);
const bool optVerbose = args.found("verbose");

View File

@ -47,7 +47,7 @@ int main(int argc, char *argv[])
argList args(argc, argv, false, true);
const scalar currTime = args.opt<scalar>("time", GREAT);
const scalar currTime = args.get<scalar>("time", GREAT);
Info<< "Using currTime = " << currTime << nl
<< "when loading " << (args.size()-1) << " files" << nl << nl;
@ -103,7 +103,7 @@ int main(int argc, char *argv[])
{
vtk::seriesWriter writer;
writer.scan(args.opt<fileName>("scan"));
writer.scan(args.get<fileName>("scan"));
Info<< "scanned for files" << nl;
writer.print(Info);