use timeSelector mechanism in a few more utilities

This commit is contained in:
Mark Olesen
2009-03-23 16:57:26 +01:00
parent 549c78f9fe
commit be8cbc1018
21 changed files with 124 additions and 239 deletions

View File

@ -39,24 +39,17 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H"
Info<< "\nEstimating error in scalar transport equation\n" << endl;
# 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"
Info<< "Reading transportProperties\n" << endl;
Info<< "\nEstimating error in scalar transport equation\n"
<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
@ -79,9 +72,9 @@ int main(int argc, char *argv[])
);
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

View File

@ -38,25 +38,17 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H"
Info<< "\nEstimating error in the incompressible momentum equation\n"
<< endl;
# 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"
Info<< "Reading transportProperties\n" << endl;
Info<< "\nEstimating error in the incompressible momentum equation\n"
<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
@ -75,9 +67,9 @@ int main(int argc, char *argv[])
transportProperties.lookup("nu")
);
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

View File

@ -39,25 +39,17 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H"
Info<< "\nEstimating error in the incompressible momentum equation\n"
<< endl;
# 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"
Info<< "Reading transportProperties\n" << endl;
Info<< "\nEstimating error in the incompressible momentum equation\n"
<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
@ -76,9 +68,9 @@ int main(int argc, char *argv[])
transportProperties.lookup("nu")
);
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

View File

@ -40,24 +40,17 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H"
Info<< "\nEstimating error in scalar transport equation\n" << endl;
# 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"
Info<< "Reading transportProperties\n" << endl;
Info<< "\nEstimating error in scalar transport equation\n"
<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
@ -80,9 +73,9 @@ int main(int argc, char *argv[])
);
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

View File

@ -61,6 +61,7 @@ See Also
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "polyMesh.H"
#include "STARCDMeshWriter.H"
@ -73,20 +74,17 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::noParallel();
timeSelector::addOptions();
argList::validOptions.insert("scale", "scale");
argList::validOptions.insert("noBnd", "");
argList::validOptions.insert("tri", "");
argList::validOptions.insert("surface", "");
# 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);
bool surfaceOnly = false;
if (args.options().found("surface") or args.options().found("tri"))
@ -118,17 +116,16 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H"
// bool firstCheck = true;
for (label timeI = startTime; timeI < endTime; ++timeI)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[timeI], timeI);
runTime.setTime(timeDirs[timeI], timeI);
# include "getTimeIndex.H"
polyMesh::readUpdateState state = mesh.readUpdate();
if (timeI == startTime || state != polyMesh::UNCHANGED)
if (!timeI || state != polyMesh::UNCHANGED)
{
meshWriters::STARCD writer(mesh, scaleFactor);

View File

@ -1,4 +1,4 @@
meshDualiser.C
makePolyDualMesh.C
polyDualMeshApp.C
EXE = $(FOAM_APPBIN)/polyDualMesh

View File

@ -348,8 +348,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);
@ -509,7 +511,7 @@ int main(int argc, char *argv[])
Info<< "Writing dual mesh to " << runTime.timeName() << endl;
mesh.write();
Info<< "End\n" << endl;
return 0;

View File

