mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: argList::opt method instead of the longer argList::lookupOrDefault
- also replaced a few instances of readIfPresent with opt<> for constant values.
This commit is contained in:
@ -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"
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
args[1],
|
||||
// Default no scaling
|
||||
args.lookupOrDefault<scalar>("scale", 1)
|
||||
args.opt<scalar>("scale", 1)
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -902,7 +902,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);
|
||||
|
||||
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<scalar>("scale", 1000);
|
||||
const scalar scaleFactor = args.opt<scalar>("scale", 1000);
|
||||
const bool writeBndFile = !args.found("noBnd");
|
||||
|
||||
#include "createPolyMesh.H"
|
||||
|
||||
@ -81,8 +81,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
fileName exportName = args[1];
|
||||
|
||||
scalar scaleFactor = 0;
|
||||
args.readIfPresent<scalar>("scale", scaleFactor);
|
||||
const scalar scaleFactor = args.opt<scalar>("scale", 0);
|
||||
const bool doTriangulate = args.found("tri");
|
||||
|
||||
fileName exportBase = exportName.lessExt();
|
||||
|
||||
@ -646,7 +646,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"
|
||||
|
||||
|
||||
@ -784,16 +784,11 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
Foam::word regionName;
|
||||
word regionName = polyMesh::defaultRegion;
|
||||
|
||||
if (args.readIfPresent("region", regionName))
|
||||
{
|
||||
Foam::Info
|
||||
<< "Creating polyMesh for region " << regionName << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
regionName = Foam::polyMesh::defaultRegion;
|
||||
Info<< "Creating polyMesh for region " << regionName << endl;
|
||||
}
|
||||
|
||||
const bool keepOrientation = args.found("keepOrientation");
|
||||
|
||||
@ -85,8 +85,7 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
const fileName kivaFileName =
|
||||
args.lookupOrDefault<fileName>("file", "otape17");
|
||||
const fileName kivaFileName = args.opt<fileName>("file", "otape17");
|
||||
|
||||
kivaVersions kivaVersion = kiva3v;
|
||||
if (args.found("version"))
|
||||
@ -112,8 +111,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
scalar zHeadMin = -GREAT;
|
||||
args.readIfPresent("zHeadMin", zHeadMin);
|
||||
const scalar zHeadMin = args.opt<scalar>("zHeadMin", -GREAT);
|
||||
|
||||
#include "readKivaGrid.H"
|
||||
|
||||
|
||||
@ -94,7 +94,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);
|
||||
|
||||
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<scalar>("scale", 0.001),
|
||||
args.opt<scalar>("scale", 0.001),
|
||||
args.found("solids")
|
||||
);
|
||||
|
||||
|
||||
@ -139,11 +139,11 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
word regionName;
|
||||
word regionName = polyMesh::defaultRegion;
|
||||
word regionPath;
|
||||
|
||||
// Check if the region is specified otherwise mesh the default region
|
||||
if (args.readIfPresent("region", regionName, polyMesh::defaultRegion))
|
||||
if (args.readIfPresent("region", regionName))
|
||||
{
|
||||
Info<< nl << "Generating mesh for region " << regionName << endl;
|
||||
regionPath = regionName;
|
||||
|
||||
@ -70,8 +70,8 @@ int main(int argc, char *argv[])
|
||||
const bool conformationOnly = args.found("conformationOnly");
|
||||
|
||||
// Allow override of decomposeParDict location
|
||||
fileName decompDictFile;
|
||||
args.readIfPresent("decomposeParDict", decompDictFile);
|
||||
const fileName decompDictFile =
|
||||
args.opt<fileName>("decomposeParDict", "");
|
||||
|
||||
IOdictionary foamyHexMeshDict
|
||||
(
|
||||
|
||||
@ -61,8 +61,7 @@ scalar getMergeDistance
|
||||
const boundBox& bb
|
||||
)
|
||||
{
|
||||
scalar mergeTol = defaultMergeTol;
|
||||
args.readIfPresent("mergeTol", mergeTol);
|
||||
const scalar mergeTol = args.opt<scalar>("mergeTol", defaultMergeTol);
|
||||
|
||||
scalar writeTol =
|
||||
Foam::pow(scalar(10), -scalar(IOstream::defaultPrecision()));
|
||||
@ -519,8 +518,8 @@ int main(int argc, char *argv[])
|
||||
printMeshData(mesh);
|
||||
|
||||
// Allow override of decomposeParDict location
|
||||
fileName decompDictFile;
|
||||
args.readIfPresent("decomposeParDict", decompDictFile);
|
||||
const fileName decompDictFile =
|
||||
args.opt<fileName>("decomposeParDict", "");
|
||||
|
||||
labelList decomp = decompositionModel::New
|
||||
(
|
||||
|
||||
@ -823,7 +823,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
args.lookupOrDefault<fileName>("decomposeParDict", "")
|
||||
args.opt<fileName>("decomposeParDict", "")
|
||||
)
|
||||
);
|
||||
|
||||
@ -1700,7 +1700,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
fileName outFileName
|
||||
(
|
||||
args.lookupOrDefault<fileName>
|
||||
args.opt<fileName>
|
||||
(
|
||||
"outFile",
|
||||
"constant/triSurface/simplifiedSurface.stl"
|
||||
|
||||
@ -136,8 +136,9 @@ int main(int argc, char *argv[])
|
||||
const bool allTopology = args.found("allTopology");
|
||||
const bool meshQuality = args.found("meshQuality");
|
||||
|
||||
word surfaceFormat;
|
||||
const bool writeSets = args.readIfPresent("writeSets", surfaceFormat);
|
||||
const word surfaceFormat = args.opt<word>("writeSets", "");
|
||||
const bool writeSets = surfaceFormat.size();
|
||||
|
||||
wordHashSet selectedFields;
|
||||
bool writeFields = args.readIfPresent
|
||||
(
|
||||
|
||||
@ -531,7 +531,7 @@ int main(int argc, char *argv[])
|
||||
#include "createTime.H"
|
||||
|
||||
const word meshRegionName =
|
||||
args.lookupOrDefault<word>("region", polyMesh::defaultRegion);
|
||||
args.opt<word>("region", polyMesh::defaultRegion);
|
||||
|
||||
const bool overwrite = args.found("overwrite");
|
||||
|
||||
|
||||
@ -103,18 +103,10 @@ int main(int argc, char *argv[])
|
||||
fileName addCase = args[2];
|
||||
|
||||
const word masterRegion =
|
||||
args.lookupOrDefault<word>
|
||||
(
|
||||
"masterRegion",
|
||||
polyMesh::defaultRegion
|
||||
);
|
||||
args.opt<word>("masterRegion", polyMesh::defaultRegion);
|
||||
|
||||
const word addRegion =
|
||||
args.lookupOrDefault<word>
|
||||
(
|
||||
"addRegion",
|
||||
polyMesh::defaultRegion
|
||||
);
|
||||
args.opt<word>("addRegion", polyMesh::defaultRegion);
|
||||
|
||||
// Since we don't use argList processor directory detection, add it to
|
||||
// the casename ourselves so it triggers the logic inside TimePath.
|
||||
|
||||
@ -199,7 +199,7 @@ int main(int argc, char *argv[])
|
||||
const word dictName("refineMeshDict");
|
||||
|
||||
// Obtain dictPath here for messages
|
||||
fileName dictPath = args.lookupOrDefault<fileName>("dict", "");
|
||||
fileName dictPath = args.opt<fileName>("dict", "");
|
||||
|
||||
IOobject dictIO = IOobject::selectIO
|
||||
(
|
||||
|
||||
@ -327,8 +327,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Allow override of decomposeParDict location
|
||||
fileName decompDictFile;
|
||||
args.readIfPresent("decomposeParDict", decompDictFile);
|
||||
const fileName decompDictFile = args.opt<fileName>("decomposeParDict", "");
|
||||
|
||||
// Get all region names
|
||||
wordList regionNames;
|
||||
@ -342,8 +341,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)
|
||||
|
||||
@ -506,8 +506,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Operating on region " << regionName << nl << endl;
|
||||
}
|
||||
|
||||
scalar mergeTol = defaultMergeTol;
|
||||
args.readIfPresent("mergeTol", mergeTol);
|
||||
const scalar mergeTol = args.opt<scalar>("mergeTol", defaultMergeTol);
|
||||
|
||||
scalar writeTol = Foam::pow(10.0, -scalar(IOstream::defaultPrecision()));
|
||||
|
||||
|
||||
@ -114,8 +114,7 @@ scalar getMergeDistance
|
||||
const boundBox& bb
|
||||
)
|
||||
{
|
||||
scalar mergeTol = defaultMergeTol;
|
||||
args.readIfPresent("mergeTol", mergeTol);
|
||||
const scalar mergeTol = args.opt<scalar>("mergeTol", defaultMergeTol);
|
||||
|
||||
const scalar writeTol =
|
||||
Foam::pow(scalar(10), -scalar(IOstream::defaultPrecision()));
|
||||
@ -136,7 +135,7 @@ scalar getMergeDistance
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
scalar mergeDist = mergeTol * bb.mag();
|
||||
const scalar mergeDist = mergeTol * bb.mag();
|
||||
|
||||
Info<< "Overall meshes bounding box : " << bb << nl
|
||||
<< "Relative tolerance : " << mergeTol << nl
|
||||
@ -2497,8 +2496,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Allow override of decomposeParDict location
|
||||
fileName decompDictFile;
|
||||
args.readIfPresent("decomposeParDict", decompDictFile);
|
||||
const fileName decompDictFile = args.opt<fileName>("decomposeParDict", "");
|
||||
|
||||
// Get all region names
|
||||
wordList regionNames;
|
||||
@ -2512,8 +2510,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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -237,7 +237,7 @@ int main(int argc, char *argv[])
|
||||
ensightCase::options caseOpts(format);
|
||||
|
||||
caseOpts.nodeValues(args.found("nodeValues"));
|
||||
caseOpts.width(args.lookupOrDefault<label>("width", 8));
|
||||
caseOpts.width(args.opt<label>("width", 8));
|
||||
caseOpts.overwrite(true); // remove existing output directory
|
||||
|
||||
// Can also have separate directory for lagrangian
|
||||
@ -247,7 +247,7 @@ int main(int argc, char *argv[])
|
||||
// Define sub-directory name to use for EnSight data.
|
||||
// The path to the ensight directory is at case level only
|
||||
// - For parallel cases, data only written from master
|
||||
fileName outputDir = args.lookupOrDefault<word>("name", "EnSight");
|
||||
fileName outputDir = args.opt<word>("name", "EnSight");
|
||||
if (!outputDir.isAbsolute())
|
||||
{
|
||||
outputDir = args.globalPath()/outputDir;
|
||||
|
||||
@ -203,7 +203,7 @@ int main(int argc, char *argv[])
|
||||
//
|
||||
ensightCase::options caseOpts(format);
|
||||
|
||||
caseOpts.width(args.lookupOrDefault<label>("width", 8));
|
||||
caseOpts.width(args.opt<label>("width", 8));
|
||||
caseOpts.overwrite(false); // leave existing output directory
|
||||
|
||||
// Can also have separate directory for lagrangian
|
||||
@ -212,7 +212,7 @@ int main(int argc, char *argv[])
|
||||
// Define sub-directory name to use for EnSight data.
|
||||
// The path to the ensight directory is at case level only
|
||||
// - For parallel cases, data only written from master
|
||||
fileName ensightDir = args.lookupOrDefault<word>("name", "Ensight");
|
||||
fileName ensightDir = args.opt<word>("name", "Ensight");
|
||||
if (!ensightDir.isAbsolute())
|
||||
{
|
||||
ensightDir = args.globalPath()/ensightDir;
|
||||
|
||||
@ -564,8 +564,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);
|
||||
}
|
||||
|
||||
|
||||
@ -627,7 +626,7 @@ int main(int argc, char *argv[])
|
||||
// Directory management
|
||||
|
||||
// Sub-directory for output
|
||||
const word vtkDirName = args.lookupOrDefault<word>("name", "VTK");
|
||||
const word vtkDirName = args.opt<word>("name", "VTK");
|
||||
|
||||
const fileName outputDir(runTime.globalPath()/vtkDirName);
|
||||
|
||||
|
||||
@ -91,10 +91,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const label maxOut = Foam::max(0, args.lookupOrDefault<label>("max", 0));
|
||||
const label span = Foam::max(1, args.lookupOrDefault<label>("span", 1));
|
||||
const label maxOut = Foam::max(0, args.opt<label>("max", 0));
|
||||
const label span = Foam::max(1, args.opt<label>("span", 1));
|
||||
|
||||
const scalar relax = args.lookupOrDefault<scalar>("scale", 1);
|
||||
const scalar relax = args.opt<scalar>("scale", 1);
|
||||
|
||||
const bool slave = args.found("slave");
|
||||
const bool removeLock = args.found("removeLock");
|
||||
|
||||
@ -234,16 +234,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
int divisions = 1;
|
||||
args.readIfPresent("divisions", divisions);
|
||||
const int divisions = args.opt<int>("divisions", 1);
|
||||
Info<< "Using " << divisions << " per time interval" << nl << endl;
|
||||
|
||||
|
||||
const word interpolationType = args.lookupOrDefault<word>
|
||||
(
|
||||
"interpolationType",
|
||||
"linear"
|
||||
);
|
||||
const word interpolationType =
|
||||
args.opt<word>("interpolationType", "linear");
|
||||
|
||||
Info<< "Using interpolation " << interpolationType << nl << endl;
|
||||
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ int main(int argc, char *argv[])
|
||||
#include "createTime.H"
|
||||
|
||||
wordList regionNames(1, fvMesh::defaultRegion);
|
||||
if (!args.readIfPresent("region", regionNames[0]))
|
||||
if (!args.readIfPresent("region", regionNames.first()))
|
||||
{
|
||||
args.readIfPresent("regions", regionNames);
|
||||
}
|
||||
|
||||
@ -431,11 +431,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
const bool enableEntries = args.found("enableFunctionEntries");
|
||||
|
||||
const word regionName = args.opt<word>("region", polyMesh::defaultRegion);
|
||||
|
||||
Foam::word regionName = polyMesh::defaultRegion;
|
||||
args.readIfPresent("region", regionName);
|
||||
|
||||
fileName regionPrefix = "";
|
||||
fileName regionPrefix;
|
||||
if (regionName != polyMesh::defaultRegion)
|
||||
{
|
||||
regionPrefix = regionName;
|
||||
|
||||
@ -66,7 +66,7 @@ int readNumProcs
|
||||
IOobject::NO_WRITE,
|
||||
false // do not register
|
||||
),
|
||||
args.lookupOrDefault<fileName>(optionName, "")
|
||||
args.opt<fileName>(optionName, "")
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@ -87,7 +87,7 @@ int main(int argc, char *argv[])
|
||||
const bool addPoint = args.found("points");
|
||||
const bool mergeRegions = args.found("mergeRegions");
|
||||
|
||||
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaleFactor = args.opt<scalar>("scale", -1);
|
||||
|
||||
if (addPoint)
|
||||
{
|
||||
|
||||
@ -1593,7 +1593,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Scale factor for both surfaces:
|
||||
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaleFactor = args.opt<scalar>("scale", -1);
|
||||
|
||||
const word surf1Name(args[2]);
|
||||
Info<< "Reading surface " << surf1Name << endl;
|
||||
|
||||
@ -366,9 +366,9 @@ int main(int argc, char *argv[])
|
||||
const fileName surfFileName = args[1];
|
||||
const bool checkSelfIntersect = args.found("checkSelfIntersection");
|
||||
const bool splitNonManifold = args.found("splitNonManifold");
|
||||
const label outputThreshold = args.lookupOrDefault("outputThreshold", 10);
|
||||
word surfaceFormat;
|
||||
const bool writeSets = args.readIfPresent("writeSets", surfaceFormat);
|
||||
const label outputThreshold = args.opt<label>("outputThreshold", 10);
|
||||
const word surfaceFormat = args.opt<word>("writeSets", "");
|
||||
const bool writeSets = !surfaceFormat.empty();
|
||||
|
||||
autoPtr<surfaceWriter> surfWriter;
|
||||
word edgeFormat;
|
||||
|
||||
@ -94,7 +94,7 @@ int main(int argc, char *argv[])
|
||||
triSurface surf
|
||||
(
|
||||
inFileName,
|
||||
args.lookupOrDefault<scalar>("scale", -1)
|
||||
args.opt<scalar>("scale", -1)
|
||||
);
|
||||
surf.writeStats(Info);
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaleFactor = args.opt<scalar>("scale", -1);
|
||||
|
||||
Info<< "Input surface :" << inFileName << nl
|
||||
<< "Scaling factor :" << scaleFactor << nl
|
||||
|
||||
@ -125,7 +125,7 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaleFactor = args.opt<scalar>("scale", -1);
|
||||
|
||||
Info<< "Reading : " << importName << endl;
|
||||
triSurface surf(importName, scaleFactor);
|
||||
|
||||
@ -61,9 +61,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
const point samplePt
|
||||
(
|
||||
args.lookupOrDefault<scalar>("x", 0),
|
||||
args.lookupOrDefault<scalar>("y", 0),
|
||||
args.lookupOrDefault<scalar>("z", 0)
|
||||
args.opt<scalar>("x", 0),
|
||||
args.opt<scalar>("y", 0),
|
||||
args.opt<scalar>("z", 0)
|
||||
);
|
||||
Info<< "Looking for nearest face/vertex to " << samplePt << endl;
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ int main(int argc, char *argv[])
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName surfFileName = args[1];
|
||||
const scalar density = args.lookupOrDefault<scalar>("density", 1);
|
||||
const scalar density = args.opt<scalar>("density", 1);
|
||||
|
||||
vector refPt = Zero;
|
||||
bool calcAroundRefPt = args.readIfPresent("referencePoint", refPt);
|
||||
|
||||
@ -610,12 +610,8 @@ int main(int argc, char *argv[])
|
||||
const scalar distance(args.get<scalar>(2));
|
||||
const scalar extendFactor(args.get<scalar>(3));
|
||||
const bool checkSelfIntersect = args.found("checkSelfIntersection");
|
||||
const label nSmooth = args.lookupOrDefault("nSmooth", 10);
|
||||
const scalar featureAngle = args.lookupOrDefault<scalar>
|
||||
(
|
||||
"featureAngle",
|
||||
180
|
||||
);
|
||||
const label nSmooth = args.opt<label>("nSmooth", 10);
|
||||
const scalar featureAngle = args.opt<scalar>("featureAngle", 180);
|
||||
const bool debug = args.found("debug");
|
||||
|
||||
|
||||
|
||||
@ -164,7 +164,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
args.lookupOrDefault<fileName>("dict", "")
|
||||
args.opt<fileName>("dict", "")
|
||||
);
|
||||
|
||||
if (!ioCsys.typeHeaderOk<coordinateSystems>(false))
|
||||
|
||||
@ -127,7 +127,7 @@ int main(int argc, char *argv[])
|
||||
Time runTime(args.rootPath(), args.caseName());
|
||||
|
||||
const fileName exportName = args[1];
|
||||
const word importName = args.lookupOrDefault<word>("name", "default");
|
||||
const word importName = args.opt<word>("name", "default");
|
||||
|
||||
// check that writing is supported
|
||||
if (!MeshedSurface<face>::canWriteType(exportName.ext(), true))
|
||||
@ -153,7 +153,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
args.lookupOrDefault<fileName>("dict", "")
|
||||
args.opt<fileName>("dict", "")
|
||||
);
|
||||
|
||||
if (!ioCsys.typeHeaderOk<coordinateSystems>(false))
|
||||
|
||||
@ -140,7 +140,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
const fileName importName = args[1];
|
||||
const word exportName = args.lookupOrDefault<word>("name", "default");
|
||||
const word exportName = args.opt<word>("name", "default");
|
||||
|
||||
// check that reading is supported
|
||||
if (!MeshedSurface<face>::canRead(importName, true))
|
||||
@ -166,7 +166,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
args.lookupOrDefault<fileName>("dict", "")
|
||||
args.opt<fileName>("dict", "")
|
||||
);
|
||||
|
||||
if (!ioCsys.typeHeaderOk<coordinateSystems>(false))
|
||||
|
||||
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
||||
// use UnsortedMeshedSurface, not MeshedSurface to maintain ordering
|
||||
UnsortedMeshedSurface<face> surf(importName);
|
||||
|
||||
const scalar scaling = args.lookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaling = args.opt<scalar>("scale", -1);
|
||||
if (scaling > 0)
|
||||
{
|
||||
DetailInfo << " -scale " << scaling << nl;
|
||||
|
||||
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "outside" << endl;
|
||||
}
|
||||
|
||||
const scalar scaling = args.lookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaling = args.opt<scalar>("scale", -1);
|
||||
if (scaling > 0)
|
||||
{
|
||||
Info<< "Input scaling: " << scaling << nl;
|
||||
|
||||
@ -68,7 +68,7 @@ int main(int argc, char *argv[])
|
||||
const scalar mergeTol = args.get<scalar>(2);
|
||||
const fileName outFileName = args[3];
|
||||
|
||||
const scalar scaling = args.lookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaling = args.opt<scalar>("scale", -1);
|
||||
|
||||
Info<< "Reading surface from " << surfFileName << " ..." << nl
|
||||
<< "Merging points within " << mergeTol << " metre." << nl;
|
||||
|
||||
@ -174,7 +174,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
args.lookupOrDefault<fileName>("decomposeParDict", "")
|
||||
args.opt<fileName>("decomposeParDict", "")
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -211,7 +211,7 @@ int main(int argc, char *argv[])
|
||||
<< " triangle ..." << endl;
|
||||
}
|
||||
|
||||
const scalar searchTol = args.lookupOrDefault("tol", 1e-3);
|
||||
const scalar searchTol = args.opt<scalar>("tol", 1e-3);
|
||||
|
||||
// Get search box. Anything not within this box will not be considered.
|
||||
const boundBox& meshBb = mesh.bounds();
|
||||
|
||||
@ -385,8 +385,7 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
|
||||
|
||||
dictionary& functionsDict = controlDict.subDict("functions");
|
||||
|
||||
word region;
|
||||
args.readIfPresent("region", region);
|
||||
const word regionName = args.opt<word>("region", "");
|
||||
|
||||
bool modifiedControlDict = false;
|
||||
|
||||
@ -417,7 +416,7 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
|
||||
args["func"],
|
||||
functionsDict,
|
||||
requiredFields,
|
||||
region
|
||||
regionName
|
||||
);
|
||||
}
|
||||
|
||||
@ -434,7 +433,7 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
|
||||
funcName,
|
||||
functionsDict,
|
||||
requiredFields,
|
||||
region
|
||||
regionName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,5 +8,5 @@ IOobject dictIO = IOobject::selectIO
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
args.lookupOrDefault<fileName>("dict", "")
|
||||
args.opt<fileName>("dict", "")
|
||||
);
|
||||
|
||||
@ -8,5 +8,5 @@ IOobject dictIO = IOobject::selectIO
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
args.lookupOrDefault<fileName>("dict", "")
|
||||
args.opt<fileName>("dict", "")
|
||||
);
|
||||
|
||||
@ -8,5 +8,5 @@ IOobject dictIO = IOobject::selectIO
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
args.lookupOrDefault<fileName>("dict", "")
|
||||
args.opt<fileName>("dict", "")
|
||||
);
|
||||
|
||||
@ -8,5 +8,5 @@ IOobject dictIO = IOobject::selectIO
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
args.lookupOrDefault<fileName>("dict", "")
|
||||
args.opt<fileName>("dict", "")
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user