Commit 29a5793b authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: argList::opt method instead of the longer argList::lookupOrDefault

- also replaced a few instances of readIfPresent with opt<> for
  constant values.
parent f3819021
......@@ -38,10 +38,9 @@ if (args.found("initialiseUBCs"))
// Construct a pressure field
// If it is available read it otherwise construct from the velocity BCs
// converting fixed-value BCs to zero-gradient and vice versa.
word pName("p");
// Update name of the pressure field from the command-line option
args.readIfPresent("pName", pName);
// Allow override from command-line -pName option
const word pName = args.opt<word>("pName", "p");
// Infer the pressure BCs from the velocity
wordList pBCTypes
......
......@@ -38,10 +38,9 @@ if (args.found("initialiseUBCs"))
// Construct a pressure field
// If it is available read it otherwise construct from the velocity BCs
// converting fixed-value BCs to zero-gradient and vice versa.
word pName("p");
// Update name of the pressure field from the command-line option
args.readIfPresent("pName", pName);
// Allow override from command-line -pName option
const word pName = args.opt<word>("pName", "p");
// Infer the pressure BCs from the velocity
wordList pBCTypes
......
......@@ -119,8 +119,10 @@ volScalarField alphac
dimensionedScalar(dimless, Zero)
);
word kinematicCloudName("kinematicCloud");
args.readIfPresent("cloud", kinematicCloudName);
const word kinematicCloudName
(
args.opt<word>("cloud", "kinematicCloud")
);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
basicKinematicTypeCloud kinematicCloud
......
......@@ -57,8 +57,10 @@ volScalarField mu
laminarTransport.nu()*rhoInfValue
);
word kinematicCloudName("kinematicCloud");
args.readIfPresent("cloud", kinematicCloudName);
const word kinematicCloudName
(
args.opt<word>("cloud", "kinematicCloud")
);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
basicKinematicCollidingCloud kinematicCloud
......
......@@ -51,7 +51,7 @@ autoPtr<compressible::turbulenceModel> turbulence
const word kinematicCloudName
(
args.lookupOrDefault<word>("cloud", "kinematicCloud")
args.opt<word>("cloud", "kinematicCloud")
);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
......
......@@ -84,8 +84,7 @@ int main(int argc, char *argv[])
instantList times = timeSelector::selectIfPresent(runTime, args);
// Allow override of decomposeParDict location
fileName decompDictFile;
args.readIfPresent("decomposeParDict", decompDictFile);
const fileName decompDictFile = args.opt<fileName>("decomposeParDict", "");
wordList regionNames;
wordList regionDirs;
......
......@@ -98,8 +98,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.opt<label>("domains", 0);
const word methodName = args.opt<word>("method", word::null);
// Set time from database
#include "createTime.H"
......@@ -107,8 +107,7 @@ int main(int argc, char *argv[])
instantList times = timeSelector::selectIfPresent(runTime, args);
// Allow override of decomposeParDict location
fileName decompDictFile;
args.readIfPresent("decomposeParDict", decompDictFile);
const fileName decompDictFile = args.opt<fileName>("decomposeParDict", "");
// Get all region names
wordList regionNames;
......@@ -122,8 +121,7 @@ int main(int argc, char *argv[])
else
{
regionNames.resize(1);
regionNames.first() =
args.lookupOrDefault<word>("region", fvMesh::defaultRegion);
regionNames.first() = args.opt<word>("region", fvMesh::defaultRegion);
}
forAll(regionNames, regioni)
......
......@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
const label maxCount = args.lookupOrDefault<label>("max", 1000);
const label maxCount = args.opt<label>("max", 1000);
externalFileCoupler coupler;
......
......@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
}
{
const label celli = args.lookupOrDefault<label>("cell", 0);
const label celli = args.opt<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");
const label nSeg = args.lookupOrDefault<label>("n", 20);
const label nSeg = args.opt<label>("n", 20);
if (!useCatmullRom && !useBSpline)
{
......
......@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", -1);
const scalar scaleFactor = args.opt<scalar>("scale", -1);
const word outputFile(args.executable() + ".obj");
......
......@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
const bool optStdout = args.found("stdout");
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 0);
const scalar scaleFactor = args.opt<scalar>("scale", 0);
const fileName importName = args[1];
const fileName exportName = optStdout ? "-stdout" : args[2];
......
......@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
argList args(argc, argv, false, true);
const label repeat = args.lookupOrDefault<label>("repeat", 1);
const label repeat = args.opt<label>("repeat", 1);
const bool optVerbose = args.found("verbose");
......
......@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
argList args(argc, argv, false, true);
const scalar currTime = args.lookupOrDefault<scalar>("time", GREAT);
const scalar currTime = args.opt<scalar>("time", GREAT);
Info<< "Using currTime = " << currTime << nl
<< "when loading " << (args.size()-1) << " files" << nl << nl;
......
......@@ -130,7 +130,6 @@ int main(int argc, char *argv[])
}
labelIOList pointPriority
(
IOobject
......
......@@ -380,8 +380,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.lookupOrDefault<scalar>("concaveAngle", 30);
const scalar concaveAngle = args.opt<scalar>("concaveAngle", 30);
const scalar concaveSin = Foam::sin(degToRad(concaveAngle));
......
......@@ -566,7 +566,7 @@ int main(int argc, char *argv[])
const bool geometry = args.found("geometry");
const bool overwrite = args.found("overwrite");
const scalar edgeTol = args.lookupOrDefault<scalar>("tol", 0.2);
const scalar edgeTol = args.opt<scalar>("tol", 0.2);
Info<< "Trying to split cells with internal angles > feature angle\n" << nl
<< "featureAngle : " << featureAngle << nl
......
......@@ -320,7 +320,7 @@ int main(int argc, char *argv[])
FatalError.exit();
}
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
const scalar scaleFactor = args.opt<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<scalar>("scale", 1);
const scalar scaleFactor = args.opt<scalar>("scale", 1);
// Default to binary output, unless otherwise specified
const IOstream::streamFormat format =
......
......@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
FatalError.exit();
}
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", 1);
const scalar scaleFactor = args.opt<scalar>("scale", 1);
#include "createTime.H"
......
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