ENH: change argList get<> and getList<> from read<>, readList<>

- more consistent with dictionary method naming. The get<> or
  getList<> returns a value, doesn't read into a existing location.
This commit is contained in:
Mark Olesen
2018-08-09 11:27:36 +02:00
parent b5162f91fc
commit ae36f5f504
47 changed files with 101 additions and 99 deletions

View File

@ -51,7 +51,7 @@ int main(int argc, char *argv[])
labelList patchIDs labelList patchIDs
( (
pbm.patchSet(args.readList<wordRe>(1)).sortedToc() pbm.patchSet(args.getList<wordRe>(1)).sortedToc()
); );
Info<< "Starting walk from patches " Info<< "Starting walk from patches "

View File

@ -108,7 +108,9 @@ int main(int argc, char *argv[])
if (args.found("label")) if (args.found("label"))
{ {
Info<< "-label = " << args.opt<label>("label") Info<< "-label = " << args.opt<label>("label")
#ifdef Foam_argList_1712
<< " or " << args.optionRead<label>("label") // old-compat << " or " << args.optionRead<label>("label") // old-compat
#endif
<< " or " << readLabel(args["label"]) // with function << " or " << readLabel(args["label"]) // with function
<< nl; << nl;
} }
@ -116,7 +118,9 @@ int main(int argc, char *argv[])
if (args.found("scalar")) if (args.found("scalar"))
{ {
Info<< "-scalar = " << args.opt<scalar>("scalar") Info<< "-scalar = " << args.opt<scalar>("scalar")
#ifdef Foam_argList_1712
<< " or " << args.optionRead<scalar>("scalar") // old-compat << " or " << args.optionRead<scalar>("scalar") // old-compat
#endif
<< " or " << readScalar(args["scalar"]) // with function << " or " << readScalar(args["scalar"]) // with function
<< nl; << nl;
} }
@ -124,7 +128,9 @@ int main(int argc, char *argv[])
if (args.found("string")) if (args.found("string"))
{ {
Info<< "-string = " << args.opt("string") Info<< "-string = " << args.opt("string")
#ifdef Foam_argList_1712
<< " or " << args.optionRead<scalar>("string") // old-compat << " or " << args.optionRead<scalar>("string") // old-compat
#endif
<< nl; << nl;
} }
@ -133,8 +139,11 @@ int main(int argc, char *argv[])
Info<< nl; Info<< nl;
for (label argi=1; argi < args.size(); ++argi) for (label argi=1; argi < args.size(); ++argi)
{ {
Info<< "arg[" << argi << "] = " << args.read<string>(argi) Info<< "arg[" << argi << "] = " << args.get<string>(argi)
#ifdef Foam_argList_1712
<< " or " << args.read<label>(argi) // old-compat
<< " or " << args.argRead<label>(argi) // old-compat << " or " << args.argRead<label>(argi) // old-compat
#endif
<< nl; << nl;
} }

View File

@ -109,12 +109,8 @@ int main(int argc, char *argv[])
const bool allRegions = args.found("allRegions"); const bool allRegions = args.found("allRegions");
const bool verbose = args.found("verbose"); const bool verbose = args.found("verbose");
const label numSubdomains = const label numSubdomains = args.lookupOrDefault<label>("domains", 0);
args.lookupOrDefault<label>("domains", 0); const word methodName = args.lookupOrDefault<word>("method", word::null);
const word methodName =
args.lookupOrDefault<word>("method", word::null);
// Set time from database // Set time from database
#include "createTime.H" #include "createTime.H"

View File

@ -46,7 +46,7 @@ int main(int argc, char *argv[])
label nReps = 10000; label nReps = 10000;
const point sample = args.read<point>(1); const point sample = args.get<point>(1);
const polyMesh::cellDecomposition decompMode = polyMesh::CELL_TETS; const polyMesh::cellDecomposition decompMode = polyMesh::CELL_TETS;

View File

