mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -83,10 +83,10 @@ int main(int argc, char *argv[])
|
||||
const fileName inFileName2 = args[2];
|
||||
const fileName outFileName = args[3];
|
||||
|
||||
const bool addPoint = args.optionFound("points");
|
||||
const bool mergeRegions = args.optionFound("mergeRegions");
|
||||
const bool addPoint = args.found("points");
|
||||
const bool mergeRegions = args.found("mergeRegions");
|
||||
|
||||
const scalar scaleFactor = args.optionLookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", -1);
|
||||
|
||||
if (addPoint)
|
||||
{
|
||||
|
||||
@ -1587,7 +1587,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
List<Pair<word>> surfaceAndSide;
|
||||
if (args.optionReadIfPresent("trim", surfaceAndSide))
|
||||
if (args.readIfPresent("trim", surfaceAndSide))
|
||||
{
|
||||
Info<< "Trimming edges with " << surfaceAndSide << endl;
|
||||
}
|
||||
@ -1595,7 +1595,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Scale factor for both surfaces:
|
||||
const scalar scaleFactor
|
||||
= args.optionLookupOrDefault<scalar>("scale", -1);
|
||||
= args.lookupOrDefault<scalar>("scale", -1);
|
||||
|
||||
const word surf1Name(args[2]);
|
||||
Info<< "Reading surface " << surf1Name << endl;
|
||||
@ -1641,13 +1641,13 @@ int main(int argc, char *argv[])
|
||||
surf2.writeStats(Info);
|
||||
Info<< endl;
|
||||
|
||||
const bool surf1Baffle = args.optionFound("surf1Baffle");
|
||||
const bool surf2Baffle = args.optionFound("surf2Baffle");
|
||||
const bool surf1Baffle = args.found("surf1Baffle");
|
||||
const bool surf2Baffle = args.found("surf2Baffle");
|
||||
|
||||
edgeIntersections edgeCuts1;
|
||||
edgeIntersections edgeCuts2;
|
||||
|
||||
const bool invertedSpace = args.optionFound("invertedSpace");
|
||||
const bool invertedSpace = args.found("invertedSpace");
|
||||
|
||||
if (invertedSpace && validActions[action] == booleanSurface::DIFFERENCE)
|
||||
{
|
||||
@ -1663,7 +1663,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
surf1,
|
||||
surf2,
|
||||
args.optionFound("perturb"),
|
||||
args.found("perturb"),
|
||||
edgeCuts1,
|
||||
edgeCuts2
|
||||
);
|
||||
@ -1673,7 +1673,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
surf1,
|
||||
surf2,
|
||||
args.optionFound("perturb"),
|
||||
args.found("perturb"),
|
||||
edgeCuts1,
|
||||
edgeCuts2
|
||||
);
|
||||
|
||||
@ -312,10 +312,10 @@ int main(int argc, char *argv[])
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName surfFileName = args[1];
|
||||
const bool checkSelfIntersect = args.optionFound("checkSelfIntersection");
|
||||
const bool splitNonManifold = args.optionFound("splitNonManifold");
|
||||
const bool checkSelfIntersect = args.found("checkSelfIntersection");
|
||||
const bool splitNonManifold = args.found("splitNonManifold");
|
||||
const label outputThreshold =
|
||||
args.optionLookupOrDefault("outputThreshold", 10);
|
||||
args.lookupOrDefault("outputThreshold", 10);
|
||||
|
||||
Info<< "Reading surface from " << surfFileName << " ..." << nl << endl;
|
||||
|
||||
@ -344,7 +344,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// write bounding box corners
|
||||
if (args.optionFound("blockMesh"))
|
||||
if (args.found("blockMesh"))
|
||||
{
|
||||
pointField cornerPts(boundBox(surf.points(), false).points());
|
||||
|
||||
|
||||
@ -71,8 +71,8 @@ int main(int argc, char *argv[])
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName inFileName = args[1];
|
||||
const scalar minLen = args.argRead<scalar>(2);
|
||||
const scalar minQuality = args.argRead<scalar>(3);
|
||||
const scalar minLen = args.read<scalar>(2);
|
||||
const scalar minQuality = args.read<scalar>(3);
|
||||
const fileName outFileName = args[4];
|
||||
|
||||
Info<< "Reading surface " << inFileName << nl
|
||||
@ -87,11 +87,11 @@ int main(int argc, char *argv[])
|
||||
triSurface surf
|
||||
(
|
||||
inFileName,
|
||||
args.optionLookupOrDefault<scalar>("scale", -1)
|
||||
args.lookupOrDefault<scalar>("scale", -1)
|
||||
);
|
||||
surf.writeStats(Info);
|
||||
|
||||
if (!args.optionFound("noClean"))
|
||||
if (!args.found("noClean"))
|
||||
{
|
||||
Info<< "Removing duplicate and illegal triangles ..." << nl << endl;
|
||||
surf.cleanup(true);
|
||||
|
||||
@ -85,7 +85,7 @@ int main(int argc, char *argv[])
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName inFileName = args[1];
|
||||
const scalar reduction = args.argRead<scalar>(2);
|
||||
const scalar reduction = args.read<scalar>(2);
|
||||
const fileName outFileName = args[3];
|
||||
|
||||
if (reduction <= 0 || reduction > 1)
|
||||
@ -97,7 +97,7 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const scalar scaleFactor = args.optionLookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", -1);
|
||||
|
||||
Info<< "Input surface :" << inFileName << nl
|
||||
<< "Scaling factor :" << scaleFactor << nl
|
||||
|
||||
@ -96,6 +96,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList args(argc, argv);
|
||||
|
||||
if (args.found("writePrecision"))
|
||||
{
|
||||
const label writePrecision = args.opt<label>("writePrecision");
|
||||
|
||||
IOstream::defaultPrecision(writePrecision);
|
||||
Sout.precision(writePrecision);
|
||||
|
||||
Info<< "Output write precision set to " << writePrecision << endl;
|
||||
}
|
||||
|
||||
const fileName importName = args[1];
|
||||
const fileName exportName = args[2];
|
||||
|
||||
@ -116,17 +126,7 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (args.optionFound("writePrecision"))
|
||||
{
|
||||
label writePrecision = args.optionRead<label>("writePrecision");
|
||||
|
||||
IOstream::defaultPrecision(writePrecision);
|
||||
Sout.precision(writePrecision);
|
||||
|
||||
Info<< "Output write precision set to " << writePrecision << endl;
|
||||
}
|
||||
|
||||
const scalar scaleFactor = args.optionLookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaleFactor = args.lookupOrDefault<scalar>("scale", -1);
|
||||
|
||||
Info<< "Reading : " << importName << endl;
|
||||
triSurface surf(importName, scaleFactor);
|
||||
@ -135,7 +135,7 @@ int main(int argc, char *argv[])
|
||||
surf.writeStats(Info);
|
||||
Info<< endl;
|
||||
|
||||
if (args.optionFound("clean"))
|
||||
if (args.found("clean"))
|
||||
{
|
||||
Info<< "Cleaning up surface" << endl;
|
||||
surf.cleanup(true);
|
||||
@ -145,7 +145,7 @@ int main(int argc, char *argv[])
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
const bool sortByRegion = args.optionFound("group");
|
||||
const bool sortByRegion = args.found("group");
|
||||
if (sortByRegion)
|
||||
{
|
||||
Info<< "Reordering faces into groups; one per region." << endl;
|
||||
|
||||
@ -90,7 +90,7 @@ int main(int argc, char *argv[])
|
||||
<< "\nwriting " << exportName;
|
||||
|
||||
scalar scaleFactor = 0;
|
||||
if (args.optionReadIfPresent("scale", scaleFactor) && scaleFactor > 0)
|
||||
if (args.readIfPresent("scale", scaleFactor) && scaleFactor > 0)
|
||||
{
|
||||
Info<< " with scaling " << scaleFactor << endl;
|
||||
mesh.scalePoints(scaleFactor);
|
||||
|
||||
@ -54,9 +54,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
const point samplePt
|
||||
(
|
||||
args.optionLookupOrDefault<scalar>("x", 0),
|
||||
args.optionLookupOrDefault<scalar>("y", 0),
|
||||
args.optionLookupOrDefault<scalar>("z", 0)
|
||||
args.lookupOrDefault<scalar>("x", 0),
|
||||
args.lookupOrDefault<scalar>("y", 0),
|
||||
args.lookupOrDefault<scalar>("z", 0)
|
||||
);
|
||||
Info<< "Looking for nearest face/vertex to " << samplePt << endl;
|
||||
|
||||
|
||||
@ -289,7 +289,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const IOdictionary dict(dictIO);
|
||||
|
||||
const scalar dist(args.argRead<scalar>(1));
|
||||
const scalar dist(args.read<scalar>(1));
|
||||
const scalar matchTolerance(max(1e-6*dist, SMALL));
|
||||
const label maxIters = 100;
|
||||
|
||||
|
||||
@ -85,10 +85,10 @@ int main(int argc, char *argv[])
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName surfFileName = args[1];
|
||||
const scalar density = args.optionLookupOrDefault("density", 1.0);
|
||||
const scalar density = args.lookupOrDefault("density", 1.0);
|
||||
|
||||
vector refPt = Zero;
|
||||
bool calcAroundRefPt = args.optionReadIfPresent("referencePoint", refPt);
|
||||
bool calcAroundRefPt = args.readIfPresent("referencePoint", refPt);
|
||||
|
||||
const triSurface surf(surfFileName);
|
||||
|
||||
@ -96,7 +96,7 @@ int main(int argc, char *argv[])
|
||||
vector cM = Zero;
|
||||
tensor J = Zero;
|
||||
|
||||
if (args.optionFound("shellProperties"))
|
||||
if (args.found("shellProperties"))
|
||||
{
|
||||
momentOfInertia::massPropertiesShell(surf, density, m, cM, J);
|
||||
}
|
||||
|
||||
@ -606,16 +606,16 @@ int main(int argc, char *argv[])
|
||||
runTime.functionObjects().off();
|
||||
|
||||
const word inputName(args[1]);
|
||||
const scalar distance(args.argRead<scalar>(2));
|
||||
const scalar extendFactor(args.argRead<scalar>(3));
|
||||
const bool checkSelfIntersect = args.optionFound("checkSelfIntersection");
|
||||
const label nSmooth = args.optionLookupOrDefault("nSmooth", 10);
|
||||
const scalar featureAngle = args.optionLookupOrDefault<scalar>
|
||||
const scalar distance(args.read<scalar>(2));
|
||||
const scalar extendFactor(args.read<scalar>(3));
|
||||
const bool checkSelfIntersect = args.found("checkSelfIntersection");
|
||||
const label nSmooth = args.lookupOrDefault("nSmooth", 10);
|
||||
const scalar featureAngle = args.lookupOrDefault<scalar>
|
||||
(
|
||||
"featureAngle",
|
||||
180
|
||||
);
|
||||
const bool debug = args.optionFound("debug");
|
||||
const bool debug = args.found("debug");
|
||||
|
||||
|
||||
Info<< "Inflating surface " << inputName
|
||||
|
||||
@ -146,9 +146,9 @@ int main(int argc, char *argv[])
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName surfFileName = args[1];
|
||||
const scalar lambda = args.argRead<scalar>(2);
|
||||
const scalar mu = args.argRead<scalar>(3);
|
||||
const label iters = args.argRead<label>(4);
|
||||
const scalar lambda = args.read<scalar>(2);
|
||||
const scalar mu = args.read<scalar>(3);
|
||||
const label iters = args.read<label>(4);
|
||||
const fileName outFileName = args[5];
|
||||
|
||||
if (lambda < 0 || lambda > 1)
|
||||
@ -179,7 +179,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
PackedBoolList fixedPoints(surf1.localPoints().size(), false);
|
||||
|
||||
if (args.optionFound("featureFile"))
|
||||
if (args.found("featureFile"))
|
||||
{
|
||||
const fileName featureFileName(args["featureFile"]);
|
||||
Info<< "Reading features from " << featureFileName << " ..." << endl;
|
||||
|
||||
@ -148,7 +148,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<coordinateSystem> fromCsys;
|
||||
autoPtr<coordinateSystem> toCsys;
|
||||
|
||||
if (args.optionFound("from") || args.optionFound("to"))
|
||||
if (args.found("from") || args.found("to"))
|
||||
{
|
||||
autoPtr<IOobject> csDictIoPtr;
|
||||
|
||||
@ -158,7 +158,7 @@ int main(int argc, char *argv[])
|
||||
// is in constant
|
||||
|
||||
fileName dictPath;
|
||||
if (args.optionReadIfPresent("dict", dictPath) && isDir(dictPath))
|
||||
if (args.readIfPresent("dict", dictPath) && isDir(dictPath))
|
||||
{
|
||||
dictPath = dictPath / dictName;
|
||||
}
|
||||
@ -204,7 +204,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
coordinateSystems csLst(csDictIoPtr());
|
||||
|
||||
if (args.optionFound("from"))
|
||||
if (args.found("from"))
|
||||
{
|
||||
const word csName = args["from"];
|
||||
|
||||
@ -220,7 +220,7 @@ int main(int argc, char *argv[])
|
||||
fromCsys.reset(new coordinateSystem(csLst[csIndex]));
|
||||
}
|
||||
|
||||
if (args.optionFound("to"))
|
||||
if (args.found("to"))
|
||||
{
|
||||
const word csName = args["to"];
|
||||
|
||||
@ -250,13 +250,13 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
MeshedSurface<face> surf(importName);
|
||||
|
||||
if (args.optionFound("clean"))
|
||||
if (args.found("clean"))
|
||||
{
|
||||
surf.cleanup(true);
|
||||
}
|
||||
|
||||
scalar scaleIn = 0;
|
||||
if (args.optionReadIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||
{
|
||||
Info<< " -scaleIn " << scaleIn << endl;
|
||||
surf.scalePoints(scaleIn);
|
||||
@ -278,13 +278,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
scalar scaleOut = 0;
|
||||
if (args.optionReadIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||
{
|
||||
Info<< " -scaleOut " << scaleOut << endl;
|
||||
surf.scalePoints(scaleOut);
|
||||
}
|
||||
|
||||
if (args.optionFound("tri"))
|
||||
if (args.found("tri"))
|
||||
{
|
||||
Info<< "triangulate" << endl;
|
||||
surf.triangulate();
|
||||
|
||||
@ -124,7 +124,7 @@ int main(int argc, char *argv[])
|
||||
Time runTime(args.rootPath(), args.caseName());
|
||||
|
||||
const fileName exportName = args[1];
|
||||
const word importName = args.optionLookupOrDefault<word>("name", "default");
|
||||
const word importName = args.lookupOrDefault<word>("name", "default");
|
||||
|
||||
// check that writing is supported
|
||||
if (!MeshedSurface<face>::canWriteType(exportName.ext(), true))
|
||||
@ -137,11 +137,11 @@ int main(int argc, char *argv[])
|
||||
autoPtr<coordinateSystem> fromCsys;
|
||||
autoPtr<coordinateSystem> toCsys;
|
||||
|
||||
if (args.optionFound("from") || args.optionFound("to"))
|
||||
if (args.found("from") || args.found("to"))
|
||||
{
|
||||
autoPtr<IOobject> ioPtr;
|
||||
|
||||
if (args.optionFound("dict"))
|
||||
if (args.found("dict"))
|
||||
{
|
||||
const fileName dictPath = args["dict"];
|
||||
|
||||
@ -187,7 +187,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
coordinateSystems csLst(ioPtr());
|
||||
|
||||
if (args.optionFound("from"))
|
||||
if (args.found("from"))
|
||||
{
|
||||
const word csName = args["from"];
|
||||
|
||||
@ -203,7 +203,7 @@ int main(int argc, char *argv[])
|
||||
fromCsys.reset(new coordinateSystem(csLst[csIndex]));
|
||||
}
|
||||
|
||||
if (args.optionFound("to"))
|
||||
if (args.found("to"))
|
||||
{
|
||||
const word csName = args["to"];
|
||||
|
||||
@ -248,13 +248,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
MeshedSurface<face> surf(smesh);
|
||||
|
||||
if (args.optionFound("clean"))
|
||||
if (args.found("clean"))
|
||||
{
|
||||
surf.cleanup(true);
|
||||
}
|
||||
|
||||
scalar scaleIn = 0;
|
||||
if (args.optionReadIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||
{
|
||||
Info<< " -scaleIn " << scaleIn << endl;
|
||||
surf.scalePoints(scaleIn);
|
||||
@ -275,7 +275,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
scalar scaleOut = 0;
|
||||
if (args.optionReadIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||
{
|
||||
Info<< " -scaleOut " << scaleOut << endl;
|
||||
surf.scalePoints(scaleOut);
|
||||
|
||||
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
const fileName importName = args[1];
|
||||
const word exportName = args.optionLookupOrDefault<word>("name", "default");
|
||||
const word exportName = args.lookupOrDefault<word>("name", "default");
|
||||
|
||||
// check that reading is supported
|
||||
if (!MeshedSurface<face>::canRead(importName, true))
|
||||
@ -150,11 +150,11 @@ int main(int argc, char *argv[])
|
||||
autoPtr<coordinateSystem> fromCsys;
|
||||
autoPtr<coordinateSystem> toCsys;
|
||||
|
||||
if (args.optionFound("from") || args.optionFound("to"))
|
||||
if (args.found("from") || args.found("to"))
|
||||
{
|
||||
autoPtr<IOobject> ioPtr;
|
||||
|
||||
if (args.optionFound("dict"))
|
||||
if (args.found("dict"))
|
||||
{
|
||||
const fileName dictPath = args["dict"];
|
||||
|
||||
@ -200,7 +200,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
coordinateSystems csLst(ioPtr());
|
||||
|
||||
if (args.optionFound("from"))
|
||||
if (args.found("from"))
|
||||
{
|
||||
const word csName = args["from"];
|
||||
|
||||
@ -216,7 +216,7 @@ int main(int argc, char *argv[])
|
||||
fromCsys.reset(new coordinateSystem(csLst[csIndex]));
|
||||
}
|
||||
|
||||
if (args.optionFound("to"))
|
||||
if (args.found("to"))
|
||||
{
|
||||
const word csName = args["to"];
|
||||
|
||||
@ -245,14 +245,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
MeshedSurface<face> surf(importName);
|
||||
|
||||
if (args.optionFound("clean"))
|
||||
if (args.found("clean"))
|
||||
{
|
||||
surf.cleanup(true);
|
||||
}
|
||||
|
||||
|
||||
scalar scaleIn = 0;
|
||||
if (args.optionReadIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||
{
|
||||
Info<< " -scaleIn " << scaleIn << endl;
|
||||
surf.scalePoints(scaleIn);
|
||||
@ -273,7 +273,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
scalar scaleOut = 0;
|
||||
if (args.optionReadIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||
{
|
||||
Info<< " -scaleOut " << scaleOut << endl;
|
||||
surf.scalePoints(scaleOut);
|
||||
|
||||
@ -112,14 +112,14 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
const bool writeXML = args.optionFound("xml");
|
||||
const bool writeAreas = args.optionFound("areas");
|
||||
const bool writeXML = args.found("xml");
|
||||
const bool writeAreas = args.found("areas");
|
||||
|
||||
|
||||
// use UnsortedMeshedSurface, not MeshedSurface to maintain ordering
|
||||
UnsortedMeshedSurface<face> surf(importName);
|
||||
|
||||
const scalar scaling = args.optionLookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaling = args.lookupOrDefault<scalar>("scale", -1);
|
||||
if (scaling > 0)
|
||||
{
|
||||
Info<< " -scale " << scaling << nl;
|
||||
|
||||
@ -103,7 +103,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const bool includeProcPatches =
|
||||
!(
|
||||
args.optionFound("excludeProcPatches")
|
||||
args.found("excludeProcPatches")
|
||||
|| Pstream::parRun()
|
||||
);
|
||||
|
||||
@ -171,11 +171,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
|
||||
@ -195,9 +195,9 @@ int main(int argc, char *argv[])
|
||||
const faceZoneMesh& fzm = mesh.faceZones();
|
||||
labelHashSet includeFaceZones(fzm.size());
|
||||
|
||||
if (args.optionFound("faceZones"))
|
||||
if (args.found("faceZones"))
|
||||
{
|
||||
wordReList zoneNames(args.optionLookup("faceZones")());
|
||||
wordReList zoneNames(args.lookup("faceZones")());
|
||||
const wordList allZoneNames(fzm.names());
|
||||
forAll(zoneNames, i)
|
||||
{
|
||||
|
||||
@ -73,11 +73,11 @@ int main(int argc, char *argv[])
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName surfFileName = args[1];
|
||||
const point visiblePoint = args.argRead<point>(2);
|
||||
const point visiblePoint = args.read<point>(2);
|
||||
const fileName outFileName = args[3];
|
||||
|
||||
const bool orientInside = args.optionFound("inside");
|
||||
const bool usePierceTest = args.optionFound("usePierceTest");
|
||||
const bool orientInside = args.found("inside");
|
||||
const bool usePierceTest = args.found("usePierceTest");
|
||||
|
||||
Info<< "Reading surface from " << surfFileName << nl
|
||||
<< "Orienting surface such that visiblePoint " << visiblePoint
|
||||
@ -92,7 +92,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "outside" << endl;
|
||||
}
|
||||
|
||||
const scalar scaling = args.optionLookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaling = args.lookupOrDefault<scalar>("scale", -1);
|
||||
if (scaling > 0)
|
||||
{
|
||||
Info<< "Input scaling: " << scaling << nl;
|
||||
|
||||
@ -65,10 +65,10 @@ int main(int argc, char *argv[])
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName surfFileName = args[1];
|
||||
const scalar mergeTol = args.argRead<scalar>(2);
|
||||
const scalar mergeTol = args.read<scalar>(2);
|
||||
const fileName outFileName = args[3];
|
||||
|
||||
const scalar scaling = args.optionLookupOrDefault<scalar>("scale", -1);
|
||||
const scalar scaling = args.lookupOrDefault<scalar>("scale", -1);
|
||||
|
||||
Info<< "Reading surface from " << surfFileName << " ..." << nl
|
||||
<< "Merging points within " << mergeTol << " metre." << nl;
|
||||
|
||||
@ -130,7 +130,7 @@ int main(int argc, char *argv[])
|
||||
<< "Using distribution method "
|
||||
<< distTypeName << nl << endl;
|
||||
|
||||
const bool keepNonMapped = args.optionFound("keepNonMapped");
|
||||
const bool keepNonMapped = args.found("keepNonMapped");
|
||||
|
||||
if (keepNonMapped)
|
||||
{
|
||||
@ -160,7 +160,7 @@ int main(int argc, char *argv[])
|
||||
if (distType == distributedTriSurfaceMesh::INDEPENDENT)
|
||||
{
|
||||
fileName decompDictFile;
|
||||
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
||||
args.readIfPresent("decomposeParDict", decompDictFile);
|
||||
|
||||
// A demand-driven decompositionMethod can have issues finding
|
||||
// an alternative decomposeParDict location.
|
||||
|
||||
@ -687,7 +687,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const fileName inSurfName = args[1];
|
||||
const fileName outSurfName = args[2];
|
||||
const bool debug = args.optionFound("debug");
|
||||
const bool debug = args.found("debug");
|
||||
|
||||
Info<< "Reading surface from " << inSurfName << endl;
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Reading surface from " << surfName << " ..." << endl;
|
||||
|
||||
word setName;
|
||||
const bool readSet = args.optionReadIfPresent("faceSet", setName);
|
||||
const bool readSet = args.readIfPresent("faceSet", setName);
|
||||
|
||||
if (readSet)
|
||||
{
|
||||
@ -211,7 +211,7 @@ int main(int argc, char *argv[])
|
||||
<< " triangle ..." << endl;
|
||||
}
|
||||
|
||||
const scalar searchTol = args.optionLookupOrDefault("tol", 1e-3);
|
||||
const scalar searchTol = args.lookupOrDefault("tol", 1e-3);
|
||||
|
||||
// Get search box. Anything not within this box will not be considered.
|
||||
const boundBox& meshBb = mesh.bounds();
|
||||
|
||||
@ -125,11 +125,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)
|
||||
@ -154,7 +154,7 @@ int main(int argc, char *argv[])
|
||||
pointField points(surf1.points());
|
||||
|
||||
vector v;
|
||||
if (args.optionReadIfPresent("translate", v))
|
||||
if (args.readIfPresent("translate", v))
|
||||
{
|
||||
Info<< "Translating points by " << v << endl;
|
||||
|
||||
@ -162,18 +162,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]);
|
||||
@ -184,11 +184,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
points = transform(rotT, points);
|
||||
}
|
||||
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
|
||||
@ -204,7 +204,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Rotating points by quaternion " << quat << endl;
|
||||
points = transform(quat, points);
|
||||
}
|
||||
else if (args.optionReadIfPresent("rollPitchYaw", v))
|
||||
else if (args.readIfPresent("rollPitchYaw", v))
|
||||
{
|
||||
Info<< "Rotating points by" << nl
|
||||
<< " roll " << v.x() << nl
|
||||
@ -219,7 +219,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Rotating points by quaternion " << quat << endl;
|
||||
points = transform(quat, points);
|
||||
}
|
||||
else if (args.optionReadIfPresent("yawPitchRoll", v))
|
||||
else if (args.readIfPresent("yawPitchRoll", v))
|
||||
{
|
||||
Info<< "Rotating points by" << nl
|
||||
<< " yaw " << v.x() << nl
|
||||
@ -235,10 +235,10 @@ int main(int argc, char *argv[])
|
||||
points = transform(quat, points);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user