44 namespace fileOperations
50 masterUncollatedFileOperation,
60 "maxMasterFileBufferSize",
68 fileOperationInitialise,
69 masterUncollatedFileOperationInitialise,
84 string ioRanksString(
getEnv(
"FOAM_IORANKS"));
85 if (ioRanksString.empty())
99 <<
"Rank 0 (master) should be in the IO ranks. Currently " 105 isIOrank.
set(ioRanks);
115 label rank = proci+1;
116 rank < n && !isIOrank[rank];
145 if (t.
equal(timeDirs[i].value()))
147 return timeDirs[i].name();
158 const bool checkGlobal,
163 word& newInstancePath
173 if (isFileOrDir(isFile, objPath))
189 if (isFileOrDir(isFile, writePath))
201 const fileName& pDir = pDirs()[i].first();
203 processorsPath(io, io.
instance(), pDir)
205 if (objPath != writePath && isFileOrDir(isFile, objPath))
207 searchType = pDirs()[i].second().first();
219 localPath != writePath
220 && isFileOrDir(isFile, localPath)
245 if (isFileOrDir(isFile, parentPath))
261 if (pathFnd != times_.end())
263 newInstancePath = findInstancePath
269 if (newInstancePath.size() && newInstancePath != io.
instance())
278 const fileName& pDir = pDirs()[i].first();
282 processorsPath(io, newInstancePath, pDir)
285 if (isFileOrDir(isFile, fName))
287 switch (pDirs()[i].second().first())
320 if (isFileOrDir(isFile, fName))
340 const word& instancePath
392 processorsPath(io, io.
instance(), procDir)
401 processorsPath(io, io.
instance(), processorsDir(io))
449 processorsPath(io, instancePath, procDir)
458 processorsPath(io, instancePath, processorsDir(io))
483 const fileName& object0 = filePaths[0];
485 for (
label i = 1; i < filePaths.
size(); i++)
487 if (filePaths[i] != object0)
504 if (cmp == IOstream::compressionType::COMPRESSED)
508 Pout<<
"masterUncollatedFileOperation::readAndSend :" 509 <<
" Opening compressed " << filePath <<
endl;
512 IFstream is(filePath, IOstream::streamFormat::BINARY);
520 std::ostringstream stringStr;
522 string buf(stringStr.str());
527 os.
write(&buf[0], buf.size());
533 IFstream is(filePath, IOstream::streamFormat::BINARY);
544 Pout<<
"masterUncollatedFileOperation::readStream :" 545 <<
" From " << filePath <<
" reading " <<
label(count)
572 IOstream::compressionType::COMPRESSED,
582 IOstream::compressionType::UNCOMPRESSED,
625 if (procValid[proci])
635 Pout<<
"masterUncollatedFileOperation::readStream :" 636 <<
" For uniform file " << filePaths[0]
637 <<
" sending to " << validProcs
638 <<
" in comm:" << comm <<
endl;
640 readAndSend(filePaths[0], validProcs, pBufs);
647 if (filePaths[0].empty())
660 <<
"problem while reading header for object " 678 Pout<<
"masterUncollatedFileOperation::readStream :" 679 <<
" For processor " << proci
680 <<
" opening " << filePaths[proci] <<
endl;
683 const fileName& fPath = filePaths[proci];
685 if (procValid[proci] && !fPath.empty())
689 readAndSend(fPath,
labelList(1, proci), pBufs);
717 Pout<<
"masterUncollatedFileOperation::readStream :" 718 <<
" Done reading " << buf.size() <<
" bytes" <<
endl;
726 <<
"problem while reading header for object " 760 Info<<
"I/O : " << typeName
761 <<
" (maxMasterFileBufferSize " << maxMasterFileBufferSize <<
')' 770 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
783 <<
"Resetting fileModificationChecking to inotify" 803 Info<<
"I/O : " << typeName
804 <<
" (maxMasterFileBufferSize " << maxMasterFileBufferSize <<
')' 813 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
826 <<
"Resetting fileModificationChecking to inotify" 840 const string s(
"-ioRanks");
843 for (
int i=1; i<argc-1; i++)
848 setEnv(
"FOAM_IORANKS", argv[i+1],
true);
855 for (
int i=index+2; i<argc; i++)
884 return masterOp<mode_t, mkDirOp>
900 return masterOp<mode_t, chModOp>
913 const bool followLink
916 return masterOp<mode_t, modeOp>
929 const bool followLink
934 masterOp<label, typeOp>
948 const bool checkGzip,
949 const bool followLink
952 return masterOp<bool, existsOp>
965 const bool followLink
968 return masterOp<bool, isDirOp>
981 const bool checkGzip,
982 const bool followLink
985 return masterOp<bool, isFileOp>
998 const bool followLink
1001 return masterOp<off_t, fileSizeOp>
1014 const bool followLink
1017 return masterOp<time_t, lastModifiedOp>
1030 const bool followLink
1033 return masterOp<double, lastModifiedHROp>
1046 const std::string& ext
1049 return masterOp<bool, mvBakOp>
1064 return masterOp<bool, rmOp>
1079 return masterOp<bool, rmDirOp>
1093 const bool filtergz,
1094 const bool followLink
1097 return masterOp<fileNameList, readDirOp>
1111 const bool followLink
1114 return masterOp<bool, cpOp>
1131 return masterOp<bool, lnOp>
1146 const bool followLink
1149 return masterOp<bool, mvOp>
1162 const bool checkGlobal,
1164 const word& typeName
1169 Pout<<
"masterUncollatedFileOperation::filePath :" 1171 <<
" checkGlobal:" << checkGlobal <<
endl;
1187 word newInstancePath;
1193 objPath = filePathInfo
1205 Pout<<
"masterUncollatedFileOperation::filePath :" 1206 <<
" master objPath:" << objPath
1208 <<
" procsDir:" << procsDir <<
" instance:" << newInstancePath
1219 label masterType(searchType);
1231 || io.
local() ==
"uniform" 1264 objPath = localObjectPath
1280 objPath = masterOp<fileName, fileOrNullOp>
1294 Pout<<
"masterUncollatedFileOperation::filePath :" 1295 <<
" Returning from file searching:" <<
endl 1297 <<
" filePath :" << objPath <<
endl <<
endl;
1305 const bool checkGlobal,
1311 Pout<<
"masterUncollatedFileOperation::dirPath :" 1313 <<
" checkGlobal:" << checkGlobal <<
endl;
1325 word newInstancePath;
1329 objPath = filePathInfo
1341 label masterType(searchType);
1353 || io.
local() ==
"uniform" 1386 objPath = localObjectPath
1401 objPath = masterOp<fileName, fileOrNullOp>
1415 Pout<<
"masterUncollatedFileOperation::dirPath :" 1416 <<
" Returning from file searching:" <<
endl 1418 <<
" filePath :" << objPath <<
endl <<
endl;
1433 const bool isFile = !io.
name().empty();
1439 if (isFileOrDir(isFile, writePath))
1451 processorsPath(io, io.
instance(), pDir)
1453 if (procPath != writePath && isFileOrDir(isFile, procPath))
1463 if (localPath != writePath && isFileOrDir(isFile, localPath))
1476 const scalar startValue,
1477 const word& stopInstance
1482 Pout<<
"masterUncollatedFileOperation::findInstance :" 1483 <<
" Starting searching for name:" << startIO.
name()
1484 <<
" local:" << startIO.
local()
1485 <<
" from instance:" << startIO.
instance()
1517 if (!foundInstance.empty())
1522 Pout<<
"masterUncollatedFileOperation::findInstance :" 1523 <<
" for name:" << io.
name() <<
" local:" << io.
local()
1524 <<
" found starting instance:" << io.
instance() <<
endl;
1539 for (instanceI = ts.
size()-1; instanceI >= 0; --instanceI)
1541 if (ts[instanceI].value() <= startValue)
1548 for (; instanceI >= 0; --instanceI)
1557 io.
instance() = ts[instanceI].name();
1563 Pout<<
"masterUncollatedFileOperation::findInstance :" 1564 <<
" for name:" << io.
name() <<
" local:" << io.
local()
1572 if (ts[instanceI].
name() == stopInstance)
1580 if (io.
name().empty())
1583 <<
"Cannot find directory " 1585 <<
" down to " << stopInstance
1591 <<
"Cannot find file \"" << io.
name()
1592 <<
"\" in directory " << io.
local()
1594 <<
" down to " << stopInstance
1601 Pout<<
"masterUncollatedFileOperation::findInstance :" 1602 <<
" name:" << io.
name() <<
" local:" << io.
local()
1610 if (foundInstance.empty())
1628 Pout<<
"masterUncollatedFileOperation::findInstance :" 1629 <<
" name:" << io.
name()
1630 <<
" local:" << io.
local()
1638 if (foundInstance.empty())
1647 <<
"Cannot find file \"" << io.
name() <<
"\" in directory " 1664 Pout<<
"masterUncollatedFileOperation::findInstance :" 1665 <<
" name:" << io.
name() <<
" local:" << io.
local()
1683 Pout<<
"masterUncollatedFileOperation::readObjects :" 1685 <<
" local:" << local <<
" instance:" << instance <<
endl;
1710 if (newInstance.empty())
1729 if (t.
equal(timeDirs[i].value()))
1751 Pout<<
"masterUncollatedFileOperation::readObjects :" 1752 <<
" newInstance:" << newInstance
1753 <<
" objectNames:" << objectNames <<
endl;
1764 const word& typeName
1771 Pout<<
"masterUncollatedFileOperation::readHeader :" <<
endl 1773 <<
" fName :" << fName <<
endl;
1780 bool uniform = uniformFile(filePaths);
1828 if (!filePaths[proci].empty())
1830 if (proci > 0 && filePaths[proci] == filePaths[proci-1])
1832 result[proci] = result[proci-1];
1833 headerClassName[proci] = headerClassName[proci-1];
1834 note[proci] = note[proci-1];
1846 == decomposedBlockData::typeName
1859 note[proci] = io.
note();
1877 Pout<<
"masterUncollatedFileOperation::readHeader :" <<
" ok:" << ok
1889 const word& typeName,
1895 Pout<<
"masterUncollatedFileOperation::readStream :" 1896 <<
" object : " << io.
name()
1897 <<
" global : " << io.
global()
1898 <<
" fName : " << fName <<
" valid:" << valid <<
endl;
1903 bool isCollated =
false;
1935 Pout<<
"masterUncollatedFileOperation::readStream :" 1936 <<
" For object : " << io.
name()
1937 <<
" doing straight IFstream input from " 1959 Pout<<
"masterUncollatedFileOperation::readStream :" 1960 <<
" For object : " << io.
name()
1961 <<
" starting collating input from " << fName <<
endl;
1967 label groupStart, groupSize, nProcs;
1990 <<
"Could not detect processor number" 1998 if (groupStart != -1 && groupSize > 0)
2000 proci = proci-groupStart;
2005 Pout<<
"masterUncollatedFileOperation::readStream :" 2006 <<
" For object : " << io.
name()
2007 <<
" starting input from block " << proci
2008 <<
" of " << isPtr().name() <<
endl;
2016 string versionString;
2017 string formatString;
2020 versionString = isPtr().version().str();
2022 os << isPtr().format();
2023 formatString = (os.
str());
2031 bool bigSize = sz > off_t(maxMasterFileBufferSize);
2036 label readComm = -1;
2037 if (groupStart != -1 && groupSize > 0)
2079 Pout<<
"masterUncollatedFileOperation::readStream :" 2080 <<
" For object : " << io.
name()
2081 <<
" starting separated input from " << fName <<
endl;
2108 bool uniform = uniformFile(filePaths);
2110 return read(io, comm_, uniform, filePaths, procValid);
2119 const bool masterOnly,
2121 const word& typeName
2130 Pout<<
"masterUncollatedFileOperation::read :" 2131 <<
" Reading global object " << io.
name() <<
endl;
2141 ok = io.
readData(io.readStream(typeName));
2172 if (myComm.
above() != -1)
2192 myComm.
below()[belowI],
2206 Pout<<
"masterUncollatedFileOperation::read :" 2207 <<
" Reading local object " << io.
name() <<
endl;
2210 ok = io.
readData(io.readStream(typeName));
2231 Pout<<
"masterUncollatedFileOperation::writeObject :" 2232 <<
" io:" << pathName <<
" valid:" << valid <<
endl;
2277 const word& constantName
2281 if (iter != times_.end())
2285 Pout<<
"masterUncollatedFileOperation::findTimes :" 2286 <<
" Found " << iter()->size() <<
" cached times" <<
endl;
2308 times_.insert(directory, tPtr);
2312 Pout<<
"masterUncollatedFileOperation::findTimes :" 2313 <<
" Caching times:" << *tPtr <<
nl 2314 <<
" for directory:" << directory <<
endl;
2332 if (iter != times_.end())
2338 if (times.
size() > 0 && times[0].name() == tm.
constant())
2354 Pout<<
"masterUncollatedFileOperation::setTime :" 2355 <<
" Caching time " << tm.
timeName()
2356 <<
" for case:" << tm.
path() <<
endl;
2370 Pout<<
"masterUncollatedFileOperation::setTime :" 2371 <<
" Caching time " << tm.
timeName()
2372 <<
" for case:" << tm.
path() <<
endl;
2408 const bool uniform = uniformFile(filePaths);
2414 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2415 <<
" Opening global file " << filePath <<
endl;
2421 ? IOstream::compressionType::COMPRESSED
2422 : IOstream::compressionType::UNCOMPRESSED
2433 procs[proci-1] = proci;
2436 readAndSend(filePath, cmp, procs, pBufs);
2450 ? IOstream::compressionType::COMPRESSED
2451 : IOstream::compressionType::UNCOMPRESSED
2481 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2482 <<
" Reading " << filePath
2492 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2493 <<
" Done reading " << buf.size() <<
" bytes" <<
endl;
2550 watchFd = monitor().addWatch(fName);
2559 const label watchIndex
2565 ok = monitor().removeWatch(watchIndex);
2584 if (monitor().getFile(watchIndices[i]) == fName)
2610 label index = findWatch(watchIndices, f);
2614 newWatchIndices.
append(addWatch(f));
2619 newWatchIndices.
append(watchIndices[index]);
2620 removedWatches.
erase(index);
2627 removeWatch(watchIndices[iter.key()]);
2636 const label watchIndex
2642 fName = monitor().getFile(watchIndex);
2651 const bool masterOnly,
2657 monitor().updateStates(
true,
false);
2671 state = monitor().getState(watchFd);
2685 monitor().setUnmodified(watchFd);
pathType
Enumeration for the location of an IOobject.
virtual mode_t mode(const fileName &, const bool followLink=true) const
Return the file mode.
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 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 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 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,.
#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.
virtual fileNameList readDir(const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true, const bool followLink=true) const
Read a directory and return the entries as a string list.
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.
virtual time_t lastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
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.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
virtual autoPtr< Ostream > NewOFstream(const fileName &pathname, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool valid=true) const
Generate an Ostream that writes a file.
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...
off_t fileSize(const fileName &, const bool followLink=true)
Return size of file.
fileState
Enumeration defining the file state.
virtual double highResLastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
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 autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool valid=true) const
Reads header for regIOobject and returns an ISstream.
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 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.
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 &)
virtual bool writeObject(const regIOobject &, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool valid=true) const
Writes a regIOobject (so header, contents and divider).
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 instantList timeDirs
void set(const PackedList< 1 > &)
Set specified bits.
static float maxMasterFileBufferSize
Max size of parallel communications. Switches from non-blocking.
void close()
Close Istream.
bool isAbsolute() const
Return true if file name is absolute.
A class for handling words, derived from string.
bool & globalObject()
Is object same for all processors.
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
iterator begin()
Return an iterator to begin traversing the UList.
const word & constant() const
Return constant name.
static void readAndSend(const fileName &filePath, const IOstream::compressionType cmp, const labelUList &procs, PstreamBuffers &pBufs)
Read file contents and send to processors.
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.
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
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.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Database for solution data, solver performance 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).
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 global() const
Is object global.
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 > 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)
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.
static autoPtr< ISstream > read(IOobject &io, const label comm, const bool uniform, const fileNameList &filePaths, const boolList &procValid)
Read files on comms master.
virtual fileName::Type type(const fileName &, const bool followLink=true) const
Return the file type: DIRECTORY, FILE or LINK.
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
virtual off_t fileSize(const fileName &, const bool followLink=true) const
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.
bool exists(const fileName &, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
Type
Enumerations to handle file types and modes.
static labelList subRanks(const label n)
Get the list of processors that are part of this communicator.