diff --git a/applications/test/IOField/Test-IOField.C b/applications/test/IOField/Test-IOField.C index 5cc910079c..6e1f490154 100644 --- a/applications/test/IOField/Test-IOField.C +++ b/applications/test/IOField/Test-IOField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,8 +29,9 @@ Description \*---------------------------------------------------------------------------*/ -#include "IOField.H" #include "argList.H" +#include "timeSelector.H" +#include "IOField.H" #include "polyMesh.H" #include "Time.H" @@ -131,9 +132,11 @@ void readIfPresent int main(int argc, char *argv[]) { - #include "addTimeOptions.H" + timeSelector::addOptions(); + #include "setRootCase.H" #include "createTime.H" + timeSelector::select0(runTime, args); #include "createPolyMesh.H" label sz = 0; diff --git a/applications/test/PatchTools/Test-PatchTools.C b/applications/test/PatchTools/Test-PatchTools.C index 36e0b13acf..6c07645fbe 100644 --- a/applications/test/PatchTools/Test-PatchTools.C +++ b/applications/test/PatchTools/Test-PatchTools.C @@ -30,6 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "fvMesh.H" #include "PatchTools.H" #include "OBJstream.H" @@ -198,10 +199,11 @@ using namespace Foam; int main(int argc, char *argv[]) { - #include "addTimeOptions.H" + timeSelector::addOptions(); argList::validArgs.append("patch"); #include "setRootCase.H" #include "createTime.H" + timeSelector::select0(runTime, args); #include "createMesh.H" diff --git a/applications/test/extendedStencil/Test-ExtendedStencil.C b/applications/test/extendedStencil/Test-ExtendedStencil.C index c2431e2638..9505f3a2db 100644 --- a/applications/test/extendedStencil/Test-ExtendedStencil.C +++ b/applications/test/extendedStencil/Test-ExtendedStencil.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,6 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "fvMesh.H" #include "volFields.H" #include "Time.H" @@ -124,14 +125,10 @@ void writeStencilStats(const labelListList& stencil) int main(int argc, char *argv[]) { - #include "addTimeOptions.H" + timeSelector::addOptions(); #include "setRootCase.H" #include "createTime.H" - - // Get times list - instantList Times = runTime.times(); - #include "checkTimeOptions.H" - runTime.setTime(Times[startTime], startTime); + timeSelector::select0(runTime, args); #include "createMesh.H" // Force calculation of extended edge addressing diff --git a/applications/test/extendedStencil/Test-ExtendedStencil2.C b/applications/test/extendedStencil/Test-ExtendedStencil2.C index c32df3bcd2..869ab2ca49 100644 --- a/applications/test/extendedStencil/Test-ExtendedStencil2.C +++ b/applications/test/extendedStencil/Test-ExtendedStencil2.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,6 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "fvMesh.H" #include "volFields.H" #include "surfaceFields.H" @@ -105,14 +106,10 @@ void writeStencilStats(const labelListList& stencil) int main(int argc, char *argv[]) { - #include "addTimeOptions.H" + timeSelector::addOptions(); #include "setRootCase.H" #include "createTime.H" - - // Get times list - instantList Times = runTime.times(); - #include "checkTimeOptions.H" - runTime.setTime(Times[startTime], startTime); + timeSelector::select0(runTime, args); #include "createMesh.H" diff --git a/applications/test/fieldMapping/Test-fieldMapping.C b/applications/test/fieldMapping/Test-fieldMapping.C index 67c3eb2ba2..d4aa4e9418 100644 --- a/applications/test/fieldMapping/Test-fieldMapping.C +++ b/applications/test/fieldMapping/Test-fieldMapping.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,6 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "fvMesh.H" #include "volFields.H" #include "Time.H" @@ -56,10 +57,11 @@ bool notEqual(const scalar s1, const scalar s2, const scalar tol) int main(int argc, char *argv[]) { - #include "addTimeOptions.H" + timeSelector::addOptions(); argList::validArgs.append("inflate (true|false)"); #include "setRootCase.H" #include "createTime.H" + timeSelector::select0(runTime, args); #include "createMesh.H" const Switch inflate(args.args()[1]); diff --git a/applications/test/findTimes/Test-findTimes.C b/applications/test/findTimes/Test-findTimes.C index a025136963..df6a70554f 100644 --- a/applications/test/findTimes/Test-findTimes.C +++ b/applications/test/findTimes/Test-findTimes.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) Info<< "Times found:" << runTime.times() << endl; - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); Info<< "Times selected:" << timeDirs << endl; Info<< "\nEnd\n" << endl; diff --git a/applications/test/hexRef8/Test-hexRef8.C b/applications/test/hexRef8/Test-hexRef8.C index a62fdd0aad..05f1da1b85 100644 --- a/applications/test/hexRef8/Test-hexRef8.C +++ b/applications/test/hexRef8/Test-hexRef8.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,7 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" -#include "Time.H" +#include "timeSelector.H" #include "volFields.H" #include "surfaceFields.H" #include "pointFields.H" @@ -57,10 +57,11 @@ bool notEqual(const scalar s1, const scalar s2, const scalar tol) // Main program: int main(int argc, char *argv[]) { - #include "addTimeOptions.H" + timeSelector::addOptions(); argList::validArgs.append("inflate (true|false)"); #include "setRootCase.H" #include "createTime.H" + timeSelector::select0(runTime, args); #include "createMesh.H" diff --git a/applications/test/mappedPatch/Test-mappedPatch.C b/applications/test/mappedPatch/Test-mappedPatch.C index c65cfeb2fd..a162246e99 100644 --- a/applications/test/mappedPatch/Test-mappedPatch.C +++ b/applications/test/mappedPatch/Test-mappedPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "fvMesh.H" #include "volFields.H" #include "meshTools.H" @@ -48,9 +49,10 @@ using namespace Foam; int main(int argc, char *argv[]) { - #include "addTimeOptions.H" + timeSelector::addOptions(); #include "setRootCase.H" #include "createTime.H" + timeSelector::select0(runTime, args); #include "createMesh.H" wordList patchFieldTypes diff --git a/applications/test/volPointInterpolation/Test-volPointInterpolation.C b/applications/test/volPointInterpolation/Test-volPointInterpolation.C index 2b62e6f6f5..c5afeaf42e 100644 --- a/applications/test/volPointInterpolation/Test-volPointInterpolation.C +++ b/applications/test/volPointInterpolation/Test-volPointInterpolation.C @@ -62,10 +62,10 @@ int main(int argc, char *argv[]) { argList::validArgs.append("field"); - Foam::timeSelector::addOptions(); + timeSelector::addOptions(); #include "setRootCase.H" #include "createTime.H" - Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createMesh.H" const pointMesh& pMesh = pointMesh::New(mesh); diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index d6ffb7152b..da7e4007c9 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) #include "addOverwriteOption.H" #include "setRootCase.H" #include "createTimeNoFunctionObjects.H" - instantList timeDirs = timeSelector::selectIfPresent(runTime, args); + const instantList timeDirs = timeSelector::selectIfPresent(runTime, args); #include "createMeshNoChangers.H" diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C index c323c155e4..2e56588694 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C +++ b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); fileName exportName = meshWriter::defaultMeshName; if (args.optionFound("case")) diff --git a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C index 2b9d13915d..64d80dcd62 100644 --- a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C +++ b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) } #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createPolyMesh.H" forAll(timeDirs, timeI) diff --git a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C index 8d2264e764..c687c9195e 100644 --- a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C +++ b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C @@ -436,7 +436,7 @@ int main(int argc, char *argv[]) << "(for points, faces, cells) is consistent with" << " Foam numbering (starting from 0)." << endl << endl; - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedPolyMesh.H" diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C index 94bf2a252e..243a9f62b7 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedPolyMesh.H" const bool noTopology = args.optionFound("noTopology"); diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index e17e71f038..0e3c5dbeec 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -34,6 +34,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "IOobjectList.H" #include "fvMesh.H" #include "polyTopoChange.H" @@ -605,7 +606,7 @@ int main(int argc, char *argv[]) #include "addRegionOption.H" #include "addOverwriteOption.H" - #include "addTimeOptions.H" + timeSelector::addOptions(); #include "addDictOption.H" argList::addBoolOption ( @@ -629,12 +630,7 @@ int main(int argc, char *argv[]) #endif // Get times list - instantList Times = runTime.times(); - - // Set startTime and endTime depending on -time and -latestTime options - #include "checkTimeOptions.H" - - runTime.setTime(Times[startTime], startTime); + const instantList Times = timeSelector::select0(runTime, args); #include "createNamedMesh.H" const word oldInstance = mesh.pointsInstance(); diff --git a/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C b/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C index a2a3ea6c3b..beb756c1ec 100644 --- a/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C +++ b/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) } - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createMeshNoChangers.H" diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C index 27cb300880..a37faf9d08 100644 --- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C +++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "Time.H" #include "polyMesh.H" #include "IStringStream.H" @@ -51,7 +52,6 @@ Description #include "IFstream.H" #include "IOobjectList.H" #include "SortableList.H" -#include "timeSelector.H" using namespace Foam; @@ -73,14 +73,13 @@ int main(int argc, char *argv[]) ); #include "addRegionOption.H" - #include "addTimeOptions.H" #include "setRootCase.H" #include "createTime.H" const bool noFlipMap = args.optionFound("noFlipMap"); // Get times list - (void)timeSelector::selectIfPresent(runTime, args); + timeSelector::selectIfPresent(runTime, args); #include "createNamedPolyMesh.H" diff --git a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C index d80ad68cb2..0fe1ac690c 100644 --- a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C +++ b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) const bool fields = !args.optionFound("noFields"); - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedMesh.H" diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSet.C b/applications/utilities/mesh/manipulation/topoSet/topoSet.C index 053a5c8dba..5dad16d358 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSet.C +++ b/applications/utilities/mesh/manipulation/topoSet/topoSet.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -207,7 +207,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::selectIfPresent(runTime, args); + const instantList timeDirs = timeSelector::selectIfPresent(runTime, args); #include "createNamedPolyMesh.H" diff --git a/applications/utilities/miscellaneous/foamListTimes/foamListTimes.C b/applications/utilities/miscellaneous/foamListTimes/foamListTimes.C index 94c005e6e8..887322069e 100644 --- a/applications/utilities/miscellaneous/foamListTimes/foamListTimes.C +++ b/applications/utilities/miscellaneous/foamListTimes/foamListTimes.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) // Use the times list from the master processor // and select a subset based on the command-line options - instantList timeDirs = timeSelector::select + const instantList timeDirs = timeSelector::select ( databases[0].times(), args diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummary.C b/applications/utilities/miscellaneous/patchSummary/patchSummary.C index 41d84a7315..85461c348c 100644 --- a/applications/utilities/miscellaneous/patchSummary/patchSummary.C +++ b/applications/utilities/miscellaneous/patchSummary/patchSummary.C @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); const bool expand = args.optionFound("expand"); diff --git a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C index 3e30583059..55f34fc5c5 100644 --- a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C +++ b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createMeshNoChangers.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 4fc48eaba9..b1c583449d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) #include "createTime.H" // get times list - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); // default to binary output, unless otherwise specified IOstream::streamFormat format = IOstream::BINARY; diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C index 9846ed16dc..08e055a007 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C @@ -270,7 +270,7 @@ int main(int argc, char *argv[]) } - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedMesh.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C b/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C index 28546de49f..1f57e6647d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,6 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "fvMesh.H" #include "volFields.H" #include "pointFields.H" @@ -144,18 +145,12 @@ void ReadAndMapFields int main(int argc, char *argv[]) { + timeSelector::addOptions(); #include "addOverwriteOption.H" - #include "addTimeOptions.H" #include "setRootCase.H" #include "createTime.H" - // Get times list - instantList Times = runTime.times(); - #include "checkTimeOptions.H" - runTime.setTime(Times[startTime], startTime); - - - // Read the mesh + timeSelector::select0(runTime, args); #include "createMeshNoChangers.H" // Read the tetDualMesh diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 02156dd7b6..9b799d2afd 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -402,7 +402,7 @@ int main(int argc, char *argv[]) - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedMesh.H" diff --git a/applications/utilities/postProcessing/foamPostProcess/foamPostProcess.C b/applications/utilities/postProcessing/foamPostProcess/foamPostProcess.C index e67e5e7190..321bf8ea02 100644 --- a/applications/utilities/postProcessing/foamPostProcess/foamPostProcess.C +++ b/applications/utilities/postProcessing/foamPostProcess/foamPostProcess.C @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); word regionName = fvMesh::defaultRegion; diff --git a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C index 10c97c9043..4e49e101ef 100644 --- a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C +++ b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedMesh.H" #include "createFields.H" diff --git a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C index 0f25d20496..4936760213 100644 --- a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C +++ b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedMesh.H" #include "createFields.H" diff --git a/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C b/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C index 0e65d22b1b..f1768481a1 100644 --- a/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C +++ b/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) Info<< "Using interpolation " << interpolationType << nl << endl; - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); scalarField timeVals(timeDirs.size()); wordList timeNames(timeDirs.size()); diff --git a/applications/utilities/preProcessing/setAtmBoundaryLayer/setAtmBoundaryLayer.C b/applications/utilities/preProcessing/setAtmBoundaryLayer/setAtmBoundaryLayer.C index 1977f7914d..f26e616a29 100644 --- a/applications/utilities/preProcessing/setAtmBoundaryLayer/setAtmBoundaryLayer.C +++ b/applications/utilities/preProcessing/setAtmBoundaryLayer/setAtmBoundaryLayer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::selectIfPresent(runTime, args); + const instantList timeDirs = timeSelector::selectIfPresent(runTime, args); #include "createNamedMesh.H" diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index 0b3e9ea4ed..f1e083315f 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "Time.H" #include "fvMesh.H" #include "topoSetSource.H" @@ -402,20 +403,12 @@ public: int main(int argc, char *argv[]) { + timeSelector::addOptions(); #include "addDictOption.H" #include "addRegionOption.H" - #include "addTimeOptions.H" #include "setRootCase.H" #include "createTime.H" - - // Get times list - instantList Times = runTime.times(); - - // Set startTime and endTime depending on -time and -latestTime options - #include "checkTimeOptions.H" - - runTime.setTime(Times[startTime], startTime); - + timeSelector::select0(runTime, args); #include "createNamedMesh.H" const dictionary setFieldsDict(systemDict("setFieldsDict", args, mesh)); diff --git a/applications/utilities/preProcessing/setWaves/setWaves.C b/applications/utilities/preProcessing/setWaves/setWaves.C index 76334e5cbc..7ca1e76080 100644 --- a/applications/utilities/preProcessing/setWaves/setWaves.C +++ b/applications/utilities/preProcessing/setWaves/setWaves.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::selectIfPresent(runTime, args); + const instantList timeDirs = timeSelector::selectIfPresent(runTime, args); #include "createNamedMesh.H" diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index f2e87239bb..33e15bcd03 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -123,7 +123,7 @@ void Foam::Time::setControls() else { // Search directory for valid time directories - instantList timeDirs = findTimes(path(), constant()); + const instantList timeDirs = findTimes(path(), constant()); if (startFrom == "firstTime") { @@ -683,7 +683,7 @@ Foam::word Foam::Time::findInstancePath // bit is the readDir, not the sorting. Tbd: avoid calling findInstancePath // from filePath. - instantList timeDirs = findTimes(path(), constant()); + const instantList timeDirs = findTimes(path(), constant()); // Note: // - times will include constant (with value 0) as first element. // For backwards compatibility make sure to find 0 in preference @@ -710,7 +710,7 @@ Foam::word Foam::Time::findInstancePath(const instant& t) const Foam::instant Foam::Time::findClosestTime(const scalar t) const { - instantList timeDirs = findTimes(path(), constant()); + const instantList timeDirs = findTimes(path(), constant()); // There is only one time (likely "constant") so return it if (timeDirs.size() == 1) diff --git a/src/OpenFOAM/db/Time/timeSelector.H b/src/OpenFOAM/db/Time/timeSelector.H index 632be0dca7..27a7143c7f 100644 --- a/src/OpenFOAM/db/Time/timeSelector.H +++ b/src/OpenFOAM/db/Time/timeSelector.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ Description // add other options #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); ... forAll(timeDirs, timeI) { diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H index 1c28c948c2..eb92d6cf85 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H @@ -87,7 +87,8 @@ if (argList::postProcess(argc, argv)) } #include "createTime.H" - Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); + const Foam::instantList timeDirs = + Foam::timeSelector::select0(runTime, args); #include INCLUDE_FILE(CREATE_MESH) #ifndef NO_CONTROL diff --git a/src/OpenFOAM/include/addTimeOptions.H b/src/OpenFOAM/include/addTimeOptions.H deleted file mode 100644 index 42d4543d83..0000000000 --- a/src/OpenFOAM/include/addTimeOptions.H +++ /dev/null @@ -1,24 +0,0 @@ -Foam::argList::addBoolOption -( - "constant", - "include the 'constant/' dir in the times list" -); - -Foam::argList::addBoolOption -( - "latestTime", - "select the latest time" -); - -Foam::argList::addBoolOption -( - "noZero", - "exclude the '0/' dir from the times list" -); - -Foam::argList::addOption -( - "time", - "time", - "specify a single time value to select" -); diff --git a/src/OpenFOAM/include/checkConstantOption.H b/src/OpenFOAM/include/checkConstantOption.H deleted file mode 100644 index 578df75350..0000000000 --- a/src/OpenFOAM/include/checkConstantOption.H +++ /dev/null @@ -1,11 +0,0 @@ -// Unless -constant is present, skip startTime if it is "constant" - -if -( - !args.optionFound("constant") - && (startTime < Times.size()-1) - && (Times[startTime].name() == "constant") -) -{ - startTime++; -} diff --git a/src/OpenFOAM/include/checkTimeOption.H b/src/OpenFOAM/include/checkTimeOption.H deleted file mode 100644 index b8b170a822..0000000000 --- a/src/OpenFOAM/include/checkTimeOption.H +++ /dev/null @@ -1,13 +0,0 @@ -// Check -time and -latestTime options - -if (args.optionFound("time")) -{ - Foam::scalar timeValue = args.optionRead("time"); - - startTime = Foam::Time::findClosestTimeIndex(Times, timeValue); -} - -if (args.optionFound("latestTime")) -{ - startTime = Times.size() - 1; -} diff --git a/src/OpenFOAM/include/checkTimeOptions.H b/src/OpenFOAM/include/checkTimeOptions.H deleted file mode 100644 index 7891356035..0000000000 --- a/src/OpenFOAM/include/checkTimeOptions.H +++ /dev/null @@ -1,7 +0,0 @@ -Foam::label startTime = 0; - -// Unless -constant is present, skip startTime if it is "constant" -#include "checkConstantOption.H" - -// Check -time and -latestTime options -#include "checkTimeOption.H" diff --git a/src/OpenFOAM/include/checkTimeOptionsNoConstant.H b/src/OpenFOAM/include/checkTimeOptionsNoConstant.H deleted file mode 100644 index 02312375df..0000000000 --- a/src/OpenFOAM/include/checkTimeOptionsNoConstant.H +++ /dev/null @@ -1,4 +0,0 @@ -Foam::label startTime = 0; - -// Check -time and -latestTime options -#include "checkTimeOption.H" diff --git a/src/parallel/parallel/processorRunTimes.C b/src/parallel/parallel/processorRunTimes.C index 05b56a9c37..16c289d188 100644 --- a/src/parallel/parallel/processorRunTimes.C +++ b/src/parallel/parallel/processorRunTimes.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -86,7 +86,7 @@ void Foam::processorRunTimes::setTime Foam::instantList Foam::processorRunTimes::selectComplete(const argList& args) { - instantList timeDirs = + const instantList timeDirs = timeSelector::selectIfPresent(completeRunTime_, args); forAll(procRunTimes_, proci) @@ -100,7 +100,7 @@ Foam::instantList Foam::processorRunTimes::selectComplete(const argList& args) Foam::instantList Foam::processorRunTimes::selectProc(const argList& args) { - instantList timeDirs = + const instantList timeDirs = timeSelector::select0(procRunTimes_[0], args); completeRunTime_.setTime(procRunTimes_[0]); diff --git a/tutorials/mesh/refineMesh/refineFieldDirs/calcRadiusField/calcRadiusField.C b/tutorials/mesh/refineMesh/refineFieldDirs/calcRadiusField/calcRadiusField.C index 6854cd6f1e..29fdb81617 100644 --- a/tutorials/mesh/refineMesh/refineFieldDirs/calcRadiusField/calcRadiusField.C +++ b/tutorials/mesh/refineMesh/refineFieldDirs/calcRadiusField/calcRadiusField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); + const instantList timeDirs = timeSelector::select0(runTime, args); const bool calcDirections = args.optionFound("calcDirections"); #include "createNamedMesh.H"