48namespace fileOperations
64 "maxMasterFileBufferSize",
90 if (mainRanks.
empty())
98 if (!mainRanks.
found(0))
101 <<
"Rank 0 (master) should be in the IO ranks. Currently "
107 const bitSet isIOrank(
n, mainRanks);
117 label rank = proci+1;
118 rank <
n && !isIOrank[rank];
147 if (t.
equal(timeDirs[i].value()))
149 return timeDirs[i].name();
160 const bool checkGlobal,
166 word& newInstancePath
172 if (
io.instance().isAbsolute())
176 if (isFileOrDir(
isFile, objPath))
190 fileName writePath(objectPath(
io,
io.headerClassName()));
192 if (isFileOrDir(
isFile, writePath))
199 if (
io.time().processorCase())
203 for (
const dirIndex& dirIdx : pDirs())
205 const fileName& pDir = dirIdx.first();
207 processorsPath(
io,
io.instance(), pDir)
209 if (objPath != writePath && isFileOrDir(
isFile, objPath))
211 searchType = dirIdx.second().first();
223 localPath != writePath
224 && isFileOrDir(
isFile, localPath)
238 &&
io.time().processorCase()
240 io.instance() ==
io.time().system()
241 ||
io.instance() ==
io.time().constant()
246 io.rootPath()/
io.time().globalCaseName()
247 /
io.instance()/
io.db().dbDir()/
io.local()/
io.name();
249 if (isFileOrDir(
isFile, parentPath))
258 const auto pathFnd = times_.cfind(
io.time().path());
260 if (
search && pathFnd.found())
262 newInstancePath = findInstancePath
268 if (newInstancePath.size() && newInstancePath !=
io.instance())
273 lookupProcessorsPath(
io.objectPath())
276 for (
const dirIndex& dirIdx : pDirs())
278 const fileName& pDir = dirIdx.first();
282 processorsPath(
io, newInstancePath, pDir)
285 if (isFileOrDir(
isFile, fName))
287 switch (dirIdx.second().first())
317 io.rootPath()/
io.caseName()
318 /newInstancePath/
io.db().dbDir()/
io.local()/
io.name()
320 if (isFileOrDir(
isFile, fName))
340 const word& instancePath
349 return io.instance()/
io.name();
355 return io.path()/
io.name();
361 return objectPath(
io,
io.headerClassName());
391 processorsPath(
io,
io.instance(), procDir)
400 processorsPath(
io,
io.instance(), processorsDir(
io))
408 io.rootPath()/
io.time().globalCaseName()
409 /
io.instance()/
io.db().dbDir()/
io.local()/
io.name();
416 io.rootPath()/
io.caseName()
417 /instancePath/
io.db().dbDir()/
io.local()/
io.name();
448 processorsPath(
io, instancePath, procDir)
457 processorsPath(
io, instancePath, processorsDir(
io))
482 const fileName& object0 = filePaths[0];
484 for (label i = 1; i < filePaths.
size(); i++)
486 if (filePaths[i] != object0)
507 <<
"Cannot open file " << filePath
513 Pout<<
"masterUncollatedFileOperation::readAndSend :"
524 const std::string buf
526 std::istreambuf_iterator<char>(ifs.
stdStream()),
527 std::istreambuf_iterator<char>()
530 for (
const label proci : procs)
533 os.write(buf.data(), buf.length());
538 Pout<<
"masterUncollatedFileOperation::readStream :"
539 <<
" From " << filePath <<
" sent " << buf.size()
551 for (
const label proci : procs)
559 Pout<<
"masterUncollatedFileOperation::readStream :"
560 <<
" From " << filePath <<
" sent " << buf.
size()
589 if (filePaths[0].empty())
592 <<
"cannot find file " <<
io.objectPath()
599 if (procValid[proci])
609 Pout<<
"masterUncollatedFileOperation::readStream :"
610 <<
" For uniform file " << filePaths[0]
611 <<
" sending to " << validProcs
612 <<
" in comm:" << comm <<
endl;
614 readAndSend(filePaths[0], validProcs, pBufs);
621 if (filePaths[0].empty())
624 <<
"cannot find file " <<
io.objectPath()
632 if (!
io.readHeader(*isPtr))
635 <<
"problem while reading header for object "
645 Pout<<
"masterUncollatedFileOperation::readStream :"
646 <<
" For processor " << proci
647 <<
" opening " << filePaths[proci] <<
endl;
650 const fileName& fPath = filePaths[proci];
652 if (procValid[proci] && !fPath.empty())
685 Pout<<
"masterUncollatedFileOperation::readStream :"
686 <<
" Done reading " << buf.
size() <<
" bytes" <<
endl;
698 if (!
io.readHeader(*isPtr))
701 <<
"problem while reading header for object "
718Foam::fileOperations::masterUncollatedFileOperation::
719masterUncollatedFileOperation
739 <<
"I/O : " << typeName
749 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
758 <<
"Resetting fileModificationChecking to inotify"
766Foam::fileOperations::masterUncollatedFileOperation::
767masterUncollatedFileOperation
781 <<
"I/O : " << typeName
791 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
800 <<
"Resetting fileModificationChecking to inotify"
828 return masterOp<mode_t>
844 return masterOp<mode_t>
857 const bool followLink
860 return masterOp<mode_t>
873 const bool followLink
892 const bool checkGzip,
893 const bool followLink
896 return masterOp<bool>
909 const bool followLink
912 return masterOp<bool>
925 const bool checkGzip,
926 const bool followLink
929 return masterOp<bool>
942 const bool followLink
945 return masterOp<off_t>
958 const bool followLink
961 return masterOp<time_t>
974 const bool followLink
977 return masterOp<double>
990 const std::string& ext
993 return masterOp<bool>
1008 return masterOp<bool>
1024 return masterOp<bool>
1038 const bool filtergz,
1039 const bool followLink
1042 return masterOp<fileNameList>
1056 const bool followLink
1059 return masterOp<bool>
1076 return masterOp<bool>
1091 const bool followLink
1094 return masterOp<bool>
1109 const bool checkGlobal,
1111 const word& typeName,
1117 Pout<<
"masterUncollatedFileOperation::filePath :"
1118 <<
" objectPath:" <<
io.objectPath()
1119 <<
" checkGlobal:" << checkGlobal <<
endl;
1124 (void)lookupProcessorsPath(
io.objectPath());
1127 (void)findTimes(
io.time().path(),
io.time().constant());
1135 word newInstancePath;
1159 Pout<<
"masterUncollatedFileOperation::filePath :"
1160 <<
" master objPath:" << objPath
1162 <<
" procsDir:" << procsDir <<
" instance:" << newInstancePath
1172 int masterType(searchType);
1183 ||
io.local() ==
"uniform"
1215 objPath = localObjectPath
1231 objPath = masterOp<fileName>
1245 Pout<<
"masterUncollatedFileOperation::filePath :"
1246 <<
" Returning from file searching:" <<
endl
1247 <<
" objectPath:" <<
io.objectPath() <<
endl
1248 <<
" filePath :" << objPath <<
endl <<
endl;
1256 const bool checkGlobal,
1263 Pout<<
"masterUncollatedFileOperation::dirPath :"
1264 <<
" objectPath:" <<
io.objectPath()
1265 <<
" checkGlobal:" << checkGlobal <<
endl;
1270 (void)lookupProcessorsPath(
io.objectPath());
1277 word newInstancePath;
1283 objPath = filePathInfo
1298 int masterType(searchType);
1310 ||
io.local() ==
"uniform"
1342 objPath = localObjectPath
1358 objPath = masterOp<fileName>
1372 Pout<<
"masterUncollatedFileOperation::dirPath :"
1373 <<
" Returning from file searching:" <<
endl
1374 <<
" objectPath:" <<
io.objectPath() <<
endl
1375 <<
" filePath :" << objPath <<
endl <<
endl;
1390 const bool isFile = !
io.name().empty();
1396 if (isFileOrDir(
isFile, writePath))
1402 if (
io.time().processorCase())
1404 for (
const dirIndex& dirIdx : pDirs)
1406 const fileName& pDir = dirIdx.first();
1408 processorsPath(
io,
io.instance(), pDir)
1410 if (procPath != writePath && isFileOrDir(
isFile, procPath))
1420 if (localPath != writePath && isFileOrDir(
isFile, localPath))
1433 const scalar startValue,
1434 const word& stopInstance
1439 Pout<<
"masterUncollatedFileOperation::findInstance :"
1440 <<
" Starting searching for name:" << startIO.
name()
1441 <<
" local:" << startIO.
local()
1442 <<
" from instance:" << startIO.
instance()
1466 foundInstance =
io.instance();
1474 if (!foundInstance.empty())
1476 io.instance() = foundInstance;
1479 Pout<<
"masterUncollatedFileOperation::findInstance :"
1480 <<
" for name:" <<
io.name() <<
" local:" <<
io.local()
1481 <<
" found starting instance:" <<
io.instance() <<
endl;
1488 const bool exitIfMissing
1494 enum failureCodes { FAILED_STOPINST = 1, FAILED_CONSTINST = 2 };
1504 label instIndex = ts.
size()-1;
1507 for (; instIndex >= 0; --instIndex)
1509 if (ts[instIndex].value() <= startValue)
1516 for (; instIndex >= 0; --instIndex)
1525 io.instance() = ts[instIndex].name();
1528 foundInstance =
io.instance();
1531 Pout<<
"masterUncollatedFileOperation::findInstance :"
1532 <<
" for name:" <<
io.name() <<
" local:" <<
io.local()
1533 <<
" found at:" <<
io.instance()
1540 if (
io.instance() == stopInstance)
1544 Pout<<
"masterUncollatedFileOperation::findInstance :"
1545 <<
" name:" <<
io.name()
1546 <<
" local:" <<
io.local()
1547 <<
" at stop-instance:" <<
io.instance() <<
endl;
1552 failed = failureCodes::FAILED_STOPINST;
1556 foundInstance =
io.instance();
1577 !failed && foundInstance.empty()
1578 && (ts.
empty() || ts[0].name() != time.
constant() || startValue < 0)
1592 Pout<<
"masterUncollatedFileOperation::findInstance :"
1593 <<
" name:" <<
io.name()
1594 <<
" local:" <<
io.local()
1595 <<
" at:" <<
io.instance() <<
endl;
1597 foundInstance =
io.instance();
1601 if (!failed && foundInstance.empty())
1605 failed = failureCodes::FAILED_CONSTINST;
1618 io.instance() = foundInstance;
1627 if (!
io.name().empty())
1630 <<
" file \"" <<
io.name() <<
"\" in";
1635 <<
io.local() <<
" in times "
1636 << startIO.
instance() <<
" down to ";
1638 if (failed == failureCodes::FAILED_STOPINST)
1651 Pout<<
"masterUncollatedFileOperation::findInstance :"
1652 <<
" name:" <<
io.name() <<
" local:" <<
io.local()
1653 <<
" returning instance:" <<
io.instance() <<
endl;
1670 Pout<<
"masterUncollatedFileOperation::readObjects :"
1672 <<
" local:" << local <<
" instance:" << instance <<
endl;
1696 if (newInstance.empty())
1715 if (t.
equal(timeDirs[i].value()))
1737 Pout<<
"masterUncollatedFileOperation::readObjects :"
1738 <<
" newInstance:" << newInstance
1739 <<
" objectNames:" << objectNames <<
endl;
1750 const word& typeName
1757 Pout<<
"masterUncollatedFileOperation::readHeader :" <<
endl
1758 <<
" objectPath:" <<
io.objectPath() <<
endl
1759 <<
" filePath :" << fName <<
endl;
1766 bool uniform = uniformFile(filePaths);
1789 io.headerClassName(),
1812 result.
resize(np,
false);
1813 headerClassName.
resize(np);
1818 if (!filePaths[proci].empty())
1820 if (proci > 0 && filePaths[proci] == filePaths[proci-1])
1822 result[proci] = result[proci-1];
1823 headerClassName[proci] = headerClassName[proci-1];
1824 note[proci] = note[proci-1];
1834 headerClassName[proci] =
io.headerClassName();
1835 note[proci] =
io.note();
1848 io.headerClassName() = headerClassName[0];
1849 io.note() = note[0];
1852 for (
const int proci : pBufs.
subProcs())
1855 os << result[proci] << headerClassName[proci] << note[proci];
1864 is >> ok >>
io.headerClassName() >>
io.note();
1870 Pout<<
"masterUncollatedFileOperation::readHeader :" <<
" ok:" << ok
1871 <<
" class:" <<
io.headerClassName() <<
endl;
1882 const word& typeName,
1888 Pout<<
"masterUncollatedFileOperation::readStream :"
1889 <<
" object : " <<
io.name()
1890 <<
" global : " <<
io.global()
1891 <<
" fName : " << fName <<
" valid:" << valid <<
endl;
1896 bool isCollated =
false;
1926 Pout<<
"masterUncollatedFileOperation::readStream :"
1927 <<
" For object : " <<
io.name()
1928 <<
" doing straight IFstream input from "
1950 Pout<<
"masterUncollatedFileOperation::readStream :"
1951 <<
" For object : " <<
io.name()
1952 <<
" starting collating input from " << fName <<
endl;
1963 splitProcessorPath(fName,
path, procDir, local, group, nProcs);
1970 label proci = detectProcessorPath(
io.objectPath());
1975 <<
"Could not detect processor number"
1976 <<
" from objectPath:" <<
io.objectPath()
1983 proci = proci - group.start();
1988 Pout<<
"masterUncollatedFileOperation::readStream :"
1989 <<
" For object : " <<
io.name()
1990 <<
" starting input from block " << proci
1991 <<
" of " << isPtr->name() <<
endl;
2000 label readComm = -1;
2025 bool bigSize =
false;
2033 > off_t(maxMasterFileBufferSize)
2062 Pout<<
"masterUncollatedFileOperation::readStream :"
2063 <<
" For object : " <<
io.name()
2064 <<
" starting separated input from " << fName <<
endl;
2075 boolList procValid(UPstream::listGatherValues<bool>(valid));
2089 boolList procValid(UPstream::listGatherValues<bool>(valid, comm_));
2095 const bool uniform = uniformFile(filePaths);
2106 const bool masterOnly,
2108 const word& typeName
2113 if (
io.globalObject())
2117 Pout<<
"masterUncollatedFileOperation::read :"
2118 <<
" Reading global object " <<
io.name() <<
endl;
2127 ok =
io.readData(
io.readStream(typeName));
2140 io.headerClassName(),
2152 bool okWrite =
io.writeData(toAll);
2163 ok =
io.readData(fromMaster);
2171 Pout<<
"masterUncollatedFileOperation::read :"
2172 <<
" Reading local object " <<
io.name() <<
endl;
2175 ok =
io.readData(
io.readStream(typeName));
2194 Pout<<
"masterUncollatedFileOperation::writeObject :"
2195 <<
" io:" << pathName <<
" valid:" << valid <<
endl;
2212 &&
io.writeHeader(
os)
2228 const word& constantName
2231 const auto iter = times_.cfind(directory);
2236 Pout<<
"masterUncollatedFileOperation::findTimes :"
2237 <<
" Found " << iter.val()->size() <<
" cached times" <<
endl;
2239 return *(iter.val());
2257 Pout<<
"masterUncollatedFileOperation::findTimes :"
2258 <<
" Caching times:" << times <<
nl
2259 <<
" for directory:" << directory <<
endl;
2267 times_.set(directory, tPtr);
2296 const label startIdx =
2307 if (times.
size() <= startIdx || times.
last() < timeNow)
2322 Pout<<
"masterUncollatedFileOperation::setTime :"
2323 <<
" Caching time " << tm.
timeName()
2324 <<
" for case:" << tm.
path() <<
endl;
2331 times, times.
size()-startIdx, startIdx
2367 const bool uniform = uniformFile(filePaths);
2373 Pout<<
"masterUncollatedFileOperation::NewIFstream :"
2374 <<
" Opening global file " << filePath <<
endl;
2411 Pout<<
"masterUncollatedFileOperation::NewIFstream :"
2412 <<
" Reading " << filePath
2423 Pout<<
"masterUncollatedFileOperation::NewIFstream :"
2424 <<
" Done reading " << buf.
size() <<
" bytes" <<
endl;
2434 isPtr->name() = filePath;
2483 watchFd = monitor().addWatch(fName);
2492 const label watchIndex
2498 ok = monitor().removeWatch(watchIndex);
2517 if (monitor().getFile(watchIndices[i]) == fName)
2542 const label index = findWatch(watchIndices,
f);
2546 newWatchIndices.
append(addWatch(
f));
2551 newWatchIndices.
append(watchIndices[index]);
2552 removedWatches.
erase(index);
2557 for (
const label index : removedWatches)
2559 removeWatch(watchIndices[index]);
2568 const label watchIndex
2574 fName = monitor().getFile(watchIndex);
2583 const bool masterOnly,
2589 monitor().updateStates(
true,
false);
2603 state = monitor().getState(watchFd);
2617 monitor().setUnmodified(watchFd);
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
bool found(const Key &key) const
Return true if hashed entry is found in table.
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
Input from file stream, using an ISstream.
virtual std::istream & stdStream()
Access to underlying std::istream.
An ISstream with internal List storage. Always UNCOMPRESSED.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
bool readHeader(Istream &is)
const Time & time() const
Return Time associated with the objectRegistry.
readOption readOpt() const noexcept
The read option.
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
const fileName & local() const noexcept
Read access to local path component.
const fileName & instance() const noexcept
Read access to instance path component.
static fileCheckTypes fileModificationChecking
Type of file modification checking.
fileName objectPath() const
The complete path + object name.
The IOstreamOption is a simple container for options an IOstream can normally have.
compressionType compression() const noexcept
Get the stream compression.
streamFormat
Data format (ascii | binary)
@ COMPRESSED
compression = true
bool good() const noexcept
True if next operation might succeed.
bool equal(scalar val) const noexcept
True if values are equal (includes SMALL for rounding)
An interval of (signed) integers defined by a start and a size.
void append(const T &val)
Append an element at the end of the list.
void resize(const label len)
Adjust allocated size of list.
Generic output stream using a standard (STL) stream.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
UPstream::rangeType allProcs() const noexcept
Range of ranks indices associated with PstreamBuffers.
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
void finishedScatters(const bool wait=true)
Mark all sends to sub-procs as done.
void finishedSends(const bool wait=true)
Mark sends as done.
UPstream::rangeType subProcs() const noexcept
Range of sub-processes indices associated with PstreamBuffers.
Inter-processor communications stream.
static void gatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
static void broadcast(Type &value, const label comm=UPstream::worldComm)
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all processes in communicator.
virtual bool read()
Re-read model coefficients if they have changed.
A List obtained as a section of another List.
instantList times() const
Search the case for valid time directories.
const word & constant() const
Return constant name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
fileName path() const
Return path.
static word timeName(const scalar t, const int precision=precision_)
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
static label read(const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Read buffer contents from given processor.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
void size(const label n)
Older name for setAddressableSize.
T & last()
Return the last element of the list.
Inter-processor communications stream.
commsTypes
Types of communications.
@ nonBlocking
"nonBlocking"
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
static int & msgType() noexcept
Message tag of standard messages.
static constexpr int masterNo() noexcept
Process index of the master (always 0)
static label worldComm
Default communicator (all processors)
static bool & parRun() noexcept
Test if this a parallel run.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void clear() noexcept
Same as reset(nullptr)
bool good() const noexcept
True if the managed pointer is non-null.
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
static autoPtr< ISstream > readBlock(const label blocki, ISstream &is, IOobject &headerIO)
Read selected block (non-seeking) + header information.
static bool isCollatedType(const word &objectType)
True if object type is a known collated type.
static bool readHeader(IOobject &io, Istream &is)
static bool readBlocks(const label comm, autoPtr< ISstream > &isPtr, List< char > &contentChars, const UPstream::commsTypes commsType)
Read data into *this. ISstream is only valid on master.
const Type & value() const
Return const reference to value.
Dummy input stream, which can be used as a placeholder for interfaces taking an Istream or ISstream....
fileState
Enumeration defining the file state.
A class for handling file names.
Type
Enumerations to handle directory entry types.
static const fileName null
An empty fileName.
An encapsulation of filesystem-related operations.
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
virtual void setTime(const Time &) const
Callback for time change.
pathType
Enumeration for the location of an IOobject.
@ PROCUNCOLLATEDINSTANCE
as PROCUNCOLLATED but with instance
@ WRITEOBJECT
write path exists
@ OBJECT
io.objectPath() exists
@ PROCINSTANCE
as PROCOBJECT but with instance
@ FINDINSTANCE
file found in time directory
@ PROCUNCOLLATED
objectPath exists in 'processorN'
@ ABSOLUTE
instance is absolute directory
@ PROCBASEINSTANCE
as PROCBASEOBJECT but with instance
@ PARENTOBJECT
parent of object path
@ PROCOBJECT
objectPath exists in 'processorsNN_first-last'
@ PROCBASEOBJECT
objectPath exists in 'processorsNN'
static labelList ioRanks()
Retrieve list of IO ranks from FOAM_IORANKS env variable.
static const Enum< pathType > pathTypeNames_
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
fileOperations that performs all file operations on the master processor. Requires the calls to be pa...
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
virtual double highResLastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
static word findInstancePath(const instantList &timeDirs, const instant &t)
Equivalent of Time::findInstance.
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool valid=true) const
Reads header for regIOobject and returns an ISstream.
static labelList subRanks(const label n)
Get the list of processors that are part of this communicator.
virtual void setTime(const Time &) const
Callback for time change.
virtual fileName filePathInfo(const bool checkGlobal, const bool isFile, const IOobject &, const bool search, pathType &searchType, word &processorsDir, word &instance) const
Search (locally!) for object; return info on how it was found.
virtual autoPtr< OSstream > NewOFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
Generate an OSstream that writes a file.
virtual bool rmDir(const fileName &dir, const bool silent=false) const
Remove a directory and its contents.
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
static float maxMasterFileBufferSize
Max size of parallel communications. Switches from non-blocking.
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const
Read object header from supplied file.
virtual bool mvBak(const fileName &, const std::string &ext="bak") const
Rename to a corresponding backup file.
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
virtual label findWatch(const labelList &watchIndices, const fileName &) const
Find index (or -1) of file in list of handles.
virtual time_t lastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
virtual fileName dirPath(const bool checkGlobal, const IOobject &io, const bool search) const
Search for a directory. checkGlobal : also check undecomposed.
virtual bool chMod(const fileName &, const mode_t) const
Set the file mode.
virtual IOobject findInstance(const IOobject &io, const scalar startValue, const word &stopInstance) const
Find instance where IOobject is.
virtual off_t fileSize(const fileName &, const bool followLink=true) const
Return size of file.
virtual bool rm(const fileName &) const
Remove a file, returning true if successful otherwise false.
virtual autoPtr< ISstream > NewIFstream(const fileName &) const
Generate an ISstream that reads a file.
virtual bool isFile(const fileName &, const bool checkGzip=true, const bool followLink=true) const
Does the name exist as a FILE in the file system?
virtual bool isDir(const fileName &, const bool followLink=true) const
Does the name exist as a DIRECTORY in the file system?
virtual fileMonitor::fileState getState(const label) const
Get current state of file (using handle)
virtual void setUnmodified(const label) const
Set current state of file (using handle) to unmodified.
static void readAndSend(const fileName &filePath, const labelUList &procs, PstreamBuffers &pBufs)
Read file contents and send to processors.
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
static bool uniformFile(const fileNameList &)
Same file?
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const
Rename src to dst.
virtual bool writeObject(const regIOobject &io, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
Writes a regIOobject (so header, contents and divider).
virtual bool ln(const fileName &src, const fileName &dst) const
Create a softlink. dst should not exist. Returns true if.
fileName localObjectPath(const IOobject &, const pathType &searchType, const word &processorsDir, const word &instancePath) const
Construct filePath.
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
virtual ~masterUncollatedFileOperation()
Destructor.
mode
Enumeration for pressure calculation mode.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Master-only drop-in replacement for OFstream.
Registry of regIOobjects.
const Time & time() const noexcept
Return time registry.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
virtual fileName filePath() const
Return complete path + object name if the file exists.
int myProcNo() const noexcept
Return processor number.
A class for managing references or pointers (no reference counting)
bool exists() const noexcept
True if expression is non-empty.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
const labelList & watchIndices() const noexcept
Read access to file-monitoring handles.
splitCell * master() const
label readDir()
Read directory and populate the 'available' files.
virtual void addWatch()
Add file watch on object (READ_IF_MODIFIED)
type
Volume classification types.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
runTimeSource setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex)
#define WarningInFunction
Report a warning using Foam::Warning.
float floatOptimisationSwitch(const char *name, const float deflt=0)
Lookup optimisation switch or add default value.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
bool read(const char *buf, int32_t &val)
Same as readInt32.
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
List< label > labelList
A List of labels.
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
off_t fileSize(const fileName &name, const bool followLink=true)
Return size of file or -1 on failure (normally follows symbolic links).
int infoDetailLevel
Global for selective suppression of Info output.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
label findSortedIndex(const ListType &input, typename ListType::const_reference val, const label start=0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
void stableSort(UList< T > &list)
Stable sort the list.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
constexpr char nl
The newline '\n' character (0x0a)
word format(conversionProperties.get< word >("format"))
#define registerOptSwitch(Name, Type, SwitchVar)
const volScalarField & cp
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.