40 namespace fileOperations
46 masterUncollatedFileOperation,
58 fileOperationInitialise,
59 masterUncollatedFileOperationInitialise,
74 string ioRanksString(
getEnv(
"FOAM_IORANKS"));
75 if (ioRanksString.empty())
89 <<
"Rank 0 (master) should be in the IO ranks. Currently " 95 isIOrank.
set(ioRanks);
105 label rank = proci+1;
106 rank < n && !isIOrank[rank];
115 return move(subRanks);
135 if (t.
equal(timeDirs[i].value()))
137 return timeDirs[i].name();
148 const bool checkGlobal,
153 word& newInstancePath
163 if (isFileOrDir(isFile, objPath))
179 if (isFileOrDir(isFile, writePath))
191 const fileName& pDir = pDirs()[i].first();
193 processorsPath(io, io.
instance(), pDir)
195 if (objPath != writePath && isFileOrDir(isFile, objPath))
197 searchType = pDirs()[i].second().first();
209 localPath != writePath
210 && isFileOrDir(isFile, localPath)
235 if (isFileOrDir(isFile, parentPath))
251 if (pathFnd != times_.end())
253 newInstancePath = findInstancePath
259 if (newInstancePath.size() && newInstancePath != io.
instance())
268 const fileName& pDir = pDirs()[i].first();
272 processorsPath(io, newInstancePath, pDir)
275 if (isFileOrDir(isFile, fName))
277 switch (pDirs()[i].second().first())
310 if (isFileOrDir(isFile, fName))
330 const word& instancePath
382 processorsPath(io, io.
instance(), procDir)
391 processorsPath(io, io.
instance(), processorsDir(io))
439 processorsPath(io, instancePath, procDir)
448 processorsPath(io, instancePath, processorsDir(io))
473 const fileName& object0 = filePaths[0];
475 for (
label i = 1; i < filePaths.
size(); i++)
477 if (filePaths[i] != object0)
498 IFstream is(filePath, IOstream::streamFormat::BINARY);
513 std::ostringstream stringStr;
515 string buf(stringStr.str());
520 os.
write(&buf[0], buf.size());
571 if (filePaths[0].empty())
596 Pout<<
"masterUncollatedFileOperation::readStream :" 597 <<
" For uniform file " << filePaths[0]
598 <<
" sending to " << validProcs
599 <<
" in comm:" << comm <<
endl;
601 readAndSend(filePaths[0], validProcs, pBufs);
608 if (filePaths[0].empty())
621 <<
"problem while reading header for object " 639 Pout<<
"masterUncollatedFileOperation::readStream :" 640 <<
" For processor " << proci
641 <<
" opening " << filePaths[proci] <<
endl;
644 const fileName& fPath = filePaths[proci];
646 if (read[proci] && !fPath.empty())
650 readAndSend(fPath,
labelList(1, proci), pBufs);
678 Pout<<
"masterUncollatedFileOperation::readStream :" 679 <<
" Done reading " << buf.size() <<
" bytes" <<
endl;
687 <<
"problem while reading header for object " 722 <<
"I/O : " << typeName
723 <<
" (maxMasterFileBufferSize " << maxMasterFileBufferSize <<
')' 732 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
745 <<
"Resetting fileModificationChecking to inotify" 766 <<
"I/O : " << typeName
767 <<
" (maxMasterFileBufferSize " << maxMasterFileBufferSize <<
')' 776 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
789 <<
"Resetting fileModificationChecking to inotify" 803 const string s(
"-ioRanks");
806 for (
int i=1; i<argc-1; i++)
811 setEnv(
"FOAM_IORANKS", argv[i+1],
true);
818 for (
int i=index+2; i<argc; i++)
847 return masterOp<mode_t, mkDirOp>
863 return masterOp<mode_t, chModOp>
876 const bool checkVariants,
877 const bool followLink
880 return masterOp<mode_t, modeOp>
883 modeOp(checkVariants, followLink),
893 const bool checkVariants,
894 const bool followLink
899 masterOp<label, typeOp>
902 typeOp(checkVariants, followLink),
913 const bool checkVariants,
914 const bool followLink
917 return masterOp<bool, existsOp>
920 existsOp(checkVariants, followLink),
930 const bool followLink
933 return masterOp<bool, isDirOp>
946 const bool checkVariants,
947 const bool followLink
950 return masterOp<bool, isFileOp>
953 isFileOp(checkVariants, followLink),
963 const bool checkVariants,
964 const bool followLink
967 return masterOp<off_t, fileSizeOp>
980 const bool checkVariants,
981 const bool followLink
984 return masterOp<time_t, lastModifiedOp>
997 const bool checkVariants,
998 const bool followLink
1001 return masterOp<double, lastModifiedHROp>
1014 const std::string& ext
1017 return masterOp<bool, mvBakOp>
1032 return masterOp<bool, rmOp>
1047 return masterOp<bool, rmDirOp>
1061 const bool filtergz,
1062 const bool followLink
1065 return masterOp<fileNameList, readDirOp>
1079 const bool followLink
1082 return masterOp<bool, cpOp>
1099 return masterOp<bool, lnOp>
1114 const bool followLink
1117 return masterOp<bool, mvOp>
1130 const bool checkGlobal,
1132 const word& typeName
1137 Pout<<
"masterUncollatedFileOperation::filePath :" 1139 <<
" checkGlobal:" << checkGlobal <<
endl;
1155 word newInstancePath;
1161 objPath = filePathInfo
1173 Pout<<
"masterUncollatedFileOperation::filePath :" 1174 <<
" master objPath:" << objPath
1176 <<
" procsDir:" << procsDir <<
" instance:" << newInstancePath
1187 label masterType(searchType);
1199 || io.
local() ==
"uniform" 1232 objPath = localObjectPath
1248 objPath = masterOp<fileName, fileOrNullOp>
1262 Pout<<
"masterUncollatedFileOperation::filePath :" 1263 <<
" Returning from file searching:" <<
endl 1265 <<
" filePath :" << objPath <<
endl <<
endl;
1273 const bool checkGlobal,
1279 Pout<<
"masterUncollatedFileOperation::dirPath :" 1281 <<
" checkGlobal:" << checkGlobal <<
endl;
1293 word newInstancePath;
1297 objPath = filePathInfo
1309 label masterType(searchType);
1321 || io.
local() ==
"uniform" 1354 objPath = localObjectPath
1369 objPath = masterOp<fileName, fileOrNullOp>
1383 Pout<<
"masterUncollatedFileOperation::dirPath :" 1384 <<
" Returning from file searching:" <<
endl 1386 <<
" filePath :" << objPath <<
endl <<
endl;
1401 const bool isFile = !io.
name().empty();
1407 if (isFileOrDir(isFile, writePath))
1419 processorsPath(io, io.
instance(), pDir)
1421 if (procPath != writePath && isFileOrDir(isFile, procPath))
1431 if (localPath != writePath && isFileOrDir(isFile, localPath))
1444 const scalar startValue,
1445 const word& stopInstance
1450 Pout<<
"masterUncollatedFileOperation::findInstance :" 1451 <<
" Starting searching for name:" << startIO.
name()
1452 <<
" local:" << startIO.
local()
1453 <<
" from instance:" << startIO.
instance()
1485 if (!foundInstance.empty())
1490 Pout<<
"masterUncollatedFileOperation::findInstance :" 1491 <<
" for name:" << io.
name() <<
" local:" << io.
local()
1492 <<
" found starting instance:" << io.
instance() <<
endl;
1507 for (instanceI = ts.
size()-1; instanceI >= 0; --instanceI)
1509 if (ts[instanceI].value() <= startValue)
1516 for (; instanceI >= 0; --instanceI)
1525 io.
instance() = ts[instanceI].name();
1531 Pout<<
"masterUncollatedFileOperation::findInstance :" 1532 <<
" for name:" << io.
name() <<
" local:" << io.
local()
1540 if (ts[instanceI].
name() == stopInstance)
1548 if (io.
name().empty())
1551 <<
"Cannot find directory " 1553 <<
" down to " << stopInstance
1559 <<
"Cannot find file \"" << io.
name()
1560 <<
"\" in directory " << io.
local()
1562 <<
" down to " << stopInstance
1569 Pout<<
"masterUncollatedFileOperation::findInstance :" 1570 <<
" name:" << io.
name() <<
" local:" << io.
local()
1578 if (foundInstance.empty())
1596 Pout<<
"masterUncollatedFileOperation::findInstance :" 1597 <<
" name:" << io.
name()
1598 <<
" local:" << io.
local()
1606 if (foundInstance.empty())
1615 <<
"Cannot find file \"" << io.
name() <<
"\" in directory " 1632 Pout<<
"masterUncollatedFileOperation::findInstance :" 1633 <<
" name:" << io.
name() <<
" local:" << io.
local()
1651 Pout<<
"masterUncollatedFileOperation::readObjects :" 1653 <<
" local:" << local <<
" instance:" << instance <<
endl;
1678 if (newInstance.empty())
1697 if (t.
equal(timeDirs[i].value()))
1719 Pout<<
"masterUncollatedFileOperation::readObjects :" 1720 <<
" newInstance:" << newInstance
1721 <<
" objectNames:" << objectNames <<
endl;
1732 const word& typeName
1739 Pout<<
"masterUncollatedFileOperation::readHeader :" <<
endl 1741 <<
" fName :" << fName <<
endl;
1748 bool uniform = uniformFile(filePaths);
1796 if (!filePaths[proci].empty())
1798 if (proci > 0 && filePaths[proci] == filePaths[proci-1])
1800 result[proci] = result[proci-1];
1801 headerClassName[proci] = headerClassName[proci-1];
1802 note[proci] = note[proci-1];
1814 == decomposedBlockData::typeName
1827 note[proci] = io.
note();
1845 Pout<<
"masterUncollatedFileOperation::readHeader :" <<
" ok:" << ok
1857 const word& typeName,
1863 Pout<<
"masterUncollatedFileOperation::readStream :" 1864 <<
" object : " << io.
name()
1865 <<
" global : " << io.
global()
1866 <<
" fName : " << fName <<
" read:" << read <<
endl;
1871 bool isCollated =
false;
1903 Pout<<
"masterUncollatedFileOperation::readStream :" 1904 <<
" For object : " << io.
name()
1905 <<
" doing straight IFstream input from " 1927 Pout<<
"masterUncollatedFileOperation::readStream :" 1928 <<
" For object : " << io.
name()
1929 <<
" starting collating input from " << fName <<
endl;
1935 label groupStart, groupSize, nProcs;
1958 <<
"Could not detect processor number" 1966 if (groupStart != -1 && groupSize > 0)
1968 proci = proci-groupStart;
1973 Pout<<
"masterUncollatedFileOperation::readStream :" 1974 <<
" For object : " << io.
name()
1975 <<
" starting input from block " << proci
1976 <<
" of " << isPtr().name() <<
endl;
1984 string versionString;
1985 string formatString;
1988 versionString = isPtr().version().str();
1990 os << isPtr().format();
1991 formatString = (os.
str());
1999 bool bigSize = sz > off_t(maxMasterFileBufferSize);
2004 label readComm = -1;
2005 if (groupStart != -1 && groupSize > 0)
2047 Pout<<
"masterUncollatedFileOperation::readStream :" 2048 <<
" For object : " << io.
name()
2049 <<
" starting separated input from " << fName <<
endl;
2083 bool uniform = uniformFile(filePaths);
2101 const bool masterOnly,
2103 const word& typeName
2116 Pout<<
"masterUncollatedFileOperation::read :" 2117 <<
" Reading global object " << io.
name() <<
endl;
2135 Istream& is = io.readStream(typeName);
2158 std::underlying_type_t<IOstream::streamFormat> formatValue(format);
2175 if (myComm.
above() != -1)
2195 myComm.
below()[belowI],
2209 Pout<<
"masterUncollatedFileOperation::read :" 2210 <<
" Reading local object " << io.
name() <<
endl;
2213 ok = io.
readData(io.readStream(typeName));
2234 Pout<<
"masterUncollatedFileOperation::writeObject :" 2235 <<
" io:" << filePath <<
" write:" << write <<
endl;
2280 const word& constantName
2284 if (iter != times_.end())
2288 Pout<<
"masterUncollatedFileOperation::findTimes :" 2289 <<
" Found " << iter()->size() <<
" cached times" <<
endl;
2311 times_.insert(directory, tPtr);
2315 Pout<<
"masterUncollatedFileOperation::findTimes :" 2316 <<
" Caching times:" << *tPtr <<
nl 2317 <<
" for directory:" << directory <<
endl;
2335 if (iter != times_.end())
2341 if (times.
size() > 0 && times[0].name() == tm.
constant())
2357 Pout<<
"masterUncollatedFileOperation::setTime :" 2358 <<
" Caching time " << tm.
timeName()
2359 <<
" for case:" << tm.
path() <<
endl;
2373 Pout<<
"masterUncollatedFileOperation::setTime :" 2374 <<
" Caching time " << tm.
timeName()
2375 <<
" for case:" << tm.
path() <<
endl;
2413 const bool uniform = uniformFile(filePaths);
2419 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2420 <<
" Opening global file " << filePath <<
endl;
2431 procs[proci-1] = proci;
2434 readAndSend(filePath, procs, pBufs);
2445 readAndSend(filePaths[proci],
labelList(1, proci), pBufs);
2466 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2467 <<
" Reading " << filePath
2477 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2478 <<
" Done reading " << buf.size() <<
" bytes" <<
endl;
2538 watchFd = monitor().addWatch(fName);
2547 const label watchIndex
2553 ok = monitor().removeWatch(watchIndex);
2572 if (monitor().getFile(watchIndices[i]) == fName)
2598 label index = findWatch(watchIndices, f);
2602 newWatchIndices.
append(addWatch(f));
2607 newWatchIndices.
append(watchIndices[index]);
2608 removedWatches.
erase(index);
2615 removeWatch(watchIndices[iter.key()]);
2624 const label watchIndex
2630 fName = monitor().getFile(watchIndex);
2639 const bool masterOnly,
2645 monitor().updateStates(
true,
false);
2659 state = monitor().getState(watchFd);
2673 monitor().setUnmodified(watchFd);
pathType
Enumeration for the location of an IOobject.
static word findInstancePath(const instantList &timeDirs, const instant &t)
Equivalent of Time::findInstance.
string getEnv(const word &)
Return environment variable of given name.
fileName localObjectPath(const IOobject &, const pathType &searchType, const word &processorsDir, const word &instancePath) const
Construct filePath.
virtual fileMonitor::fileState getState(const label) const
Get current state of file (using handle)
List< instant > instantList
List of instants.
static bool readBlocks(const label comm, autoPtr< ISstream > &isPtr, List< char > &data, const UPstream::commsTypes commsType)
Read data into *this. ISstream is only valid on master.
masterUncollatedFileOperationInitialise(int &argc, char **&argv)
Construct from components.
virtual bool cp(const fileName &src, const fileName &dst, const bool followLink=true) const
Copy, recursively if necessary, the source to the destination.
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool read=true) const
Reads header for regIOobject and returns an ISstream.
virtual bool chMod(const fileName &, const mode_t) const
Set the file mode.
const labelList & below() const
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const
Rename src to dst.
label findSortedIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element in sorted list and return index,.
bool exists(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist (as directory or file) in the file system?
#define forAll(list, i)
Loop across all elements in list.
bool processorCase() const
Return true if this is a processor case.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static int masterNo()
Process index of the master.
const word & name() const
Return name.
A class for handling file names.
masterUncollatedFileOperation(const bool verbose)
Construct null.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
An STL-conforming const_iterator.
float floatOptimisationSwitch(const char *name, const float defaultValue=0)
Lookup optimisation switch or add default value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual label addWatch(const fileName &) const
Add watching of a file. Returns handle.
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
fileState
Enumeration defining the file state.
#define InfoHeader
Report write to Foam::Info if the local log switch is true.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void size(const label)
Override size to be inconsistent with allocated storage.
static const fileName null
An empty fileName.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const
Read object header from supplied file.
static int nProcsSimpleSum
Number of processors at which the sum algorithm changes from linear.
bool subCycling() const
Return true if time currently being sub-cycled, otherwise false.
virtual double highResLastModified(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return time of last file modification.
virtual bool isDir(const fileName &, const bool followLink=true) const
Does the name exist as a directory in the file system?
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
virtual istream & stdStream()
Access to underlying std::istream.
virtual bool rmDir(const fileName &) const
Remove a directory and its contents.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
runTimeSource setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex)
const labelList & watchIndices() const
Return file-monitoring handles.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
word format(conversionProperties.lookup("format"))
static int & msgType()
Message tag of standard messages.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
virtual bool ln(const fileName &src, const fileName &dst) const
Create a softlink. dst should not exist. Returns true if.
T * ptr()
Return object pointer for reuse.
static label worldComm
Default communicator (all processors)
T & first()
Return the first element of the list.
virtual fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true) const
Read a directory and return the entries as a string list.
static const List< commsStruct > & linearCommunication(const label communicator=0)
Communication schedule for linear all-to-master (proc 0)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool good() const
Return true if next operation might succeed.
bool exists(const dirIndexList &, IOobject &io) const
Helper: check IO for local existence. Like filePathInfo but.
Macros for easy insertion into run-time selection tables.
addNamedToRunTimeSelectionTable(fileOperationInitialise, collatedFileOperationInitialise, word, collated)
fileName path() const
Return complete path.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
Input inter-processor communications stream.
addToRunTimeSelectionTable(fileOperation, collatedFileOperation, word)
void clear()
Delete object (if the pointer is valid) and set pointer to.
Input inter-processor communications stream operating on external buffer.
bool readHeader(Istream &)
Read header.
string & note()
Return non-constant access to the optional note.
A List obtained as a section of another List.
bool read(const char *, int32_t &)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
static void readAndSend(const fileName &fName, const labelUList &procs, PstreamBuffers &pBufs)
Detect file (possibly compressed), read file contents and send.
static instantList timeDirs
void set(const PackedList< 1 > &)
Set specified bits.
static float maxMasterFileBufferSize
Max size of parallel communications. Switches from non-blocking.
virtual bool writeObject(const regIOobject &, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool write=true) const
Writes a regIOobject (so header, contents and divider).
void close()
Close Istream.
bool isAbsolute() const
Return true if file name is absolute.
A class for handling words, derived from string.
virtual autoPtr< ISstream > NewIFstream(const fileName &filePath, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion) const
Generate an ISstream that reads a file.
Master-only drop-in replacement for OFstream.
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
void append(const T &)
Append an element at the end of the list.
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
const fileName & local() const
virtual off_t fileSize(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return size of file.
iterator begin()
Return an iterator to begin traversing the UList.
const word & constant() const
Return constant name.
const Type & value() const
Return const reference to value.
streamFormat
Enumeration for the format of data in the stream.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
static const word null
An empty word.
static const List< commsStruct > & treeCommunication(const label communicator=0)
Communication schedule for tree all-to-master (proc 0)
List< label > labelList
A List of labels.
streamFormat format() const
Return current stream format.
fileType
Enumeration of file types.
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
virtual fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return the file type: directory, file or link.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Structure for communicating between processors.
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const word & system() const
Return system name.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
compressionType
Enumeration for the format of data in the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Output inter-processor communications stream operating on external buffer.
virtual fileName filePath(const bool checkGlobal, const IOobject &, const word &typeName) const
Search for an object. checkGlobal : also check undecomposed case.
virtual bool mvBak(const fileName &, const std::string &ext="bak") const
Rename to a corresponding backup file.
static label read(const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=0)
Read into given buffer from given processor and return the.
const fileName & globalCaseName() const
Return global case name.
const Time & time() const
Return time.
Database for solution and other reduced data.
static bool write(const commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=0)
Write given buffer to given processor.
static fileCheckTypes fileModificationChecking
Type of file modification checking.
Output inter-processor communications stream.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
virtual bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Does the name exist as a file in the file system?
word name(const complex &)
Return a string representation of a complex.
virtual ~masterUncollatedFileOperation()
Destructor.
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
A class for managing temporary objects without reference counting.
const fileName & rootPath() const
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
An instant of time. Contains the time value and name.
virtual bool rm(const fileName &) const
Remove a file, returning true if successful otherwise false.
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
void setSize(const label)
Reset size of List.
static autoPtr< ISstream > read(IOobject &io, const label comm, const bool uniform, const fileNameList &filePaths, const boolList &read)
Read files on comms master.
static autoPtr< ISstream > readBlock(const label blocki, Istream &is, IOobject &headerIO)
Read selected block (non-seeking) + header information.
static bool uniformFile(const fileNameList &)
Same file?
static bool & parRun()
Is this a parallel run?
const fileName & instance() const
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static Stream & writeEndDivider(Stream &os)
Write the standard end file divider.
static bool readMasterHeader(IOobject &, Istream &)
Read header. Call only on master.
virtual bool readData(Istream &)
Virtual readData function.
virtual void setTime(const Time &) const
Callback for time change.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const Time & time() const
Return time.
Input from memory buffer stream.
prefixOSstream Pout(cout, "Pout")
virtual void setUnmodified(const label) const
Set current state of file (using handle) to unmodified.
instantList times() const
Search the case for valid time directories.
string str() const
Return the string.
virtual bool global() const
Is object same for all processors.
virtual mode_t mode(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return the file mode.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
bool writeHeader(Ostream &) const
Write header.
virtual autoPtr< Ostream > NewOFstream(const fileName &filePath, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool write=true) const
Generate an Ostream that writes a file.
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
off_t fileSize(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return size of file.
virtual label findWatch(const labelList &watchIndices, const fileName &) const
Find index (or -1) of file in list of handles.
defineTypeNameAndDebug(collatedFileOperation, 0)
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
Registry of regIOobjects.
virtual bool writeData(Ostream &) const =0
Pure virtual writaData function.
virtual fileName filePathInfo(const bool checkGlobal, const bool isFile, const IOobject &, pathType &searchType, word &processorsDir, word &instance) const
Search (locally!) for object; return info on how it was found.
const objectRegistry & db() const
Return the local objectRegistry.
virtual void setTime(const Time &) const
Callback for time change.
void stableSort(UList< T > &)
readOption readOpt() const
virtual fileName dirPath(const bool checkGlobal, const IOobject &) const
Search for a directory. checkGlobal : also check undecomposed.
fileName path() const
Return path.
Dummy stream for input. Aborts at any attempt to read from it.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
const word & headerClassName() const
Return name of the class name read from header.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static const NamedEnum< pathType, 12 > pathTypeNames_
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
const fileName & caseName() const
fileName objectPath() const
Return complete path + object name.
Output to memory buffer stream.
bool setEnv(const word &name, const std::string &value, const bool overwrite)
Set an environment variable.
bool equal(const scalar) const
Comparison used for instants to be equal.
virtual IOobject findInstance(const IOobject &io, const scalar startValue, const word &stopInstance) const
Find instance where IOobject is. Fails if cannot be found.
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
static labelList subRanks(const label n)
Get the list of processors that are part of this communicator.
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())
virtual time_t lastModified(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return time of last file modification.