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_;
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(),
118 const word& constantDirName
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;
155 const UList<instant>& timeDirs,
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];
200 const UList<instant>& timeDirs,
212 if (t.equal(timeDirs[i].value()))
214 return timeDirs[i].name();
224 const fileName& directory,
226 const word& constantDirName
231 return findInstancePath(timeDirs, t);
254 return findClosestTime
270 return findClosestTime
281 return findInstancePath(
path(), t);
291 return findInstancePath(
path(layout), t);
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
void size(const label n)
Older name for setAddressableSize.
Address the time paths without using the Time class.
A class for handling file names.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
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.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
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.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
dimensionedScalar pos(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
Extract command arguments and options from the supplied argc and argv parameters. ...
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...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Expression::UniformListWrap< scalar > constant
Wrap of constant as a list expression.
static instantList findTimes(const fileName &directory, const word &constantDirName="constant")
Search a given directory for valid time directories.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
instantList times() const
Search the case for valid time directories.
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.
Layout
The layout of the case structure.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Foam::argList args(argc, argv)