ENH: simplify method names for reading argList options and arguments

- use succincter method names that more closely resemble dictionary
  and HashTable method names. This improves method name consistency
  between classes and also requires less typing effort:

    args.found(optName)        vs.  args.optionFound(optName)
    args.readIfPresent(..)     vs.  args.optionReadIfPresent(..)
    ...
    args.opt<scalar>(optName)  vs.  args.optionRead<scalar>(optName)
    args.read<scalar>(index)   vs.  args.argRead<scalar>(index)

- the older method names forms have been retained for code compatibility,
  but are now deprecated
This commit is contained in:
Mark Olesen
2018-01-08 15:35:18 +01:00
parent 2feb11dbeb
commit 345a2a42f1
168 changed files with 1161 additions and 1040 deletions

View File

@ -691,7 +691,7 @@ int main(int argc, char *argv[])
Info<< "Reading blocked cells from cellSet " << blockedSetName
<< endl;
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
// Read faceSets, lookup patches

View File

@ -102,10 +102,10 @@ int main(int argc, char *argv[])
IOdictionary collapseDict(dictIO);
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
const bool collapseFaces = args.optionFound("collapseFaces");
const bool collapseFaceSet = args.optionFound("collapseFaceSet");
const bool collapseFaces = args.found("collapseFaces");
const bool collapseFaceSet = args.found("collapseFaceSet");
if (collapseFaces && collapseFaceSet)
{
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
word faceSetName("indirectPatchFaces");
IOobject::readOption readFlag = IOobject::READ_IF_PRESENT;
if (args.optionReadIfPresent("collapseFaceSet", faceSetName))
if (args.readIfPresent("collapseFaceSet", faceSetName))
{
readFlag = IOobject::MUST_READ;
}

View File

@ -368,16 +368,16 @@ int main(int argc, char *argv[])
#include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
const scalar featureAngle = args.argRead<scalar>(1);
const scalar featureAngle = args.read<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.optionLookupOrDefault("concaveAngle", 30.0);
scalar concaveAngle = args.lookupOrDefault("concaveAngle", 30.0);
scalar concaveSin = Foam::sin(degToRad(concaveAngle));
const bool overwrite = args.optionFound("overwrite");
const bool meshQuality = args.optionFound("meshQuality");
const bool overwrite = args.found("overwrite");
const bool meshQuality = args.found("meshQuality");
Info<< "Merging all faces of a cell" << nl
<< " - which are on the same patch" << nl

View File

@ -345,7 +345,7 @@ int main(int argc, char *argv[])
#include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
Info<< "Reading modifyMeshDict\n" << endl;

View File

@ -73,9 +73,9 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
word cellSetName(args[1]);
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
const bool minSet = args.optionFound("minSet");
const bool minSet = args.found("minSet");
Info<< "Reading cells to refine from cellSet " << cellSetName
<< nl << endl;

View File

@ -84,8 +84,8 @@ int main(int argc, char *argv[])
const wordReList patches((IStringStream(args[1])()));
const labelHashSet patchSet(mesh.boundaryMesh().patchSet(patches));
const scalar weight = args.argRead<scalar>(2);
const bool overwrite = args.optionFound("overwrite");
const scalar weight = args.read<scalar>(2);
const bool overwrite = args.found("overwrite");
if (!patchSet.size())
{
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
// Edit list of cells to refine according to specified set
word setName;
if (args.optionReadIfPresent("useSet", setName))
if (args.readIfPresent("useSet", setName))
{
Info<< "Subsetting cells to cut based on cellSet"
<< setName << nl << endl;

View File

@ -118,7 +118,7 @@ int main(int argc, char *argv[])
<< " to allow for some truncation error."
<< nl << endl;
const bool readLevel = args.optionFound("readLevel");
const bool readLevel = args.found("readLevel");
const scalarField& vols = mesh.cellVolumes();

View File

@ -63,7 +63,7 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
const word setName = args[1];
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
// Read faces
faceSet candidateSet(mesh, setName);

View File

@ -553,15 +553,15 @@ int main(int argc, char *argv[])
#include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
const scalar featureAngle = args.argRead<scalar>(1);
const scalar featureAngle = args.read<scalar>(1);
const scalar minCos = Foam::cos(degToRad(featureAngle));
const scalar minSin = Foam::sin(degToRad(featureAngle));
const bool readSet = args.optionFound("set");
const bool geometry = args.optionFound("geometry");
const bool overwrite = args.optionFound("overwrite");
const bool readSet = args.found("set");
const bool geometry = args.found("geometry");
const bool overwrite = args.found("overwrite");
const scalar edgeTol = args.optionLookupOrDefault("tol", 0.2);
const scalar edgeTol = args.lookupOrDefault("tol", 0.2);
Info<< "Trying to split cells with internal angles > feature angle\n" << nl
<< "featureAngle : " << featureAngle << nl

View File

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

View File

@ -160,11 +160,11 @@ int main(int argc, char *argv[])
Time runTime(args.rootPath(), args.caseName());
runTime.functionObjects().off();
const bool optList = args.optionFound("list");
const bool optList = args.found("list");
// exportName only has a size when export is in effect
fileName exportName;
if (args.optionReadIfPresent("name", exportName))
if (args.readIfPresent("name", exportName))
{
const word ext = exportName.ext();
// strip erroneous extension (.ccm, .ccmg, .ccmp)
@ -173,22 +173,22 @@ int main(int argc, char *argv[])
exportName = exportName.lessExt();
}
}
else if (args.optionFound("export"))
else if (args.found("export"))
{
exportName = ccm::writer::defaultMeshName;
if (args.optionFound("case"))
if (args.found("case"))
{
exportName += '-' + args.globalCaseName();
}
}
// By default, no scaling
const scalar scaleFactor = args.optionLookupOrDefault("scale", 1.0);
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0);
// Default to binary output, unless otherwise specified
const IOstream::streamFormat format =
(
args.optionFound("ascii")
args.found("ascii")
? IOstream::ASCII
: IOstream::BINARY
);
@ -201,15 +201,15 @@ int main(int argc, char *argv[])
// ~~~~~~~~~~~~~~~~~~~~
ccm::reader::options rOpts;
rOpts.removeBaffles(args.optionFound("noBaffles"));
rOpts.mergeInterfaces(args.optionFound("merge"));
rOpts.removeBaffles(args.found("noBaffles"));
rOpts.mergeInterfaces(args.found("merge"));
if (args.optionFound("numbered"))
if (args.found("numbered"))
{
rOpts.useNumberedNames(true);
}
if (args.optionFound("solids"))
if (args.found("solids"))
{
Info<< "treating solids like fluids" << endl;
rOpts.keepSolid(true);
@ -235,7 +235,7 @@ int main(int argc, char *argv[])
if
(
args.optionFound("remap")
args.found("remap")
? reader.remapMeshInfo(runTime, args["remap"])
: reader.remapMeshInfo(runTime)
)
@ -257,7 +257,7 @@ int main(int argc, char *argv[])
{
autoPtr<polyMesh> mesh =
(
args.optionFound("remap")
args.found("remap")
? reader.mesh(runTime, args["remap"])
: reader.mesh(runTime)
);

View File

@ -123,12 +123,12 @@ int main(int argc, char *argv[])
// get times list
instantList timeDirs = Foam::timeSelector::select0(runTime, args);
const bool optMesh = args.optionFound("mesh");
const bool optResults = args.optionFound("results");
const bool optOverwrite = args.optionFound("overwrite");
const bool optMesh = args.found("mesh");
const bool optResults = args.found("results");
const bool optOverwrite = args.found("overwrite");
fileName exportName = ccm::writer::defaultMeshName;
if (args.optionReadIfPresent("name", exportName))
if (args.readIfPresent("name", exportName))
{
const word ext = exportName.ext();
// strip erroneous extension (.ccm, .ccmg, .ccmp)
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
exportName = exportName.lessExt();
}
}
else if (args.optionFound("case"))
else if (args.found("case"))
{
exportName += '-' + args.globalCaseName();
}
@ -154,9 +154,9 @@ int main(int argc, char *argv[])
// // skip over time=0, unless some other time option has been specified
// if
// (
// !args.optionFound("zeroTime")
// && !args.optionFound("time")
// && !args.optionFound("latestTime")
// !args.found("zeroTime")
// && !args.found("time")
// && !args.found("latestTime")
// && Times.size() > 2
// )
// {
@ -253,7 +253,7 @@ int main(int argc, char *argv[])
);
// writer.setTopologyFile(exportName + ".ccmg");
Info<< "writing solution:";
if (args.optionFound("remap"))
if (args.found("remap"))
{
writer.writeSolution(objects, args["remap"]);
}

View File

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

View File

@ -90,7 +90,7 @@ int main(int argc, char *argv[])
// Binary output, unless otherwise specified
const IOstream::streamFormat format =
(
args.optionFound("ascii")
args.found("ascii")
? IOstream::ASCII
: IOstream::BINARY
);
@ -103,7 +103,7 @@ int main(int argc, char *argv[])
(
args[1],
// Default no scaling
args.optionLookupOrDefault("scale", 1.0)
args.lookupOrDefault("scale", 1.0)
);
@ -111,7 +111,7 @@ int main(int argc, char *argv[])
reader.writeMesh(mesh(), format);
if (args.optionFound("check"))
if (args.found("check"))
{
checkFireEdges(mesh());
}

View File

@ -804,15 +804,15 @@ int main(int argc, char *argv[])
FatalError.exit();
}
args.optionReadIfPresent("scale", scaleFactor);
args.readIfPresent("scale", scaleFactor);
wordHashSet ignoreCellGroups;
wordHashSet ignoreFaceGroups;
args.optionReadIfPresent("ignoreCellGroups", ignoreCellGroups);
args.optionReadIfPresent("ignoreFaceGroups", ignoreFaceGroups);
args.readIfPresent("ignoreCellGroups", ignoreCellGroups);
args.readIfPresent("ignoreFaceGroups", ignoreFaceGroups);
cubitFile = args.optionFound("cubit");
cubitFile = args.found("cubit");
if (cubitFile)
{

View File

@ -898,10 +898,10 @@ int main(int argc, char *argv[])
FatalError.exit();
}
const scalar scaleFactor = args.optionLookupOrDefault("scale", 1.0);
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0);
const bool writeSets = args.optionFound("writeSets");
const bool writeZones = args.optionFound("writeZones");
const bool writeSets = args.found("writeSets");
const bool writeZones = args.found("writeZones");
#include "createTime.H"
@ -975,7 +975,7 @@ int main(int argc, char *argv[])
scalar twoDThickness = 1.0;
if (!args.optionReadIfPresent("2D", twoDThickness))
if (!args.readIfPresent("2D", twoDThickness))
{
const scalar extrusionFactor = 0.02; //0.01 in each direction
boundBox box(points);

View File

@ -81,7 +81,7 @@ int main(int argc, char *argv[])
instantList timeDirs = timeSelector::select0(runTime, args);
fileName exportName = meshWriter::defaultMeshName;
if (args.optionFound("case"))
if (args.found("case"))
{
exportName += '-' + args.globalCaseName();
}
@ -89,11 +89,11 @@ int main(int argc, char *argv[])
// write control options
// ~~~~~~~~~~~~~~~~~~~~~
fileFormats::FIREMeshWriter::binary = !args.optionFound("ascii");
fileFormats::FIREMeshWriter::binary = !args.found("ascii");
// Default: no rescaling
scalar scaleFactor = 1;
if (args.optionReadIfPresent("scale", scaleFactor))
if (args.readIfPresent("scale", scaleFactor))
{
if (scaleFactor <= 0)
{

View File

@ -90,14 +90,14 @@ int main(int argc, char *argv[])
instantList timeDirs = timeSelector::select0(runTime, args);
fileName exportName = meshWriter::defaultMeshName;
if (args.optionFound("case"))
if (args.found("case"))
{
exportName += '-' + args.globalCaseName();
}
// Default rescale from [m] to [mm]
const scalar scaleFactor = args.optionLookupOrDefault("scale", 1000.0);
const bool writeBndFile = !args.optionFound("noBnd");
const scalar scaleFactor = args.lookupOrDefault("scale", 1000.0);
const bool writeBndFile = !args.found("noBnd");
#include "createPolyMesh.H"

View File

@ -77,8 +77,8 @@ int main(int argc, char *argv[])
fileName exportName = args[1];
scalar scaleFactor = 0;
args.optionReadIfPresent<scalar>("scale", scaleFactor);
const bool doTriangulate = args.optionFound("tri");
args.readIfPresent<scalar>("scale", scaleFactor);
const bool doTriangulate = args.found("tri");
fileName exportBase = exportName.lessExt();
word exportExt = exportName.ext();

View File

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

View File

@ -783,7 +783,7 @@ int main(int argc, char *argv[])
Foam::word regionName;
if (args.optionReadIfPresent("region", regionName))
if (args.readIfPresent("region", regionName))
{
Foam::Info
<< "Creating polyMesh for region " << regionName << endl;
@ -793,7 +793,7 @@ int main(int argc, char *argv[])
regionName = Foam::polyMesh::defaultRegion;
}
const bool keepOrientation = args.optionFound("keepOrientation");
const bool keepOrientation = args.found("keepOrientation");
IFstream inFile(args[1]);
// Storage for points

View File

@ -1122,7 +1122,7 @@ int main(int argc, char *argv[])
// For debugging: dump boundary faces as OBJ surface mesh
if (args.optionFound("dump"))
if (args.found("dump"))
{
Info<< "Writing boundary faces to OBJ file boundaryFaces.obj"
<< nl << endl;

View File

@ -82,10 +82,10 @@ int main(int argc, char *argv[])
#include "createTime.H"
const fileName kivaFileName =
args.optionLookupOrDefault<fileName>("file", "otape17");
args.lookupOrDefault<fileName>("file", "otape17");
kivaVersions kivaVersion = kiva3v;
if (args.optionFound("version"))
if (args.found("version"))
{
const word versionName = args["version"];
@ -109,7 +109,7 @@ int main(int argc, char *argv[])
}
scalar zHeadMin = -GREAT;
args.optionReadIfPresent("zHeadMin", zHeadMin);
args.readIfPresent("zHeadMin", zHeadMin);
#include "readKivaGrid.H"

View File

@ -70,7 +70,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
const bool readHex = args.optionFound("hex");
const bool readHex = args.found("hex");
IFstream mshStream(args[1]);
label nCells;

View File

@ -90,12 +90,12 @@ int main(int argc, char *argv[])
FatalError.exit();
}
const scalar scaleFactor = args.optionLookupOrDefault("scale", 1.0);
const scalar scaleFactor = args.lookupOrDefault("scale", 1.0);
const bool readBlank = !args.optionFound("noBlank");
const bool singleBlock = args.optionFound("singleBlock");
const bool readBlank = !args.found("noBlank");
const bool singleBlock = args.found("singleBlock");
scalar twoDThickness = -1;
if (args.optionReadIfPresent("2D", twoDThickness))
if (args.readIfPresent("2D", twoDThickness))
{
Info<< "Reading 2D case by extruding points by " << twoDThickness
<< " in z direction." << nl << endl;

View File

@ -95,7 +95,7 @@ int main(int argc, char *argv[])
// Binary output, unless otherwise specified
const IOstream::streamFormat format =
(
args.optionFound("ascii")
args.found("ascii")
? IOstream::ASCII
: IOstream::BINARY
);
@ -113,8 +113,8 @@ int main(int argc, char *argv[])
prefix,
runTime,
// Default rescale from [mm] to [m]
args.optionLookupOrDefault("scale", 0.001),
args.optionFound("solids")
args.lookupOrDefault("scale", 0.001),
args.found("solids")
);

View File

@ -112,7 +112,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
const fileName prefix = args[1];
const bool readFaceFile = !args.optionFound("noFaceFile");
const bool readFaceFile = !args.found("noFaceFile");
const fileName nodeFile(prefix + ".node");
const fileName eleFile(prefix + ".ele");

View File

@ -429,13 +429,13 @@ int main(int argc, char *argv[])
#include "createTime.H"
runTime.functionObjects().off();
const bool patchFaces = args.optionFound("patchFaces");
const bool patchEdges = args.optionFound("patchEdges");
const bool doCell = args.optionFound("cell");
const bool doPoint = args.optionFound("point");
const bool doFace = args.optionFound("face");
const bool doCellSet = args.optionFound("cellSet");
const bool doFaceSet = args.optionFound("faceSet");
const bool patchFaces = args.found("patchFaces");
const bool patchEdges = args.found("patchEdges");
const bool doCell = args.found("cell");
const bool doPoint = args.found("point");
const bool doFace = args.found("face");
const bool doCellSet = args.found("cellSet");
const bool doFaceSet = args.found("faceSet");
Info<< "Writing mesh objects as .obj files such that the object"
@ -467,19 +467,19 @@ int main(int argc, char *argv[])
}
if (doCell)
{
label celli = args.optionRead<label>("cell");
const label celli = args.opt<label>("cell");
writePoints(mesh, celli, runTime.timeName());
}
if (doPoint)
{
label pointi = args.optionRead<label>("point");
const label pointi = args.opt<label>("point");
writePointCells(mesh, pointi, runTime.timeName());
}
if (doFace)
{
label facei = args.optionRead<label>("face");
const label facei = args.opt<label>("face");
fileName fName
(

View File

@ -129,7 +129,7 @@ int main(int argc, char *argv[])
word regionPath;
// Check if the region is specified otherwise mesh the default region
if (args.optionReadIfPresent("region", regionName, polyMesh::defaultRegion))
if (args.readIfPresent("region", regionName, polyMesh::defaultRegion))
{
Info<< nl << "Generating mesh for region " << regionName << endl;
regionPath = regionName;
@ -140,7 +140,7 @@ int main(int argc, char *argv[])
fileName dictPath;
// Check if the dictionary is specified on the command-line
if (args.optionReadIfPresent("dict", dictPath))
if (args.readIfPresent("dict", dictPath))
{
if (isDir(dictPath))
{
@ -176,7 +176,7 @@ int main(int argc, char *argv[])
dictPath = runTime.system()/regionPath/dictName;
}
if (!args.optionFound("noClean"))
if (!args.found("noClean"))
{
fileName polyMeshPath
(
@ -223,7 +223,7 @@ int main(int argc, char *argv[])
IOdictionary meshDict(meshDictIO);
blockMesh blocks(meshDict, regionName);
if (args.optionFound("blockTopology"))
if (args.found("blockTopology"))
{
// Write mesh as edges.
{
@ -383,7 +383,7 @@ int main(int argc, char *argv[])
Info<< nl << "Writing polyMesh with "
<< mesh.cellZones().size() << " cellZones";
if (args.optionFound("sets") && !mesh.cellZones().empty())
if (args.found("sets") && !mesh.cellZones().empty())
{
Info<< " (written as cellSets too)";
}
@ -397,7 +397,7 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
if (args.optionFound("sets"))
if (args.found("sets"))
{
forAll(mesh.cellZones(), zonei)
{

View File

@ -268,7 +268,7 @@ int main(int argc, char *argv[])
// Get optional regionName
word regionName;
word regionDir;
if (args.optionReadIfPresent("region", regionName))
if (args.readIfPresent("region", regionName))
{
regionDir = regionName;
Info<< "Create mesh " << regionName << " for time = "

View File

@ -1473,8 +1473,6 @@ void extrudeGeometricProperties
}
int main(int argc, char *argv[])
{
argList::addNote("Create region mesh by extruding a faceZone or faceSet");
@ -1501,8 +1499,7 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
const word dictName("extrudeToRegionMeshDict");
@ -1510,11 +1507,9 @@ int main(int argc, char *argv[])
IOdictionary dict(dictIO);
// Point generator
autoPtr<extrudeModel> model(extrudeModel::New(dict));
// Region
const word shellRegionName(dict.lookup("region"));
@ -1522,7 +1517,7 @@ int main(int argc, char *argv[])
wordList zoneNames;
wordList zoneShadowNames;
bool hasZones = dict.found("faceZones");
const bool hasZones = dict.found("faceZones");
if (hasZones)
{
dict.lookup("faceZones") >> zoneNames;

View File

@ -128,7 +128,7 @@ int main(int argc, char *argv[])
runTimeExtruded.functionObjects().off();
const ExtrudeMode surfaceFormat = ExtrudeModeNames[args[1]];
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
Info<< "Extruding from " << ExtrudeModeNames[surfaceFormat]
<< " at time " << runTimeExtruded.timeName() << endl;

View File

@ -62,12 +62,12 @@ int main(int argc, char *argv[])
runTime.functionObjects().off();
const bool checkGeometry = args.optionFound("checkGeometry");
const bool conformationOnly = args.optionFound("conformationOnly");
const bool checkGeometry = args.found("checkGeometry");
const bool conformationOnly = args.found("conformationOnly");
// Allow override of decomposeParDict location
fileName decompDictFile;
args.optionReadIfPresent("decomposeParDict", decompDictFile);
args.readIfPresent("decomposeParDict", decompDictFile);
IOdictionary foamyHexMeshDict
(

View File

@ -62,7 +62,7 @@ scalar getMergeDistance
)
{
scalar mergeTol = defaultMergeTol;
args.optionReadIfPresent("mergeTol", mergeTol);
args.readIfPresent("mergeTol", mergeTol);
scalar writeTol =
Foam::pow(scalar(10.0), -scalar(IOstream::defaultPrecision()));
@ -404,7 +404,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
runTime.functionObjects().off();
const bool writeMesh = args.optionFound("writeMesh");
const bool writeMesh = args.found("writeMesh");
if (writeMesh)
{
@ -523,7 +523,7 @@ int main(int argc, char *argv[])
// Allow override of decomposeParDict location
fileName decompDictFile;
args.optionReadIfPresent("decomposeParDict", decompDictFile);
args.readIfPresent("decomposeParDict", decompDictFile);
labelList decomp = decompositionModel::New
(

View File

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

View File

@ -82,13 +82,13 @@ int main(int argc, char *argv[])
const dictionary& extrusionDict(controlDict.subDict("extrusion"));
Switch extrude(extrusionDict.lookup("extrude"));
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
// Read and triangulation
// ~~~~~~~~~~~~~~~~~~~~~~
CV2D mesh(runTime, controlDict);
if (args.optionFound("pointsFile"))
if (args.found("pointsFile"))
{
mesh.insertPoints(args["pointsFile"]);
}

View File

@ -711,22 +711,21 @@ int main(int argc, char *argv[])
#include "createTime.H"
runTime.functionObjects().off();
const bool overwrite = args.optionFound("overwrite");
const bool checkGeometry = args.optionFound("checkGeometry");
const bool surfaceSimplify = args.optionFound("surfaceSimplify");
const bool overwrite = args.found("overwrite");
const bool checkGeometry = args.found("checkGeometry");
const bool surfaceSimplify = args.found("surfaceSimplify");
autoPtr<fvMesh> meshPtr;
{
word regionName;
if (args.optionReadIfPresent("region", regionName))
word regionName = fvMesh::defaultRegion;
if (args.readIfPresent("region", regionName))
{
Info<< "Create mesh " << regionName << " for time = "
<< runTime.timeName() << nl << endl;
}
else
{
regionName = fvMesh::defaultRegion;
Info<< "Create mesh for time = "
<< runTime.timeName() << nl << endl;
}
@ -792,7 +791,7 @@ int main(int argc, char *argv[])
if (Pstream::parRun())
{
fileName decompDictFile;
args.optionReadIfPresent("decomposeParDict", decompDictFile);
args.readIfPresent("decomposeParDict", decompDictFile);
// A demand-driven decompositionMethod can have issues finding
// an alternative decomposeParDict location.
@ -1663,11 +1662,11 @@ int main(int argc, char *argv[])
labelHashSet includePatches(bMesh.size());
if (args.optionFound("patches"))
if (args.found("patches"))
{
includePatches = bMesh.patchSet
(
wordReList(args.optionLookup("patches")())
wordReList(args.lookup("patches")())
);
}
else
@ -1685,7 +1684,7 @@ int main(int argc, char *argv[])
fileName outFileName
(
args.optionLookupOrDefault<fileName>
args.lookupOrDefault<fileName>
(
"outFile",
"constant/triSurface/simplifiedSurface.stl"

View File

@ -52,7 +52,7 @@ int main(int argc, char *argv[])
#include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
if (!overwrite)
{

View File

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

View File

@ -126,20 +126,20 @@ int main(int argc, char *argv[])
instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H"
const bool noTopology = args.optionFound("noTopology");
const bool allGeometry = args.optionFound("allGeometry");
const bool allTopology = args.optionFound("allTopology");
const bool meshQuality = args.optionFound("meshQuality");
const bool noTopology = args.found("noTopology");
const bool allGeometry = args.found("allGeometry");
const bool allTopology = args.found("allTopology");
const bool meshQuality = args.found("meshQuality");
word surfaceFormat;
const bool writeSets = args.optionReadIfPresent("writeSets", surfaceFormat);
const bool writeSets = args.readIfPresent("writeSets", surfaceFormat);
HashSet<word> selectedFields;
bool writeFields = args.optionReadIfPresent
bool writeFields = args.readIfPresent
(
"writeFields",
selectedFields
);
if (!writeFields && args.optionFound("writeAllFields"))
if (!writeFields && args.found("writeAllFields"))
{
selectedFields.insert("nonOrthoAngle");
selectedFields.insert("faceWeight");

View File

@ -438,7 +438,7 @@ int main(int argc, char *argv[])
#include "createNamedMesh.H"
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
const word oldInstance = mesh.pointsInstance();

View File

@ -523,13 +523,13 @@ int main(int argc, char *argv[])
runTime.functionObjects().off();
Foam::word meshRegionName = polyMesh::defaultRegion;
args.optionReadIfPresent("region", meshRegionName);
args.readIfPresent("region", meshRegionName);
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
#include "createNamedPolyMesh.H"
const bool writeObj = args.optionFound("writeObj");
const bool writeObj = args.found("writeObj");
const word oldInstance = mesh.pointsInstance();

View File

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

View File

@ -97,20 +97,20 @@ int main(int argc, char *argv[])
FatalError.exit();
}
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
fileName masterCase = args[1];
fileName addCase = args[2];
const word masterRegion =
args.optionLookupOrDefault<word>
args.lookupOrDefault<word>
(
"masterRegion",
polyMesh::defaultRegion
);
const word addRegion =
args.optionLookupOrDefault<word>
args.lookupOrDefault<word>
(
"masterRegion",
polyMesh::defaultRegion
@ -166,7 +166,7 @@ int main(int argc, char *argv[])
const bool specifiedInstance =
(
!overwrite
&& args.optionReadIfPresent("resultTime", meshInstance)
&& args.readIfPresent("resultTime", meshInstance)
);
if (specifiedInstance)

View File

@ -304,10 +304,10 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
const bool readDict = args.optionFound("dict");
const bool split = args.optionFound("split");
const bool overwrite = args.optionFound("overwrite");
const bool detectOnly = args.optionFound("detectOnly");
const bool readDict = args.found("dict");
const bool split = args.found("split");
const bool overwrite = args.found("overwrite");
const bool detectOnly = args.found("detectOnly");
if (readDict && (split || detectOnly))
{

View File

@ -47,7 +47,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
if (!overwrite)
{

View File

@ -168,7 +168,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createNamedDynamicFvMesh.H"
const bool checkAMI = args.optionFound("checkAMI");
const bool checkAMI = args.found("checkAMI");
if (checkAMI)
{

View File

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

View File

@ -401,7 +401,7 @@ int main(int argc, char *argv[])
}
}
const scalar featureAngle = args.argRead<scalar>(1);
const scalar featureAngle = args.read<scalar>(1);
const scalar minCos = Foam::cos(degToRad(featureAngle));
Info<< "Feature:" << featureAngle << endl
@ -409,7 +409,7 @@ int main(int argc, char *argv[])
<< endl;
const bool splitAllFaces = args.optionFound("splitAllFaces");
const bool splitAllFaces = args.found("splitAllFaces");
if (splitAllFaces)
{
Info<< "Splitting all internal faces to create multiple faces"
@ -417,12 +417,9 @@ int main(int argc, char *argv[])
<< endl;
}
const bool overwrite = args.optionFound("overwrite");
const bool doNotPreserveFaceZones = args.optionFound
(
"doNotPreserveFaceZones"
);
const bool concaveMultiCells = args.optionFound("concaveMultiCells");
const bool overwrite = args.found("overwrite");
const bool doNotPreserveFaceZones = args.found("doNotPreserveFaceZones");
const bool concaveMultiCells = args.found("concaveMultiCells");
if (concaveMultiCells)
{
Info<< "Generating multiple cells for points on concave feature edges."

View File

@ -182,9 +182,9 @@ int main(int argc, char *argv[])
// Read/construct control dictionary
//
const bool readDict = args.optionFound("dict");
const bool refineAllCells = args.optionFound("all");
const bool overwrite = args.optionFound("overwrite");
const bool readDict = args.found("dict");
const bool refineAllCells = args.found("all");
const bool overwrite = args.found("overwrite");
// List of cells to refine
labelList refCells;

View File

@ -653,9 +653,9 @@ int main(int argc, char *argv[])
#include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
const bool readDict = args.optionFound("dict");
const bool doFrontWidth = args.optionFound("frontWidth");
const bool overwrite = args.optionFound("overwrite");
const bool readDict = args.found("dict");
const bool doFrontWidth = args.found("frontWidth");
const bool overwrite = args.found("overwrite");
label band;
scalar profile;

View File

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

View File

@ -768,10 +768,10 @@ int main(int argc, char *argv[])
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
const bool writeVTK = !args.optionFound("noVTK");
const bool loop = args.optionFound("loop");
const bool batch = args.optionFound("batch");
const bool noSync = args.optionFound("noSync");
const bool writeVTK = !args.found("noVTK");
const bool loop = args.found("loop");
const bool batch = args.found("batch");
const bool noSync = args.found("noSync");
if (loop && !batch)
{

View File

@ -77,7 +77,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
const bool noFlipMap = args.optionFound("noFlipMap");
const bool noFlipMap = args.found("noFlipMap");
// Get times list
(void)timeSelector::selectIfPresent(runTime, args);

View File

@ -129,7 +129,7 @@ int main(int argc, char *argv[])
const word setName = args[1];
const word masterPatch = args[2];
const word slavePatch = args[3];
const bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.found("overwrite");
// List of faces to split
faceSet facesSet(mesh, setName);

View File

@ -1487,23 +1487,23 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
word blockedFacesName;
if (args.optionReadIfPresent("blockedFaces", blockedFacesName))
if (args.readIfPresent("blockedFaces", blockedFacesName))
{
Info<< "Reading blocked internal faces from faceSet "
<< blockedFacesName << nl << endl;
}
const bool makeCellZones = args.optionFound("makeCellZones");
const bool largestOnly = args.optionFound("largestOnly");
const bool insidePoint = args.optionFound("insidePoint");
const bool useCellZones = args.optionFound("cellZones");
const bool useCellZonesOnly = args.optionFound("cellZonesOnly");
const bool useCellZonesFile = args.optionFound("cellZonesFileOnly");
const bool overwrite = args.optionFound("overwrite");
const bool detectOnly = args.optionFound("detectOnly");
const bool sloppyCellZones = args.optionFound("sloppyCellZones");
const bool useFaceZones = args.optionFound("useFaceZones");
const bool prefixRegion = args.optionFound("prefixRegion");
const bool makeCellZones = args.found("makeCellZones");
const bool largestOnly = args.found("largestOnly");
const bool insidePoint = args.found("insidePoint");
const bool useCellZones = args.found("cellZones");
const bool useCellZonesOnly = args.found("cellZonesOnly");
const bool useCellZonesFile = args.found("cellZonesFileOnly");
const bool overwrite = args.found("overwrite");
const bool detectOnly = args.found("detectOnly");
const bool sloppyCellZones = args.found("sloppyCellZones");
const bool useFaceZones = args.found("useFaceZones");
const bool prefixRegion = args.found("prefixRegion");
if
@ -2001,7 +2001,7 @@ int main(int argc, char *argv[])
if (insidePoint)
{
const point insidePoint = args.optionRead<point>("insidePoint");
const point insidePoint = args.opt<point>("insidePoint");
label regionI = -1;

View File

@ -153,7 +153,7 @@ int main(int argc, char *argv[])
if (useCommandArgs)
{
if (args.optionFound("dict"))
if (args.found("dict"))
{
FatalErrorInFunction
<< "Cannot specify both dictionary and command-line arguments"
@ -171,21 +171,21 @@ int main(int argc, char *argv[])
{
// Carp about inapplicable options
if (args.optionFound("integral"))
if (args.found("integral"))
{
FatalErrorInFunction
<< "Only specify -integral with command-line arguments"
<< endl;
}
if (args.optionFound("partial"))
if (args.found("partial"))
{
FatalErrorInFunction
<< "Only specify -partial with command-line arguments"
<< endl;
}
if (args.optionFound("perfect"))
if (args.found("perfect"))
{
FatalErrorInFunction
<< "Only specify -perfect with command-line arguments"
@ -199,8 +199,8 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
const bool intermediate = args.optionFound("intermediate");
const bool overwrite = args.optionFound("overwrite");
const bool intermediate = args.found("intermediate");
const bool overwrite = args.found("overwrite");
const word dictName("stitchMeshDict");
@ -210,9 +210,9 @@ int main(int argc, char *argv[])
if (useCommandArgs)
{
// Command argument driven:
const int integralCover = args.optionFound("integral");
const int partialCover = args.optionFound("partial");
const int perfectCover = args.optionFound("perfect");
const int integralCover = args.found("integral");
const int partialCover = args.found("partial");
const int perfectCover = args.found("perfect");
if ((integralCover + partialCover + perfectCover) > 1)
{
@ -377,7 +377,7 @@ int main(int argc, char *argv[])
// set up the tolerances for the sliding mesh
dictionary slidingTolerances;
if (args.optionFound("toleranceDict"))
if (args.found("toleranceDict"))
{
IOdictionary toleranceFile
(

View File

@ -376,8 +376,8 @@ int main(int argc, char *argv[])
word meshInstance = mesh.pointsInstance();
word fieldsInstance = runTime.timeName();
const bool overwrite = args.optionFound("overwrite");
const bool specifiedInstance = args.optionReadIfPresent
const bool overwrite = args.found("overwrite");
const bool specifiedInstance = args.readIfPresent
(
"resultTime",
fieldsInstance
@ -396,7 +396,7 @@ int main(int argc, char *argv[])
labelList exposedPatchIDs;
if (args.optionFound("patch"))
if (args.found("patch"))
{
const word patchName = args["patch"];
@ -412,9 +412,9 @@ int main(int argc, char *argv[])
Info<< "Adding exposed internal faces to patch " << patchName
<< nl << endl;
}
else if (args.optionFound("patches"))
else if (args.found("patches"))
{
const wordReList patchNames(args.optionRead<wordReList>("patches"));
const wordReList patchNames(args.opt<wordReList>("patches"));
exposedPatchIDs = mesh.boundaryMesh().patchSet(patchNames).sortedToc();

View File

@ -217,7 +217,7 @@ int main(int argc, char *argv[])
#include "createNamedPolyMesh.H"
const bool noSync = args.optionFound("noSync");
const bool noSync = args.found("noSync");
const word dictName("topoSetDict");
#include "setSystemMeshDictionaryIO.H"

View File

@ -202,7 +202,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H"
#include "setRootCase.H"
const bool doRotateFields = args.optionFound("rotateFields");
const bool doRotateFields = args.found("rotateFields");
// Verify that an operation has been specified
{
@ -216,11 +216,11 @@ int main(int argc, char *argv[])
"scale"
};
if (!args.optionCount(operationNames))
if (!args.count(operationNames))
{
FatalError
<< "No operation supplied, "
<< "use least one of the following:" << nl
<< "use at least one of the following:" << nl
<< " ";
for (const auto& opName : operationNames)
@ -239,7 +239,7 @@ int main(int argc, char *argv[])
word regionName = polyMesh::defaultRegion;
fileName meshDir = polyMesh::meshSubDir;
if (args.optionReadIfPresent("region", regionName))
if (args.readIfPresent("region", regionName))
{
meshDir = regionName/polyMesh::meshSubDir;
}
@ -259,7 +259,7 @@ int main(int argc, char *argv[])
);
vector v;
if (args.optionReadIfPresent("translate", v))
if (args.readIfPresent("translate", v))
{
Info<< "Translating points by " << v << endl;
@ -267,18 +267,18 @@ int main(int argc, char *argv[])
}
vector origin;
const bool useOrigin = args.optionReadIfPresent("origin", origin);
const bool useOrigin = args.readIfPresent("origin", origin);
if (useOrigin)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
}
if (args.optionFound("rotate"))
if (args.found("rotate"))
{
Pair<vector> n1n2
(
args.optionLookup("rotate")()
args.lookup("rotate")()
);
n1n2[0] /= mag(n1n2[0]);
n1n2[1] /= mag(n1n2[1]);
@ -294,11 +294,11 @@ int main(int argc, char *argv[])
rotateFields(args, runTime, rotT);
}
}
else if (args.optionFound("rotate-angle"))
else if (args.found("rotate-angle"))
{
const Tuple2<vector, scalar> axisAngle
(
args.optionLookup("rotate-angle")()
args.lookup("rotate-angle")()
);
Info<< "Rotating points " << nl
@ -319,7 +319,7 @@ int main(int argc, char *argv[])
rotateFields(args, runTime, quat.R());
}
}
else if (args.optionReadIfPresent("rollPitchYaw", v))
else if (args.readIfPresent("rollPitchYaw", v))
{
Info<< "Rotating points by" << nl
<< " roll " << v.x() << nl
@ -339,7 +339,7 @@ int main(int argc, char *argv[])
rotateFields(args, runTime, quat.R());
}
}
else if (args.optionReadIfPresent("yawPitchRoll", v))
else if (args.readIfPresent("yawPitchRoll", v))
{
Info<< "Rotating points by" << nl
<< " yaw " << v.x() << nl
@ -360,10 +360,10 @@ int main(int argc, char *argv[])
}
}
if (args.optionFound("scale"))
if (args.found("scale"))
{
// Use readList to handle single or multiple values
const List<scalar> scaling = args.optionReadList<scalar>("scale");
const List<scalar> scaling = args.readList<scalar>("scale");
if (scaling.size() == 1)
{