From 20ca801a3ac0b35064ad92a3aa5482c24e70c3f4 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Fri, 31 May 2019 18:48:28 +0200 Subject: [PATCH] STYLE: avoid deprecated argList methods --- utilities/FMSToSurface/FMSToSurface.C | 4 +- .../generateBoundaryLayers.C | 2 +- .../improveMeshQuality/improveMeshQuality.C | 10 ++-- .../mergeSurfacePatches/mergeSurfacePatches.C | 46 ++++++++----------- utilities/scaleMesh/scaleMesh.C | 3 +- utilities/scaleSurfaceMesh/scaleSurfaceMesh.C | 3 +- .../surfaceFeatureEdges/surfaceFeatureEdges.C | 2 +- utilities/surfaceToFMS/surfaceToFMS.C | 3 +- 8 files changed, 33 insertions(+), 40 deletions(-) diff --git a/utilities/FMSToSurface/FMSToSurface.C b/utilities/FMSToSurface/FMSToSurface.C index 9692da4d..cee66fb3 100644 --- a/utilities/FMSToSurface/FMSToSurface.C +++ b/utilities/FMSToSurface/FMSToSurface.C @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) origSurf.writeSurface(outFileName); // export surface subsets as separate surface meshes - if (args.optionFound("exportSubsets")) + if (args.found("exportSubsets")) { DynList<label> subsetIDs; origSurf.facetSubsetIndices(subsetIDs); @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) } } - if (args.optionFound("exportFeatureEdges")) + if (args.found("exportFeatureEdges")) { fileName fName = outFileNoExt+"_featureEdges"; fName += ".vtk"; diff --git a/utilities/generateBoundaryLayers/generateBoundaryLayers.C b/utilities/generateBoundaryLayers/generateBoundaryLayers.C index dcdf2c21..fbd843f5 100644 --- a/utilities/generateBoundaryLayers/generateBoundaryLayers.C +++ b/utilities/generateBoundaryLayers/generateBoundaryLayers.C @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) polyMeshGen pmg(runTime); pmg.read(); - const bool is2DLayer = args.optionFound("2DLayers"); + const bool is2DLayer = args.found("2DLayers"); // generate the initial boundary layer generateLayer(pmg, meshDict, is2DLayer); diff --git a/utilities/improveMeshQuality/improveMeshQuality.C b/utilities/improveMeshQuality/improveMeshQuality.C index badfd144..1d301022 100644 --- a/utilities/improveMeshQuality/improveMeshQuality.C +++ b/utilities/improveMeshQuality/improveMeshQuality.C @@ -64,31 +64,31 @@ int main(int argc, char *argv[]) // Read the settings - if (!args.optionReadIfPresent("nLoops", nLoops)) + if (!args.readIfPresent("nLoops", nLoops)) { Info<< "Default number of loops is " << nLoops << endl; } - if (!args.optionReadIfPresent("nIterations", nIterations)) + if (!args.readIfPresent("nIterations", nIterations)) { Info<< "Default number of iterations is " << nIterations << endl; } - if (!args.optionReadIfPresent("nSurfaceIterations", nSurfaceIterations)) + if (!args.readIfPresent("nSurfaceIterations", nSurfaceIterations)) { Info<< "Default number of surface iterations is " << nSurfaceIterations << endl; } - if (!args.optionReadIfPresent("qualityThreshold", qualityThreshold)) + if (!args.readIfPresent("qualityThreshold", qualityThreshold)) { Info<< "Using default quality threshold 0.1" << endl; } word constrainedCellSet; - if (!args.optionReadIfPresent("constrainedCellSet", constrainedCellSet)) + if (!args.readIfPresent("constrainedCellSet", constrainedCellSet)) { Info<< "No constraints applied on the smoothing procedure" << endl; } diff --git a/utilities/mergeSurfacePatches/mergeSurfacePatches.C b/utilities/mergeSurfacePatches/mergeSurfacePatches.C index 22d7caf2..d4898012 100644 --- a/utilities/mergeSurfacePatches/mergeSurfacePatches.C +++ b/utilities/mergeSurfacePatches/mergeSurfacePatches.C @@ -69,7 +69,8 @@ void getPatchIds if (nFound != patchNames.size()) { WarningInFunction - << "Not all supplied patch names were found on the surface mesh" << endl; + << "Not all supplied patch names were found on the surface mesh" + << endl; } } @@ -321,12 +322,9 @@ int main(int argc, char *argv[]) fileName outFileName(inFileName); - if (args.optionFound("output")) - { - outFileName = args["output"]; - } + args.readIfPresent("output", outFileName); - const bool keepPatches = args.optionFound("keep"); + const bool keepPatches = args.found("keep"); // Read original surface triSurf origSurf(inFileName); @@ -334,16 +332,16 @@ int main(int argc, char *argv[]) // Get patch ids DynamicList<label> patchIds; - if (args.options().found("patchNames")) + if (args.found("patchNames")) { - if (args.optionFound("patchIds")) + if (args.found("patchIds")) { - FatalError() << "Cannot specify both patch names and ids" + FatalErrorInFunction + << "Cannot specify both patch names and ids" << nl << Foam::abort(FatalError); } - IStringStream is(args["patchNames"]); - wordList patchNames(is); + wordList patchNames(args.getList<word>("patchNames")); getPatchIds ( @@ -352,20 +350,15 @@ int main(int argc, char *argv[]) patchIds ); } - - if (args.optionFound("patchIds")) + else if (args.found("patchIds")) { - IStringStream is(args["patchIds"]); - - patchIds.append(labelList(is)); + patchIds.append(args.getList<label>("patchIds")); } - if (args.optionFound("patchIdRange")) + labelPair idRange; + if (args.readIfPresent("patchIdRange", idRange)) { - IStringStream is(args["patchIdRange"]); - Pair<label> idRange(is); - - for (label id = idRange.first(); id <= idRange.second(); id++) + for (label id = idRange.first(); id <= idRange.second(); ++id) { patchIds.append(id); } @@ -373,7 +366,8 @@ int main(int argc, char *argv[]) if (!patchIds.size()) { - FatalError() << "No patches specified" + FatalErrorInFunction + << "No patches specified" << nl << Foam::abort(FatalError); } @@ -389,11 +383,11 @@ int main(int argc, char *argv[]) // Write new surface mesh newSurf->writeSurface(outFileName); - Info<< "Original surface patches: " << origSurf.patches().size() << endl; - Info<< "Final surface patches: " << newSurf->patches().size() << endl; - Info<< "Surface written to " << outFileName << endl; + Info<< "Original surface patches: " << origSurf.patches().size() << nl + << "Final surface patches: " << newSurf->patches().size() << nl + << "Surface written to " << outFileName << endl; - Info<< "End\n" << endl; + Info<< "\nEnd\n" << endl; return 0; } diff --git a/utilities/scaleMesh/scaleMesh.C b/utilities/scaleMesh/scaleMesh.C index c496c603..9d4903b4 100644 --- a/utilities/scaleMesh/scaleMesh.C +++ b/utilities/scaleMesh/scaleMesh.C @@ -48,8 +48,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - // const scalar scalingFactor(readScalar(args[1])); - const scalar scalingFactor(args.argRead<scalar>(1)); + const scalar scalingFactor(args.get<scalar>(1)); Info<< "Scaling mesh vertices by a factor " << scalingFactor << endl; diff --git a/utilities/scaleSurfaceMesh/scaleSurfaceMesh.C b/utilities/scaleSurfaceMesh/scaleSurfaceMesh.C index a71ebc5f..000339b9 100644 --- a/utilities/scaleSurfaceMesh/scaleSurfaceMesh.C +++ b/utilities/scaleSurfaceMesh/scaleSurfaceMesh.C @@ -54,8 +54,7 @@ int main(int argc, char *argv[]) const fileName inFileName(args[1]); const fileName outFileName(args[2]); - // const scalar scalingFactor(readScalar(args[3])); - const scalar scalingFactor(args.argRead<scalar>(3)); + const scalar scalingFactor(args.get<scalar>(3)); // read the surface mesh triSurf surface(inFileName); diff --git a/utilities/surfaceFeatureEdges/surfaceFeatureEdges.C b/utilities/surfaceFeatureEdges/surfaceFeatureEdges.C index 079144fd..acbd7d36 100644 --- a/utilities/surfaceFeatureEdges/surfaceFeatureEdges.C +++ b/utilities/surfaceFeatureEdges/surfaceFeatureEdges.C @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) } scalar tol(45.0); - if (!args.optionReadIfPresent("angle", tol)) + if (!args.readIfPresent("angle", tol)) { Info<< "Using 45 deg as default angle!" << endl; } diff --git a/utilities/surfaceToFMS/surfaceToFMS.C b/utilities/surfaceToFMS/surfaceToFMS.C index a705a42e..e738a67a 100644 --- a/utilities/surfaceToFMS/surfaceToFMS.C +++ b/utilities/surfaceToFMS/surfaceToFMS.C @@ -52,7 +52,8 @@ int main(int argc, char *argv[]) const fileName inFileName(args[1]); if (inFileName.ext() == "fms") { - FatalError << "trying to convert a fms file to itself" + FatalErrorInFunction + << "trying to convert a fms file to itself" << nl << exit(FatalError); } -- GitLab