diff --git a/applications/test/IOField/Test-IOField.cxx b/applications/test/IOField/Test-IOField.cxx index d9bfc1e077..d294c5ec9d 100644 --- a/applications/test/IOField/Test-IOField.cxx +++ b/applications/test/IOField/Test-IOField.cxx @@ -188,8 +188,6 @@ int main(int argc, char *argv[]) argList::addBoolOption("label", "Use label for tests (default)"); argList::addBoolOption("ref", "Test writing by ref"); - #include "addTimeOptions.H" - #include "setRootCase.H" #include "createTime.H" #include "createPolyMesh.H" @@ -280,7 +278,6 @@ int main(int argc, char *argv[]) { IOFieldRef(ioOutput, mesh.points()).write(); } - } diff --git a/applications/test/PatchTools/Test-PatchTools.C b/applications/test/PatchTools/Test-PatchTools.C index 6adfedd36d..f63cfeffcd 100644 --- a/applications/test/PatchTools/Test-PatchTools.C +++ b/applications/test/PatchTools/Test-PatchTools.C @@ -201,7 +201,6 @@ using namespace Foam; int main(int argc, char *argv[]) { - #include "addTimeOptions.H" argList::addArgument("patch"); #include "setRootCase.H" #include "createTime.H" diff --git a/applications/test/checkDecomposePar/Test-checkDecomposePar.C b/applications/test/checkDecomposePar/Test-checkDecomposePar.C index 903a22b0d4..6a15fdcc08 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-2023 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,7 +24,7 @@ License along with OpenFOAM. If not, see . Application - checkDecomposePar + Test-checkDecomposePar Group grpParallelUtilities @@ -35,8 +35,9 @@ Description \*---------------------------------------------------------------------------*/ -#include "OSspecific.H" -#include "fvCFD.H" +#include "argList.H" +#include "timeSelector.H" +#include "polyMesh.H" #include "cpuTime.H" #include "IFstream.H" #include "regionProperties.H" @@ -44,10 +45,14 @@ Description #include "decompositionInformation.H" #include "decompositionModel.H" +using namespace Foam; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { + timeSelector::addOptions_singleTime(); // Single-time options + argList::addNote ( "Check decomposition from kaffpa (KaHIP) output" @@ -65,9 +70,6 @@ int main(int argc, char *argv[]) argList::addArgument("kaffpa-output-file"); - // Include explicit constant options, have zero from time range - timeSelector::addOptions(true, false); - #include "setRootCase.H" const auto decompFile = args.get(1); @@ -75,8 +77,8 @@ int main(int argc, char *argv[]) // Set time from database #include "createTime.H" - // Allow override of time - instantList times = timeSelector::selectIfPresent(runTime, args); + // Allow override of time from specified time options, or no-op + timeSelector::setTimeIfPresent(runTime, args); // Allow override of decomposeParDict location const fileName decompDictFile = @@ -95,7 +97,7 @@ int main(int argc, char *argv[]) Info<< "\n\nDecomposing mesh " << regionName << nl << endl; Info<< "Create mesh..." << flush; - fvMesh mesh + polyMesh mesh ( IOobject ( @@ -111,7 +113,7 @@ int main(int argc, char *argv[]) Info<< " nCells = " << mesh.nCells() << endl; // Expected format is a simple ASCII list - cellToProc.setSize(mesh.nCells()); + cellToProc.resize(mesh.nCells()); { IFstream is(decompFile); diff --git a/applications/test/extendedStencil/Test-ExtendedStencil.C b/applications/test/extendedStencil/Test-ExtendedStencil.C index 6c76abfc36..e876f079f1 100644 --- a/applications/test/extendedStencil/Test-ExtendedStencil.C +++ b/applications/test/extendedStencil/Test-ExtendedStencil.C @@ -32,6 +32,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "fvMesh.H" #include "volFields.H" #include "Time.H" @@ -126,14 +127,14 @@ void writeStencilStats(const labelListList& stencil) int main(int argc, char *argv[]) { - #include "addTimeOptions.H" + timeSelector::addOptions_singleTime(); // Single-time options + #include "setRootCase.H" #include "createTime.H" - // Get times list - instantList Times = runTime.times(); - #include "checkTimeOptions.H" - runTime.setTime(Times[startTime], startTime); + // Set time from specified time options, or force start from Time=0 + timeSelector::setTimeIfPresent(runTime, args, true); + #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 3560a1d884..988caba770 100644 --- a/applications/test/extendedStencil/Test-ExtendedStencil2.C +++ b/applications/test/extendedStencil/Test-ExtendedStencil2.C @@ -32,6 +32,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "fvMesh.H" #include "volFields.H" #include "surfaceFields.H" @@ -107,14 +108,16 @@ void writeStencilStats(const labelListList& stencil) int main(int argc, char *argv[]) { - #include "addTimeOptions.H" + argList::noFunctionObjects(); // Never use function objects + + timeSelector::addOptions_singleTime(); // Single-time options + #include "setRootCase.H" #include "createTime.H" - // Get times list - instantList Times = runTime.times(); - #include "checkTimeOptions.H" - runTime.setTime(Times[startTime], startTime); + // Set time from specified time options, or force start from Time=0 + timeSelector::setTimeIfPresent(runTime, args, true); + #include "createMesh.H" diff --git a/applications/test/fieldMapping/Make/options b/applications/test/fieldMapping/Make/options index d840aaca0b..8fee919326 100644 --- a/applications/test/fieldMapping/Make/options +++ b/applications/test/fieldMapping/Make/options @@ -5,4 +5,5 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ + -lmeshTools \ -ldynamicMesh diff --git a/applications/test/fieldMapping/Test-fieldMapping.C b/applications/test/fieldMapping/Test-fieldMapping.C index 1e2cec4467..bb4ad0576b 100644 --- a/applications/test/fieldMapping/Test-fieldMapping.C +++ b/applications/test/fieldMapping/Test-fieldMapping.C @@ -32,6 +32,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "fvMesh.H" #include "volFields.H" #include "Time.H" @@ -51,22 +52,33 @@ using namespace Foam; int main(int argc, char *argv[]) { - #include "addTimeOptions.H" - argList::addArgument("inflate (true|false)"); + timeSelector::addOptions_singleTime(); // Single-time options + + argList::addBoolOption + ( + "inflate", + "Use inflation/deflation for deleting cells" + ); + #include "setRootCase.H" #include "createTime.H" + + // Allow override of time from specified time options, or no-op + timeSelector::setTimeIfPresent(runTime, args); + #include "createMesh.H" - const Switch inflate(args[1]); + const bool inflate = args.found("inflate"); if (inflate) { - Info<< "Deleting cells using inflation/deflation" << nl << endl; + Info<< "Deleting cells using inflation/deflation" + << nl << endl; } else { - Info<< "Deleting cells, introducing points at new position" << nl - << endl; + Info<< "Deleting cells, introducing points at new position" + << nl << endl; } diff --git a/applications/test/hexRef8/Make/options b/applications/test/hexRef8/Make/options index d840aaca0b..8fee919326 100644 --- a/applications/test/hexRef8/Make/options +++ b/applications/test/hexRef8/Make/options @@ -5,4 +5,5 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ + -lmeshTools \ -ldynamicMesh diff --git a/applications/test/hexRef8/Test-hexRef8.C b/applications/test/hexRef8/Test-hexRef8.C index dd34e6608d..12c6d5e38e 100644 --- a/applications/test/hexRef8/Test-hexRef8.C +++ b/applications/test/hexRef8/Test-hexRef8.C @@ -33,6 +33,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "Time.H" #include "volFields.H" #include "surfaceFields.H" @@ -52,21 +53,28 @@ using namespace Foam; // Main program: int main(int argc, char *argv[]) { - #include "addTimeOptions.H" - argList::addArgument("inflate (true|false)"); + timeSelector::addOptions_singleTime(); // Single-time options + + argList::addBoolOption + ( + "inflate", + "Use inflation/deflation for splitting/deleting cells" + ); + #include "setRootCase.H" #include "createTime.H" + + // Allow override of time from specified time options, or no-op + timeSelector::setTimeIfPresent(runTime, args); + #include "createMesh.H" - - const pointConstraints& pc = pointConstraints::New(pointMesh::New(mesh)); - - const Switch inflate(args[1]); + const bool inflate = args.found("inflate"); if (inflate) { - Info<< "Splitting/deleting cells using inflation/deflation" << nl - << endl; + Info<< "Splitting/deleting cells using inflation/deflation" + << nl << endl; } else { @@ -75,6 +83,8 @@ int main(int argc, char *argv[]) } + const pointConstraints& pc = pointConstraints::New(pointMesh::New(mesh)); + Random rndGen(0); diff --git a/applications/test/mappedPatch/Test-MappedPatch.C b/applications/test/mappedPatch/Test-MappedPatch.C index c54fb26426..d62445ea24 100644 --- a/applications/test/mappedPatch/Test-MappedPatch.C +++ b/applications/test/mappedPatch/Test-MappedPatch.C @@ -51,7 +51,6 @@ using namespace Foam; int main(int argc, char *argv[]) { - #include "addTimeOptions.H" #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" diff --git a/applications/utilities/mesh/conversion/ccm/foamToCcm/foamToCcm.C b/applications/utilities/mesh/conversion/ccm/foamToCcm/foamToCcm.C index 88dd59676d..2cb7609138 100644 --- a/applications/utilities/mesh/conversion/ccm/foamToCcm/foamToCcm.C +++ b/applications/utilities/mesh/conversion/ccm/foamToCcm/foamToCcm.C @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) // // skip over time=0, unless some other time option has been specified // if // ( -// !args.found("zeroTime") +// !args.found("noZero") // && !args.found("time") // && !args.found("latestTime") // && Times.size() > 2 diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C index 7ebeeca51d..8e95e454a9 100644 --- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C +++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C @@ -1569,7 +1569,7 @@ int main(int argc, char *argv[]) //Get polyMesh to write to constant - runTime.setTime(instant(runTime.constant()), 0); + runTime.setTime(instant(0, runTime.constant()), 0); repatcher.repatch(); diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index 3702cfe8ce..9a3eb42647 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -803,6 +803,10 @@ CompactListList