@ -101,8 +101,8 @@ int main(int argc, char *argv[])
} }
{ {
label start = args.read<label>(argI); label start = args.get<label>(argI);
label size = args.read<label>(argI+1); label size = args.get<label>(argI+1);
++argI; ++argI;
range.reset(start, size); range.reset(start, size);

View File

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

View File

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

View File

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

View File

@ -366,13 +366,15 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
const scalar featureAngle = args.read<scalar>(1); const scalar featureAngle = args.get<scalar>(1);
const scalar minCos = Foam::cos(degToRad(featureAngle)); const scalar minCos = Foam::cos(degToRad(featureAngle));
// Sin of angle between two consecutive edges on a face. // Sin of angle between two consecutive edges on a face.
// If sin(angle) larger than this the face will be considered concave. // If sin(angle) larger than this the face will be considered concave.
scalar concaveAngle = args.lookupOrDefault("concaveAngle", 30.0); const scalar concaveAngle =
scalar concaveSin = Foam::sin(degToRad(concaveAngle)); args.lookupOrDefault<scalar>("concaveAngle", 30);
const scalar concaveSin = Foam::sin(degToRad(concaveAngle));
const bool overwrite = args.found("overwrite"); const bool overwrite = args.found("overwrite");
const bool meshQuality = args.found("meshQuality"); const bool meshQuality = args.found("meshQuality");

View File

@ -81,8 +81,8 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
// Find set of patches from the list of regular expressions provided // Find set of patches from the list of regular expressions provided
const wordRes patches(args.readList<wordRe>(1)); const wordRes patches(args.getList<wordRe>(1));
const scalar weight = args.read<scalar>(2); const scalar weight = args.get<scalar>(2);
const bool overwrite = args.found("overwrite"); const bool overwrite = args.found("overwrite");
const labelHashSet patchSet(mesh.boundaryMesh().patchSet(patches)); const labelHashSet patchSet(mesh.boundaryMesh().patchSet(patches));

View File

@ -556,7 +556,7 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
const scalar featureAngle = args.read<scalar>(1); const scalar featureAngle = args.get<scalar>(1);
const scalar minCos = Foam::cos(degToRad(featureAngle)); const scalar minCos = Foam::cos(degToRad(featureAngle));
const scalar minSin = Foam::sin(degToRad(featureAngle)); const scalar minSin = Foam::sin(degToRad(featureAngle));
@ -564,7 +564,7 @@ int main(int argc, char *argv[])
const bool geometry = args.found("geometry"); const bool geometry = args.found("geometry");
const bool overwrite = args.found("overwrite"); const bool overwrite = args.found("overwrite");
const scalar edgeTol = args.lookupOrDefault("tol", 0.2); const scalar edgeTol = args.lookupOrDefault<scalar>("tol", 0.2);
Info<< "Trying to split cells with internal angles > feature angle\n" << nl Info<< "Trying to split cells with internal angles > feature angle\n" << nl
<< "featureAngle : " << featureAngle << nl << "featureAngle : " << featureAngle << nl

View File

@ -314,7 +314,7 @@ int main(int argc, char *argv[])
FatalError.exit(); FatalError.exit();
} }
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0); const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
#include "createTime.H" #include "createTime.H"

View File

@ -186,7 +186,7 @@ int main(int argc, char *argv[])
} }
// By default, no scaling // By default, no scaling
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0); const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
// Default to binary output, unless otherwise specified // Default to binary output, unless otherwise specified
const IOstream::streamFormat format = const IOstream::streamFormat format =

View File

@ -64,7 +64,7 @@ int main(int argc, char *argv[])
FatalError.exit(); FatalError.exit();
} }
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0); const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
#include "createTime.H" #include "createTime.H"

View File

@ -103,7 +103,7 @@ int main(int argc, char *argv[])
( (
args[1], args[1],
// Default no scaling // Default no scaling
args.lookupOrDefault("scale", 1.0) args.lookupOrDefault<scalar>("scale", 1)
); );

