Commit 1310e852 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

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.
parent 29ccc00c
......@@ -40,7 +40,7 @@ if (args.found("initialiseUBCs"))
// converting fixed-value BCs to zero-gradient and vice versa.
// Allow override from command-line -pName option
const word pName = args.opt<word>("pName", "p");
const word pName = args.get<word>("pName", "p");
// Infer the pressure BCs from the velocity
wordList pBCTypes
......
......@@ -40,7 +40,7 @@ if (args.found("initialiseUBCs"))
// converting fixed-value BCs to zero-gradient and vice versa.
// Allow override from command-line -pName option
const word pName = args.opt<word>("pName", "p");
const word pName = args.get<word>("pName", "p");
// Infer the pressure BCs from the velocity
wordList pBCTypes
......
......@@ -121,7 +121,7 @@ volScalarField alphac
const word kinematicCloudName
(
args.opt<word>("cloud", "kinematicCloud")
args.get<word>("cloud", "kinematicCloud")
);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
......
......@@ -59,7 +59,7 @@ volScalarField mu
const word kinematicCloudName
(
args.opt<word>("cloud", "kinematicCloud")
args.get<word>("cloud", "kinematicCloud")
);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
......
......@@ -51,7 +51,7 @@ autoPtr<compressible::turbulenceModel> turbulence
const word kinematicCloudName
(
args.opt<word>("cloud", "kinematicCloud")
args.get<word>("cloud", "kinematicCloud")
);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
......
......@@ -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
......
......@@ -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;
......
......@@ -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)
......
......@@ -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;
......
......@@ -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));
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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"))
......
......@@ -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];
......
......@@ -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");
......
......@@ -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);
......
......@@ -383,7 +383,7 @@ int main(int argc, char *argv[])
// Sin of angle between two consecutive edges on a face.
// If sin(angle) larger than this the face will be considered concave.
const scalar concaveAngle = args.opt<scalar>("concaveAngle", 30);
const scalar concaveAngle = args.get<scalar>("concaveAngle", 30);
const scalar concaveSin = Foam::sin(degToRad(concaveAngle));
......
......@@ -561,7 +561,7 @@ int main(int argc, char *argv[])
const bool geometry = args.found("geometry");
const bool overwrite = args.found("overwrite");
const scalar edgeTol = args.opt<scalar>("tol", 0.2);
const scalar edgeTol = args.get<scalar>("tol", 0.2);
Info<< "Trying to split cells with internal angles > feature angle\n" << nl
<< "featureAngle : " << featureAngle << nl
......
......@@ -323,7 +323,7 @@ int main(int argc, char *argv[])
FatalError.exit();
}
const scalar scaleFactor = args.opt<scalar>("scale", 1);
const scalar scaleFactor = args.get<scalar>("scale", 1);
#include "createTime.H"
......
......@@ -188,7 +188,7 @@ int main(int argc, char *argv[])
}
// By default, no scaling
const scalar scaleFactor = args.opt<scalar>("scale", 1);
const scalar scaleFactor = args.get<scalar>("scale", 1);
// Default to binary output, unless otherwise specified
const IOstream::streamFormat format =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment