58 #ifndef fileOperations_masterUncollatedFileOperation_H 59 #define fileOperations_masterUncollatedFileOperation_H 75 namespace fileOperations
131 const bool followLink_;
133 modeOp(
const bool followLink)
135 followLink_(followLink)
146 const bool followLink_;
148 typeOp(
const bool followLink)
150 followLink_(followLink)
161 const bool checkGzip_;
162 const bool followLink_;
164 existsOp(
const bool checkGzip,
const bool followLink)
166 checkGzip_(checkGzip),
167 followLink_(followLink)
178 const bool followLink_;
182 followLink_(followLink)
194 const bool checkGzip_;
195 const bool followLink_;
197 isFileOp(
const bool checkGzip,
const bool followLink)
199 checkGzip_(checkGzip),
200 followLink_(followLink)
211 const bool followLink_;
215 followLink_(followLink)
227 const bool followLink_;
231 followLink_(followLink)
243 const bool followLink_;
247 followLink_(followLink)
261 mvBakOp(
const std::string& ext)
292 const bool followLink_;
294 cpOp(
const bool followLink)
296 followLink_(followLink)
302 return Foam::cp(src, dest, followLink_);
317 const bool followLink_;
319 mvOp(
const bool followLink)
321 followLink_(followLink)
327 return Foam::mv(src, dest, followLink_);
355 const bool filtergz_;
356 const bool followLink_;
362 const bool followLink
367 followLink_(followLink)
385 template<
class Type,
class fileOp>
394 template<
class Type,
class fileOp>
420 const bool checkGlobal,
433 const word& processorsDir,
434 const word& instancePath
511 const bool followLink =
true 518 const bool followLink =
true 526 const bool checkGzip=
true,
527 const bool followLink =
true 534 const bool followLink =
true 542 const bool checkGzip=
true,
543 const bool followLink =
true 550 const bool followLink =
true 557 const bool followLink =
true 564 const bool followLink =
true 572 const bool filtergz=
true,
573 const bool followLink =
true 581 const bool followLink =
true 593 const bool followLink =
false 602 const std::string& ext =
"bak" 625 const bool checkGlobal,
634 const bool checkGlobal,
661 const word& typeName,
662 const bool valid =
true 669 const bool masterOnly,
682 const bool valid =
true 695 const bool valid =
true 723 const bool masterOnly,
748 const scalar startValue,
749 const word& stopInstance
756 virtual void flush()
const;
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.
time_t lastModified(const fileName &, const bool followLink=true)
Return time of last file modification.
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)
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.
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const
Rename src to dst.
fileOperations that performs all file operations on the master processor. Requires the calls to be pa...
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.
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
A class for handling file names.
masterUncollatedFileOperation(const bool verbose)
Construct null.
virtual time_t lastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
virtual label addWatch(const fileName &) const
Add watching of a file. Returns handle.
HashPtrTable< instantList > times_
Cached times for a given directory.
bool operator()(const fileName &fName) const
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.
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.
static const fileName null
An empty fileName.
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool valid=true) const
Reads header for regIOobject and returns an ISstream.
TypeName("masterUncollated")
Runtime type information.
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const
Read object header from supplied file.
virtual bool isDir(const fileName &, const bool followLink=true) const
Does the name exist as a DIRECTORY in the file system?
virtual bool rmDir(const fileName &) const
Remove a directory and its contents.
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy, recursively if necessary, the source to the destination.
word format(conversionProperties.lookup("format"))
virtual bool ln(const fileName &src, const fileName &dst) const
Create a softlink. dst should not exist. Returns true if.
A HashTable specialization for hashing pointers.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool mvBak(const fileName &, const std::string &ext="bak")
Rename to a corresponding backup file.
bool exists(const dirIndexList &, IOobject &io) const
Helper: check IO for local existence. Like filePathInfo but.
mkDirOp(const mode_t mode)
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
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).
static instantList timeDirs
static float maxMasterFileBufferSize
Max size of parallel communications. Switches from non-blocking.
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
A class for handling words, derived from string.
Type scatterList(const UList< Type > &, const int, const label comm) const
mode_t mode(const fileName &, const bool followLink=true)
Return the file mode.
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
static void readAndSend(const fileName &filePath, const IOstream::compressionType cmp, const labelUList &procs, PstreamBuffers &pBufs)
Read file contents and send to processors.
streamFormat
Enumeration for the format of data in the stream.
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
Type masterOp(const fileName &, const fileOp &fop, const int tag, const label comm) const
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
compressionType
Enumeration for the format of data in the stream.
bool rmDir(const fileName &)
Remove a directory and its contents.
bool isFile(const fileName &, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
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.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
const label myComm_
Any communicator allocated by me.
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
virtual ~masterUncollatedFileOperation()
Destructor.
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
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.
static bool uniformFile(const fileNameList &)
Same file?
static const versionNumber currentVersion
Current version number.
virtual void setUnmodified(const label) const
Set current state of file (using handle) to unmodified.
bool chMod(const fileName &, const mode_t)
Set the file mode.
const HashPtrTable< instantList > & times() const
Return cached times.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
fileNameList readDir(const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a string list.
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.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual label findWatch(const labelList &watchIndices, const fileName &) const
Find index (or -1) of file in list of handles.
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
bool rm(const fileName &)
Remove a file, returning true if successful otherwise false.
Registry of regIOobjects.
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.
virtual void setTime(const Time &) const
Callback for time change.
virtual fileName dirPath(const bool checkGlobal, const IOobject &) const
Search for a directory. checkGlobal : also check undecomposed.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
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?
Type
Enumerations to handle file types and modes.
virtual word processorsDir(const IOobject &io) const
Actual name of processors dir (for use in mode PROCOBJECT,.
static labelList subRanks(const label n)
Get the list of processors that are part of this communicator.
double highResLastModified(const fileName &, const bool followLink=true)
Return time of last file modification.