View File

@ -897,7 +897,7 @@ int main(int argc, char *argv[])
FatalError.exit(); FatalError.exit();
} }
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0); const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
const bool writeSets = args.found("writeSets"); const bool writeSets = args.found("writeSets");
const bool writeZones = args.found("writeZones"); const bool writeZones = args.found("writeZones");

View File

@ -96,7 +96,7 @@ int main(int argc, char *argv[])
} }
// Default rescale from [m] to [mm] // Default rescale from [m] to [mm]
const scalar scaleFactor = args.lookupOrDefault("scale", 1000.0); const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1000);
const bool writeBndFile = !args.found("noBnd"); const bool writeBndFile = !args.found("noBnd");
#include "createPolyMesh.H" #include "createPolyMesh.H"

View File

@ -641,7 +641,7 @@ int main(int argc, char *argv[])
FatalError.exit(); FatalError.exit();
} }
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0); const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
#include "createTime.H" #include "createTime.H"

View File

@ -90,7 +90,7 @@ int main(int argc, char *argv[])
FatalError.exit(); FatalError.exit();
} }
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0); const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
const bool readBlank = !args.found("noBlank"); const bool readBlank = !args.found("noBlank");
const bool singleBlock = args.found("singleBlock"); const bool singleBlock = args.found("singleBlock");

View File

@ -113,7 +113,7 @@ int main(int argc, char *argv[])
prefix, prefix,
runTime, runTime,
// Default rescale from [mm] to [m] // Default rescale from [mm] to [m]
args.lookupOrDefault("scale", 0.001), args.lookupOrDefault<scalar>("scale", 0.001),
args.found("solids") args.found("solids")
); );

View File

@ -61,7 +61,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
const labelVector n(args.read<labelVector>(1)); const labelVector n(args.get<labelVector>(1));
const fileName exportName = args[2]; const fileName exportName = args[2];
Info<< "Reading surfaces as specified in the foamyHexMeshDict and" Info<< "Reading surfaces as specified in the foamyHexMeshDict and"

View File

@ -1667,7 +1667,7 @@ int main(int argc, char *argv[])
{ {
includePatches = bMesh.patchSet includePatches = bMesh.patchSet
( (
args.readList<wordRe>("patches") args.getList<wordRe>("patches")
); );
} }
else else

View File

@ -91,7 +91,7 @@ int main(int argc, char *argv[])
<< " s\n" << endl << endl; << " s\n" << endl << endl;
const scalar featureAngle = args.read<scalar>(1); const scalar featureAngle = args.get<scalar>(1);
const bool overwrite = args.found("overwrite"); const bool overwrite = args.found("overwrite");
const scalar minCos = Foam::cos(degToRad(featureAngle)); const scalar minCos = Foam::cos(degToRad(featureAngle));

View File

@ -48,7 +48,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
const scalar scaleFactor = args.read<scalar>(1); const scalar scaleFactor = args.get<scalar>(1);
#include "createTime.H" #include "createTime.H"
#include "createNamedMesh.H" #include "createNamedMesh.H"

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
#include "createNamedPolyMesh.H" #include "createNamedPolyMesh.H"
const word zoneName = args[1]; const word zoneName = args[1];
const point outsidePoint = args.read<point>(2); const point outsidePoint = args.get<point>(2);
Info<< "Orienting faceZone " << zoneName Info<< "Orienting faceZone " << zoneName
<< " such that " << outsidePoint << " is outside" << " such that " << outsidePoint << " is outside"

View File

@ -401,7 +401,7 @@ int main(int argc, char *argv[])
} }
} }
const scalar featureAngle = args.read<scalar>(1); const scalar featureAngle = args.get<scalar>(1);
const scalar minCos = Foam::cos(degToRad(featureAngle)); const scalar minCos = Foam::cos(degToRad(featureAngle));
Info<< "Feature:" << featureAngle << endl Info<< "Feature:" << featureAngle << endl

