From b060378dca689544307c13f2a285182681be397a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 12 Apr 2021 22:56:20 +0200 Subject: [PATCH] ENH: improve consistency of fileName handling windows/non-windows (#2057) - wrap command-line retrieval of fileName with an implicit validate. Instead of this: fileName input(args[1]); fileName other(args["someopt"]); Now use this: auto input = args.get(1); auto other = args.get("someopt"); which adds a fileName::validate on the inputs Because of how it is implemented, it will automatically also apply to argList getOrDefault, readIfPresent etc. - adjust fileName::validate and clean to handle backslash conversion. This makes it easier to ensure that path names arising from MS-Windows are consistently handled internally. - dictionarySearch: now check for initial '/' directly instead of relying on fileName isAbsolute(), which now does more things BREAKING: remove fileName::clean() const method - relying on const/non-const to control the behaviour (inplace change or return a copy) is too fragile and the const version was almost never used. Replace: fileName sanitized = constPath.clean(); With: fileName sanitized(constPath); sanitized.clean()); STYLE: test empty() instead of comparing with fileName::null --- applications/test/List3/Test-List3.C | 6 +- .../test/PackedList/Test-PackedList.C | 5 +- .../Test-checkDecomposePar.C | 5 +- .../test/codeStream/Test-codeStream.C | 5 +- .../coordinateSystem/Test-coordinateSystem.C | 6 +- applications/test/copyFile/Test-copyFile.C | 6 +- .../Test-decomposedBlockData.C | 3 +- .../test/dictionary/Test-dictionary.C | 5 +- .../test/dictionaryCopy/Test-dictionaryCopy.C | 2 +- .../dictionaryTokens/Test-dictionaryTokens.C | 4 +- .../test/dynamicLibrary/Test-dynamicLibrary.C | 4 +- applications/test/exprEntry/Test-exprEntry.C | 4 +- applications/test/fileName/Test-fileName.C | 4 +- .../test/fileNameClean/Test-fileNameClean.C | 18 +- .../test/fstreamPointer/Test-fstreamPointer.C | 4 +- applications/test/mvBak/Test-mvBak.C | 5 +- .../test/plotFunction1/Test-plotFunction1.C | 4 +- applications/test/regex1/Test-regex1.C | 2 +- applications/test/spline/Test-spline.C | 6 +- .../Test-surfaceIntersection.C | 6 +- .../test/surfaceReading/Test-surfaceReading.C | 4 +- .../test/surfaceWriter/Test-surfaceWriter.C | 6 +- .../vtkSeriesWriter/Test-vtkSeriesWriter.C | 4 +- .../mesh/conversion/ansysToFoam/ansysToFoam.L | 4 +- .../mesh/conversion/ccm/ccmToFoam/ccmToFoam.C | 4 +- .../mesh/conversion/cfx4ToFoam/cfx4ToFoam.C | 4 +- .../mesh/conversion/datToFoam/datToFoam.C | 2 +- .../mesh/conversion/fireToFoam/fireToFoam.C | 4 +- .../fluent3DMeshToFoam/fluent3DMeshToFoam.L | 2 +- .../fluentMeshToFoam/fluentMeshToFoam.L | 4 +- .../conversion/foamToSurface/foamToSurface.C | 4 +- .../conversion/gambitToFoam/gambitToFoam.L | 4 +- .../mesh/conversion/gmshToFoam/gmshToFoam.C | 4 +- .../ideasUnvToFoam/ideasUnvToFoam.C | 2 +- .../mesh/conversion/mshToFoam/mshToFoam.C | 3 +- .../netgenNeutralToFoam/netgenNeutralToFoam.C | 4 +- .../conversion/plot3dToFoam/plot3dToFoam.C | 4 +- .../mesh/conversion/star4ToFoam/star4ToFoam.C | 4 +- .../conversion/tetgenToFoam/tetgenToFoam.C | 4 +- .../vtkUnstructuredToFoam.C | 3 +- .../conformalVoronoiMesh.C | 6 +- .../foamyHexMeshSurfaceSimplify.C | 4 +- .../foamyHexMeshSurfaceSimplify_non_octree.C | 6 +- .../foamyMesh/foamyQuadMesh/foamyQuadMesh.C | 3 +- .../generation/snappyHexMesh/snappyHexMesh.C | 2 +- .../mesh/manipulation/checkMesh/checkTools.C | 6 +- .../manipulation/insideCells/insideCells.C | 6 +- .../manipulation/mergeMeshes/mergeMeshes.C | 10 +- .../mesh/manipulation/objToVTK/objToVTK.C | 6 +- .../mesh/manipulation/setSet/setSet.C | 4 +- .../foamDictionary/foamDictionary.C | 4 +- .../foamHasLibrary/foamHasLibrary.C | 4 +- .../dataConversion/smapToFoam/smapToFoam.C | 2 +- .../lumpedPointMovement/lumpedPointMovement.C | 4 +- .../preProcessing/mapFields/mapFields.C | 4 +- .../preProcessing/mapFieldsPar/mapFieldsPar.C | 4 +- .../utilities/surface/surfaceAdd/surfaceAdd.C | 12 +- .../surface/surfaceCheck/surfaceCheck.C | 4 +- .../surface/surfaceClean/surfaceClean.C | 10 +- .../surface/surfaceCoarsen/surfaceCoarsen.C | 8 +- .../surface/surfaceConvert/surfaceConvert.C | 6 +- .../surfaceFeatureConvert.C | 6 +- .../surface/surfaceFind/surfaceFind.C | 4 +- .../surface/surfaceInertia/surfaceInertia.C | 4 +- .../surface/surfaceInflate/surfaceInflate.C | 12 +- .../surfaceLambdaMuSmooth.C | 14 +- .../surfaceMeshConvert/surfaceMeshConvert.C | 6 +- .../surfaceMeshExport/surfaceMeshExport.C | 6 +- .../surfaceMeshExtract/surfaceMeshExtract.C | 4 +- .../surfaceMeshImport/surfaceMeshImport.C | 6 +- .../surface/surfaceMeshInfo/surfaceMeshInfo.C | 4 +- .../surface/surfaceOrient/surfaceOrient.C | 8 +- .../surfacePointMerge/surfacePointMerge.C | 8 +- .../surfaceRedistributePar.C | 4 +- .../surfaceRefineRedGreen.C | 6 +- .../surfaceSplitByPatch/surfaceSplitByPatch.C | 4 +- .../surfaceSplitByTopology.C | 9 +- .../surfaceSplitNonManifolds.C | 6 +- .../surface/surfaceSubset/surfaceSubset.C | 12 +- .../surface/surfaceToPatch/surfaceToPatch.C | 4 +- .../surfaceTransformPoints.C | 6 +- .../adiabaticFlameT/adiabaticFlameT.C | 3 +- .../chemkinToFoam/chemkinToFoam.C | 14 +- .../equilibriumFlameT/equilibriumFlameT.C | 3 +- .../mixtureAdiabaticFlameT.C | 3 +- src/OpenFOAM/db/IOobject/IOobject.C | 4 +- src/OpenFOAM/db/dictionary/dictionarySearch.C | 28 +- .../db/functionObjects/writeFile/writeFile.C | 3 +- src/OpenFOAM/global/argList/argList.C | 5 +- src/OpenFOAM/global/argList/argList.H | 4 +- src/OpenFOAM/global/argList/argListI.H | 6 +- .../primitives/strings/fileName/fileName.C | 270 +++++++++--------- .../primitives/strings/fileName/fileName.H | 71 ++--- .../primitives/strings/fileName/fileNameI.H | 26 +- .../averageNeighbourFvGeometryScheme.C | 4 +- .../field/externalCoupled/externalCoupled.C | 8 +- .../lagrangian/dataCloud/dataCloud.C | 2 +- .../lagrangian/vtkCloud/vtkCloud.C | 2 +- src/functionObjects/utilities/abort/abort.C | 9 +- .../utilities/ensightWrite/ensightWrite.C | 2 +- .../utilities/vtkWrite/vtkWrite.C | 2 +- .../rotorDiskSource/bladeModel/bladeModel.C | 6 +- .../profileModel/profileModel.C | 4 +- .../meshRefinement/meshRefinement.C | 6 +- src/meshTools/coupling/externalFileCoupler.C | 6 +- .../mappedPolyPatch/mappedPatchBase.C | 11 +- src/sampling/probes/probes.C | 3 +- .../sampledSet/shortestPath/shortestPathSet.C | 4 +- .../chemkinReader/chemkinReader.C | 4 +- 109 files changed, 483 insertions(+), 456 deletions(-) diff --git a/applications/test/List3/Test-List3.C b/applications/test/List3/Test-List3.C index 6855008211..e23b36579b 100644 --- a/applications/test/List3/Test-List3.C +++ b/applications/test/List3/Test-List3.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -101,7 +101,7 @@ int main(int argc, char *argv[]) { if (true) { - IFstream is(args[argi]); + IFstream is(args.get(argi)); Info<< nl << nl << "read from " << is.name() << nl << endl; @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) if (true) { - IFstream is(args[argi]); + IFstream is(args.get(argi)); Info<< nl << nl << "read from " << is.name() << nl << endl; diff --git a/applications/test/PackedList/Test-PackedList.C b/applications/test/PackedList/Test-PackedList.C index b6f5582a83..771be2a355 100644 --- a/applications/test/PackedList/Test-PackedList.C +++ b/applications/test/PackedList/Test-PackedList.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -125,9 +126,9 @@ int main(int argc, char *argv[]) } - for (label argI=1; argI < args.size(); ++argI) + for (label argi=1; argi < args.size(); ++argi) { - const string& srcFile = args[argI]; + const auto srcFile = args.get(argi); Info<< nl << "reading " << srcFile << nl; IFstream ifs(srcFile); diff --git a/applications/test/checkDecomposePar/Test-checkDecomposePar.C b/applications/test/checkDecomposePar/Test-checkDecomposePar.C index 805b57b9ec..41e46a9cf6 100644 --- a/applications/test/checkDecomposePar/Test-checkDecomposePar.C +++ b/applications/test/checkDecomposePar/Test-checkDecomposePar.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -74,8 +74,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" - const fileName decompFile = args[1]; - + const auto decompFile = args.get(1); const bool region = args.found("region"); const bool allRegions = args.found("allRegions"); const bool verbose = args.found("verbose"); diff --git a/applications/test/codeStream/Test-codeStream.C b/applications/test/codeStream/Test-codeStream.C index fc3b656436..49b04ac2f1 100644 --- a/applications/test/codeStream/Test-codeStream.C +++ b/applications/test/codeStream/Test-codeStream.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,9 +60,9 @@ int main(int argc, char *argv[]) else { IOobject::writeDivider(Info); - for (label argI=1; argI < args.size(); ++argI) + for (label argi=1; argi < args.size(); ++argi) { - const string& dictFile = args[argI]; + const auto dictFile = args.get(argi); IFstream is(dictFile); dictionary dict(is); diff --git a/applications/test/coordinateSystem/Test-coordinateSystem.C b/applications/test/coordinateSystem/Test-coordinateSystem.C index 402038e6a9..7931a97abf 100644 --- a/applications/test/coordinateSystem/Test-coordinateSystem.C +++ b/applications/test/coordinateSystem/Test-coordinateSystem.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) for (label argi=1; argi < args.size(); ++argi) { - const string& dictFile = args[argi]; + const auto dictFile = args.get(argi); IFstream is(dictFile); dictionary inputDict(is); @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) { for (label argi=1; argi < args.size(); ++argi) { - const string& dictFile = args[argi]; + const auto dictFile = args.get(argi); IFstream is(dictFile); dictionary inputDict(is); diff --git a/applications/test/copyFile/Test-copyFile.C b/applications/test/copyFile/Test-copyFile.C index c3be05dc13..616aefc410 100644 --- a/applications/test/copyFile/Test-copyFile.C +++ b/applications/test/copyFile/Test-copyFile.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -135,8 +135,8 @@ int main(int argc, char *argv[]) args.readIfPresent("maxPath", maxPath); #endif - const fileName srcFile(fileName::validate(args[1])); - const fileName dstFile(fileName::validate(args[2])); + const auto srcFile = args.get(1); + const auto dstFile = args.get(2); const fileName tmpFile(dstFile + Foam::name(pid())); Info<< "src : " << srcFile << nl diff --git a/applications/test/decomposedBlockData/Test-decomposedBlockData.C b/applications/test/decomposedBlockData/Test-decomposedBlockData.C index 9edc26ee7e..2402055210 100644 --- a/applications/test/decomposedBlockData/Test-decomposedBlockData.C +++ b/applications/test/decomposedBlockData/Test-decomposedBlockData.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,7 +55,7 @@ int main(int argc, char *argv[]) #include "createTime.H" - const fileName file(args[1]); + const auto file = args.get(1); Info<< "Reading " << file << nl << endl; decomposedBlockData data diff --git a/applications/test/dictionary/Test-dictionary.C b/applications/test/dictionary/Test-dictionary.C index 5e12dbd7ef..1c5c7a30e1 100644 --- a/applications/test/dictionary/Test-dictionary.C +++ b/applications/test/dictionary/Test-dictionary.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2012 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -123,9 +124,9 @@ int main(int argc, char *argv[]) else { IOobject::writeDivider(Info); - for (label argI=1; argI < args.size(); ++argI) + for (label argi=1; argi < args.size(); ++argi) { - const string& dictFile = args[argI]; + const auto dictFile = args.get(argi); IFstream is(dictFile); dictionary dict(is); diff --git a/applications/test/dictionaryCopy/Test-dictionaryCopy.C b/applications/test/dictionaryCopy/Test-dictionaryCopy.C index 264c88e3e8..4ab58d3a0a 100644 --- a/applications/test/dictionaryCopy/Test-dictionaryCopy.C +++ b/applications/test/dictionaryCopy/Test-dictionaryCopy.C @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) for (label argi=1; argi < args.size(); ++argi) { - const string& dictFile = args[argi]; + const auto dictFile = args.get(argi); IFstream is(dictFile); dictionary input(is); diff --git a/applications/test/dictionaryTokens/Test-dictionaryTokens.C b/applications/test/dictionaryTokens/Test-dictionaryTokens.C index 3760124cab..1b8967b763 100644 --- a/applications/test/dictionaryTokens/Test-dictionaryTokens.C +++ b/applications/test/dictionaryTokens/Test-dictionaryTokens.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) for (label argi=1; argi < args.size(); ++argi) { - IFstream is(args[argi]); + IFstream is(args.get(argi)); dictionary dict(is); diff --git a/applications/test/dynamicLibrary/Test-dynamicLibrary.C b/applications/test/dynamicLibrary/Test-dynamicLibrary.C index ee7009b961..0e878a5616 100644 --- a/applications/test/dynamicLibrary/Test-dynamicLibrary.C +++ b/applications/test/dynamicLibrary/Test-dynamicLibrary.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) for (int argi = 1; argi < args.size(); ++argi) { - const fileName libName(fileName::validate(args[argi])); + const auto libName = args.get(argi); if (libName.empty()) { diff --git a/applications/test/exprEntry/Test-exprEntry.C b/applications/test/exprEntry/Test-exprEntry.C index e5b76da7b7..1f14bbf45a 100644 --- a/applications/test/exprEntry/Test-exprEntry.C +++ b/applications/test/exprEntry/Test-exprEntry.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) { IOobject::writeDivider(Info); - IFstream is(args[argi]); + IFstream is(args.get(argi)); const dictionary dict(is); diff --git a/applications/test/fileName/Test-fileName.C b/applications/test/fileName/Test-fileName.C index 5c368dbdfb..c6bdd486df 100644 --- a/applications/test/fileName/Test-fileName.C +++ b/applications/test/fileName/Test-fileName.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2017 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -60,7 +60,7 @@ unsigned testClean(std::initializer_list> tests) const std::string& expected = test.second(); fileName cleaned(test.first()); - cleaned.clean(); + cleaned.clean(); // Remove unneeded ".." if (cleaned == expected) { diff --git a/applications/test/fileNameClean/Test-fileNameClean.C b/applications/test/fileNameClean/Test-fileNameClean.C index f368778a44..b6a23325ce 100644 --- a/applications/test/fileNameClean/Test-fileNameClean.C +++ b/applications/test/fileNameClean/Test-fileNameClean.C @@ -5,7 +5,8 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,11 +25,10 @@ License along with OpenFOAM. If not, see . Application - fileNameCleanTest + Test-fileNameClean Description - \*---------------------------------------------------------------------------*/ #include "argList.H" @@ -51,7 +51,7 @@ void printCleaning(fileName& pathName) Info<< "components = " << flatOutput(pathName.components()) << nl; Info<< "component 2 = " << pathName.component(2) << nl; - pathName.clean(); + pathName.clean(); // Remove unneeded ".." Info<< "cleaned = " << pathName << nl << " path() = " << pathName.path() << nl @@ -94,9 +94,15 @@ int main(int argc, char *argv[]) printCleaning(pathName); } - for (label argI=1; argI < args.size(); ++argI) + for (label argi=1; argi < args.size(); ++argi) { - pathName = args[argI]; + fileName fn(args[argi], false); // no strip + Info<< "Input = " << fn << nl; + fn.clean(); // Remove unneeded ".." + Info<< "cleaned = " << fn << nl; + Info<< "get = " << args.get(argi) << nl; + + pathName = fileName::validate(args[argi]); printCleaning(pathName); } diff --git a/applications/test/fstreamPointer/Test-fstreamPointer.C b/applications/test/fstreamPointer/Test-fstreamPointer.C index 6f12abd9a0..2cad909ace 100644 --- a/applications/test/fstreamPointer/Test-fstreamPointer.C +++ b/applications/test/fstreamPointer/Test-fstreamPointer.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) for (label argi = 1; argi < args.size(); ++argi) { - const fileName inputName(args[argi]); + const auto inputName = args.get(argi); InfoErr<< "input: " << inputName; diff --git a/applications/test/mvBak/Test-mvBak.C b/applications/test/mvBak/Test-mvBak.C index 9c9b6c7172..7c6ff169ff 100644 --- a/applications/test/mvBak/Test-mvBak.C +++ b/applications/test/mvBak/Test-mvBak.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,9 +54,9 @@ int main(int argc, char *argv[]) label ok = 0; - for (label argI=1; argI < args.size(); ++argI) + for (label argi=1; argi < args.size(); ++argi) { - const string& srcFile = args[argI]; + const auto srcFile = args.get(argi); if (args.found("ext")) { diff --git a/applications/test/plotFunction1/Test-plotFunction1.C b/applications/test/plotFunction1/Test-plotFunction1.C index 9ddc5cc024..99bc8769a8 100644 --- a/applications/test/plotFunction1/Test-plotFunction1.C +++ b/applications/test/plotFunction1/Test-plotFunction1.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) for (label argi=1; argi < args.size(); ++argi) { - IFstream is(args[argi]); + IFstream is(args.get(argi)); dictionary dict(is); diff --git a/applications/test/regex1/Test-regex1.C b/applications/test/regex1/Test-regex1.C index b84d7d00a3..9f917355a9 100644 --- a/applications/test/regex1/Test-regex1.C +++ b/applications/test/regex1/Test-regex1.C @@ -375,7 +375,7 @@ int main(int argc, char *argv[]) for (label argi = 1; argi < args.size(); ++argi) { - IFstream is(args[argi]); + IFstream is(args.get(argi)); List tests(is); Info<< "Test expressions:" << tests << endl; diff --git a/applications/test/spline/Test-spline.C b/applications/test/spline/Test-spline.C index 4d9af262dc..9785da0fdb 100644 --- a/applications/test/spline/Test-spline.C +++ b/applications/test/spline/Test-spline.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -76,9 +76,9 @@ int main(int argc, char *argv[]) useCatmullRom = true; } - for (label argI=1; argI < args.size(); ++argI) + for (label argi=1; argi < args.size(); ++argi) { - const string& srcFile = args[argI]; + const auto srcFile = args.get(argi); Info<< nl << "reading " << srcFile << nl; IFstream ifs(srcFile); diff --git a/applications/test/surfaceIntersection/Test-surfaceIntersection.C b/applications/test/surfaceIntersection/Test-surfaceIntersection.C index c3e2731b93..e0c6c218b3 100644 --- a/applications/test/surfaceIntersection/Test-surfaceIntersection.C +++ b/applications/test/surfaceIntersection/Test-surfaceIntersection.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -139,13 +139,13 @@ int main(int argc, char *argv[]) const word outputFile(args.executable() + ".obj"); - const fileName surf1Name(args[1]); + const auto surf1Name = args.get(1); triSurface surf1 = loadSurface(runTime, surf1Name, scaleFactor)(); Info<< surf1Name << " statistics:" << endl; surf1.writeStats(Info); Info<< endl; - const fileName surf2Name(args[2]); + const auto surf2Name = args.get(2); triSurface surf2 = loadSurface(runTime, surf2Name, scaleFactor)(); Info<< surf2Name << " statistics:" << endl; surf2.writeStats(Info); diff --git a/applications/test/surfaceReading/Test-surfaceReading.C b/applications/test/surfaceReading/Test-surfaceReading.C index ea6572039c..bd0c39d12b 100644 --- a/applications/test/surfaceReading/Test-surfaceReading.C +++ b/applications/test/surfaceReading/Test-surfaceReading.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" - const fileName importName = args[1]; + const auto importName = args.get(1); word ext; if (!args.readIfPresent("ext", ext)) diff --git a/applications/test/surfaceWriter/Test-surfaceWriter.C b/applications/test/surfaceWriter/Test-surfaceWriter.C index c1826f2fe1..3d8ee9cf25 100644 --- a/applications/test/surfaceWriter/Test-surfaceWriter.C +++ b/applications/test/surfaceWriter/Test-surfaceWriter.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -68,8 +68,8 @@ int main(int argc, char *argv[]) #include "setRootCase.H" - const fileName importName = args[1]; - const fileName exportName = args[2]; + const auto importName = args.get(1); + const auto exportName = args.get(2); if (importName == exportName) { diff --git a/applications/test/vtkSeriesWriter/Test-vtkSeriesWriter.C b/applications/test/vtkSeriesWriter/Test-vtkSeriesWriter.C index 1cc4ad3026..c01b249f73 100644 --- a/applications/test/vtkSeriesWriter/Test-vtkSeriesWriter.C +++ b/applications/test/vtkSeriesWriter/Test-vtkSeriesWriter.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) for (label argi=1; argi < args.size(); ++argi) { - const auto& input = args[argi]; + const auto input = args.get(argi); Info << "load from " << input << nl; diff --git a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L index cafcdf67ad..66cb8534a5 100644 --- a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L +++ b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -327,7 +327,7 @@ int main(int argc, char *argv[]) #include "createTime.H" - const fileName ansysFile(args[1]); + const auto ansysFile = args.get(1); std::ifstream ansysStream(ansysFile); if (!ansysStream) diff --git a/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C b/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C index 14855f0931..876a6d59be 100644 --- a/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C +++ b/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -225,7 +225,7 @@ int main(int argc, char *argv[]) } // CCM reader for reading geometry/solution - ccm::reader reader(args[1], rOpts); + ccm::reader reader(args.get(1), rOpts); // list the geometry information if (optList) diff --git a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C index 903767ab43..3039c16a56 100644 --- a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C +++ b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) #include "createTime.H" - IFstream cfxFile(args[1]); + IFstream cfxFile(args.get(1)); // Read the cfx information using a fixed format reader. // Comments in the file are in C++ style, so the stream parser will remove diff --git a/applications/utilities/mesh/conversion/datToFoam/datToFoam.C b/applications/utilities/mesh/conversion/datToFoam/datToFoam.C index 2e3dd0d452..8a526ab5cf 100644 --- a/applications/utilities/mesh/conversion/datToFoam/datToFoam.C +++ b/applications/utilities/mesh/conversion/datToFoam/datToFoam.C @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) #include "createTime.H" - std::ifstream plot3dFile(args[1]); + std::ifstream plot3dFile(args.get(1)); string line; std::getline(plot3dFile, line); diff --git a/applications/utilities/mesh/conversion/fireToFoam/fireToFoam.C b/applications/utilities/mesh/conversion/fireToFoam/fireToFoam.C index 021907f096..b3809ff160 100644 --- a/applications/utilities/mesh/conversion/fireToFoam/fireToFoam.C +++ b/applications/utilities/mesh/conversion/fireToFoam/fireToFoam.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) fileFormats::FIREMeshReader reader ( - args[1], + args.get(1), // Default no scaling args.getOrDefault("scale", 1) ); diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L index 066da1368a..98d751ee0d 100644 --- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L @@ -835,7 +835,7 @@ int main(int argc, char *argv[]) #include "createTime.H" - const fileName fluentFile = args[1]; + const auto fluentFile = args.get(1); IFstream fluentStream(fluentFile); if (!fluentStream) diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L index 8623da54ec..8d70aa39f9 100644 --- a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -912,7 +912,7 @@ int main(int argc, char *argv[]) #include "createTime.H" - const fileName fluentFile = args[1]; + const auto fluentFile = args.get(1); std::ifstream fluentStream(fluentFile); if (!fluentStream) diff --git a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C index 17703601d8..53b359a2f2 100644 --- a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C +++ b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" - fileName exportName = args[1]; + auto exportName = args.get(1); const scalar scaleFactor = args.getOrDefault("scale", 0); const bool doTriangulate = args.found("tri"); diff --git a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L index cbd4172c75..f8a226a635 100644 --- a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L +++ b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -653,7 +653,7 @@ int main(int argc, char *argv[]) #include "createTime.H" - const fileName gambitFile = args[1]; + const auto gambitFile = args.get(1); std::ifstream gambitStream(gambitFile); if (!gambitStream) diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C index 02a17f4235..b7e6909ff2 100644 --- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C +++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1325,7 +1325,7 @@ int main(int argc, char *argv[]) } const bool keepOrientation = args.found("keepOrientation"); - IFstream inFile(args[1]); + IFstream inFile(args.get(1)); // Storage for points pointField points; diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C index 6c2d2188b6..4c3fe7cc47 100644 --- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C +++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C @@ -666,7 +666,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - const fileName ideasName = args[1]; + const auto ideasName = args.get(1); IFstream inFile(ideasName); if (!inFile.good()) diff --git a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C index 20088ce4ca..1bfa8f7183 100644 --- a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C +++ b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -77,7 +78,7 @@ int main(int argc, char *argv[]) #include "createTime.H" const bool readHex = args.found("hex"); - IFstream mshStream(args[1]); + IFstream mshStream(args.get(1)); label nCells; mshStream >> nCells; diff --git a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C index cbae422f00..81e0280d22 100644 --- a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C +++ b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - IFstream str(args[1]); + IFstream str(args.get(1)); // // Read nodes. diff --git a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C index 78e8381bb6..1a95f8fec2 100644 --- a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C +++ b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) #include "createTime.H" - IFstream plot3dFile(args[1]); + IFstream plot3dFile(args.get(1)); // Read the plot3d information using a fixed format reader. // Comments in the file are in C++ style, so the stream parser will remove diff --git a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C index 24a6c28f70..b48f1b6bd0 100644 --- a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C +++ b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) // Remove extensions and/or trailing '.' - const fileName prefix = fileName(args[1]).lessExt(); + const auto prefix = args.get(1).lessExt(); fileFormats::STARCDMeshReader reader diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C index 55ac13b40c..1d457708d8 100644 --- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C +++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - const fileName prefix = args[1]; + const auto prefix = args.get(1); const bool readFaceFile = !args.found("noFaceFile"); const fileName nodeFile(prefix + ".node"); diff --git a/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C b/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C index 377458839f..cb8f557734 100644 --- a/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C +++ b/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -65,7 +66,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - IFstream mshStream(args[1]); + IFstream mshStream(args.get(1)); vtkUnstructuredReader reader(runTime, mshStream); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 00a843e531..136967f73b 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -289,7 +289,7 @@ void Foam::conformalVoronoiMesh::insertSurfacePointPairs } } - if (foamyHexMeshControls().objOutput() && fName != fileName::null) + if (foamyHexMeshControls().objOutput() && !fName.empty()) { DelaunayMeshTools::writeOBJ(time().path()/fName, pts); } @@ -324,7 +324,7 @@ void Foam::conformalVoronoiMesh::insertEdgePointGroups } } - if (foamyHexMeshControls().objOutput() && fName != fileName::null) + if (foamyHexMeshControls().objOutput() && !fName.empty()) { DelaunayMeshTools::writeOBJ(time().path()/fName, pts); } diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C index 699c0f1a7d..2a355d70c1 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -378,7 +378,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - const fileName exportName = args[1]; + const auto exportName = args.get(1); Info<< "Reading surfaces as specified in the foamyHexMeshDict and" << " writing a re-sampled surface to " << exportName diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify_non_octree.C b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify_non_octree.C index 611bc52793..1cfd57f9e8 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify_non_octree.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify_non_octree.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -64,8 +64,8 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - const labelVector n(args.get(1)); - const fileName exportName = args[2]; + const auto n = args.get(1); + const auto exportName = args.get(2); Info<< "Reading surfaces as specified in the foamyHexMeshDict and" << " writing re-sampled " << n << " to " << exportName diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C index 82f0ab9731..919b812071 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -97,7 +98,7 @@ int main(int argc, char *argv[]) if (args.found("pointsFile")) { - mesh.insertPoints(args["pointsFile"]); + mesh.insertPoints(args.get("pointsFile")); } else { diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index b9fedffe61..1218daddde 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -541,7 +541,7 @@ void extractSurface ? runTime.globalPath()/outFileName : runTime.path()/outFileName ); - globalCasePath.clean(); + globalCasePath.clean(); // Remove unneeded ".." Info<< "Writing merged surface to " << globalCasePath << endl; diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C index e7ab6c2d17..ad29e420dc 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C @@ -306,7 +306,7 @@ void Foam::mergeAndWrite / mesh.pointsInstance() / set.name() ); - outputDir.clean(); + outputDir.clean(); // Remove unneeded ".." mergeAndWrite(mesh, writer, set.name(), setPatch, outputDir); } @@ -399,7 +399,7 @@ void Foam::mergeAndWrite / mesh.pointsInstance() / set.name() ); - outputDir.clean(); + outputDir.clean(); // Remove unneeded ".." mergeAndWrite(mesh, writer, set.name(), setPatch, outputDir); } @@ -498,7 +498,7 @@ void Foam::mergeAndWrite / mesh.pointsInstance() // set.name() ); - outputDir.clean(); + outputDir.clean(); // Remove unneeded ".." mkDir(outputDir); fileName outputFile(outputDir/writer.getFileName(points, wordList())); diff --git a/applications/utilities/mesh/manipulation/insideCells/insideCells.C b/applications/utilities/mesh/manipulation/insideCells/insideCells.C index a3d19eb384..07b4a629d2 100644 --- a/applications/utilities/mesh/manipulation/insideCells/insideCells.C +++ b/applications/utilities/mesh/manipulation/insideCells/insideCells.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -66,8 +66,8 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createPolyMesh.H" - const fileName surfName = args[1]; - const fileName setName = args[2]; + const auto surfName = args.get(1); + const auto setName = args.get(2); // Read surface Info<< "Reading surface from " << surfName << endl; diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C index 92b38c546b..5fa4a4f626 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C +++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,7 +45,7 @@ using namespace Foam; void getRootCase(fileName& casePath) { - casePath.clean(); + casePath.clean(); // Remove unneeded ".." if (casePath.empty() || casePath == ".") { @@ -56,7 +56,7 @@ void getRootCase(fileName& casePath) { // avoid relative cases ending in '..' - makes for very ugly names casePath = cwd()/casePath; - casePath.clean(); + casePath.clean(); // Remove unneeded ".." } } @@ -102,8 +102,8 @@ int main(int argc, char *argv[]) const bool overwrite = args.found("overwrite"); - fileName masterCase = args[1]; - fileName addCase = args[2]; + auto masterCase = args.get(1); + auto addCase = args.get(2); const word masterRegion = args.getOrDefault("masterRegion", polyMesh::defaultRegion); diff --git a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C index 8965219067..4ff92cf77a 100644 --- a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C +++ b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -123,8 +123,8 @@ int main(int argc, char *argv[]) argList::addArgument("vtk-file", "The output vtk file"); argList args(argc, argv); - const fileName objName = args[1]; - const fileName outName = args[2]; + const auto objName = args.get(1); + const auto outName = args.get(2); std::ifstream OBJfile(objName); diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index 1473bf293f..b866b07cb2 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2018 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -793,7 +793,7 @@ int main(int argc, char *argv[]) if (batch) { - const fileName batchFile = args["batch"]; + const auto batchFile = args.get("batch"); Info<< "Reading commands from file " << batchFile << endl; diff --git a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C index 97eeb2ccba..fddf9b20c2 100644 --- a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C +++ b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -373,7 +373,7 @@ int main(int argc, char *argv[]) } } - const fileName dictFileName(args[1]); + const auto dictFileName = args.get(1); autoPtr dictFile(new IFstream(dictFileName)); if (!dictFile().good()) diff --git a/applications/utilities/miscellaneous/foamHasLibrary/foamHasLibrary.C b/applications/utilities/miscellaneous/foamHasLibrary/foamHasLibrary.C index 07243cac40..398b239716 100644 --- a/applications/utilities/miscellaneous/foamHasLibrary/foamHasLibrary.C +++ b/applications/utilities/miscellaneous/foamHasLibrary/foamHasLibrary.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) for (int argi = 1; argi < args.size(); ++argi) { - const fileName libName(fileName::validate(args[argi])); + const auto libName = args.get(argi); // with validate if (libName.empty()) { diff --git a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C index af91270a9e..49bb2b1239 100644 --- a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C +++ b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) #include "createNamedMesh.H" - IFstream smapFile(args[1]); + IFstream smapFile(args.get(1)); if (!smapFile.good()) { diff --git a/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C b/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C index 1925d5d569..ef5597dcae 100644 --- a/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C +++ b/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -150,7 +150,7 @@ int main(int argc, char *argv[]) args.readIfPresent("visual-length", lumpedPointState::visLength); - const fileName responseFile(args[1]); + const auto responseFile = args.get(1); // ---------------------------------------------------------------------- // Slave mode diff --git a/applications/utilities/preProcessing/mapFields/mapFields.C b/applications/utilities/preProcessing/mapFields/mapFields.C index 9e7b984745..78645b20b4 100644 --- a/applications/utilities/preProcessing/mapFields/mapFields.C +++ b/applications/utilities/preProcessing/mapFields/mapFields.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -286,7 +286,7 @@ int main(int argc, char *argv[]) fileName rootDirTarget(args.rootPath()); fileName caseDirTarget(args.globalCaseName()); - fileName casePath = args[1]; + const auto casePath = args.get(1); const fileName rootDirSource = casePath.path().toAbsolute(); const fileName caseDirSource = casePath.name(); diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C index 7c6435f1e4..025c400b26 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C +++ b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2018 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -214,7 +214,7 @@ int main(int argc, char *argv[]) fileName rootDirTarget(args.rootPath()); fileName caseDirTarget(args.globalCaseName()); - const fileName casePath = args[1]; + const auto casePath = args.get(1); const fileName rootDirSource = casePath.path(); const fileName caseDirSource = casePath.name(); diff --git a/applications/utilities/surface/surfaceAdd/surfaceAdd.C b/applications/utilities/surface/surfaceAdd/surfaceAdd.C index 6195dd3c68..0db4feefd1 100644 --- a/applications/utilities/surface/surfaceAdd/surfaceAdd.C +++ b/applications/utilities/surface/surfaceAdd/surfaceAdd.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -83,9 +83,9 @@ int main(int argc, char *argv[]) argList args(argc, argv); - const fileName inFileName1 = args[1]; - const fileName inFileName2 = args[2]; - const fileName outFileName = args[3]; + const auto inFileName1 = args.get(1); + const auto inFileName2 = args.get(2); + const auto outFileName = args.get(3); const bool addPoint = args.found("points"); const bool mergeRegions = args.found("mergeRegions"); @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) << nl << endl; Info<< "Surface : " << inFileName1<< nl - << "Points : " << args["points"] << nl + << "Points : " << args.get("points") << nl << "Writing : " << outFileName << nl << endl; } else @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) if (addPoint) { - IFstream pointsFile(args["points"]); + IFstream pointsFile(args.get("points")); const pointField extraPoints(pointsFile); Info<< "Additional Points:" << extraPoints.size() << endl; diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C index 87a04e1e21..4d3b9e39fe 100644 --- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C +++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -335,7 +335,7 @@ int main(int argc, char *argv[]) argList args(argc, argv); - const fileName surfFileName = args[1]; + const auto surfFileName = args.get(1); const bool checkSelfIntersect = args.found("checkSelfIntersection"); const bool splitNonManifold = args.found("splitNonManifold"); const label outputThreshold = diff --git a/applications/utilities/surface/surfaceClean/surfaceClean.C b/applications/utilities/surface/surfaceClean/surfaceClean.C index 98c850c695..f1e6264231 100644 --- a/applications/utilities/surface/surfaceClean/surfaceClean.C +++ b/applications/utilities/surface/surfaceClean/surfaceClean.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -82,10 +82,10 @@ int main(int argc, char *argv[]) ); argList args(argc, argv); - const fileName inFileName = args[1]; - const scalar minLen = args.get(2); - const scalar minQuality = args.get(3); - const fileName outFileName = args[4]; + const auto inFileName = args.get(1); + const auto minLen = args.get(2); + const auto minQuality = args.get(3); + const auto outFileName = args.get(4); Info<< "Reading surface " << inFileName << nl << "Collapsing all triangles with" << nl diff --git a/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C b/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C index 1adad6a7f8..6db75af3df 100644 --- a/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C +++ b/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -92,9 +92,9 @@ int main(int argc, char *argv[]) argList args(argc, argv); - const fileName inFileName = args[1]; - const scalar reduction = args.get(2); - const fileName outFileName = args[3]; + const auto inFileName = args.get(1); + const auto reduction = args.get(2); + const auto outFileName = args.get(3); if (reduction <= 0 || reduction > 1) { diff --git a/applications/utilities/surface/surfaceConvert/surfaceConvert.C b/applications/utilities/surface/surfaceConvert/surfaceConvert.C index f65f316f8d..3530da1ae1 100644 --- a/applications/utilities/surface/surfaceConvert/surfaceConvert.C +++ b/applications/utilities/surface/surfaceConvert/surfaceConvert.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -159,8 +159,8 @@ int main(int argc, char *argv[]) } } - const fileName importName(args[1]); - const fileName exportName(args[2]); + const auto importName = args.get(1); + const auto exportName = args.get(2); if (importName == exportName) { diff --git a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C index 087b0eed27..03c64a2f39 100644 --- a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C +++ b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -106,8 +106,8 @@ int main(int argc, char *argv[]) argList args(argc, argv); Time runTime(args.rootPath(), args.caseName()); - const fileName importName(args[1]); - const fileName exportName(args[2]); + const auto importName = args.get(1); + const auto exportName = args.get(2); // Disable inplace editing if (importName == exportName) diff --git a/applications/utilities/surface/surfaceFind/surfaceFind.C b/applications/utilities/surface/surfaceFind/surfaceFind.C index e23ce76847..1f69a792e6 100644 --- a/applications/utilities/surface/surfaceFind/surfaceFind.C +++ b/applications/utilities/surface/surfaceFind/surfaceFind.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) Info<< "Reading surf ..." << endl; - meshedSurface surf1(args[1]); + meshedSurface surf1(args.get(1)); // // Nearest vertex diff --git a/applications/utilities/surface/surfaceInertia/surfaceInertia.C b/applications/utilities/surface/surfaceInertia/surfaceInertia.C index 7147ce4656..2b51209788 100644 --- a/applications/utilities/surface/surfaceInertia/surfaceInertia.C +++ b/applications/utilities/surface/surfaceInertia/surfaceInertia.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) argList args(argc, argv); - const fileName surfFileName = args[1]; + const auto surfFileName = args.get(1); const scalar density = args.getOrDefault("density", 1); vector refPt = Zero; diff --git a/applications/utilities/surface/surfaceInflate/surfaceInflate.C b/applications/utilities/surface/surfaceInflate/surfaceInflate.C index 333533f2fa..a2d52a992d 100644 --- a/applications/utilities/surface/surfaceInflate/surfaceInflate.C +++ b/applications/utilities/surface/surfaceInflate/surfaceInflate.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -609,12 +609,12 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - const word inputName(args[1]); - const scalar distance(args.get(2)); - const scalar extendFactor(args.get(3)); + const auto inputName = args.get(1); + const auto distance = args.get(2); + const auto extendFactor = args.get(3); const bool checkSelfIntersect = args.found("checkSelfIntersection"); - const label nSmooth = args.getOrDefault