@ -37,6 +37,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "polyMesh.H"
#include "OFstream.H"
@ -336,6 +337,7 @@ void writePointCells
int main(int argc, char *argv[])
{
timeSelector::addOptions();
argList::validOptions.insert("patchFaces", "");
argList::validOptions.insert("cell", "cellI");
argList::validOptions.insert("face", "faceI");
@ -343,7 +345,6 @@ int main(int argc, char *argv[])
argList::validOptions.insert("cellSet", "setName");
argList::validOptions.insert("faceSet", "setName");
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
@ -361,31 +362,23 @@ int main(int argc, char *argv[])
<< "(for points, faces, cells) is consistent with"
<< " Foam numbering (starting from 0)." << endl << endl;
// Get times list
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createPolyMesh.H"
bool firstCheck = true;
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
polyMesh::readUpdateState state = mesh.readUpdate();
if (firstCheck || state != polyMesh::UNCHANGED)
if (!timeI || state != polyMesh::UNCHANGED)
{
if (patchFaces)
{
writePatchFaces(mesh, runTime.timeName());
}
else if (doCell)
{
@ -487,9 +480,7 @@ int main(int argc, char *argv[])
Info << "No mesh." << endl;
}
firstCheck = false;
Info << endl << endl;
Info << nl << endl;
}

View File

@ -31,7 +31,9 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "polyMesh.H"
#include "globalMeshData.H"
@ -45,48 +47,34 @@ using namespace Foam;
int main(int argc, char *argv[])
{
timeSelector::addOptions(false); // no constant
# include "addRegionOption.H"
# include "addTimeOptionsNoConstant.H"
argList::validOptions.insert("noTopology", "");
argList::validOptions.insert("allGeometry", "");
argList::validOptions.insert("allTopology", "");
# include "setRootCase.H"
# include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createNamedPolyMesh.H"
const bool noTopology = args.options().found("noTopology");
const bool noTopology = args.options().found("noTopology");
const bool allGeometry = args.options().found("allGeometry");
const bool allTopology = args.options().found("allTopology");
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
# include "checkTimeOptionsNoConstant.H"
runTime.setTime(Times[startTime], startTime);
# include "createNamedPolyMesh.H"
bool firstCheck = true;
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
polyMesh::readUpdateState state = mesh.readUpdate();
if
(
firstCheck
!timeI
|| state == polyMesh::TOPO_CHANGE
|| state == polyMesh::TOPO_PATCH_CHANGE
)
{
firstCheck = false;
Info<< "Time = " << runTime.timeName() << nl << endl;
// Clear mesh before checking
@ -110,32 +98,30 @@ int main(int argc, char *argv[])
if (noFailedChecks == 0)
{
Info<< "\nMesh OK."
<< nl << endl;
Info<< "\nMesh OK.\n" << endl;
}
else
{
Info<< "\nFailed " << noFailedChecks << " mesh checks."
<< nl << endl;
Info<< "\nFailed " << noFailedChecks << " mesh checks.\n"
<< endl;
}
}
else if (state == polyMesh::POINTS_MOVED)
{
Info<< "Time = " << runTime.timeName() << nl << endl;
label noFailedChecks = checkGeometry(mesh, allGeometry);
label nFailedChecks = checkGeometry(mesh, allGeometry);
reduce(noFailedChecks, sumOp<label>());
reduce(nFailedChecks, sumOp<label>());
if (noFailedChecks == 0)
if (nFailedChecks)
{
Info << "\nMesh OK."
<< nl << endl;
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
<< endl;
}
else
{
Info<< "\nFailed " << noFailedChecks << " mesh checks."
<< nl << endl;
Info << "\nMesh OK.\n" << endl;
}
}
}

View File

@ -31,6 +31,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "fvMesh.H"
#include "volFields.H"
@ -66,7 +67,8 @@ void RotateFields
int main(int argc, char *argv[])
{
# include "addTimeOptions.H"
timeSelector::addOptions();
argList::validArgs.append("n1");
argList::validArgs.append("n2");
@ -105,19 +107,15 @@ int main(int argc, char *argv[])
points.write();
}
// 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"
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

View File

@ -48,8 +48,8 @@ Description
#if READLINE != 0
#include <readline/readline.h>
#include <readline/history.h>
# include <readline/readline.h>
# include <readline/history.h>
#endif
using namespace Foam;

View File

@ -40,25 +40,19 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "addRegionOption.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 "createNamedMesh.H"
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << nl << endl;

View File

@ -38,26 +38,22 @@ Description
int main(int argc, char *argv[])
{
argList::noParallel();
# include "addTimeOptions.H"
timeSelector::addOptions(false); // no constant
# include "setRootCase.H"
# include "createTime.H"
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptionsNoConstant.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
// make a directory called proInterface in the case
mkDir(runTime.rootPath()/runTime.caseName()/"fluentInterface");
for (label timeI = startTime; timeI < endTime; timeI++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[timeI], timeI);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
if (mesh.readUpdate())

View File

@ -225,8 +225,10 @@ labelList getSelectedPatches
int main(int argc, char *argv[])
{
# include "addTimeOptions.H"
timeSelector::addOptions();
# include "addRegionOption.H"
argList::validOptions.insert("fields", "fields");
argList::validOptions.insert("cellSet", "cellSet name");
argList::validOptions.insert("faceSet", "faceSet name");
@ -244,7 +246,6 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
bool doWriteInternal = !args.options().found("noInternal");
bool doFaceZones = !args.options().found("noFaceZones");
bool doLinks = !args.options().found("noLinks");
@ -312,14 +313,8 @@ int main(int argc, char *argv[])
}
instantList Times = runTime.times();
instantList timeDirs = timeSelector::select0(runTime, args);
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Current mesh.
# include "createNamedMesh.H"
// VTK/ directory in the case
@ -359,11 +354,11 @@ int main(int argc, char *argv[])
// mesh wrapper; does subsetting and decomposition
vtkMesh vMesh(mesh, cellSetName);
for (label timeI = startTime; timeI < endTime; timeI++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[timeI], timeI);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time " << Times[timeI].name() << endl;
Info<< "Time: " << runTime.timeName() << endl;
// Check for new polyMesh/ and update mesh, fvMeshSubset and cell
// decomposition.

View File

@ -36,25 +36,18 @@ Description
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"
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

View File

@ -37,25 +37,18 @@ Description
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"
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
mesh.readUpdate();

View File

@ -29,6 +29,8 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "fvMesh.H"
#include "vectorIOField.H"
#include "volFields.H"
@ -41,23 +43,18 @@ using namespace Foam;
int main(int argc, char *argv[])
{
# include "addTimeOptions.H"
timeSelector::addOptions();
# 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"
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
@ -77,10 +74,10 @@ int main(int argc, char *argv[])
mesh.C()
);
//Info<< "Writing cellCentre positions to " << cc.name() << " in "
// << runTime.timeName() << endl;
// Info<< "Writing cellCentre positions to " << cc.name() << " in "
// << runTime.timeName() << endl;
//
//cc.write();
// cc.write();
Info<< "Writing components of cellCentre positions to volScalarFields"
<< " ccx, ccy, ccz in " << runTime.timeName() << endl;
@ -104,7 +101,7 @@ int main(int argc, char *argv[])
}
}
Info << nl << "End" << endl;
Info<< "\nEnd" << endl;
return 0;
}

View File

@ -38,23 +38,16 @@ Description
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"
runTime.setTime(Times[endTime-1], endTime-1);
runTime.setTime(timeDirs[timeDirs.size()-1], timeDirs.size()-1);
volScalarField pMean
(
@ -68,9 +61,9 @@ int main(int argc, char *argv[])
mesh
);
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

View File

@ -35,30 +35,22 @@ Description
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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"
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

View File

@ -42,24 +42,19 @@ Source files:
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
timeSelector::addOptions();
#include "setRootCase.H"
#include "createTime.H"
// Get times list
instantList Times = runTime.times();
instantList timeDirs = timeSelector::select0(runTime, args);
// set startTime and endTime depending on -time and -latestTime options
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
#include "createMesh.H"
#include "createFields.H"
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

View File

@ -26,7 +26,7 @@ Application
streamFunction
Description
Calculates and writes the stream function of velocity field U at each time
Calculates and writes the stream function of velocity field U at each time
\*---------------------------------------------------------------------------*/
@ -42,27 +42,20 @@ Description
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 "createMeshNoClear.H"
pointMesh pMesh(mesh);
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< nl << "Time: " << runTime.timeName() << endl;