Replaced all remaining addTimeOptions.H includes with the more flexible timeSelector

This commit is contained in:
Henry Weller
2023-06-23 15:24:06 +01:00
parent f3df607dde
commit 0657826ab9
43 changed files with 91 additions and 162 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,8 +29,9 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "IOField.H"
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "IOField.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "Time.H" #include "Time.H"
@ -131,9 +132,11 @@ void readIfPresent
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "addTimeOptions.H" timeSelector::addOptions();
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
timeSelector::select0(runTime, args);
#include "createPolyMesh.H" #include "createPolyMesh.H"
label sz = 0; label sz = 0;

View File

@ -30,6 +30,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "PatchTools.H" #include "PatchTools.H"
#include "OBJstream.H" #include "OBJstream.H"
@ -198,10 +199,11 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "addTimeOptions.H" timeSelector::addOptions();
argList::validArgs.append("patch"); argList::validArgs.append("patch");
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
timeSelector::select0(runTime, args);
#include "createMesh.H" #include "createMesh.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,6 +30,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "Time.H" #include "Time.H"
@ -124,14 +125,10 @@ void writeStencilStats(const labelListList& stencil)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "addTimeOptions.H" timeSelector::addOptions();
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
timeSelector::select0(runTime, args);
// Get times list
instantList Times = runTime.times();
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
#include "createMesh.H" #include "createMesh.H"
// Force calculation of extended edge addressing // Force calculation of extended edge addressing

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,6 +30,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
@ -105,14 +106,10 @@ void writeStencilStats(const labelListList& stencil)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "addTimeOptions.H" timeSelector::addOptions();
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
timeSelector::select0(runTime, args);
// Get times list
instantList Times = runTime.times();
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
#include "createMesh.H" #include "createMesh.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,6 +30,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "Time.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[]) int main(int argc, char *argv[])
{ {
#include "addTimeOptions.H" timeSelector::addOptions();
argList::validArgs.append("inflate (true|false)"); argList::validArgs.append("inflate (true|false)");
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
timeSelector::select0(runTime, args);
#include "createMesh.H" #include "createMesh.H"
const Switch inflate(args.args()[1]); const Switch inflate(args.args()[1]);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -45,7 +45,7 @@ int main(int argc, char *argv[])
Info<< "Times found:" << runTime.times() << endl; 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<< "Times selected:" << timeDirs << endl;
Info<< "\nEnd\n" << endl; Info<< "\nEnd\n" << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,7 +31,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "timeSelector.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "pointFields.H" #include "pointFields.H"
@ -57,10 +57,11 @@ bool notEqual(const scalar s1, const scalar s2, const scalar tol)
// Main program: // Main program:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "addTimeOptions.H" timeSelector::addOptions();
argList::validArgs.append("inflate (true|false)"); argList::validArgs.append("inflate (true|false)");
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
timeSelector::select0(runTime, args);
#include "createMesh.H" #include "createMesh.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,6 +31,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "meshTools.H" #include "meshTools.H"
@ -48,9 +49,10 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "addTimeOptions.H" timeSelector::addOptions();
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
timeSelector::select0(runTime, args);
#include "createMesh.H" #include "createMesh.H"
wordList patchFieldTypes wordList patchFieldTypes

View File

@ -62,10 +62,10 @@ int main(int argc, char *argv[])
{ {
argList::validArgs.append("field"); argList::validArgs.append("field");
Foam::timeSelector::addOptions(); timeSelector::addOptions();
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
#include "createMesh.H" #include "createMesh.H"
const pointMesh& pMesh = pointMesh::New(mesh); const pointMesh& pMesh = pointMesh::New(mesh);

View File

@ -85,7 +85,7 @@ int main(int argc, char *argv[])
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTimeNoFunctionObjects.H" #include "createTimeNoFunctionObjects.H"
instantList timeDirs = timeSelector::selectIfPresent(runTime, args); const instantList timeDirs = timeSelector::selectIfPresent(runTime, args);
#include "createMeshNoChangers.H" #include "createMeshNoChangers.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,7 +84,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
fileName exportName = meshWriter::defaultMeshName; fileName exportName = meshWriter::defaultMeshName;
if (args.optionFound("case")) if (args.optionFound("case"))

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -86,7 +86,7 @@ int main(int argc, char *argv[])
} }
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
#include "createPolyMesh.H" #include "createPolyMesh.H"
forAll(timeDirs, timeI) forAll(timeDirs, timeI)

View File

@ -436,7 +436,7 @@ int main(int argc, char *argv[])
<< "(for points, faces, cells) is consistent with" << "(for points, faces, cells) is consistent with"
<< " Foam numbering (starting from 0)." << endl << endl; << " Foam numbering (starting from 0)." << endl << endl;
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedPolyMesh.H" #include "createNamedPolyMesh.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -103,7 +103,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedPolyMesh.H" #include "createNamedPolyMesh.H"
const bool noTopology = args.optionFound("noTopology"); const bool noTopology = args.optionFound("noTopology");

View File

@ -34,6 +34,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "IOobjectList.H" #include "IOobjectList.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "polyTopoChange.H" #include "polyTopoChange.H"
@ -605,7 +606,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H" #include "addRegionOption.H"
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
#include "addTimeOptions.H" timeSelector::addOptions();
#include "addDictOption.H" #include "addDictOption.H"
argList::addBoolOption argList::addBoolOption
( (
@ -629,12 +630,7 @@ int main(int argc, char *argv[])
#endif #endif
// Get times list // Get times list
instantList Times = runTime.times(); const instantList Times = timeSelector::select0(runTime, args);
// Set startTime and endTime depending on -time and -latestTime options
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
#include "createNamedMesh.H" #include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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" #include "createMeshNoChangers.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,6 +41,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "Time.H" #include "Time.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "IStringStream.H" #include "IStringStream.H"
@ -51,7 +52,6 @@ Description
#include "IFstream.H" #include "IFstream.H"
#include "IOobjectList.H" #include "IOobjectList.H"
#include "SortableList.H" #include "SortableList.H"
#include "timeSelector.H"
using namespace Foam; using namespace Foam;
@ -73,14 +73,13 @@ int main(int argc, char *argv[])
); );
#include "addRegionOption.H" #include "addRegionOption.H"
#include "addTimeOptions.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
const bool noFlipMap = args.optionFound("noFlipMap"); const bool noFlipMap = args.optionFound("noFlipMap");
// Get times list // Get times list
(void)timeSelector::selectIfPresent(runTime, args); timeSelector::selectIfPresent(runTime, args);
#include "createNamedPolyMesh.H" #include "createNamedPolyMesh.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -83,7 +83,7 @@ int main(int argc, char *argv[])
const bool fields = !args.optionFound("noFields"); const bool fields = !args.optionFound("noFields");
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H" #include "createNamedMesh.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -207,7 +207,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::selectIfPresent(runTime, args); const instantList timeDirs = timeSelector::selectIfPresent(runTime, args);
#include "createNamedPolyMesh.H" #include "createNamedPolyMesh.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -130,7 +130,7 @@ int main(int argc, char *argv[])
// Use the times list from the master processor // Use the times list from the master processor
// and select a subset based on the command-line options // and select a subset based on the command-line options
instantList timeDirs = timeSelector::select const instantList timeDirs = timeSelector::select
( (
databases[0].times(), databases[0].times(),
args args

View File

@ -59,7 +59,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
const bool expand = args.optionFound("expand"); const bool expand = args.optionFound("expand");

View File

@ -47,7 +47,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
#include "createMeshNoChangers.H" #include "createMeshNoChangers.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -135,7 +135,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
// get times list // get times list
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
// default to binary output, unless otherwise specified // default to binary output, unless otherwise specified
IOstream::streamFormat format = IOstream::BINARY; IOstream::streamFormat format = IOstream::BINARY;

View File

@ -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" #include "createNamedMesh.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,6 +30,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "pointFields.H" #include "pointFields.H"
@ -144,18 +145,12 @@ void ReadAndMapFields
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
#include "addTimeOptions.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
// Get times list timeSelector::select0(runTime, args);
instantList Times = runTime.times();
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Read the mesh
#include "createMeshNoChangers.H" #include "createMeshNoChangers.H"
// Read the tetDualMesh // Read the tetDualMesh

View File

@ -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" #include "createNamedMesh.H"

View File

@ -227,7 +227,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
word regionName = fvMesh::defaultRegion; word regionName = fvMesh::defaultRegion;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -53,7 +53,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H" #include "createNamedMesh.H"
#include "createFields.H" #include "createFields.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H" #include "createNamedMesh.H"
#include "createFields.H" #include "createFields.H"

View File

@ -235,7 +235,7 @@ int main(int argc, char *argv[])
Info<< "Using interpolation " << interpolationType << nl << endl; Info<< "Using interpolation " << interpolationType << nl << endl;
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
scalarField timeVals(timeDirs.size()); scalarField timeVals(timeDirs.size());
wordList timeNames(timeDirs.size()); wordList timeNames(timeDirs.size());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::selectIfPresent(runTime, args); const instantList timeDirs = timeSelector::selectIfPresent(runTime, args);
#include "createNamedMesh.H" #include "createNamedMesh.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,6 +27,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "Time.H" #include "Time.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "topoSetSource.H" #include "topoSetSource.H"
@ -402,20 +403,12 @@ public:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
#include "addDictOption.H" #include "addDictOption.H"
#include "addRegionOption.H" #include "addRegionOption.H"
#include "addTimeOptions.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
timeSelector::select0(runTime, args);
// 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);
#include "createNamedMesh.H" #include "createNamedMesh.H"
const dictionary setFieldsDict(systemDict("setFieldsDict", args, mesh)); const dictionary setFieldsDict(systemDict("setFieldsDict", args, mesh));

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::selectIfPresent(runTime, args); const instantList timeDirs = timeSelector::selectIfPresent(runTime, args);
#include "createNamedMesh.H" #include "createNamedMesh.H"

View File

@ -123,7 +123,7 @@ void Foam::Time::setControls()
else else
{ {
// Search directory for valid time directories // Search directory for valid time directories
instantList timeDirs = findTimes(path(), constant()); const instantList timeDirs = findTimes(path(), constant());
if (startFrom == "firstTime") if (startFrom == "firstTime")
{ {
@ -683,7 +683,7 @@ Foam::word Foam::Time::findInstancePath
// bit is the readDir, not the sorting. Tbd: avoid calling findInstancePath // bit is the readDir, not the sorting. Tbd: avoid calling findInstancePath
// from filePath. // from filePath.
instantList timeDirs = findTimes(path(), constant()); const instantList timeDirs = findTimes(path(), constant());
// Note: // Note:
// - times will include constant (with value 0) as first element. // - times will include constant (with value 0) as first element.
// For backwards compatibility make sure to find 0 in preference // 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 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 // There is only one time (likely "constant") so return it
if (timeDirs.size() == 1) if (timeDirs.size() == 1)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,7 +35,7 @@ Description
// add other options // add other options
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
... ...
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {

View File

@ -87,7 +87,8 @@ if (argList::postProcess(argc, argv))
} }
#include "createTime.H" #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) #include INCLUDE_FILE(CREATE_MESH)
#ifndef NO_CONTROL #ifndef NO_CONTROL

View File

@ -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"
);

View File

@ -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++;
}

View File

@ -1,13 +0,0 @@
// Check -time and -latestTime options
if (args.optionFound("time"))
{
Foam::scalar timeValue = args.optionRead<scalar>("time");
startTime = Foam::Time::findClosestTimeIndex(Times, timeValue);
}
if (args.optionFound("latestTime"))
{
startTime = Times.size() - 1;
}

View File

@ -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"

View File

@ -1,4 +0,0 @@
Foam::label startTime = 0;
// Check -time and -latestTime options
#include "checkTimeOption.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -86,7 +86,7 @@ void Foam::processorRunTimes::setTime
Foam::instantList Foam::processorRunTimes::selectComplete(const argList& args) Foam::instantList Foam::processorRunTimes::selectComplete(const argList& args)
{ {
instantList timeDirs = const instantList timeDirs =
timeSelector::selectIfPresent(completeRunTime_, args); timeSelector::selectIfPresent(completeRunTime_, args);
forAll(procRunTimes_, proci) forAll(procRunTimes_, proci)
@ -100,7 +100,7 @@ Foam::instantList Foam::processorRunTimes::selectComplete(const argList& args)
Foam::instantList Foam::processorRunTimes::selectProc(const argList& args) Foam::instantList Foam::processorRunTimes::selectProc(const argList& args)
{ {
instantList timeDirs = const instantList timeDirs =
timeSelector::select0(procRunTimes_[0], args); timeSelector::select0(procRunTimes_[0], args);
completeRunTime_.setTime(procRunTimes_[0]); completeRunTime_.setTime(procRunTimes_[0]);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -61,7 +61,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); const instantList timeDirs = timeSelector::select0(runTime, args);
const bool calcDirections = args.optionFound("calcDirections"); const bool calcDirections = args.optionFound("calcDirections");
#include "createNamedMesh.H" #include "createNamedMesh.H"