62#ifndef Foam_fileOperations_masterUncollatedFileOperation_H
63#define Foam_fileOperations_masterUncollatedFileOperation_H
80namespace fileOperations
136 const bool followLink_;
138 modeOp(
const bool followLink)
140 followLink_(followLink)
151 const bool followLink_;
153 typeOp(
const bool followLink)
155 followLink_(followLink)
167 const bool checkGzip_;
168 const bool followLink_;
170 existsOp(
const bool checkGzip,
const bool followLink)
172 checkGzip_(checkGzip),
173 followLink_(followLink)
184 const bool followLink_;
188 followLink_(followLink)
199 const bool checkGzip_;
200 const bool followLink_;
202 isFileOp(
const bool checkGzip,
const bool followLink)
204 checkGzip_(checkGzip),
205 followLink_(followLink)
216 const bool followLink_;
220 followLink_(followLink)
231 const bool followLink_;
235 followLink_(followLink)
246 const bool followLink_;
250 followLink_(followLink)
263 mvBakOp(
const std::string& ext)
287 rmDirOp(
const bool silent=
false)
300 const bool followLink_;
302 cpOp(
const bool followLink)
304 followLink_(followLink)
309 return Foam::cp(src, dest, followLink_);
324 const bool followLink_;
326 mvOp(
const bool followLink)
328 followLink_(followLink)
333 return Foam::mv(src, dest, followLink_);
360 const bool filtergz_;
361 const bool followLink_;
367 const bool followLink
372 followLink_(followLink)
390 template<
class Type,
class FileOp>
399 template<
class Type,
class FileOp>
425 const bool checkGlobal,
440 const word& instancePath
508 const bool followLink =
true
515 const bool followLink =
true
523 const bool checkGzip=
true,
524 const bool followLink =
true
531 const bool followLink =
true
539 const bool checkGzip=
true,
540 const bool followLink =
true
547 const bool followLink =
true
554 const bool followLink =
true
561 const bool followLink =
true
569 const bool filtergz=
true,
570 const bool followLink =
true
578 const bool followLink =
true
590 const bool followLink =
false
599 const std::string& ext =
"bak"
610 const bool silent =
false
627 const bool checkGlobal,
629 const word& typeName,
637 const bool checkGlobal,
665 const word& typeName,
666 const bool valid =
true
673 const bool masterOnly,
684 const bool valid =
true
695 const bool valid =
true
723 const bool masterOnly,
749 const scalar startValue,
750 const word& stopInstance
757 virtual void flush()
const;
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
The IOstreamOption is a simple container for options an IOstream can normally have.
streamFormat
Data format (ascii | binary)
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
fileState
Enumeration defining the file state.
A class for handling file names.
Type
Enumerations to handle directory entry types.
An encapsulation of filesystem-related operations.
List< dirIndex > dirIndexList
virtual word processorsDir(const IOobject &io) const
Actual name of processors dir (for use in mode PROCOBJECT,.
pathType
Enumeration for the location of an IOobject.
masterUncollatedFileOperationInitialise(int &argc, char **&argv)
Construct from components.
virtual ~masterUncollatedFileOperationInitialise()=default
Destructor.
chModOp(const mode_t mode)
bool operator()(const fileName &f) const
bool operator()(const fileName &src, const fileName &dest) const
cpOp(const bool followLink)
existsOp(const bool checkGzip, const bool followLink)
bool operator()(const fileName &f) const
fileOrNullOp(const bool isFile)
const fileName & operator()(const fileName &f) const
off_t operator()(const fileName &f) const
fileSizeOp(const bool followLink)
highResLastModifiedOp(const bool followLink)
double operator()(const fileName &f) const
bool operator()(const fileName &f) const
isDirOp(const bool followLink)
isFileOp(const bool checkGzip, const bool followLink)
bool operator()(const fileName &f) const
time_t operator()(const fileName &f) const
lastModifiedOp(const bool followLink)
bool operator()(const fileName &src, const fileName &dest) const
mkDirOp(const mode_t mode)
bool operator()(const fileName &f) const
mode_t operator()(const fileName &f) const
modeOp(const bool followLink)
bool operator()(const fileName &f) const
mvBakOp(const std::string &ext)
mvOp(const bool followLink)
bool operator()(const fileName &src, const fileName &dest) const
readDirOp(const fileName::Type type, const bool filtergz, const bool followLink)
fileNameList operator()(const fileName &f) const
bool operator()(const fileName &f) const
rmDirOp(const bool silent=false)
bool operator()(const fileName &f) const
label operator()(const fileName &f) const
typeOp(const bool followLink)
fileOperations that performs all file operations on the master processor. Requires the calls to be pa...
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
virtual double highResLastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
static word findInstancePath(const instantList &timeDirs, const instant &t)
Equivalent of Time::findInstance.
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool valid=true) const
Reads header for regIOobject and returns an ISstream.
const HashPtrTable< DynamicList< instant > > & times() const noexcept
Return cached times.
virtual label addWatch(const fileName &) const
Add watching of a file. Returns handle.
static labelList subRanks(const label n)
Get the list of processors that are part of this communicator.
virtual mode_t mode(const fileName &, const bool followLink=true) const
Return the file mode.
virtual void setTime(const Time &) const
Callback for time change.
virtual fileName filePathInfo(const bool checkGlobal, const bool isFile, const IOobject &, const bool search, pathType &searchType, word &processorsDir, word &instance) const
Search (locally!) for object; return info on how it was found.
virtual autoPtr< OSstream > NewOFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
Generate an OSstream that writes a file.
virtual bool rmDir(const fileName &dir, const bool silent=false) const
Remove a directory and its contents.
const label myComm_
Any communicator allocated by me.
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.
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
static float maxMasterFileBufferSize
Max size of parallel communications. Switches from non-blocking.
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const
Read object header from supplied file.
virtual bool mvBak(const fileName &, const std::string &ext="bak") const
Rename to a corresponding backup file.
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
virtual label findWatch(const labelList &watchIndices, const fileName &) const
Find index (or -1) of file in list of handles.
virtual time_t lastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
virtual fileName dirPath(const bool checkGlobal, const IOobject &io, const bool search) const
Search for a directory. checkGlobal : also check undecomposed.
static autoPtr< ISstream > read(IOobject &io, const label comm, const bool uniform, const fileNameList &filePaths, const boolList &procValid)
Read files on comms master.
virtual bool chMod(const fileName &, const mode_t) const
Set the file mode.
Type masterOp(const fileName &fName, const FileOp &fop, const int tag, const label comm) const
virtual IOobject findInstance(const IOobject &io, const scalar startValue, const word &stopInstance) const
Find instance where IOobject is.
bool exists(const dirIndexList &, IOobject &io) const
Helper: check IO for local existence. Like filePathInfo but.
virtual off_t fileSize(const fileName &, const bool followLink=true) const
Return size of file.
virtual bool rm(const fileName &) const
Remove a file, returning true if successful otherwise false.
virtual autoPtr< ISstream > NewIFstream(const fileName &) const
Generate an ISstream that reads a file.
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 bool isDir(const fileName &, const bool followLink=true) const
Does the name exist as a DIRECTORY in the file system?
Type scatterList(const UList< Type > &, const int, const label comm) const
virtual fileMonitor::fileState getState(const label) const
Get current state of file (using handle)
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.
virtual void setUnmodified(const label) const
Set current state of file (using handle) to unmodified.
static void readAndSend(const fileName &filePath, const labelUList &procs, PstreamBuffers &pBufs)
Read file contents and send to processors.
HashPtrTable< DynamicList< instant > > times_
Cached times for a given directory.
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
static bool uniformFile(const fileNameList &)
Same file?
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
virtual fileName::Type type(const fileName &, const bool followLink=true) const
Return the file type: DIRECTORY, FILE or SYMLINK.
TypeName("masterUncollated")
Runtime type information.
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const
Rename src to dst.
virtual bool writeObject(const regIOobject &io, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
Writes a regIOobject (so header, contents and divider).
virtual bool ln(const fileName &src, const fileName &dst) const
Create a softlink. dst should not exist. Returns true if.
fileName localObjectPath(const IOobject &, const pathType &searchType, const word &processorsDir, const word &instancePath) const
Construct filePath.
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
virtual ~masterUncollatedFileOperation()
Destructor.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Registry of regIOobjects.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
A class for handling words, derived from Foam::string.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
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 mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
bool chMod(const fileName &name, const mode_t mode)
Set the file/directory mode, return true on success.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
bool rmDir(const fileName &directory, const bool silent=false)
Remove a directory and its contents (optionally silencing warnings)
off_t fileSize(const fileName &name, const bool followLink=true)
Return size of file or -1 on failure (normally follows symbolic links).
double highResLastModified(const fileName &, const bool followLink=true)
Return time of last file modification.
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
bool mvBak(const fileName &src, const std::string &ext="bak")
Rename to a corresponding backup file.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE 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).
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
word format(conversionProperties.get< word >("format"))
const volScalarField & cp
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.