STYLE: use newer argList access methods

This commit is contained in:
Mark Olesen
2018-07-19 08:32:18 +02:00
parent 712f49758a
commit 8042647610
4 changed files with 24 additions and 23 deletions

View File

@ -93,7 +93,7 @@ int main(int argc, char *argv[])
Info<< nl << "Specify an option! " << nl << endl; Info<< nl << "Specify an option! " << nl << endl;
} }
if (args.optionFound("labelListList")) if (args.found("labelListList"))
{ {
for (label argi=1; argi < args.size(); ++argi) for (label argi=1; argi < args.size(); ++argi)
{ {

View File

@ -360,10 +360,9 @@ int main(int argc, char *argv[])
const fileName surfFileName = args[1]; const fileName surfFileName = args[1];
const bool checkSelfIntersect = args.found("checkSelfIntersection"); const bool checkSelfIntersect = args.found("checkSelfIntersection");
const bool splitNonManifold = args.found("splitNonManifold"); const bool splitNonManifold = args.found("splitNonManifold");
const label outputThreshold = const label outputThreshold = args.lookupOrDefault("outputThreshold", 10);
args.lookupOrDefault("outputThreshold", 10);
word surfaceFormat; word surfaceFormat;
const bool writeSets = args.optionReadIfPresent("writeSets", surfaceFormat); const bool writeSets = args.readIfPresent("writeSets", surfaceFormat);
autoPtr<surfaceWriter> surfWriter; autoPtr<surfaceWriter> surfWriter;
word edgeFormat; word edgeFormat;

View File

@ -1,6 +1,6 @@
Foam::autoPtr<Foam::fvMesh> meshPtr(nullptr); Foam::autoPtr<Foam::fvMesh> meshPtr(nullptr);
if (args.optionFound("dry-run") || args.optionFound("dry-run-write")) if (args.found("dry-run") || args.found("dry-run-write"))
{ {
Foam::Info Foam::Info
<< "Operating in 'dry-run' mode: case will run for 1 time step. " << "Operating in 'dry-run' mode: case will run for 1 time step. "
@ -11,18 +11,19 @@ if (args.optionFound("dry-run") || args.optionFound("dry-run-write"))
// Create a simplified 1D mesh and attempt to re-create boundary conditions // Create a simplified 1D mesh and attempt to re-create boundary conditions
meshPtr.reset(new Foam::simplifiedMeshes::columnFvMesh(runTime)); meshPtr.reset(new Foam::simplifiedMeshes::columnFvMesh(runTime));
// Stopping after 1 iteration of the simplified mesh // Stop after 1 iteration of the simplified mesh
// Note: using saNoWriteNow will only trigger the function object execute
// function and not the write function
runTime.stopAt(Foam::Time::saNoWriteNow);
if (args.optionFound("dry-run-write")) if (args.found("dry-run-write"))
{ {
// Stopping after 1 iteration of the simplified mesh // Using saWriteNow triggers function objects execute(), write()
// Note: using saWriteNow to trigger writing/execution of function
// objects
runTime.stopAt(Foam::Time::saWriteNow); runTime.stopAt(Foam::Time::saWriteNow);
} }
else
{
// Using saNoWriteNow triggers function objects execute(),
// but not write()
runTime.stopAt(Foam::Time::saNoWriteNow);
}
Foam::functionObject::outputPrefix = "postProcessing-dry-run"; Foam::functionObject::outputPrefix = "postProcessing-dry-run";
} }

View File

@ -95,26 +95,27 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New
const Time& runTime const Time& runTime
) )
{ {
if (args.optionFound("dry-run") || args.optionFound("dry-run-write")) if (args.found("dry-run") || args.found("dry-run-write"))
{ {
Info Info
<< "Operating in 'dry-run' mode: case will run for 1 time step. " << "Operating in 'dry-run' mode: case will run for 1 time step. "
<< "All checks assumed OK on a clean exit" << Foam::endl; << "All checks assumed OK on a clean exit" << endl;
FieldBase::allowConstructFromLargerSize = true; FieldBase::allowConstructFromLargerSize = true;
// Stopping after 1 iteration of the simplified mesh // Stop after 1 iteration of the simplified mesh
// Note: using saNoWriteNow will only trigger the function object execute
// function and not the write function
runTime.stopAt(Foam::Time::saNoWriteNow);
if (args.optionFound("dry-run-write")) if (args.found("dry-run-write"))
{ {
// Stopping after 1 iteration of the simplified mesh // Using saWriteNow triggers function objects execute(), write()
// Note: using saWriteNow to trigger writing/execution of function
// objects
runTime.stopAt(Foam::Time::saWriteNow); runTime.stopAt(Foam::Time::saWriteNow);
} }
else
{
// Using saNoWriteNow triggers function objects execute(),
// but not write()
runTime.stopAt(Foam::Time::saNoWriteNow);
}
functionObject::outputPrefix = "postProcessing-dry-run"; functionObject::outputPrefix = "postProcessing-dry-run";