diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C index c7444c2be6..e2bf673ce2 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C @@ -45,6 +45,7 @@ Description #include "argList.H" #include "Time.H" +#include "timeSelector.H" #include "fvMesh.H" #include "mathematicalConstants.H" #include "polyTopoChange.H" @@ -340,7 +341,8 @@ void dumpFeatures int main(int argc, char *argv[]) { argList::noParallel(); -# include "addTimeOptions.H" + timeSelector::addOptions(true, false); + argList::validArgs.append("feature angle[0-180]"); argList::validOptions.insert("splitAllFaces", ""); argList::validOptions.insert("doNotPreserveFaceZones", ""); @@ -349,13 +351,10 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - // Get times list - instantList Times = runTime.times(); - -# include "checkTimeOptions.H" - runTime.setTime(Times[startTime], startTime); + instantList timeDirs = timeSelector::select0(runTime, args); # include "createMesh.H" + const word oldInstance = mesh.pointsInstance(); // Mark boundary edges and points. diff --git a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C index 7b64177da5..f438a1f963 100644 --- a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C +++ b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C @@ -59,11 +59,10 @@ int main(int argc, char *argv[]) pointField zeroPoints(mesh.points()); - runTime.setTime(Times[0], 0); - - for (int i = 1; i parcels(mesh); diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H index 129d788738..ec540efe7d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H +++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H @@ -5,9 +5,9 @@ HashSet surfVectorHash; HashSet sprayScalarHash; HashSet sprayVectorHash; -forAll(Times, timeI) +forAll(timeDirs, timeI) { - runTime.setTime(Times[timeI], timeI); + runTime.setTime(timeDirs[timeI], timeI); // Add all fields to hashtable IOobjectList objects(mesh, runTime.timeName()); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 118e99fc91..04518db985 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -113,11 +113,9 @@ int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[]) instantList Times = runTime.times(); int nearestIndex = timeIndex_; - for (int requestI = 0; requestI < nRequest; ++requestI) { int index = Time::findClosestTimeIndex(Times, requestTimes[requestI]); - if (index >= 0 && index != timeIndex_) { nearestIndex = index; @@ -125,7 +123,6 @@ int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[]) } } - if (nearestIndex < 0) { nearestIndex = 0; diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H index e143dd359d..7c4ef69a4f 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H @@ -8,7 +8,7 @@ int USERD_get_maxsize_info return Z_ERR; #ifdef ENSIGHTDEBUG - Info << "Entering: USERD_get_maxsize_info" << endl << flush; + Info << "Entering: USERD_get_maxsize_info" << endl; #endif label maxNPoints = 0; @@ -19,9 +19,9 @@ int USERD_get_maxsize_info label nPyr05Max = 0; label nTet04Max = 0; - Info << "Checking all time steps for EnSight memory allocation purpose. This can take some time." << endl; + Info<< "Checking all time steps for EnSight memory allocation purpose. This can take some time." << endl; - for (label t=1; t < TimeList.size(); t++) + for (label timeI=1; timeI < timeDirs.size(); ++timeI) { label nPen06 = 0; @@ -29,21 +29,21 @@ int USERD_get_maxsize_info label nPyr05 = 0; label nTet04 = 0; - runTimePtr->setTime(TimeList[t], t); + runTimePtr->setTime(timeDirs[timeI], timeI); - Info << "Checking time = " << TimeList[t].value() << endl << flush; + Info<< "Checking time = " << runTimePtr->timeName() << endl; const cellShapeList& cells = meshPtr->cellShapes(); - label nPoints = meshPtr->nPoints(); - label nCells = cells.size(); + const label nPoints = meshPtr->nPoints(); + const label nCells = cells.size(); maxNPoints = max(maxNPoints, nPoints); for (label n=0; n 1) { - // Get the maximum number of spray parcels // and store it Cloud lagrangian(*meshPtr); @@ -79,9 +78,7 @@ int USERD_get_maxsize_info { nMaxParcels = lagrangian.size(); } - } - } max_number_of_nodes[0] = maxNPoints; @@ -97,7 +94,7 @@ int USERD_get_maxsize_info } #ifdef ENSIGHTDEBUG - Info << "Leaving: USERD_get_maxsize_info" << endl << flush; + Info<< "Leaving: USERD_get_maxsize_info" << endl; #endif return Z_OK; diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_sol_times.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_sol_times.H index 353b67def1..dcc6482289 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_sol_times.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_sol_times.H @@ -10,18 +10,18 @@ int USERD_get_sol_times ) { #ifdef ENSIGHTDEBUG - Info << "Entering: USERD_get_sol_times" << endl << flush; - Info << TimeList << endl; + Info<< "Entering: USERD_get_sol_times\n" << timeDirs << endl; #endif + for (label n=0; nboundaryMesh().size(); // set the number of fields and store their names // a valid field must exist for all time-steps - runTime.setTime(TimeList[TimeList.size()-1], TimeList.size()-1); + runTime.setTime(timeDirs[timeDirs.size()-1], timeDirs.size()-1); IOobjectList objects(*meshPtr, runTime.timeName()); - fieldNames = (const wordList&)objects.names(); + fieldNames = objects.names(); // because of the spray being a 'field' ... // get the availabe number of variables and @@ -149,7 +149,7 @@ int USERD_set_filenames label n = 0; while (!lagrangianNamesFound && n < Num_time_steps) { - runTime.setTime(TimeList[n+1], n+1); + runTime.setTime(timeDirs[n+1], n+1); Cloud lagrangian(*meshPtr); @@ -195,7 +195,7 @@ int USERD_set_filenames } Current_time_step = Num_time_steps; - runTime.setTime(TimeList[Current_time_step], Current_time_step); + runTime.setTime(timeDirs[Current_time_step], Current_time_step); Num_variables = nVar + nSprayVariables; Numparts_available = Num_unstructured_parts + Num_structured_parts + nPatches; diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H index ef2f9a2453..5e4c581532 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H @@ -20,18 +20,30 @@ void USERD_set_time_set_and_step if (time_step == 0) { - runTime.setTime(TimeList[Current_time_step], Current_time_step); + runTime.setTime + ( + timeDirs[Current_time_step], + Current_time_step + ); } else { - runTime.setTime(TimeList[Current_time_step + 1], Current_time_step + 1); + runTime.setTime + ( + timeDirs[Current_time_step + 1], + Current_time_step + 1 + ); } meshPtr->readUpdate(); if (time_step == 0) { - runTime.setTime(TimeList[Current_time_step + 1], Current_time_step + 1); + runTime.setTime + ( + timeDirs[Current_time_step + 1], + Current_time_step + 1 + ); } if (Numparts_available > nPatches+1) diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H index 80c71ba028..c6548c1408 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H @@ -5,7 +5,6 @@ nVar -= Num_variables - nSprayVariables + lagrangianScalarNames.size(); if (nVar >= 0) { - word name = lagrangianVectorNames[nVar]; IOField v @@ -42,7 +41,7 @@ if (nVar >= 0) } else { - //Info << "getLagrangianVector: nVar = " << nVar << endl; + // Info<< "getLagrangianVector: nVar = " << nVar << endl; return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H index d68861b138..7c7f2b16d8 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H @@ -41,7 +41,7 @@ static word pointPrepend = "point_"; static fileName rootDir; static fileName caseDir; -static instantList TimeList; +static instantList timeDirs; static List fieldNames; static List lagrangianScalarNames; diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/calculateFields.H b/applications/utilities/postProcessing/miscellaneous/postChannel/calculateFields.H index e4f4f411e1..6c7cffcf0a 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/calculateFields.H +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/calculateFields.H @@ -12,7 +12,7 @@ IOobject ( "txx", - Times[i].name(), + runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE @@ -28,7 +28,7 @@ IOobject ( "tyy", - Times[i].name(), + runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE @@ -44,7 +44,7 @@ IOobject ( "tzz", - Times[i].name(), + runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE @@ -60,7 +60,7 @@ IOobject ( "txy", - Times[i].name(), + runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C index 943bff5811..559e769cf1 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C @@ -48,18 +48,13 @@ Description int main(int argc, char *argv[]) { argList::noParallel(); -# include "addTimeOptions.H" -# include "setRootCase.H" + timeSelector::addOptions(); +# 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); + instantList timeDirs = timeSelector::select0(runTime, args); # include "createMesh.H" # include "readTransportProperties.H" @@ -83,10 +78,9 @@ int main(int argc, char *argv[]) // For each time step read all fields - for (label i=startTime; i("sourceTime"); - sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime); + sourceTimeIndex = Time::findClosestTimeIndex + ( + sourceTimes, + args.optionRead("sourceTime") + ); } } else { - scalar sourceTime = runTimeTarget.time().value(); - sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime); + sourceTimeIndex = Time::findClosestTimeIndex + ( + sourceTimes, + runTimeTarget.time().value() + ); } diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index 085a1abe2d..5ba3727b39 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -28,6 +28,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "Time.H" #include "fvMesh.H" #include "topoSetSource.H" @@ -174,19 +175,13 @@ public: int main(int argc, char *argv[]) { + timeSelector::addOptions(); -# 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); + instantList timeDirs = timeSelector::select0(runTime, args); # include "createMesh.H" @@ -220,11 +215,11 @@ int main(int argc, char *argv[]) PtrList regions(setFieldsDict.lookup("regions")); - forAll(regions, regioni) + forAll(regions, regionI) { - const entry& region = regions[regioni]; + const entry& region = regions[regionI]; - autoPtr cellSelector = + autoPtr cellSelector = topoSetSource::New(region.keyword(), mesh, region.dict()); cellSet selectedCellSet @@ -247,7 +242,7 @@ int main(int argc, char *argv[]) ); } - Info << nl << "End" << endl; + Info<< "\nEnd" << endl; return 0; } diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 0a3cbedc18..cc2c8e710d 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -109,20 +109,20 @@ void Foam::Time::setControls() else { // Search directory for valid time directories - instantList Times = findTimes(path()); + instantList timeDirs = findTimes(path()); if (startFrom == "firstTime") { - if (Times.size()) + if (timeDirs.size()) { - startTime_ = Times[0].value(); + startTime_ = timeDirs[0].value(); } } else if (startFrom == "latestTime") { - if (Times.size()) + if (timeDirs.size()) { - startTime_ = Times[Times.size()-1].value(); + startTime_ = timeDirs[timeDirs.size()-1].value(); } } else @@ -385,13 +385,13 @@ Foam::instantList Foam::Time::times() const Foam::word Foam::Time::findInstancePath(const instant& t) const { - instantList times = Time::findTimes(path()); + instantList timeDirs = findTimes(path()); - forAllReverse(times, i) + forAllReverse(timeDirs, timeI) { - if (times[i] == t) + if (timeDirs[timeI] == t) { - return times[i].name(); + return timeDirs[timeI].name(); } } @@ -401,37 +401,37 @@ Foam::word Foam::Time::findInstancePath(const instant& t) const Foam::instant Foam::Time::findClosestTime(const scalar t) const { - instantList times = Time::findTimes(path()); + instantList timeDirs = findTimes(path()); - // If there is only one time it is "constant" so return it - if (times.size() == 1) + // there is only one time (likely "constant") so return it + if (timeDirs.size() == 1) { - return times[0]; + return timeDirs[0]; } - if (t < times[1].value()) + if (t < timeDirs[1].value()) { - return times[1]; + return timeDirs[1]; } - else if (t > times[times.size() - 1].value()) + else if (t > timeDirs[timeDirs.size()-1].value()) { - return times[times.size() - 1]; + return timeDirs[timeDirs.size()-1]; } label nearestIndex = -1; scalar deltaT = GREAT; - for (label i=1; i < times.size(); i++) + for (label timeI=1; timeI < timeDirs.size(); ++timeI) { - scalar diff = mag(times[i].value() - t); + scalar diff = mag(timeDirs[timeI].value() - t); if (diff < deltaT) { deltaT = diff; - nearestIndex = i; + nearestIndex = timeI; } } - return times[nearestIndex]; + return timeDirs[nearestIndex]; } @@ -440,29 +440,29 @@ Foam::instant Foam::Time::findClosestTime(const scalar t) const // // Foam::instant Foam::Time::findClosestTime(const scalar t) const // { -// instantList times = Time::findTimes(path()); -// label timeIndex = min(findClosestTimeIndex(times, t), 0); -// return times[timeIndex]; +// instantList timeDirs = findTimes(path()); +// label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0); +// return timeDirs[timeIndex]; // } Foam::label Foam::Time::findClosestTimeIndex ( - const instantList& times, + const instantList& timeDirs, const scalar t ) { label nearestIndex = -1; scalar deltaT = GREAT; - forAll (times, i) + forAll(timeDirs, timeI) { - if (times[i].name() == "constant") continue; + if (timeDirs[timeI].name() == "constant") continue; - scalar diff = fabs(times[i].value() - t); + scalar diff = mag(timeDirs[timeI].value() - t); if (diff < deltaT) { deltaT = diff; - nearestIndex = i; + nearestIndex = timeI; } } diff --git a/src/OpenFOAM/db/Time/timeSelector.C b/src/OpenFOAM/db/Time/timeSelector.C index 8cd7940ccf..caf8c4f3a0 100644 --- a/src/OpenFOAM/db/Time/timeSelector.C +++ b/src/OpenFOAM/db/Time/timeSelector.C @@ -170,7 +170,7 @@ Foam::List Foam::timeSelector::select // determine latestTime selection (if any) // this must appear before the -time option processing label latestIdx = -1; - if (args.options().found("latestTime")) + if (args.optionFound("latestTime")) { selectTimes = false; latestIdx = timeDirs.size() - 1; @@ -182,12 +182,12 @@ Foam::List Foam::timeSelector::select } } - if (args.options().found("time")) + if (args.optionFound("time")) { // can match 0/, but can never match constant/ selectTimes = timeSelector ( - IStringStream(args.options()["time"])() + args.optionLookup("time")() ).selected(timeDirs); } @@ -201,13 +201,13 @@ Foam::List Foam::timeSelector::select if (constantIdx >= 0) { // only add constant/ if specifically requested - selectTimes[constantIdx] = args.options().found("constant"); + selectTimes[constantIdx] = args.optionFound("constant"); } // special treatment for 0/ if (zeroIdx >= 0) { - if (args.options().found("noZero")) + if (args.optionFound("noZero")) { // exclude 0/ if specifically requested selectTimes[zeroIdx] = false; @@ -215,7 +215,7 @@ Foam::List Foam::timeSelector::select else if (argList::validOptions.found("zeroTime")) { // with -zeroTime enabled, drop 0/ unless specifically requested - selectTimes[zeroIdx] = args.options().found("zeroTime"); + selectTimes[zeroIdx] = args.optionFound("zeroTime"); } } diff --git a/src/OpenFOAM/db/Time/timeSelector.H b/src/OpenFOAM/db/Time/timeSelector.H index 1138f1b0e5..ecdb92bb33 100644 --- a/src/OpenFOAM/db/Time/timeSelector.H +++ b/src/OpenFOAM/db/Time/timeSelector.H @@ -85,7 +85,7 @@ class argList; class Time; /*---------------------------------------------------------------------------*\ - Class timeSelector Declaration + Class timeSelector Declaration \*---------------------------------------------------------------------------*/ class timeSelector @@ -136,7 +136,7 @@ public: ); //- Return the set of times selected based on the argList options - static List select + static List select ( const List&, const argList& args @@ -144,7 +144,7 @@ public: //- Return the set of times selected based on the argList options // also set the runTime to the first instance - static List select0 + static List select0 ( Time& runTime, const argList& args diff --git a/src/OpenFOAM/include/CintDefs.H b/src/OpenFOAM/include/CintDefs.H index 7dcb75b6d4..90e1f62a2f 100644 --- a/src/OpenFOAM/include/CintDefs.H +++ b/src/OpenFOAM/include/CintDefs.H @@ -1,6 +1,6 @@ #ifdef __CINT__ -#define tmp Foam::tmp -#define UList Foam::UList -#define List Foam::List -#define InfoProxy Foam::InfoProxy +# define tmp Foam::tmp +# define UList Foam::UList +# define List Foam::List +# define InfoProxy Foam::InfoProxy #endif diff --git a/src/OpenFOAM/include/CintUndefs.H b/src/OpenFOAM/include/CintUndefs.H index 20a47aea2a..6b0b69e99c 100644 --- a/src/OpenFOAM/include/CintUndefs.H +++ b/src/OpenFOAM/include/CintUndefs.H @@ -1,6 +1,6 @@ #ifdef __CINT__ -#undef tmp -#undef UList -#undef List -#undef InfoProxy +# undef tmp +# undef UList +# undef List +# undef InfoProxy #endif diff --git a/src/OpenFOAM/include/addRegionOption.H b/src/OpenFOAM/include/addRegionOption.H index 382836d329..4ece251a17 100644 --- a/src/OpenFOAM/include/addRegionOption.H +++ b/src/OpenFOAM/include/addRegionOption.H @@ -1 +1,5 @@ - argList::validOptions.insert("region", "name"); +// +// addRegionOption.H +// ~~~~~~~~~~~~~~~~~ + + Foam::argList::validOptions.insert("region", "name"); diff --git a/src/OpenFOAM/include/addTimeOptions.H b/src/OpenFOAM/include/addTimeOptions.H index d55374486b..ec57beec07 100644 --- a/src/OpenFOAM/include/addTimeOptions.H +++ b/src/OpenFOAM/include/addTimeOptions.H @@ -2,7 +2,7 @@ // addTimeOptions.H // ~~~~~~~~~~~~~~~~ - argList::validOptions.insert("constant", ""); - argList::validOptions.insert("latestTime", ""); - argList::validOptions.insert("noZero", ""); - argList::validOptions.insert("time", "time"); + Foam::argList::validOptions.insert("constant", ""); + Foam::argList::validOptions.insert("latestTime", ""); + Foam::argList::validOptions.insert("noZero", ""); + Foam::argList::validOptions.insert("time", "time"); diff --git a/src/OpenFOAM/include/checkConstantOption.H b/src/OpenFOAM/include/checkConstantOption.H index be3aa5b9f7..9f39ac6541 100644 --- a/src/OpenFOAM/include/checkConstantOption.H +++ b/src/OpenFOAM/include/checkConstantOption.H @@ -1,4 +1,14 @@ - if (Times.size() > 1 && !args.optionFound("constant")) +// +// checkConstantOption.H +// ~~~~~~~~~~~~~~~~~~~~~ +// unless -constant is present, skip startTime if it is "constant" + + if + ( + !args.optionFound("constant") + && (startTime < Times.size()-1) + && (Times[startTime].name() == "constant") + ) { - startTime = 1; + startTime++; } diff --git a/src/OpenFOAM/include/checkLatestTimeOption.H b/src/OpenFOAM/include/checkLatestTimeOption.H deleted file mode 100644 index 38d24a34d5..0000000000 --- a/src/OpenFOAM/include/checkLatestTimeOption.H +++ /dev/null @@ -1,4 +0,0 @@ - if (args.optionFound("latestTime")) - { - startTime = Times.size() - 1; - } diff --git a/src/OpenFOAM/include/checkTimeOption.H b/src/OpenFOAM/include/checkTimeOption.H index a3a43141fc..64ef62440f 100644 --- a/src/OpenFOAM/include/checkTimeOption.H +++ b/src/OpenFOAM/include/checkTimeOption.H @@ -1,7 +1,17 @@ +// +// checkTimeOption.H +// ~~~~~~~~~~~~~~~~~ +// check -time and -latestTime options + if (args.optionFound("time")) { - scalar timeValue = args.optionRead("time"); + Foam::scalar timeValue = args.optionRead("time"); - startTime = Time::findClosestTimeIndex(Times, timeValue); + startTime = Foam::Time::findClosestTimeIndex(Times, timeValue); endTime = startTime + 1; } + + if (args.optionFound("latestTime")) + { + startTime = Times.size() - 1; + } diff --git a/src/OpenFOAM/include/checkTimeOptions.H b/src/OpenFOAM/include/checkTimeOptions.H index 121b17797e..7b2b15b329 100644 --- a/src/OpenFOAM/include/checkTimeOptions.H +++ b/src/OpenFOAM/include/checkTimeOptions.H @@ -1,6 +1,12 @@ - label startTime = 0; - label endTime = Times.size(); +// +// checkTimeOptions.H +// ~~~~~~~~~~~~~~~~~~ + Foam::label startTime = 0; + Foam::label endTime = Times.size(); + +// unless -constant is present, skip startTime if it is "constant" # include "checkConstantOption.H" + +// check -time and -latestTime options # include "checkTimeOption.H" -# include "checkLatestTimeOption.H" diff --git a/src/OpenFOAM/include/checkTimeOptionsNoConstant.H b/src/OpenFOAM/include/checkTimeOptionsNoConstant.H index 4d5bfced69..407903ddc1 100644 --- a/src/OpenFOAM/include/checkTimeOptionsNoConstant.H +++ b/src/OpenFOAM/include/checkTimeOptionsNoConstant.H @@ -1,5 +1,9 @@ - label startTime = 0; - label endTime = Times.size(); +// +// checkTimeOptionsNoConstant.H +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Foam::label startTime = 0; + Foam::label endTime = Times.size(); + +// check -time and -latestTime options # include "checkTimeOption.H" -# include "checkLatestTimeOption.H" diff --git a/src/OpenFOAM/include/createMesh.H b/src/OpenFOAM/include/createMesh.H index a85c239f41..630494649d 100644 --- a/src/OpenFOAM/include/createMesh.H +++ b/src/OpenFOAM/include/createMesh.H @@ -1,4 +1,9 @@ - Foam::Info<< "Create mesh for time = " +// +// createMesh.H +// ~~~~~~~~~~~~ + + Foam::Info + << "Create mesh for time = " << runTime.timeName() << Foam::nl << Foam::endl; Foam::fvMesh mesh diff --git a/src/OpenFOAM/include/createMeshNoClear.H b/src/OpenFOAM/include/createMeshNoClear.H index d0e61ab7f8..8526a37be6 100644 --- a/src/OpenFOAM/include/createMeshNoClear.H +++ b/src/OpenFOAM/include/createMeshNoClear.H @@ -1,13 +1,19 @@ - Info<< "Create mesh, no clear-out for time = " - << runTime.timeName() << nl << endl; +// +// createMeshNoClear.H +// ~~~~~~~~~~~~~~~~~~~ +// currently identical to createMesh.H - fvMesh mesh + Foam::Info + << "Create mesh, no clear-out for time = " + << runTime.timeName() << Foam::nl << Foam::endl; + + Foam::fvMesh mesh ( - IOobject + Foam::IOobject ( - fvMesh::defaultRegion, + Foam::fvMesh::defaultRegion, runTime.timeName(), runTime, - IOobject::MUST_READ + Foam::IOobject::MUST_READ ) ); diff --git a/src/OpenFOAM/include/createNamedMesh.H b/src/OpenFOAM/include/createNamedMesh.H index fe61435e47..f61ec2bd6e 100644 --- a/src/OpenFOAM/include/createNamedMesh.H +++ b/src/OpenFOAM/include/createNamedMesh.H @@ -1,24 +1,30 @@ - word regionName; +// +// createNamedMesh.H +// ~~~~~~~~~~~~~~~~~ + + Foam::word regionName; if (args.optionReadIfPresent("region", regionName)) { - Info<< "Create mesh " << regionName << " for time = " - << runTime.timeName() << nl << endl; + Foam::Info + << "Create mesh " << regionName << " for time = " + << runTime.timeName() << Foam::nl << Foam::endl; } else { - regionName = fvMesh::defaultRegion; - Info<< "Create mesh for time = " - << runTime.timeName() << nl << endl; + regionName = Foam::fvMesh::defaultRegion; + Foam::Info + << "Create mesh for time = " + << runTime.timeName() << Foam::nl << Foam::endl; } - fvMesh mesh + Foam::fvMesh mesh ( - IOobject + Foam::IOobject ( regionName, runTime.timeName(), runTime, - IOobject::MUST_READ + Foam::IOobject::MUST_READ ) ); diff --git a/src/OpenFOAM/include/createNamedPolyMesh.H b/src/OpenFOAM/include/createNamedPolyMesh.H index a1670fb8ed..bee8601c74 100644 --- a/src/OpenFOAM/include/createNamedPolyMesh.H +++ b/src/OpenFOAM/include/createNamedPolyMesh.H @@ -1,24 +1,30 @@ - word regionName; +// +// createNamedPolyMesh.H +// ~~~~~~~~~~~~~~~~~~~~~ + + Foam::word regionName; if (args.optionReadIfPresent("region", regionName)) { - Info<< "Create polyMesh " << regionName << " for time = " - << runTime.timeName() << nl << endl; + Foam::Info + << "Create polyMesh " << regionName << " for time = " + << runTime.timeName() << Foam::nl << Foam::endl; } else { - regionName = polyMesh::defaultRegion; - Info<< "Create polyMesh for time = " - << runTime.timeName() << nl << endl; + regionName = Foam::polyMesh::defaultRegion; + Foam::Info + << "Create polyMesh for time = " + << runTime.timeName() << Foam::nl << Foam::endl; } - polyMesh mesh + Foam::polyMesh mesh ( - IOobject + Foam::IOobject ( regionName, runTime.timeName(), runTime, - IOobject::MUST_READ + Foam::IOobject::MUST_READ ) ); diff --git a/src/OpenFOAM/include/createPolyMesh.H b/src/OpenFOAM/include/createPolyMesh.H index 3249a6c02a..02e25d1c51 100644 --- a/src/OpenFOAM/include/createPolyMesh.H +++ b/src/OpenFOAM/include/createPolyMesh.H @@ -1,13 +1,18 @@ - Info<< "Create polyMesh for time = " - << runTime.timeName() << nl << endl; +// +// createPolyMesh.H +// ~~~~~~~~~~~~~~~~ - polyMesh mesh + Foam::Info + << "Create polyMesh for time = " + << runTime.timeName() << Foam::nl << Foam::endl; + + Foam::polyMesh mesh ( - IOobject + Foam::IOobject ( - polyMesh::defaultRegion, + Foam::polyMesh::defaultRegion, runTime.timeName(), runTime, - IOobject::MUST_READ + Foam::IOobject::MUST_READ ) ); diff --git a/src/OpenFOAM/include/createTime.H b/src/OpenFOAM/include/createTime.H index 7c600100fe..057814a870 100644 --- a/src/OpenFOAM/include/createTime.H +++ b/src/OpenFOAM/include/createTime.H @@ -1,3 +1,7 @@ +// +// createTime.H +// ~~~~~~~~~~~~ + Foam::Info<< "Create time\n" << Foam::endl; Foam::Time runTime diff --git a/src/OpenFOAM/include/setRootCase.H b/src/OpenFOAM/include/setRootCase.H index 09d961ea8a..587374d067 100644 --- a/src/OpenFOAM/include/setRootCase.H +++ b/src/OpenFOAM/include/setRootCase.H @@ -1,6 +1,9 @@ -Foam::argList args(argc, argv); +// +// setRootCase.H +// ~~~~~~~~~~~~~ -if (!args.checkRootCase()) -{ - Foam::FatalError.exit(); -} + Foam::argList args(argc, argv); + if (!args.checkRootCase()) + { + Foam::FatalError.exit(); + } diff --git a/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C b/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C index b64f5f8adb..080f027658 100644 --- a/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C +++ b/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C @@ -232,14 +232,14 @@ void Foam::calcTypes::addSubtract::preCalc << exit(FatalError); } - if (args.options().found("field")) + if (args.optionFound("field")) { - addSubtractFieldName_ = args.options()["field"]; + addSubtractFieldName_ = args.option("field"); calcType_ = FIELD; } - else if (args.options().found("value")) + else if (args.optionFound("value")) { - addSubtractValueStr_ = args.options()["value"]; + addSubtractValueStr_ = args.option("value"); calcType_ = VALUE; } else @@ -249,9 +249,9 @@ void Foam::calcTypes::addSubtract::preCalc << nl << exit(FatalError); } - if (args.options().found("resultName")) + if (args.optionFound("resultName")) { - resultName_ = args.options()["resultName"]; + resultName_ = args.option("resultName"); } }