diff --git a/applications/test/fvSolutionCombine/Test-fvSolutionCombine.C b/applications/test/fvSolutionCombine/Test-fvSolutionCombine.C index 074996252e..0d9775e849 100644 --- a/applications/test/fvSolutionCombine/Test-fvSolutionCombine.C +++ b/applications/test/fvSolutionCombine/Test-fvSolutionCombine.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) IOobject ( dictName, - "system", + runTime.system(), runTime, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, @@ -128,9 +128,9 @@ int main(int argc, char *argv[]) return 2; } - if (optRewrite && solutionDict.instance() != "system") + if (optRewrite && solutionDict.instance() != runTime.system()) { - Info<<"instance is not 'system' " + Info<<"instance is not " << runTime.system() "- disabling rewrite for this file" << nl; optRewrite = false; } diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H b/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H index d722c432e3..d21b64fdc1 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H +++ b/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H @@ -4,7 +4,7 @@ if ( - runTime.timeName() != "constant" + runTime.timeName() != runTime.constant() && runTime.timeName() != "0" ) { diff --git a/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H b/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H index d722c432e3..d21b64fdc1 100644 --- a/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H +++ b/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H @@ -4,7 +4,7 @@ if ( - runTime.timeName() != "constant" + runTime.timeName() != runTime.constant() && runTime.timeName() != "0" ) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H index 491ada9a43..53e234939e 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H @@ -9,7 +9,7 @@ } else if ( - runTime.timeName() != "constant" + runTime.timeName() != runTime.constant() && runTime.timeName() != "0" ) { diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 1e49db7505..cf0ca1314a 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -575,7 +575,7 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) // skip "constant" time whenever possible if (timeI == 0 && nTimes > 1) { - if (timeLst[timeI].name() == "constant") + if (timeLst[timeI].name() == runTime.constant()) { ++timeI; --nTimes; diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 8619e2da91..b589dfc883 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -148,7 +148,7 @@ void Foam::Time::setControls() else { // Search directory for valid time directories - instantList timeDirs = findTimes(path()); + instantList timeDirs = findTimes(path(), constant()); if (startFrom == "firstTime") { @@ -694,13 +694,13 @@ Foam::word Foam::Time::timeName() const // Search the construction path for times Foam::instantList Foam::Time::times() const { - return findTimes(path()); + return findTimes(path(), constant()); } Foam::word Foam::Time::findInstancePath(const instant& t) const { - instantList timeDirs = findTimes(path()); + instantList timeDirs = findTimes(path(), constant()); forAllReverse(timeDirs, timeI) { @@ -716,7 +716,7 @@ Foam::word Foam::Time::findInstancePath(const instant& t) const Foam::instant Foam::Time::findClosestTime(const scalar t) const { - instantList timeDirs = findTimes(path()); + instantList timeDirs = findTimes(path(), constant()); // there is only one time (likely "constant") so return it if (timeDirs.size() == 1) @@ -755,15 +755,16 @@ Foam::instant Foam::Time::findClosestTime(const scalar t) const // // Foam::instant Foam::Time::findClosestTime(const scalar t) const // { -// instantList timeDirs = findTimes(path()); -// label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0); +// instantList timeDirs = findTimes(path(), constant()); +// label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0, constant()); // return timeDirs[timeIndex]; // } Foam::label Foam::Time::findClosestTimeIndex ( const instantList& timeDirs, - const scalar t + const scalar t, + const word& constantName ) { label nearestIndex = -1; @@ -771,7 +772,7 @@ Foam::label Foam::Time::findClosestTimeIndex forAll(timeDirs, timeI) { - if (timeDirs[timeI].name() == "constant") continue; + if (timeDirs[timeI].name() == constantName) continue; scalar diff = mag(timeDirs[timeI].value() - t); if (diff < deltaT) diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 1e761cd73e..695f666c2e 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -374,7 +374,12 @@ public: instant findClosestTime(const scalar) const; //- Search instantList for the time index closest to the given time - static label findClosestTimeIndex(const instantList&, const scalar); + static label findClosestTimeIndex + ( + const instantList&, + const scalar, + const word& constantName = "constant" + ); //- Write using given format, version and compression virtual bool writeObject @@ -404,7 +409,11 @@ public: virtual word timeName() const; //- Search a given directory for valid time directories - static instantList findTimes(const fileName&); + static instantList findTimes + ( + const fileName&, + const word& constantName = "constant" + ); //- Return start time index virtual label startTimeIndex() const; diff --git a/src/OpenFOAM/db/Time/findTimes.C b/src/OpenFOAM/db/Time/findTimes.C index 87b3669fd6..3384916737 100644 --- a/src/OpenFOAM/db/Time/findTimes.C +++ b/src/OpenFOAM/db/Time/findTimes.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,11 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Foam::instantList Foam::Time::findTimes(const fileName& directory) +Foam::instantList Foam::Time::findTimes +( + const fileName& directory, + const word& constantName +) { if (debug) { @@ -53,7 +57,7 @@ Foam::instantList Foam::Time::findTimes(const fileName& directory) bool haveConstant = false; forAll(dirEntries, i) { - if (dirEntries[i] == "constant") + if (dirEntries[i] == constantName) { Times[nTimes].value() = 0; Times[nTimes].name() = dirEntries[i]; diff --git a/src/OpenFOAM/db/Time/timeSelector.C b/src/OpenFOAM/db/Time/timeSelector.C index 60b589a347..7a8bcc5eb4 100644 --- a/src/OpenFOAM/db/Time/timeSelector.C +++ b/src/OpenFOAM/db/Time/timeSelector.C @@ -155,7 +155,8 @@ void Foam::timeSelector::addOptions Foam::List Foam::timeSelector::select ( const instantList& timeDirs, - const argList& args + const argList& args, + const word& constantName ) { if (timeDirs.size()) @@ -168,7 +169,7 @@ Foam::List Foam::timeSelector::select forAll(timeDirs, timeI) { - if (timeDirs[timeI].name() == "constant") + if (timeDirs[timeI].name() == constantName) { constantIdx = timeI; } @@ -250,7 +251,12 @@ Foam::List Foam::timeSelector::select0 const argList& args ) { - instantList timeDirs = timeSelector::select(runTime.times(), args); + instantList timeDirs = timeSelector::select + ( + runTime.times(), + args, + runTime.constant() + ); if (timeDirs.empty()) { diff --git a/src/OpenFOAM/db/Time/timeSelector.H b/src/OpenFOAM/db/Time/timeSelector.H index 88255cac06..ce22d83fce 100644 --- a/src/OpenFOAM/db/Time/timeSelector.H +++ b/src/OpenFOAM/db/Time/timeSelector.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -138,7 +138,8 @@ public: static instantList select ( const instantList&, - const argList& args + const argList& args, + const word& constantName = "constant" ); //- Return the set of times selected based on the argList options diff --git a/src/conversion/meshReader/meshReader.C b/src/conversion/meshReader/meshReader.C index b6f50c2452..851492229d 100644 --- a/src/conversion/meshReader/meshReader.C +++ b/src/conversion/meshReader/meshReader.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -138,7 +138,7 @@ Foam::autoPtr Foam::meshReader::mesh IOobject ( polyMesh::defaultRegion, - "constant", + registry.time().constant(), registry ), xferMove(points_), diff --git a/src/conversion/meshReader/meshReaderAux.C b/src/conversion/meshReader/meshReaderAux.C index 91708d8055..95360dba1e 100644 --- a/src/conversion/meshReader/meshReaderAux.C +++ b/src/conversion/meshReader/meshReaderAux.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ License #include "meshReader.H" #include "IOMap.H" #include "OFstream.H" - +#include "Time.H" // * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * // @@ -80,7 +80,7 @@ void Foam::meshReader::writeInterfaces(const objectRegistry& registry) const IOobject ( "interfaces", - "constant", + registry.time().constant(), polyMesh::meshSubDir, registry, IOobject::NO_READ, @@ -115,7 +115,7 @@ void Foam::meshReader::writeMeshLabelList IOobject ( propertyName, - "constant", + registry.time().constant(), polyMesh::meshSubDir, registry, IOobject::NO_READ, diff --git a/src/conversion/meshWriter/starcd/STARCDMeshWriter.C b/src/conversion/meshWriter/starcd/STARCDMeshWriter.C index 2df70059e2..08383060e1 100644 --- a/src/conversion/meshWriter/starcd/STARCDMeshWriter.C +++ b/src/conversion/meshWriter/starcd/STARCDMeshWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -72,7 +72,7 @@ void Foam::meshWriters::STARCD::getCellTable() IOobject ( "cellTableId", - "constant", + mesh_.time().constant(), polyMesh::meshSubDir, mesh_, IOobject::READ_IF_PRESENT, @@ -506,7 +506,7 @@ bool Foam::meshWriters::STARCD::write(const fileName& meshName) const if ( mesh_.time().timeName() != "0" - && mesh_.time().timeName() != "constant" + && mesh_.time().timeName() != mesh_.time().constant() ) { baseName += "_" + mesh_.time().timeName(); diff --git a/src/edgeMesh/edgeMeshFormats/edgeMeshFormatsCore.C b/src/edgeMesh/edgeMeshFormats/edgeMeshFormatsCore.C index f87d6f7d38..9cd5e35fda 100644 --- a/src/edgeMesh/edgeMeshFormats/edgeMeshFormatsCore.C +++ b/src/edgeMesh/edgeMeshFormats/edgeMeshFormatsCore.C @@ -105,7 +105,7 @@ Foam::fileName Foam::fileFormats::edgeMeshFormatsCore::findMeshInstance } } - return "constant"; + return t.constant(); } @@ -148,7 +148,7 @@ Foam::fileName Foam::fileFormats::edgeMeshFormatsCore::findMeshFile } // fallback to "constant" - return t.path()/"constant"/localName; + return t.path()/t.constant()/localName; } #endif diff --git a/src/meshTools/coordinateSystems/coordinateSystems.C b/src/meshTools/coordinateSystems/coordinateSystems.C index fef44796e3..1739ecd8e2 100644 --- a/src/meshTools/coordinateSystems/coordinateSystems.C +++ b/src/meshTools/coordinateSystems/coordinateSystems.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,7 +85,7 @@ const Foam::coordinateSystems& Foam::coordinateSystems::New IOobject ( typeName, - "constant", + obr.time().constant(), obr, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE diff --git a/src/surfMesh/surfaceFormats/surfaceFormatsCore.C b/src/surfMesh/surfaceFormats/surfaceFormatsCore.C index c1d1aac7ac..c098eaf1b9 100644 --- a/src/surfMesh/surfaceFormats/surfaceFormatsCore.C +++ b/src/surfMesh/surfaceFormats/surfaceFormatsCore.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -105,7 +105,7 @@ Foam::fileName Foam::fileFormats::surfaceFormatsCore::findMeshInstance } } - return "constant"; + return t.constant(); } @@ -148,7 +148,7 @@ Foam::fileName Foam::fileFormats::surfaceFormatsCore::findMeshFile } // fallback to "constant" - return t.path()/"constant"/localName; + return t.path()/t.constant()/localName; } #endif diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index 1350653865..d8630cc77d 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -83,7 +83,7 @@ Foam::fileName Foam::triSurface::triSurfInstance(const Time& d) << "reading " << foamName << " from constant/" << endl; } - return "constant"; + return d.constant(); }