62 #ifndef Foam_fileOperations_masterUncollatedFileOperation_H 63 #define Foam_fileOperations_masterUncollatedFileOperation_H 78 namespace fileOperations
92 mutable label managedComm_;
98 void init(
bool verbose);
143 const bool followLink_;
145 modeOp(
const bool followLink)
147 followLink_(followLink)
158 const bool followLink_;
160 typeOp(
const bool followLink)
162 followLink_(followLink)
174 const bool checkGzip_;
175 const bool followLink_;
177 existsOp(
const bool checkGzip,
const bool followLink)
179 checkGzip_(checkGzip),
180 followLink_(followLink)
191 const bool followLink_;
195 followLink_(followLink)
206 const bool checkGzip_;
207 const bool followLink_;
209 isFileOp(
const bool checkGzip,
const bool followLink)
211 checkGzip_(checkGzip),
212 followLink_(followLink)
223 const bool followLink_;
227 followLink_(followLink)
238 const bool followLink_;
242 followLink_(followLink)
253 const bool followLink_;
257 followLink_(followLink)
270 mvBakOp(
const std::string& ext)
295 rmDirOp(
bool silent=
false,
bool emptyOnly=
false)
298 emptyOnly_(emptyOnly)
309 const bool followLink_;
311 cpOp(
const bool followLink)
313 followLink_(followLink)
318 return Foam::cp(src, dest, followLink_);
333 const bool followLink_;
335 mvOp(
const bool followLink)
337 followLink_(followLink)
342 return Foam::mv(src, dest, followLink_);
369 const bool filtergz_;
370 const bool followLink_;
376 const bool followLink
381 followLink_(followLink)
396 template<
class Type,
class FileOp>
405 template<
class Type,
class FileOp>
431 const bool checkGlobal,
447 const word& instancePath
497 const bool distributedRoots,
525 const bool followLink =
true 532 const bool followLink =
true 540 const bool checkGzip=
true,
541 const bool followLink =
true 548 const bool followLink =
true 556 const bool checkGzip=
true,
557 const bool followLink =
true 564 const bool followLink =
true 571 const bool followLink =
true 578 const bool followLink =
true 586 const bool filtergz=
true,
587 const bool followLink =
true 595 const bool followLink =
true 607 const bool followLink =
false 616 const std::string& ext =
"bak" 629 const bool silent =
false,
630 const bool emptyOnly =
false 639 const bool checkGlobal,
641 const word& typeName,
649 const bool checkGlobal,
677 const word& typeName,
678 const bool readOnProc =
true 685 const bool masterOnly,
696 const bool writeOnProc =
true 707 const bool writeOnProc =
true 716 const bool writeOnProc =
true 744 const bool masterOnly,
767 const scalar startValue,
768 const word& stopInstance
775 virtual void flush()
const;
virtual void storeComm() const
Transfer ownership of communicator to this fileOperation. Use with caution.
virtual mode_t mode(const fileName &, const bool followLink=true) const
Return the file mode.
bool operator()(const fileName &src, const fileName &dest) const
static word findInstancePath(const instantList &timeDirs, const instant &t)
Equivalent of Time::findInstance.
bool mvBak(const fileName &src, const std::string &ext="bak")
Rename to a corresponding backup file.
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.
List< dirIndex > dirIndexList
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.
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
A class for handling file names.
off_t fileSize(const fileName &name, const bool followLink=true)
Return size of file or -1 on failure (normally follows symbolic links).
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< DynamicList< instant > > times_
Cached times for a given directory.
masterUncollatedFileOperation(bool verbose=false)
Default construct.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
existsOp(const bool checkGzip, const bool followLink)
static autoPtr< ISstream > read(IOobject &io, const label comm, const bool uniform, const fileNameList &filePaths, const boolUList &readOnProcs)
Read files on comms master.
virtual autoPtr< ISstream > NewIFstream(const fileName &) const
Generate an ISstream that reads a file.
Type masterOp(const fileName &fName, const FileOp &fop, const int tag, const label comm) const
fileState
Enumeration defining the file state.
virtual double highResLastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
pathType
Enumeration for the location of an IOobject.
readDirOp(const fileName::Type type, const bool filtergz, const bool followLink)
static const fileName null
An empty fileName.
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?
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
time_t operator()(const fileName &f) const
virtual bool rmDir(const fileName &dir, const bool silent=false, const bool emptyOnly=false) const
Remove a directory and its contents.
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool readOnProc=true) const
Reads header for regIOobject and returns an ISstream to read the contents.
A simple container for options an IOstream can normally have.
virtual bool ln(const fileName &src, const fileName &dst) const
Create a softlink. dst should not exist. Returns true if.
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers...
mode_t operator()(const fileName &f) const
off_t operator()(const fileName &f) const
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool exists(const dirIndexList &, IOobject &io) const
Helper: check IO for local existence. Like filePathInfo but.
An encapsulation of filesystem-related operations.
lastModifiedOp(const bool followLink)
mkDirOp(const mode_t mode)
virtual fileName filePath(const bool checkGlobal, const IOobject &io, const word &typeName, const bool search) const
Search for an object. checkGlobal : also check undecomposed case.
mvBakOp(const std::string &ext)
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
virtual bool writeObject(const regIOobject &io, IOstreamOption streamOpt=IOstreamOption(), const bool writeOnProc=true) const
Writes a regIOobject (so header, contents and divider).
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
atomicType
Atomic operations (output)
fileSizeOp(const bool followLink)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
bool operator()(const fileName &src, const fileName &dest) const
static float maxMasterFileBufferSize
Max size of parallel communications. Switches from non-blocking.
highResLastModifiedOp(const bool followLink)
A class for handling words, derived from Foam::string.
isDirOp(const bool followLink)
virtual fileName dirPath(const bool checkGlobal, const IOobject &io, const bool search) const
Search for a directory. checkGlobal : also check undecomposed.
Type scatterList(const UList< Type > &, const int, const label comm) const
bool operator()(const fileName &f) const
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
isFileOp(const bool checkGzip, const bool followLink)
bool operator()(const fileName &f) const
time_t lastModified(const fileName &name, const bool followLink=true)
Return time of last file modification (normally follows symbolic links).
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
bool operator()(const fileName &src, const fileName &dest) const
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
rmDirOp(bool silent=false, bool emptyOnly=false)
static void readAndSend(const fileName &filePath, const labelUList &recvProcs, PstreamBuffers &pBufs)
Read file contents and send to processors.
bool operator()(const fileName &f) 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.
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
const fileName & operator()(const fileName &f) const
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).
cpOp(const bool followLink)
bool chMod(const fileName &name, const mode_t mode)
Set the file/directory mode, return true on success.
virtual ~masterUncollatedFileOperation()
Destructor.
const HashPtrTable< DynamicList< instant > > & times() const noexcept
Return cached times.
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
word format(conversionProperties.get< word >("format"))
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
typeOp(const bool followLink)
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the 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.
virtual void sync()
Forcibly parallel sync.
bool operator()(const fileName &f) const
virtual fileName filePathInfo(const bool checkGlobal, const bool isFile, const IOobject &io, const dirIndexList &pDirs, const bool search, pathType &searchType, word &processorsDir, word &instance) const
Search (locally!) for object; return info on how it was found.
bool operator()(const fileName &f) const
label comm() const noexcept
Communicator to use.
virtual void setUnmodified(const label) const
Set current state of file (using handle) to unmodified.
bool operator()(const fileName &f) const
streamFormat
Data format (ascii | binary)
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
virtual autoPtr< OSstream > NewOFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool writeOnProc=true) const
Generate an OSstream that writes a file.
virtual fileName::Type type(const fileName &, const bool followLink=true) const
Return the file type: DIRECTORY, FILE or SYMLINK.
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
virtual off_t fileSize(const fileName &, const bool followLink=true) const
Return size of file.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
fileNameList operator()(const fileName &f) const
label operator()(const fileName &f) const
virtual label findWatch(const labelList &watchIndices, const fileName &) const
Find index (or -1) of file in list of handles.
chModOp(const mode_t mode)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
Registry of regIOobjects.
virtual void setTime(const Time &) const
Callback for time change.
modeOp(const bool followLink)
bool operator()(const fileName &f) const
mvOp(const bool followLink)
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::Type::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
double operator()(const fileName &f) const
fileOperations that performs all file operations on the master processor. Requires the calls to be pa...
Defines the attributes of an object for which implicit objectRegistry management is supported...
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
virtual IOobject findInstance(const IOobject &io, const scalar startValue, const word &stopInstance) const
Find instance where IOobject is.
bool operator()(const fileName &f) const
Type
Enumerations to handle directory entry types.
fileOrNullOp(const bool isFile)
virtual word processorsDir(const IOobject &io) const
Actual name of processors dir (for use in mode PROCOBJECT, PROCINSTANCE)
double highResLastModified(const fileName &, const bool followLink=true)
Return time of last file modification.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.