Go to the documentation of this file.
36 bool Foam::TimePaths::detectProcessorCase()
40 return processorCase_;
44 const auto sep = globalCaseName_.rfind(
'/');
45 const auto pos = globalCaseName_.find
48 (sep == string::npos ? 0 : sep)
53 globalCaseName_ =
".";
54 processorCase_ =
true;
56 else if (
pos != string::npos && sep != string::npos && sep ==
pos-1)
58 globalCaseName_.resize(sep);
59 processorCase_ =
true;
62 return processorCase_;
71 const word& systemName,
72 const word& constantName
81 constant_(constantName)
86 detectProcessorCase();
94 const word& systemName,
95 const word& constantName
98 processorCase_(
false),
101 globalCaseName_(caseName),
104 constant_(constantName)
107 detectProcessorCase();
113 const bool processorCase,
115 const bool distributed,
118 const word& systemName,
119 const word& constantName
122 processorCase_(processorCase),
123 distributed_(distributed),
125 globalCaseName_(globalCaseName),
128 constant_(constantName)
133 detectProcessorCase();
142 const word& constantName
159 const word& constantName
162 const label nTimes = timeDirs.size();
164 label nearestIndex = -1;
165 scalar deltaT = GREAT;
167 for (label timei=0; timei < nTimes; ++timei)
169 if (timeDirs[timei].
name() == constantName)
continue;
171 const scalar
diff =
mag(timeDirs[timei].value() - t);
175 nearestIndex = timei;
187 const label nTimes = timeDirs.size();
192 return timeDirs.first();
195 if (t < timeDirs[1].value())
199 else if (t > timeDirs.last().value())
201 return timeDirs.last();
204 label nearestIndex = -1;
205 scalar deltaT = GREAT;
207 for (label timei=1; timei < nTimes; ++timei)
209 const scalar
diff =
mag(timeDirs[timei].value() - t);
213 nearestIndex = timei;
217 return timeDirs[nearestIndex];
static instantList findTimes(const fileName &directory, const word &constantName="constant")
Search a given directory for valid time directories.
static label findClosestTimeIndex(const instantList &timeDirs, const scalar t, const word &constantName="constant")
Search instantList for the time index closest to the specified time.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
A class for handling words, derived from Foam::string.
A class for handling file names.
TimePaths(const argList &args, const word &systemName="system", const word &constantName="constant")
Construct using characteristics given by the argList.
Extract command arguments and options from the supplied argc and argv parameters.
const fileOperation & fileHandler()
Get current file handler.
const fileName & rootPath() const
Return root path.
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
const ParRunControl & parRunControl() const
Return the ParRunControl.
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
word name(const complex &c)
Return string representation of complex.
instantList times() const
Search the case for valid time directories.
instant findClosestTime(const scalar t) const
Search the case for the time closest to the given time.
bool distributed() const
True if this is a parallel run and uses distributed roots.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
const fileName & caseName() const
Return case name (parallel run) or global case (serial run)
bool parRun() const
True if this is parallel run.
An instant of time. Contains the time value and name.
Foam::argList args(argc, argv)
constant condensation/saturation model.
const fileName & globalCaseName() const
Return global case name.
dimensionedScalar pos(const dimensionedScalar &ds)