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

@ -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)
{