View File

@ -83,11 +83,8 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
vector n1(args.read<vector>(1)); const vector n1(args.get<vector>(1).normalise());
n1 /= mag(n1); const vector n2(args.get<vector>(2).normalise());
vector n2(args.read<vector>(2));
n2 /= mag(n2);
const tensor rotT(rotationTensor(n1, n2)); const tensor rotT(rotationTensor(n1, n2));

View File

@ -391,7 +391,6 @@ int main(int argc, char *argv[])
meshInstance = fieldsInstance; meshInstance = fieldsInstance;
} }
Info<< "Reading cell set from " << selectionName << nl << endl; Info<< "Reading cell set from " << selectionName << nl << endl;
@ -400,12 +399,12 @@ int main(int argc, char *argv[])
if (args.found("patches")) if (args.found("patches"))
{ {
const wordRes patchNames(args.readList<wordRe>("patches")); const wordRes patchNames(args.getList<wordRe>("patches"));
exposedPatchIDs = mesh.boundaryMesh().patchSet(patchNames).sortedToc(); exposedPatchIDs = mesh.boundaryMesh().patchSet(patchNames).sortedToc();
Info<< "Adding exposed internal faces to nearest of patches " Info<< "Adding exposed internal faces to nearest of patches "
<< patchNames << nl << endl; << flatOutput(patchNames) << nl << endl;
if (exposedPatchIDs.empty()) if (exposedPatchIDs.empty())
{ {
@ -414,7 +413,6 @@ int main(int argc, char *argv[])
<< mesh.boundaryMesh().names() << mesh.boundaryMesh().names()
<< exit(FatalError); << exit(FatalError);
} }
} }
else if (args.found("patch")) else if (args.found("patch"))
{ {

View File

@ -363,7 +363,7 @@ int main(int argc, char *argv[])
List<scalar> scaling; List<scalar> scaling;
if (args.readListIfPresent("scale", scaling)) if (args.readListIfPresent("scale", scaling))
{ {
// readList handles single or multiple values // readListIfPresent handles single or multiple values
if (scaling.size() == 1) if (scaling.size() == 1)
{ {

View File

@ -237,11 +237,11 @@ int main(int argc, char *argv[])
if (args.found("patches")) if (args.found("patches"))
{ {
writeOpts.patchSelection(args.readList<wordRe>("patches")); writeOpts.patchSelection(args.getList<wordRe>("patches"));
} }
if (args.found("faceZones")) if (args.found("faceZones"))
{ {
writeOpts.faceZoneSelection(args.readList<wordRe>("faceZones")); writeOpts.faceZoneSelection(args.getList<wordRe>("faceZones"));
} }
// //

View File

@ -90,11 +90,8 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
const label maxOut = const label maxOut = Foam::max(0, args.lookupOrDefault<label>("max", 0));
Foam::max(0, args.lookupOrDefault<label>("max", 0)); const label span = Foam::max(1, args.lookupOrDefault<label>("span", 1));
const label span =
Foam::max(1, args.lookupOrDefault<label>("span", 1));
const scalar relax = args.lookupOrDefault<scalar>("scale", 1); const scalar relax = args.lookupOrDefault<scalar>("scale", 1);

View File

@ -86,7 +86,7 @@ int main(int argc, char *argv[])
args.readIfPresent("regions", regionNames); args.readIfPresent("regions", regionNames);
} }
const wordRe patchGroup(args.read<wordRe>(1)); const wordRe patchGroup(args.get<wordRe>(1));
fileName commsDir(runTime.path()/"comms"); fileName commsDir(runTime.path()/"comms");
args.readIfPresent("commsDir", commsDir); args.readIfPresent("commsDir", commsDir);

View File

@ -1591,8 +1591,7 @@ int main(int argc, char *argv[])
// Scale factor for both surfaces: // Scale factor for both surfaces:
const scalar scaleFactor const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", -1);
= args.lookupOrDefault<scalar>("scale", -1);
const word surf1Name(args[2]); const word surf1Name(args[2]);
Info<< "Reading surface " << surf1Name << endl; Info<< "Reading surface " << surf1Name << endl;

View File

@ -71,8 +71,8 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
const fileName inFileName = args[1]; const fileName inFileName = args[1];
const scalar minLen = args.read<scalar>(2); const scalar minLen = args.get<scalar>(2);
const scalar minQuality = args.read<scalar>(3); const scalar minQuality = args.get<scalar>(3);
const fileName outFileName = args[4]; const fileName outFileName = args[4];
Info<< "Reading surface " << inFileName << nl Info<< "Reading surface " << inFileName << nl

View File

@ -85,7 +85,7 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
const fileName inFileName = args[1]; const fileName inFileName = args[1];
const scalar reduction = args.read<scalar>(2); const scalar reduction = args.get<scalar>(2);
const fileName outFileName = args[3]; const fileName outFileName = args[3];
if (reduction <= 0 || reduction > 1) if (reduction <= 0 || reduction > 1)

View File

@ -289,7 +289,7 @@ int main(int argc, char *argv[])
const IOdictionary dict(dictIO); const IOdictionary dict(dictIO);
const scalar dist(args.read<scalar>(1)); const scalar dist(args.get<scalar>(1));
const scalar matchTolerance(max(1e-6*dist, SMALL)); const scalar matchTolerance(max(1e-6*dist, SMALL));
const label maxIters = 100; const label maxIters = 100;

View File

@ -85,7 +85,7 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
const fileName surfFileName = args[1]; const fileName surfFileName = args[1];
const scalar density = args.lookupOrDefault("density", 1.0); const scalar density = args.lookupOrDefault<scalar>("density", 1);
vector refPt = Zero; vector refPt = Zero;
bool calcAroundRefPt = args.readIfPresent("referencePoint", refPt); bool calcAroundRefPt = args.readIfPresent("referencePoint", refPt);

View File

@ -607,8 +607,8 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
const word inputName(args[1]); const word inputName(args[1]);
const scalar distance(args.read<scalar>(2)); const scalar distance(args.get<scalar>(2));
const scalar extendFactor(args.read<scalar>(3)); const scalar extendFactor(args.get<scalar>(3));
const bool checkSelfIntersect = args.found("checkSelfIntersection"); const bool checkSelfIntersect = args.found("checkSelfIntersection");
const label nSmooth = args.lookupOrDefault("nSmooth", 10); const label nSmooth = args.lookupOrDefault("nSmooth", 10);
const scalar featureAngle = args.lookupOrDefault<scalar> const scalar featureAngle = args.lookupOrDefault<scalar>

View File

@ -146,9 +146,9 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
const fileName surfFileName = args[1]; const fileName surfFileName = args[1];
const scalar lambda = args.read<scalar>(2); const scalar lambda = args.get<scalar>(2);
const scalar mu = args.read<scalar>(3); const scalar mu = args.get<scalar>(3);
const label iters = args.read<label>(4); const label iters = args.get<label>(4);
const fileName outFileName = args[5]; const fileName outFileName = args[5];
if (lambda < 0 || lambda > 1) if (lambda < 0 || lambda > 1)

View File

@ -173,10 +173,7 @@ int main(int argc, char *argv[])
if (args.found("patches")) if (args.found("patches"))
{ {
includePatches = bMesh.patchSet includePatches = bMesh.patchSet(args.getList<wordRe>("patches"));
(
args.readList<wordRe>("patches")
);
} }
else else
{ {
@ -197,7 +194,7 @@ int main(int argc, char *argv[])
if (args.found("faceZones")) if (args.found("faceZones"))
{ {
wordReList zoneNames(args.readList<wordRe>("faceZones")); wordReList zoneNames(args.getList<wordRe>("faceZones"));
const wordList allZoneNames(fzm.names()); const wordList allZoneNames(fzm.names());
for (const wordRe& zoneName : zoneNames) for (const wordRe& zoneName : zoneNames)
{ {

View File

@ -73,7 +73,7 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
const fileName surfFileName = args[1]; const fileName surfFileName = args[1];
const point visiblePoint = args.read<point>(2); const point visiblePoint = args.get<point>(2);
const fileName outFileName = args[3]; const fileName outFileName = args[3];
const bool orientInside = args.found("inside"); const bool orientInside = args.found("inside");

View File

@ -65,7 +65,7 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
const fileName surfFileName = args[1]; const fileName surfFileName = args[1];
const scalar mergeTol = args.read<scalar>(2); const scalar mergeTol = args.get<scalar>(2);
const fileName outFileName = args[3]; const fileName outFileName = args[3];
const scalar scaling = args.lookupOrDefault<scalar>("scale", -1); const scalar scaling = args.lookupOrDefault<scalar>("scale", -1);

View File

@ -238,7 +238,7 @@ int main(int argc, char *argv[])
List<scalar> scaling; List<scalar> scaling;
if (args.readListIfPresent("scale", scaling)) if (args.readListIfPresent("scale", scaling))
{ {
// readList handles single or multiple values // readListIfPresent handles single or multiple values
if (scaling.size() == 1) if (scaling.size() == 1)
{ {

View File

@ -435,7 +435,7 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
{ {
modifiedControlDict = true; modifiedControlDict = true;
wordList funcNames = args.readList<word>("funcs"); wordList funcNames = args.getList<word>("funcs");
for (const word& funcName : funcNames) for (const word& funcName : funcNames)
{ {

View File

@ -1117,12 +1117,10 @@ void Foam::argList::parse
// If running distributed (different roots for different procs) // If running distributed (different roots for different procs)
label dictNProcs = -1; label dictNProcs = -1;
if (options_.found("roots")) if (this->readListIfPresent("roots", roots))
{ {
distributed_ = true; distributed_ = true;
source = "-roots"; source = "-roots";
roots = this->readList<fileName>("roots");
if (roots.size() != 1) if (roots.size() != 1)
{ {
dictNProcs = roots.size()+1; dictNProcs = roots.size()+1;

View File

@ -317,15 +317,15 @@ public:
//- Return non-const access to the command options //- Return non-const access to the command options
inline HashTable<string>& options(); inline HashTable<string>& options();
//- Read a value from the argument at index. //- Get a value from the argument at index.
// Index 1 is the first non-option argument. // Index 1 is the first (non-option) argument.
template<class T> template<class T>
inline T read(const label index) const; inline T get(const label index) const;
//- Read a value from the argument at index. //- Read a value from the argument at index.
// Index 1 is the first non-option argument. // Index 1 is the first (non-option) argument.
template<class T> template<class T>
inline List<T> readList(const label index) const; inline List<T> getList(const label index) const;
//- Return true if the named option is found //- Return true if the named option is found
inline bool found(const word& optName) const; inline bool found(const word& optName) const;
@ -372,7 +372,7 @@ public:
//- Read a List of values from the named option, //- Read a List of values from the named option,
//- treating a single entry like a list of size 1. //- treating a single entry like a list of size 1.
template<class T> template<class T>
inline List<T> readList(const word& optName) const; inline List<T> getList(const word& optName) const;
//- If named option is present, read a List of values //- If named option is present, read a List of values
//- treating a single entry like a list of size 1. //- treating a single entry like a list of size 1.
@ -516,7 +516,7 @@ public:
//- The string corresponding to the argument index. //- The string corresponding to the argument index.
// Index 0 is the executable. // Index 0 is the executable.
// Index 1 is the first non-option argument. // Index 1 is the first (non-option) argument.
inline const string& operator[](const label index) const; inline const string& operator[](const label index) const;
//- The string associated with the named option //- The string associated with the named option
@ -528,12 +528,21 @@ public:
#ifdef Foam_argList_1712 #ifdef Foam_argList_1712
//- Read a value from the argument at index. //- Read a value from the argument at index.
// Index 1 is the first non-option argument. // Index 1 is the first (non-option) argument.
// \deprecated in favour of get() - AUG-2018
template<class T>
inline T read(const label index) const
{
return this->get<T>(index);
}
//- Read a value from the argument at index.
// Index 1 is the first (non-option) argument.
// \deprecated in favour of read() - JAN-2018 // \deprecated in favour of read() - JAN-2018
template<class T> template<class T>
inline T argRead(const label index) const inline T argRead(const label index) const
{ {
return this->read<T>(index); return this->get<T>(index);
} }
//- Return true if the named option is found //- Return true if the named option is found
@ -600,11 +609,11 @@ public:
} }
//- Read a List of values from the named option //- Read a List of values from the named option
// \deprecated in favour of readList() - JAN-2018 // \deprecated in favour of getList() - JAN-2018
template<class T> template<class T>
inline List<T> optionReadList(const word& optName) const inline List<T> optionReadList(const word& optName) const
{ {
return this->readList<T>(optName); return this->getList<T>(optName);
} }
#endif /* Foam_argList_1712 */ #endif /* Foam_argList_1712 */

View File

@ -133,22 +133,22 @@ inline Foam::ITstream Foam::argList::lookup(const word& optName) const
namespace Foam namespace Foam
{ {
template<> inline int32_t argList::read<int32_t>(const label index) const template<> inline int32_t argList::get<int32_t>(const label index) const
{ {
return Foam::readInt32(args_[index]); return Foam::readInt32(args_[index]);
} }
template<> inline int64_t argList::read<int64_t>(const label index) const template<> inline int64_t argList::get<int64_t>(const label index) const
{ {
return Foam::readInt64(args_[index]); return Foam::readInt64(args_[index]);
} }
template<> inline float argList::read<float>(const label index) const template<> inline float argList::get<float>(const label index) const
{ {
return Foam::readFloat(args_[index]); return Foam::readFloat(args_[index]);
} }
template<> inline double argList::read<double>(const label index) const template<> inline double argList::get<double>(const label index) const
{ {
return Foam::readDouble(args_[index]); return Foam::readDouble(args_[index]);
} }
@ -176,19 +176,19 @@ namespace Foam
template<> template<>
inline string argList::read<Foam::string>(const label index) const inline string argList::get<Foam::string>(const label index) const
{ {
return args_[index]; return args_[index];
} }
template<> template<>
inline word argList::read<Foam::word>(const label index) const inline word argList::get<Foam::word>(const label index) const
{ {
return args_[index]; return args_[index];
} }
template<> template<>
inline fileName argList::read<Foam::fileName>(const label index) const inline fileName argList::get<Foam::fileName>(const label index) const
{ {
return args_[index]; return args_[index];
} }
@ -217,7 +217,7 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T> template<class T>
inline T Foam::argList::read(const label index) const inline T Foam::argList::get(const label index) const
{ {
ITstream is(Foam::name(index), args_[index]); ITstream is(Foam::name(index), args_[index]);
@ -296,7 +296,7 @@ inline T Foam::argList::lookupOrDefault
template<class T> template<class T>
inline Foam::List<T> Foam::argList::readList(const label index) const inline Foam::List<T> Foam::argList::getList(const label index) const
{ {
ITstream is(Foam::name(index), args_[index]); ITstream is(Foam::name(index), args_[index]);
@ -310,7 +310,7 @@ inline Foam::List<T> Foam::argList::readList(const label index) const
template<class T> template<class T>
inline Foam::List<T> Foam::argList::readList(const word& optName) const inline Foam::List<T> Foam::argList::getList(const word& optName) const
{ {
ITstream is(optName, options_[optName]); ITstream is(optName, options_[optName]);