36bool 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_;
70 const bool processorCase,
72 const bool distributed,
75 const word& systemDirName,
76 const word& constantDirName
79 processorCase_(processorCase),
80 distributed_(distributed),
82 globalCaseName_(globalCaseName),
84 system_(systemDirName),
85 constant_(constantDirName)
89 detectProcessorCase();
96 const word& systemDirName,
97 const word& constantDirName
102 args.runControl().parRun(),
104 args.runControl().distributed(),
105 args.globalCaseName(),
121 return fileHandler().findTimes(directory, constantDirName);
129 const word& constantDirName
132 const label nTimes = timeDirs.
size();
134 label nearestIndex = -1;
135 scalar deltaT = GREAT;
137 for (label timei=0; timei < nTimes; ++timei)
139 if (timeDirs[timei].
name() == constantDirName)
continue;
145 nearestIndex = timei;
157 const word& constantDirName
160 const label nTimes = timeDirs.size();
165 return instant(0, constantDirName);
167 else if (nTimes == 1)
172 else if (t < timeDirs[1].value())
176 else if (t > timeDirs[nTimes-1].value())
178 return timeDirs[nTimes-1];
181 label nearestIndex = 0;
182 scalar deltaT = GREAT;
184 for (label timei=1; timei < nTimes; ++timei)
190 nearestIndex = timei;
194 return timeDirs[nearestIndex];
212 if (t.equal(timeDirs[i].value()))
214 return timeDirs[i].name();
226 const word& constantDirName
254 return findClosestTime
270 return findClosestTime
291 return findInstancePath(
path(layout), t);
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Layout
The layout of the case structure.
bool equal(scalar val) const noexcept
Is instant value equal to val within (SMALL) rounding?
Address the time paths without using the Time class.
instantList times() const
Search the case for valid time directories.
bool distributed() const noexcept
True if case running with parallel distributed directories (ie. not NFS mounted).
const fileName & rootPath() const noexcept
Return root path.
const word & constant() const noexcept
Return constant name.
static instantList findTimes(const fileName &directory, const word &constantDirName="constant")
Search a given directory for valid time directories.
const fileName & globalCaseName() const noexcept
Return global case name.
static word findInstancePath(const UList< instant > &timeDirs, const instant &t)
Search instantList for matching time value, return the instance name or word::null if nothing is equa...
static instant findClosestTime(const UList< instant > &timeDirs, const scalar t, const word &constantDirName="constant")
Search instant list for the instant closest to the specified time.
static label findClosestTimeIndex(const UList< instant > &timeDirs, const scalar t, const word &constantDirName="constant")
Search instant list for the time index closest to the specified time.
bool processorCase() const noexcept
True if this is a processor case.
TimePaths(const bool processorCase, const fileName &rootPath, const bool distributed, const fileName &globalCaseName, const fileName &caseName, const word &systemDirName="system", const word &constantDirName="constant")
Construct from all components.
const fileName & caseName() const noexcept
Return case name.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
Extract command arguments and options from the supplied argc and argv parameters.
A class for handling file names.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
A class for handling words, derived from Foam::string.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
dimensionedScalar pos(const dimensionedScalar &ds)
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler().
List< instant > instantList
List of instants.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
Foam::argList args(argc, argv)
#define forAllReverse(list, i)
Reverse loop across all elements in list.