Commit ae36f5f5 authored by Mark Olesen's avatar Mark Olesen
Browse files

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.
parent b5162f91
......@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
labelList patchIDs
(
pbm.patchSet(args.readList<wordRe>(1)).sortedToc()
pbm.patchSet(args.getList<wordRe>(1)).sortedToc()
);
Info<< "Starting walk from patches "
......
......@@ -108,7 +108,9 @@ int main(int argc, char *argv[])
if (args.found("label"))
{
Info<< "-label = " << args.opt<label>("label")
#ifdef Foam_argList_1712
<< " or " << args.optionRead<label>("label") // old-compat
#endif
<< " or " << readLabel(args["label"]) // with function
<< nl;
}
......@@ -116,7 +118,9 @@ int main(int argc, char *argv[])
if (args.found("scalar"))
{
Info<< "-scalar = " << args.opt<scalar>("scalar")
#ifdef Foam_argList_1712
<< " or " << args.optionRead<scalar>("scalar") // old-compat
#endif
<< " or " << readScalar(args["scalar"]) // with function
<< nl;
}
......@@ -124,7 +128,9 @@ int main(int argc, char *argv[])
if (args.found("string"))
{
Info<< "-string = " << args.opt("string")
#ifdef Foam_argList_1712
<< " or " << args.optionRead<scalar>("string") // old-compat
#endif
<< nl;
}
......@@ -133,8 +139,11 @@ int main(int argc, char *argv[])
Info<< nl;
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
#endif
<< nl;
}
......
......@@ -109,12 +109,8 @@ int main(int argc, char *argv[])
const bool allRegions = args.found("allRegions");
const bool verbose = args.found("verbose");
const label numSubdomains =
args.lookupOrDefault<label>("domains", 0);
const word methodName =
args.lookupOrDefault<word>("method", word::null);
const label numSubdomains = args.lookupOrDefault<label>("domains", 0);
const word methodName = args.lookupOrDefault<word>("method", word::null);
// Set time from database
#include "createTime.H"
......
......@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
label nReps = 10000;
const point sample = args.read<point>(1);
const point sample = args.get<point>(1);
const polyMesh::cellDecomposition decompMode = polyMesh::CELL_TETS;
......
......@@ -101,8 +101,8 @@ int main(int argc, char *argv[])
}
{
label start = args.read<label>(argI);
label size = args.read<label>(argI+1);
label start = args.get<label>(argI);
label size = args.get<label>(argI+1);
++argI;
range.reset(start, size);
......
......@@ -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));
......
......@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
bool useBSpline = args.found("B");
bool useCatmullRom = args.found("CMR");
label nSeg = args.lookupOrDefault<label>("n", 20);
const label nSeg = args.lookupOrDefault<label>("n", 20);
if (!useCatmullRom && !useBSpline)
{
......
......@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
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 exportName = optStdout ? "-stdout" : args[2];
......
......@@ -366,13 +366,15 @@ int main(int argc, char *argv[])
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));
// Sin of angle between two consecutive edges on a face.
// If sin(angle) larger than this the face will be considered concave.
scalar concaveAngle = args.lookupOrDefault("concaveAngle", 30.0);
scalar concaveSin = Foam::sin(degToRad(concaveAngle));
const scalar concaveAngle =
args.lookupOrDefault<scalar>("concaveAngle", 30);
const scalar concaveSin = Foam::sin(degToRad(concaveAngle));
const bool overwrite = args.found("overwrite");
const bool meshQuality = args.found("meshQuality");
......
......@@ -81,8 +81,8 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
// Find set of patches from the list of regular expressions provided
const wordRes patches(args.readList<wordRe>(1));
const scalar weight = args.read<scalar>(2);
const wordRes patches(args.getList<wordRe>(1));
const scalar weight = args.get<scalar>(2);
const bool overwrite = args.found("overwrite");
const labelHashSet patchSet(mesh.boundaryMesh().patchSet(patches));
......
......@@ -556,7 +556,7 @@ int main(int argc, char *argv[])
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 minSin = Foam::sin(degToRad(featureAngle));
......@@ -564,7 +564,7 @@ int main(int argc, char *argv[])
const bool geometry = args.found("geometry");
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
<< "featureAngle : " << featureAngle << nl
......
......@@ -314,7 +314,7 @@ int main(int argc, char *argv[])
FatalError.exit();
}
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0);
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
#include "createTime.H"
......
......@@ -186,7 +186,7 @@ int main(int argc, char *argv[])
}
// 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
const IOstream::streamFormat format =
......
......@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
FatalError.exit();
}
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0);
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
#include "createTime.H"
......
......@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
(
args[1],
// Default no scaling
args.lookupOrDefault("scale", 1.0)
args.lookupOrDefault<scalar>("scale", 1)
);
......
......@@ -897,7 +897,7 @@ int main(int argc, char *argv[])
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 writeZones = args.found("writeZones");
......
......@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
}
// 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");
#include "createPolyMesh.H"
......
......@@ -641,7 +641,7 @@ int main(int argc, char *argv[])
FatalError.exit();
}
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0);
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
#include "createTime.H"
......
......@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
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 singleBlock = args.found("singleBlock");
......
......@@ -113,7 +113,7 @@ int main(int argc, char *argv[])
prefix,
runTime,
// Default rescale from [mm] to [m]
args.lookupOrDefault("scale", 0.001),
args.lookupOrDefault<scalar>("scale", 0.001),
args.found("solids")
);
......
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