mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
cleanup of time handling (cosmetic changes), used timeSelector in more places
This commit is contained in:
@ -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.
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user