45 namespace fileOperations
51 masterUncollatedFileOperation,
61 "maxMasterFileBufferSize",
69 fileOperationInitialise,
70 masterUncollatedFileOperationInitialise,
85 string ioRanksString(
getEnv(
"FOAM_IORANKS"));
86 if (ioRanksString.empty())
100 <<
"Rank 0 (master) should be in the IO ranks. Currently " 106 isIOrank.
set(ioRanks);
116 label rank = proci+1;
117 rank < n && !isIOrank[rank];
126 return move(subRanks);
146 if (t.
equal(timeDirs[i].value()))
148 return timeDirs[i].name();
159 const bool checkGlobal,
164 word& newInstancePath
174 if (isFileOrDir(isFile, objPath))
190 if (isFileOrDir(isFile, writePath))
202 const fileName& pDir = pDirs()[i].first();
204 processorsPath(io, io.
instance(), pDir)
206 if (objPath != writePath && isFileOrDir(isFile, objPath))
208 searchType = pDirs()[i].second().first();
220 localPath != writePath
221 && isFileOrDir(isFile, localPath)
246 if (isFileOrDir(isFile, parentPath))
262 if (pathFnd != times_.end())
264 newInstancePath = findInstancePath
270 if (newInstancePath.size() && newInstancePath != io.
instance())
279 const fileName& pDir = pDirs()[i].first();
283 processorsPath(io, newInstancePath, pDir)
286 if (isFileOrDir(isFile, fName))
288 switch (pDirs()[i].second().first())
321 if (isFileOrDir(isFile, fName))
341 const word& instancePath
393 processorsPath(io, io.
instance(), procDir)
402 processorsPath(io, io.
instance(), processorsDir(io))
450 processorsPath(io, instancePath, procDir)
459 processorsPath(io, instancePath, processorsDir(io))
484 const fileName& object0 = filePaths[0];
486 for (
label i = 1; i < filePaths.
size(); i++)
488 if (filePaths[i] != object0)
509 IFstream is(filePath, IOstream::streamFormat::BINARY);
524 std::ostringstream stringStr;
526 string buf(stringStr.str());
531 os.
write(&buf[0], buf.size());
582 if (filePaths[0].empty())
607 Pout<<
"masterUncollatedFileOperation::readStream :" 608 <<
" For uniform file " << filePaths[0]
609 <<
" sending to " << validProcs
610 <<
" in comm:" << comm <<
endl;
612 readAndSend(filePaths[0], validProcs, pBufs);
619 if (filePaths[0].empty())
632 <<
"problem while reading header for object " 650 Pout<<
"masterUncollatedFileOperation::readStream :" 651 <<
" For processor " << proci
652 <<
" opening " << filePaths[proci] <<
endl;
655 const fileName& fPath = filePaths[proci];
657 if (read[proci] && !fPath.empty())
661 readAndSend(fPath,
labelList(1, proci), pBufs);
689 Pout<<
"masterUncollatedFileOperation::readStream :" 690 <<
" Done reading " << buf.size() <<
" bytes" <<
endl;
698 <<
"problem while reading header for object " 733 <<
"I/O : " << typeName
734 <<
" (maxMasterFileBufferSize " << maxMasterFileBufferSize <<
')' 743 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
756 <<
"Resetting fileModificationChecking to inotify" 777 <<
"I/O : " << typeName
778 <<
" (maxMasterFileBufferSize " << maxMasterFileBufferSize <<
')' 787 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
800 <<
"Resetting fileModificationChecking to inotify" 814 const string s(
"-ioRanks");
817 for (
int i=1; i<argc-1; i++)
822 setEnv(
"FOAM_IORANKS", argv[i+1],
true);
829 for (
int i=index+2; i<argc; i++)
858 return masterOp<mode_t, mkDirOp>
874 return masterOp<mode_t, chModOp>
887 const bool checkVariants,
888 const bool followLink
891 return masterOp<mode_t, modeOp>
894 modeOp(checkVariants, followLink),
904 const bool checkVariants,
905 const bool followLink
910 masterOp<label, typeOp>
913 typeOp(checkVariants, followLink),
924 const bool checkVariants,
925 const bool followLink
928 return masterOp<bool, existsOp>
931 existsOp(checkVariants, followLink),
941 const bool followLink
944 return masterOp<bool, isDirOp>
957 const bool checkVariants,
958 const bool followLink
961 return masterOp<bool, isFileOp>
964 isFileOp(checkVariants, followLink),
974 const bool checkVariants,
975 const bool followLink
978 return masterOp<off_t, fileSizeOp>
991 const bool checkVariants,
992 const bool followLink
995 return masterOp<time_t, lastModifiedOp>
1008 const bool checkVariants,
1009 const bool followLink
1012 return masterOp<double, lastModifiedHROp>
1025 const std::string& ext
1028 return masterOp<bool, mvBakOp>
1043 return masterOp<bool, rmOp>
1058 return masterOp<bool, rmDirOp>
1072 const bool filtergz,
1073 const bool followLink
1076 return masterOp<fileNameList, readDirOp>
1090 const bool followLink
1093 return masterOp<bool, cpOp>
1110 return masterOp<bool, lnOp>
1125 const bool followLink
1128 return masterOp<bool, mvOp>
1141 const bool checkGlobal,
1143 const word& typeName
1148 Pout<<
"masterUncollatedFileOperation::filePath :" 1150 <<
" checkGlobal:" << checkGlobal <<
endl;
1166 word newInstancePath;
1172 objPath = filePathInfo
1184 Pout<<
"masterUncollatedFileOperation::filePath :" 1185 <<
" master objPath:" << objPath
1187 <<
" procsDir:" << procsDir <<
" instance:" << newInstancePath
1198 label masterType(searchType);
1210 || io.
local() ==
"uniform" 1243 objPath = localObjectPath
1259 objPath = masterOp<fileName, fileOrNullOp>
1273 Pout<<
"masterUncollatedFileOperation::filePath :" 1274 <<
" Returning from file searching:" <<
endl 1276 <<
" filePath :" << objPath <<
endl <<
endl;
1284 const bool checkGlobal,
1290 Pout<<
"masterUncollatedFileOperation::dirPath :" 1292 <<
" checkGlobal:" << checkGlobal <<
endl;
1304 word newInstancePath;
1308 objPath = filePathInfo
1320 label masterType(searchType);
1332 || io.
local() ==
"uniform" 1365 objPath = localObjectPath
1380 objPath = masterOp<fileName, fileOrNullOp>
1394 Pout<<
"masterUncollatedFileOperation::dirPath :" 1395 <<
" Returning from file searching:" <<
endl 1397 <<
" filePath :" << objPath <<
endl <<
endl;
1412 const bool isFile = !io.
name().empty();
1418 if (isFileOrDir(isFile, writePath))
1430 processorsPath(io, io.
instance(), pDir)
1432 if (procPath != writePath && isFileOrDir(isFile, procPath))
1442 if (localPath != writePath && isFileOrDir(isFile, localPath))
1455 const scalar startValue,
1456 const word& stopInstance
1461 Pout<<
"masterUncollatedFileOperation::findInstance :" 1462 <<
" Starting searching for name:" << startIO.
name()
1463 <<
" local:" << startIO.
local()
1464 <<
" from instance:" << startIO.
instance()
1496 if (!foundInstance.empty())
1501 Pout<<
"masterUncollatedFileOperation::findInstance :" 1502 <<
" for name:" << io.
name() <<
" local:" << io.
local()
1503 <<
" found starting instance:" << io.
instance() <<
endl;
1518 for (instanceI = ts.
size()-1; instanceI >= 0; --instanceI)
1520 if (ts[instanceI].value() <= startValue)
1527 for (; instanceI >= 0; --instanceI)
1536 io.
instance() = ts[instanceI].name();
1542 Pout<<
"masterUncollatedFileOperation::findInstance :" 1543 <<
" for name:" << io.
name() <<
" local:" << io.
local()
1551 if (ts[instanceI].
name() == stopInstance)
1559 if (io.
name().empty())
1562 <<
"Cannot find directory " 1564 <<
" down to " << stopInstance
1570 <<
"Cannot find file \"" << io.
name()
1571 <<
"\" in directory " << io.
local()
1573 <<
" down to " << stopInstance
1580 Pout<<
"masterUncollatedFileOperation::findInstance :" 1581 <<
" name:" << io.
name() <<
" local:" << io.
local()
1589 if (foundInstance.empty())
1607 Pout<<
"masterUncollatedFileOperation::findInstance :" 1608 <<
" name:" << io.
name()
1609 <<
" local:" << io.
local()
1617 if (foundInstance.empty())
1626 <<
"Cannot find file \"" << io.
name() <<
"\" in directory " 1643 Pout<<
"masterUncollatedFileOperation::findInstance :" 1644 <<
" name:" << io.
name() <<
" local:" << io.
local()
1662 Pout<<
"masterUncollatedFileOperation::readObjects :" 1664 <<
" local:" << local <<
" instance:" << instance <<
endl;
1689 if (newInstance.empty())
1708 if (t.
equal(timeDirs[i].value()))
1730 Pout<<
"masterUncollatedFileOperation::readObjects :" 1731 <<
" newInstance:" << newInstance
1732 <<
" objectNames:" << objectNames <<
endl;
1743 const word& typeName
1750 Pout<<
"masterUncollatedFileOperation::readHeader :" <<
endl 1752 <<
" fName :" << fName <<
endl;
1759 bool uniform = uniformFile(filePaths);
1807 if (!filePaths[proci].empty())
1809 if (proci > 0 && filePaths[proci] == filePaths[proci-1])
1811 result[proci] = result[proci-1];
1812 headerClassName[proci] = headerClassName[proci-1];
1813 note[proci] = note[proci-1];
1825 == decomposedBlockData::typeName
1838 note[proci] = io.
note();
1856 Pout<<
"masterUncollatedFileOperation::readHeader :" <<
" ok:" << ok
1868 const word& typeName,
1874 Pout<<
"masterUncollatedFileOperation::readStream :" 1875 <<
" object : " << io.
name()
1876 <<
" global : " << io.
global()
1877 <<
" fName : " << fName <<
" read:" << read <<
endl;
1882 bool isCollated =
false;
1914 Pout<<
"masterUncollatedFileOperation::readStream :" 1915 <<
" For object : " << io.
name()
1916 <<
" doing straight IFstream input from " 1938 Pout<<
"masterUncollatedFileOperation::readStream :" 1939 <<
" For object : " << io.
name()
1940 <<
" starting collating input from " << fName <<
endl;
1946 label groupStart, groupSize, nProcs;
1969 <<
"Could not detect processor number" 1977 if (groupStart != -1 && groupSize > 0)
1979 proci = proci-groupStart;
1984 Pout<<
"masterUncollatedFileOperation::readStream :" 1985 <<
" For object : " << io.
name()
1986 <<
" starting input from block " << proci
1987 <<
" of " << isPtr().name() <<
endl;
1995 string versionString;
1996 string formatString;
1999 versionString = isPtr().version().str();
2001 os << isPtr().format();
2002 formatString = (os.
str());
2010 bool bigSize = sz > off_t(maxMasterFileBufferSize);
2015 label readComm = -1;
2016 if (groupStart != -1 && groupSize > 0)
2058 Pout<<
"masterUncollatedFileOperation::readStream :" 2059 <<
" For object : " << io.
name()
2060 <<
" starting separated input from " << fName <<
endl;
2094 bool uniform = uniformFile(filePaths);
2112 const bool masterOnly,
2114 const word& typeName
2123 Pout<<
"masterUncollatedFileOperation::read :" 2124 <<
" Reading global object " << io.
name() <<
endl;
2141 ok = io.
readData(io.readStream(typeName));
2164 if (myComm.
above() != -1)
2184 myComm.
below()[belowI],
2198 Pout<<
"masterUncollatedFileOperation::read :" 2199 <<
" Reading local object " << io.
name() <<
endl;
2202 ok = io.
readData(io.readStream(typeName));
2223 Pout<<
"masterUncollatedFileOperation::writeObject :" 2224 <<
" io:" << pathName <<
" write:" << write <<
endl;
2269 const word& constantName
2273 if (iter != times_.end())
2277 Pout<<
"masterUncollatedFileOperation::findTimes :" 2278 <<
" Found " << iter()->size() <<
" cached times" <<
endl;
2300 times_.insert(directory, tPtr);
2304 Pout<<
"masterUncollatedFileOperation::findTimes :" 2305 <<
" Caching times:" << *tPtr <<
nl 2306 <<
" for directory:" << directory <<
endl;
2324 if (iter != times_.end())
2330 if (times.
size() > 0 && times[0].name() == tm.
constant())
2346 Pout<<
"masterUncollatedFileOperation::setTime :" 2347 <<
" Caching time " << tm.
timeName()
2348 <<
" for case:" << tm.
path() <<
endl;
2362 Pout<<
"masterUncollatedFileOperation::setTime :" 2363 <<
" Caching time " << tm.
timeName()
2364 <<
" for case:" << tm.
path() <<
endl;
2400 const bool uniform = uniformFile(filePaths);
2406 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2407 <<
" Opening global file " << filePath <<
endl;
2418 procs[proci-1] = proci;
2421 readAndSend(filePath, procs, pBufs);
2432 readAndSend(filePaths[proci],
labelList(1, proci), pBufs);
2453 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2454 <<
" Reading " << filePath
2464 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2465 <<
" Done reading " << buf.size() <<
" bytes" <<
endl;
2525 watchFd = monitor().addWatch(fName);
2534 const label watchIndex
2540 ok = monitor().removeWatch(watchIndex);
2559 if (monitor().getFile(watchIndices[i]) == fName)
2585 label index = findWatch(watchIndices, f);
2589 newWatchIndices.
append(addWatch(f));
2594 newWatchIndices.
append(watchIndices[index]);
2595 removedWatches.
erase(index);
2602 removeWatch(watchIndices[iter.key()]);
2611 const label watchIndex
2617 fName = monitor().getFile(watchIndex);
2626 const bool masterOnly,
2632 monitor().updateStates(
true,
false);
2646 state = monitor().getState(watchFd);
2660 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.
fileName path() const
Return path.
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.
virtual autoPtr< ISstream > NewIFstream(const fileName &) const
Generate an ISstream that reads a file.
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.
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.
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.
virtual autoPtr< Ostream > NewOFstream(const fileName &pathname, 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.
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.
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.
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.
registerOptSwitch("maxThreadFileBufferSize", float, collatedFileOperation::maxThreadFileBufferSize)
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 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.
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.