diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C index c7444c2be63250e5234a4b926ac77c51af1bb1f0..e2bf673ce26375af9422b21a9e5ca3451988c247 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 7b64177da576620e81160feeed77606f5a2b0dc6..f438a1f9637537c09dffbed428cc84d341494fbd 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<Times.size(); i++) + // skip "constant" time + for (label timeI = 1; timeI < Times.size(); ++timeI) { - runTime.setTime(Times[i], i); + runTime.setTime(Times[timeI], timeI); Info<< "Time = " << runTime.timeName() << endl; diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index a2925210db9aee736308b147536d5b68a2d749fa..bdc60d724b4af233ec85b7048d659c6cbe4aaac0 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -387,7 +387,6 @@ int main(int argc, char *argv[]) const word oldInstance = mesh.pointsInstance(); const bool blockOrder = args.optionFound("blockOrder"); - if (blockOrder) { Info<< "Ordering cells into regions (using decomposition);" @@ -396,7 +395,6 @@ int main(int argc, char *argv[]) } const bool orderPoints = args.optionFound("orderPoints"); - if (orderPoints) { Info<< "Ordering points into internal and boundary points." << nl diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index 21b77ff842dd1d2850f8a0b2272aa4c3f66b9fe8..d79d516806e040de45f70483eec4cdd195bacd04 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -591,24 +591,10 @@ commandStatus parseType } else if (setType == "time") { - scalar time = readScalar(is); - + scalar requestedTime = readScalar(is); instantList Times = runTime.times(); - int nearestIndex = -1; - scalar nearestDiff = Foam::GREAT; - - forAll(Times, timeIndex) - { - if (Times[timeIndex].name() == "constant") continue; - - scalar diff = fabs(Times[timeIndex].value() - time); - if (diff < nearestDiff) - { - nearestDiff = diff; - nearestIndex = timeIndex; - } - } + label nearestIndex = Time::findClosestTimeIndex(Times, requestedTime); Pout<< "Changing time from " << runTime.timeName() << " to " << Times[nearestIndex].name() @@ -646,7 +632,8 @@ commandStatus parseType } default: { - FatalErrorIn("parseType") << "Illegal mesh update state " + FatalErrorIn("parseType") + << "Illegal mesh update state " << stat << abort(FatalError); break; } @@ -746,7 +733,7 @@ int main(int argc, char *argv[]) Pout<< "Reading commands from file " << batchFile << endl; - // we also cannot handle .gz files + // we cannot handle .gz files if (!isFile(batchFile, false)) { FatalErrorIn(args.executable()) @@ -864,7 +851,7 @@ int main(int argc, char *argv[]) delete fileStreamPtr; } - Pout << nl << "End" << endl; + Pout<< "\nEnd" << endl; return 0; } diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C index 9d27d8691b387ded455c75823454de3f0d553c4c..dfd7262fd17ba65a287bd041289dbcc95475c7df 100644 --- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C +++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C @@ -64,7 +64,6 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" - bool noFlipMap = args.optionFound("noFlipMap"); // Get times list @@ -73,9 +72,8 @@ int main(int argc, char *argv[]) label startTime = Times.size()-1; label endTime = Times.size(); + // check -time and -latestTime options # include "checkTimeOption.H" -# include "checkLatestTimeOption.H" - runTime.setTime(Times[startTime], startTime); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index a6a429318e9d51c160e4f344dc181aec85d0858a..881bb4b05a3ae7a5da76a3f6a500e68d7134bd3d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -48,6 +48,7 @@ Note \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "IOobjectList.H" #include "IOmanip.H" #include "OFstream.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C index cc146bc57617143b3fe89a1b16070bcd71d1ca72..87270649df41445b6b77676ab141dfc0e155b68f 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C +++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C @@ -23,7 +23,8 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Write out the FOAM mesh in Version 3.0 Fieldview-UNS format (binary). + Write out the OpenFOAM mesh in Version 3.0 Fieldview-UNS format (binary). + See Fieldview Release 9 Reference Manual - Appendix D (Unstructured Data Format) Borrows various from uns/write_binary_uns.c from FieldView dist. @@ -31,6 +32,7 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "volFields.H" #include "surfaceFields.H" #include "pointFields.H" @@ -176,20 +178,15 @@ int main(int argc, char *argv[]) { argList::noParallel(); argList::validOptions.insert("noWall", ""); + timeSelector::addOptions(true, false); -# include "addTimeOptions.H" # include "setRootCase.H" # include "createTime.H" - instantList Times = runTime.times(); - -# include "checkTimeOptions.H" - - runTime.setTime(Times[startTime], startTime); + instantList timeDirs = timeSelector::select0(runTime, args); # include "createMesh.H" - // Initialize name mapping table FieldviewNames.insert("alpha", "aalpha"); FieldviewNames.insert("Alpha", "AAlpha"); @@ -285,17 +282,16 @@ int main(int argc, char *argv[]) label fieldViewTime = 0; - for (label i=startTime; i<endTime; i++) + forAll(timeDirs, timeI) { - runTime.setTime(Times[i], i); - - Info<< "Time " << Times[i].name() << endl; + runTime.setTime(timeDirs[timeI], timeI); + Info<< "Time: " << runTime.timeName() << endl; fvMesh::readUpdateState state = mesh.readUpdate(); if ( - i == startTime + timeI == 0 || state == fvMesh::TOPO_CHANGE || state == fvMesh::TOPO_PATCH_CHANGE ) @@ -334,7 +330,7 @@ int main(int argc, char *argv[]) fileName fvFileName ( - fvPath/runTime.caseName() + "_" + Foam::name(i) + ".uns" + fvPath/runTime.caseName() + "_" + Foam::name(timeI) + ".uns" ); Info<< " file:" << fvFileName.c_str() << endl; @@ -364,7 +360,7 @@ int main(int argc, char *argv[]) // Output constants for time, fsmach, alpha and re. float fBuf[4]; - fBuf[0] = Times[i].value(); + fBuf[0] = runTime.value(); fBuf[1] = 0.0; fBuf[2] = 0.0; fBuf[3] = 1.0; @@ -892,7 +888,7 @@ int main(int argc, char *argv[]) writeInt(fvParticleFile, fieldViewTime + 1); // Time value - writeFloat(fvParticleFile, Times[i].value()); + writeFloat(fvParticleFile, runTime.value()); // Read particles Cloud<passiveParticle> parcels(mesh); diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H index 129d788738403040a45b32a823cc7036311c9e29..ec540efe7df467f5ce5136303309ce71eb3b602e 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H +++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H @@ -5,9 +5,9 @@ HashSet<word> surfVectorHash; HashSet<word> sprayScalarHash; HashSet<word> 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 118e99fc9101c2fd64a0cddae1c6a9e28c198008..04518db985c1db2a5245f464b364613a456ed84b 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 e143dd359d5dedb6a3a0a5a9ef764f2709222182..7c4ef69a4fd06f91e26a2ce00cefdae159743af5 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<nCells;n++) { label nFaces = cells[n].nFaces(); - labelList points = cells[n]; + const labelList& points = cells[n]; if ((nFaces == 6) && (points.size() == 8)) { @@ -70,7 +70,6 @@ int USERD_get_maxsize_info if (Numparts_available > 1) { - // Get the maximum number of spray parcels // and store it Cloud<passiveParticle> 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 353b67def1551dd4838481a0fdfe339caa26d418..dcc64822897df9246929b025bf1e64e61167673d 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; n<Num_time_steps;n++) { - solution_times[n] = TimeList[n+1].value(); + solution_times[n] = timeDirs[n+1].value(); } - if (TimeList[1].value() < 0) + if (timeDirs[1].value() < 0) { scalar addCAD = 360.0; - while (TimeList[1].value() + addCAD < 0.0) + while (timeDirs[1].value() + addCAD < 0.0) { addCAD += 360.0; } @@ -29,14 +29,14 @@ int USERD_get_sol_times { solution_times[n] += addCAD; - Info << "Time[" << n << "] = " << TimeList[n+1].value() + Info << "Time[" << n << "] = " << timeDirs[n+1].value() << " was corrected to " << solution_times[n] << endl; } } #ifdef ENSIGHTDEBUG - Info << "Leaving: USERD_get_sol_times" << endl << flush; + Info<< "Leaving: USERD_get_sol_times" << endl; #endif return Z_OK; diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_timeset_description.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_timeset_description.H index 6eebf9b345ced343d96cc57f4d59328b79f27290..e3c98ba240127ba9047968c11c5a162113632bc9 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_timeset_description.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_timeset_description.H @@ -4,13 +4,12 @@ int USERD_get_timeset_description char timeset_description[Z_BUFL] ) { - + #ifdef ENSIGHTDEBUG - Info << "Entering: USERD_get_timeset_description" << endl - << flush; + Info<< "Entering: USERD_get_timeset_description" << endl; #endif - if (TimeList[1].value() < 0) + if (timeDirs[1].value() < 0) { strncpy(timeset_description, "CAD", Z_BUFL); } @@ -20,8 +19,7 @@ int USERD_get_timeset_description } #ifdef ENSIGHTDEBUG - Info << "Leaving: USERD_get_timeset_description" << endl - << flush; + Info<< "Leaving: USERD_get_timeset_description" << endl; #endif return Z_OK; diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H index 83303fef717fdea9600e8e7331f3270d5cbce984..712ce53b869072019ca37fa40c749d35197b1b2f 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H @@ -79,18 +79,18 @@ int USERD_set_filenames ); // set the available number of time-steps - TimeList = (const instantList&)Foam::Time::findTimes(rootDir/caseDir); + timeDirs = Foam::Time::findTimes(rootDir/caseDir); - Num_time_steps = TimeList.size() - 1; + Num_time_steps = timeDirs.size() - 1; nPatches = meshPtr->boundaryMesh().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<passiveParticle> 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 ef2f9a24531ed8f5b3a6371cb0ef247ed204c264..5e4c5815323af4948db69d381d5e37483bbb0185 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 80c71ba028062eebb8eeabb88e9607cf19e3d6b7..c6548c1408279dce2d0e92c827b814caab09d51c 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<vector> 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 d68861b138e6cb79159d94767c0206769c2baa5c..7c7f2b16d822c6dfdf43ffeb78322234063529f9 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<word> fieldNames; static List<word> lagrangianScalarNames; diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/calculateFields.H b/applications/utilities/postProcessing/miscellaneous/postChannel/calculateFields.H index e4f4f411e1a1e56e017b2a9bc5de4407d3437108..6c7cffcf0ad300c7d95042c0fa44c06de822c03c 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 943bff5811f05f92a7291978bf95d371a1f7e1a4..559e769cf1c293e3de4ca34a1ce4751ad72de5c9 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<endTime; i++) + forAll(timeDirs, timeI) { - runTime.setTime(Times[i], i); - + runTime.setTime(timeDirs[timeI], timeI); Info<< "Collapsing fields for time " << runTime.timeName() << endl; # include "readFields.H" @@ -96,7 +90,7 @@ int main(int argc, char *argv[]) # include "collapse.H" } - Info<< "end" << endl; + Info<< "\nEnd" << endl; return 0; } diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H b/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H index d281b6335144fd968eb021f9573dcb3ce079718d..e0ce9b1f6da71c361a6a0b62dffca7111ede1f2a 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H @@ -1,7 +1,7 @@ IOobject UMeanHeader ( "UMean", - runTime.times()[i].name(), + runTime.timeName(), mesh, IOobject::MUST_READ ); @@ -23,7 +23,7 @@ IOobject ( "UPrime2Mean", - runTime.times()[i].name(), + runTime.timeName(), mesh, IOobject::MUST_READ ), @@ -39,7 +39,7 @@ IOobject ( "pPrime2Mean", - runTime.times()[i].name(), + runTime.timeName(), mesh, IOobject::MUST_READ ), @@ -52,7 +52,7 @@ IOobject ( "epsilonMean", - runTime.times()[i].name(), + runTime.timeName(), mesh, IOobject::MUST_READ ), @@ -64,7 +64,7 @@ IOobject ( "nuMean", - runTime.times()[i].name(), + runTime.timeName(), mesh, IOobject::MUST_READ ), @@ -76,7 +76,7 @@ IOobject ( "gammaDotMean", - runTime.times()[i].name(), + runTime.timeName(), mesh, IOobject::MUST_READ ), @@ -88,7 +88,7 @@ IOobject ( "nuPrime", - runTime.times()[i].name(), + runTime.timeName(), mesh, IOobject::MUST_READ ), @@ -102,7 +102,7 @@ IOobject ( "gammaDotPrime", - runTime.times()[i].name(), + runTime.timeName(), mesh, IOobject::MUST_READ ), diff --git a/applications/utilities/preProcessing/mapFields/createTimes.H b/applications/utilities/preProcessing/mapFields/createTimes.H index b7c8a1fe3343ea9426217c41890bcdf7819f5f93..8367e595579842d813bbd2d15945ffc63d5c16d0 100644 --- a/applications/utilities/preProcessing/mapFields/createTimes.H +++ b/applications/utilities/preProcessing/mapFields/createTimes.H @@ -1,4 +1,4 @@ - Info<< nl << "Create databases as time" << endl; + Info << "\nCreate databases as time" << endl; Time runTimeSource ( diff --git a/applications/utilities/preProcessing/mapFields/mapFields.C b/applications/utilities/preProcessing/mapFields/mapFields.C index bd840ab267a26bf21e126bd3f130601f869d2e44..fde815d76faa06334770adb5c0a9857478ae4a0e 100644 --- a/applications/utilities/preProcessing/mapFields/mapFields.C +++ b/applications/utilities/preProcessing/mapFields/mapFields.C @@ -43,31 +43,6 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -int getTimeIndex -( - const instantList& times, - const scalar t -) -{ - int nearestIndex = -1; - scalar nearestDiff = Foam::GREAT; - - forAll(times, timeIndex) - { - if (times[timeIndex].name() == "constant") continue; - - scalar diff = fabs(times[timeIndex].value() - t); - if (diff < nearestDiff) - { - nearestDiff = diff; - nearestIndex = timeIndex; - } - } - - return nearestIndex; -} - - void mapConsistentMesh ( const fvMesh& meshSource, @@ -254,9 +229,7 @@ wordList addProcessorPatches int main(int argc, char *argv[]) { # include "setRoots.H" - # include "createTimes.H" - # include "setTimeIndex.H" runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex); @@ -357,7 +330,7 @@ int main(int argc, char *argv[]) } } } - else if(!parallelSource && parallelTarget) + else if (!parallelSource && parallelTarget) { IOdictionary decompositionDict ( @@ -426,7 +399,7 @@ int main(int argc, char *argv[]) } } } - else if(parallelSource && parallelTarget) + else if (parallelSource && parallelTarget) { IOdictionary decompositionDictSource ( diff --git a/applications/utilities/preProcessing/mapFields/setTimeIndex.H b/applications/utilities/preProcessing/mapFields/setTimeIndex.H index 15f8efdb0fca44b9d286e3ff6085ba952f3e24c9..19efd9ff5b4bc80ebe49a0b941fe999daee6221d 100644 --- a/applications/utilities/preProcessing/mapFields/setTimeIndex.H +++ b/applications/utilities/preProcessing/mapFields/setTimeIndex.H @@ -8,12 +8,18 @@ } else { - scalar sourceTime = args.optionRead<scalar>("sourceTime"); - sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime); + sourceTimeIndex = Time::findClosestTimeIndex + ( + sourceTimes, + args.optionRead<scalar>("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 085a1abe2d1ddec95a378b248add668a1fef410e..5ba3727b39bb794d2fdeff316abc67f30589bfeb 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<entry> regions(setFieldsDict.lookup("regions")); - forAll(regions, regioni) + forAll(regions, regionI) { - const entry& region = regions[regioni]; + const entry& region = regions[regionI]; - autoPtr<topoSetSource> cellSelector = + autoPtr<topoSetSource> 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 0a3cbedc187b59c2dd02dacb156638662ea190d2..cc2c8e710da75ba158d1b8062a4ad508c50d57ee 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 8cd7940ccff7884a15a245fabed7d3a0c0f14e15..caf8c4f3a0fc608c92bc92b16ea956eb4b9c96ec 100644 --- a/src/OpenFOAM/db/Time/timeSelector.C +++ b/src/OpenFOAM/db/Time/timeSelector.C @@ -170,7 +170,7 @@ Foam::List<Foam::instant> 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::instant> 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::instant> 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::instant> 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 1138f1b0e5013436dcdc9658d4dbe537b54c9611..ecdb92bb33297157ef58b7f5d073dda150fd9405 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<Foam::instant> select + static List<instant> select ( const List<instant>&, 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<Foam::instant> select0 + static List<instant> select0 ( Time& runTime, const argList& args diff --git a/src/OpenFOAM/include/CintDefs.H b/src/OpenFOAM/include/CintDefs.H index 7dcb75b6d47fab143d80ce84f04e27547288aa84..90e1f62a2f1a2cd098a4b8ecac448273cbae4635 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 20a47aea2aef9cf4967c63cc1e0485fd8db01130..6b0b69e99ceba4cca1744c51d733c6b685329344 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 382836d3299051bca85c37a483628aa602a883de..4ece251a17240b9054d84f6b3da0d759222047e7 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 d55374486b3625485d3e4aeef7ddb041bb5becad..ec57beec07a6b153ed55ccf52b3600ea888c8ca4 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 be3aa5b9f75184f1117fcbced0af279aaa856249..9f39ac65413c0f6bbb1b510993f3e122fea3955f 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 38d24a34d5d23e8cbaf3d8c7640e6109802ed206..0000000000000000000000000000000000000000 --- 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 a3a43141fc5125d4c04f7327d3f432a0be3fd20d..64ef62440f0b18dda6d70dd9395ef6d0f054031a 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<scalar>("time"); + Foam::scalar timeValue = args.optionRead<scalar>("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 121b17797e5db58a0e181481c11c7c0a2a41b7d3..7b2b15b32955145cb08c801e89e1e15bc57c26a5 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 4d5bfced69f7eebd1750b8155449bd4e6d94b6e6..407903ddc17ba8e5f0d2021f8bfe6dbb8b8f2f68 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 a85c239f41f0abd121da986440ee2df5525b7722..630494649d5642631313e5226115de446a515e1d 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 d0e61ab7f8b606f66e85069648cbecd205f980aa..8526a37be6ec2c42d0d3d6581e265676ec229ec1 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 fe61435e479b194a0862aa3e459efc961c8bbfd9..f61ec2bd6e8836d39d895b4a0604a69e26e2c4cb 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 a1670fb8ed0c29112b1da405e9a05ae301b75e22..bee8601c743ee3547f154b9c800c9cb2f900e0e0 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 3249a6c02aade2f70a342a25157f3fca2c8fdb1e..02e25d1c519ab1a92fb56aa7d1e71baaf71b36e9 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 7c600100fe1b57e0079fb4ae61e1528267dd0c2b..057814a8708a767ecdd07470abaef6779136dffe 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 09d961ea8a2312c076a9dc0e09c37032ddaf5fc8..587374d067c059aefd4dd78ce680e2eb20bbfd8f 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 b64f5f8adbbc4a68d2d5f5c114e1ba7662e93700..080f02765881f785be50c5cdbf01ac6bd9d92981 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"); } }