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 globalFile,
153 word& newInstancePath
163 if (isFileOrDir(isFile, objPath))
179 if (isFileOrDir(isFile, writePath))
190 lookupProcessorsPath(io.
objectPath(globalFile))
194 const fileName& pDir = pDirs()[i].first();
196 processorsPath(io, io.
instance(), pDir)
198 if (objPath != writePath && isFileOrDir(isFile, objPath))
200 searchType = pDirs()[i].second().first();
212 localPath != writePath
213 && isFileOrDir(isFile, localPath)
238 if (isFileOrDir(isFile, parentPath))
254 if (pathFnd != times_.end())
256 newInstancePath = findInstancePath
262 if (newInstancePath.size() && newInstancePath != io.
instance())
267 lookupProcessorsPath(io.
objectPath(globalFile))
271 const fileName& pDir = pDirs()[i].first();
275 processorsPath(io, newInstancePath, pDir)
278 if (isFileOrDir(isFile, fName))
280 switch (pDirs()[i].second().first())
313 if (isFileOrDir(isFile, fName))
333 const word& instancePath
385 processorsPath(io, io.
instance(), procDir)
394 processorsPath(io, io.
instance(), processorsDir(io))
442 processorsPath(io, instancePath, procDir)
451 processorsPath(io, instancePath, processorsDir(io))
476 const fileName& object0 = filePaths[0];
478 for (
label i = 1; i < filePaths.
size(); i++)
480 if (filePaths[i] != object0)
501 IFstream is(filePath, IOstream::streamFormat::BINARY);
516 std::ostringstream stringStr;
518 string buf(stringStr.str());
523 os.
write(&buf[0], buf.size());
574 if (filePaths[0].empty())
577 <<
"cannot find file for object " << io.
name()
599 Pout<<
"masterUncollatedFileOperation::readStream :" 600 <<
" For uniform file " << filePaths[0]
601 <<
" sending to " << validProcs
602 <<
" in comm:" << comm <<
endl;
604 readAndSend(filePaths[0], validProcs, pBufs);
611 if (filePaths[0].empty())
614 <<
"cannot find file for object " << io.
name()
624 <<
"problem while reading header for object " 642 Pout<<
"masterUncollatedFileOperation::readStream :" 643 <<
" For processor " << proci
644 <<
" opening " << filePaths[proci] <<
endl;
647 const fileName& fPath = filePaths[proci];
649 if (read[proci] && !fPath.empty())
653 readAndSend(fPath,
labelList(1, proci), pBufs);
681 Pout<<
"masterUncollatedFileOperation::readStream :" 682 <<
" Done reading " << buf.size() <<
" bytes" <<
endl;
690 <<
"problem while reading header for object " 725 <<
"I/O : " << typeName
726 <<
" (maxMasterFileBufferSize " << maxMasterFileBufferSize <<
')' 735 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
748 <<
"Resetting fileModificationChecking to inotify" 769 <<
"I/O : " << typeName
770 <<
" (maxMasterFileBufferSize " << maxMasterFileBufferSize <<
')' 779 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
792 <<
"Resetting fileModificationChecking to inotify" 806 const string s(
"-ioRanks");
809 for (
int i=1; i<argc-1; i++)
814 setEnv(
"FOAM_IORANKS", argv[i+1],
true);
821 for (
int i=index+2; i<argc; i++)
850 return masterOp<mode_t, mkDirOp>
866 return masterOp<mode_t, chModOp>
879 const bool checkVariants,
880 const bool followLink
883 return masterOp<mode_t, modeOp>
886 modeOp(checkVariants, followLink),
896 const bool checkVariants,
897 const bool followLink
902 masterOp<label, typeOp>
905 typeOp(checkVariants, followLink),
916 const bool checkVariants,
917 const bool followLink
920 return masterOp<bool, existsOp>
923 existsOp(checkVariants, followLink),
933 const bool followLink
936 return masterOp<bool, isDirOp>
949 const bool checkVariants,
950 const bool followLink
953 return masterOp<bool, isFileOp>
956 isFileOp(checkVariants, followLink),
966 const bool checkVariants,
967 const bool followLink
970 return masterOp<off_t, fileSizeOp>
983 const bool checkVariants,
984 const bool followLink
987 return masterOp<time_t, lastModifiedOp>
1000 const bool checkVariants,
1001 const bool followLink
1004 return masterOp<double, lastModifiedHROp>
1017 const std::string& ext
1020 return masterOp<bool, mvBakOp>
1035 return masterOp<bool, rmOp>
1050 return masterOp<bool, rmDirOp>
1064 const bool filtergz,
1065 const bool followLink
1068 return masterOp<fileNameList, readDirOp>
1082 const bool followLink
1085 return masterOp<bool, cpOp>
1102 return masterOp<bool, lnOp>
1117 const bool followLink
1120 return masterOp<bool, mvOp>
1133 const bool globalFile,
1135 const word& typeName
1140 Pout<<
"masterUncollatedFileOperation::filePath :" 1141 <<
" objectPath:" << io.
objectPath(globalFile)
1142 <<
" globalFile:" << globalFile <<
endl;
1147 (void)lookupProcessorsPath(io.
objectPath(globalFile));
1158 word newInstancePath;
1164 objPath = filePathInfo
1176 Pout<<
"masterUncollatedFileOperation::filePath :" 1177 <<
" master objPath:" << objPath
1179 <<
" procsDir:" << procsDir <<
" instance:" << newInstancePath
1190 label masterType(searchType);
1202 || io.
local() ==
"uniform" 1235 objPath = relativeObjectPath
1251 objPath = masterOp<fileName, fileOrNullOp>
1265 Pout<<
"masterUncollatedFileOperation::filePath :" 1266 <<
" Returning from file searching:" <<
endl 1268 <<
" filePath :" << objPath <<
endl <<
endl;
1276 const bool globalFile,
1282 Pout<<
"masterUncollatedFileOperation::dirPath :" 1283 <<
" objectPath:" << io.
objectPath(globalFile)
1284 <<
" globalFile:" << globalFile <<
endl;
1289 (void)lookupProcessorsPath(io.
objectPath(globalFile));
1296 word newInstancePath;
1300 objPath = filePathInfo
1312 label masterType(searchType);
1324 || io.
local() ==
"uniform" 1357 objPath = relativeObjectPath
1372 objPath = masterOp<fileName, fileOrNullOp>
1386 Pout<<
"masterUncollatedFileOperation::dirPath :" 1387 <<
" Returning from file searching:" <<
endl 1389 <<
" filePath :" << objPath <<
endl <<
endl;
1404 const bool isFile = !io.
name().empty();
1410 if (isFileOrDir(isFile, writePath))
1422 processorsPath(io, io.
instance(), pDir)
1424 if (procPath != writePath && isFileOrDir(isFile, procPath))
1434 if (localPath != writePath && isFileOrDir(isFile, localPath))
1447 const scalar startValue,
1448 const word& stopInstance
1453 Pout<<
"masterUncollatedFileOperation::findInstance :" 1454 <<
" Starting searching for name:" << startIO.
name()
1455 <<
" local:" << startIO.
local()
1456 <<
" from instance:" << startIO.
instance()
1488 if (!foundInstance.empty())
1493 Pout<<
"masterUncollatedFileOperation::findInstance :" 1494 <<
" for name:" << io.
name() <<
" local:" << io.
local()
1495 <<
" found starting instance:" << io.
instance() <<
endl;
1510 for (instanceI = ts.
size()-1; instanceI >= 0; --instanceI)
1512 if (ts[instanceI].value() <= startValue)
1519 for (; instanceI >= 0; --instanceI)
1528 io.
instance() = ts[instanceI].name();
1534 Pout<<
"masterUncollatedFileOperation::findInstance :" 1535 <<
" for name:" << io.
name() <<
" local:" << io.
local()
1543 if (ts[instanceI].
name() == stopInstance)
1551 if (io.
name().empty())
1554 <<
"Cannot find directory " 1556 <<
" down to " << stopInstance
1562 <<
"Cannot find file \"" << io.
name()
1563 <<
"\" in directory " << io.
local()
1565 <<
" down to " << stopInstance
1572 Pout<<
"masterUncollatedFileOperation::findInstance :" 1573 <<
" name:" << io.
name() <<
" local:" << io.
local()
1581 if (foundInstance.empty())
1599 Pout<<
"masterUncollatedFileOperation::findInstance :" 1600 <<
" name:" << io.
name()
1601 <<
" local:" << io.
local()
1609 if (foundInstance.empty())
1618 <<
"Cannot find file \"" << io.
name() <<
"\" in directory " 1635 Pout<<
"masterUncollatedFileOperation::findInstance :" 1636 <<
" name:" << io.
name() <<
" local:" << io.
local()
1654 Pout<<
"masterUncollatedFileOperation::readObjects :" 1656 <<
" local:" << local <<
" instance:" << instance <<
endl;
1681 if (newInstance.empty())
1700 if (t.
equal(timeDirs[i].value()))
1722 Pout<<
"masterUncollatedFileOperation::readObjects :" 1723 <<
" newInstance:" << newInstance
1724 <<
" objectNames:" << objectNames <<
endl;
1735 const word& typeName
1742 Pout<<
"masterUncollatedFileOperation::readHeader :" <<
nl 1743 <<
" object :" << io.
name() <<
nl 1744 <<
" fName :" << fName <<
endl;
1751 bool uniform = uniformFile(filePaths);
1799 if (!filePaths[proci].empty())
1801 if (proci > 0 && filePaths[proci] == filePaths[proci-1])
1803 result[proci] = result[proci-1];
1804 headerClassName[proci] = headerClassName[proci-1];
1805 note[proci] = note[proci-1];
1817 == decomposedBlockData::typeName
1830 note[proci] = io.
note();
1848 Pout<<
"masterUncollatedFileOperation::readHeader :" <<
" ok:" << ok
1860 const word& typeName,
1866 Pout<<
"masterUncollatedFileOperation::readStream :" 1867 <<
" object : " << io.
name()
1868 <<
" global : " << io.
global()
1869 <<
" fName : " << fName <<
" read:" << read <<
endl;
1874 bool isCollated =
false;
1906 Pout<<
"masterUncollatedFileOperation::readStream :" 1907 <<
" For object : " << io.
name()
1908 <<
" doing straight IFstream input from " 1930 Pout<<
"masterUncollatedFileOperation::readStream :" 1931 <<
" For object : " << io.
name()
1932 <<
" starting collating input from " << fName <<
endl;
1938 label groupStart, groupSize, nProcs;
1961 <<
"Could not detect processor number" 1969 if (groupStart != -1 && groupSize > 0)
1971 proci = proci-groupStart;
1976 Pout<<
"masterUncollatedFileOperation::readStream :" 1977 <<
" For object : " << io.
name()
1978 <<
" starting input from block " << proci
1979 <<
" of " << isPtr().name() <<
endl;
1987 string versionString;
1988 string formatString;
1991 versionString = isPtr().version().str();
1993 os << isPtr().format();
1994 formatString = (os.
str());
2002 bool bigSize = sz > off_t(maxMasterFileBufferSize);
2007 label readComm = -1;
2008 if (groupStart != -1 && groupSize > 0)
2050 Pout<<
"masterUncollatedFileOperation::readStream :" 2051 <<
" For object : " << io.
name()
2052 <<
" starting separated input from " << fName <<
endl;
2086 bool uniform = uniformFile(filePaths);
2104 const bool masterOnly,
2106 const word& typeName
2119 Pout<<
"masterUncollatedFileOperation::read :" 2120 <<
" Reading global object " << io.
name() <<
endl;
2138 Istream& is = io.readStream(typeName);
2161 std::underlying_type_t<IOstream::streamFormat> formatValue(format);
2178 if (myComm.
above() != -1)
2198 myComm.
below()[belowI],
2212 Pout<<
"masterUncollatedFileOperation::read :" 2213 <<
" Reading local object " << io.
name() <<
endl;
2216 ok = io.
readData(io.readStream(typeName));
2237 Pout<<
"masterUncollatedFileOperation::writeObject :" 2238 <<
" io:" << filePath <<
" write:" << write <<
endl;
2283 const word& constantName
2287 if (iter != times_.end())
2291 Pout<<
"masterUncollatedFileOperation::findTimes :" 2292 <<
" Found " << iter()->size() <<
" cached times" <<
endl;
2314 times_.insert(directory, tPtr);
2318 Pout<<
"masterUncollatedFileOperation::findTimes :" 2319 <<
" Caching times:" << *tPtr <<
nl 2320 <<
" for directory:" << directory <<
endl;
2338 if (iter != times_.end())
2344 if (times.
size() > 0 && times[0].name() == tm.
constant())
2360 Pout<<
"masterUncollatedFileOperation::setTime :" 2361 <<
" Caching time " << tm.
timeName()
2362 <<
" for case:" << tm.
path() <<
endl;
2376 Pout<<
"masterUncollatedFileOperation::setTime :" 2377 <<
" Caching time " << tm.
timeName()
2378 <<
" for case:" << tm.
path() <<
endl;
2416 const bool uniform = uniformFile(filePaths);
2422 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2423 <<
" Opening global file " << filePath <<
endl;
2434 procs[proci-1] = proci;
2437 readAndSend(filePath, procs, pBufs);
2448 readAndSend(filePaths[proci],
labelList(1, proci), pBufs);
2469 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2470 <<
" Reading " << filePath
2480 Pout<<
"masterUncollatedFileOperation::NewIFstream :" 2481 <<
" Done reading " << buf.size() <<
" bytes" <<
endl;
2541 watchFd = monitor().addWatch(fName);
2550 const label watchIndex
2556 ok = monitor().removeWatch(watchIndex);
2575 if (monitor().getFile(watchIndices[i]) == fName)
2601 label index = findWatch(watchIndices, f);
2605 newWatchIndices.
append(addWatch(f));
2610 newWatchIndices.
append(watchIndices[index]);
2611 removedWatches.
erase(index);
2618 removeWatch(watchIndices[iter.key()]);
2627 const label watchIndex
2633 fName = monitor().getFile(watchIndex);
2642 const bool masterOnly,
2648 monitor().updateStates(
true,
false);
2662 state = monitor().getState(watchFd);
2676 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.
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.
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.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
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.
fileName objectPath() const
Return complete path + object name.
const fileName & caseName(const bool global) const
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.
fileName relativeObjectPath(const IOobject &, const pathType &searchType, const word &processorsDir, const word &instancePath) const
Construct filePath.
word format(conversionProperties.lookup("format"))
static int & msgType()
Message tag of standard messages.
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)
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 fileName filePathInfo(const bool globalFile, const bool isFile, const IOobject &, pathType &searchType, word &processorsDir, word &instance) const
Search (locally!) for object; return info on how it was found.
Input inter-processor communications stream operating on external buffer.
bool readHeader(Istream &)
Read header.
virtual fileName dirPath(const bool globalFile, const IOobject &) const
Search for a directory. globalFile : also check undecomposed.
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.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
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.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
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.
fileName path(const bool global) const
Return complete path including the processor sub-directory.
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)
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 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?
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
Return true if object is global, i.e. 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)
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
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.
const objectRegistry & db() const
Return the local objectRegistry.
virtual fileName filePath(const bool globalFile, const IOobject &, const word &typeName) const
Search for an object. globalFile : also check undecomposed case.
virtual void setTime(const Time &) const
Callback for time change.
void stableSort(UList< T > &)
readOption readOpt() const
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.
Output to memory buffer stream.
fileName objectPath(const bool global) const
Return complete path + object name including the processor.
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.
virtual time_t lastModified(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return time of last file modification.