62 #ifndef Foam_fileOperations_masterUncollatedFileOperation_H 63 #define Foam_fileOperations_masterUncollatedFileOperation_H 80 namespace fileOperations
100 void init(
bool verbose);
144 const bool followLink_;
146 modeOp(
const bool followLink)
148 followLink_(followLink)
159 const bool followLink_;
161 typeOp(
const bool followLink)
163 followLink_(followLink)
175 const bool checkGzip_;
176 const bool followLink_;
178 existsOp(
const bool checkGzip,
const bool followLink)
180 checkGzip_(checkGzip),
181 followLink_(followLink)
192 const bool followLink_;
196 followLink_(followLink)
207 const bool checkGzip_;
208 const bool followLink_;
210 isFileOp(
const bool checkGzip,
const bool followLink)
212 checkGzip_(checkGzip),
213 followLink_(followLink)
224 const bool followLink_;
228 followLink_(followLink)
239 const bool followLink_;
243 followLink_(followLink)
254 const bool followLink_;
258 followLink_(followLink)
271 mvBakOp(
const std::string& ext)
296 rmDirOp(
bool silent=
false,
bool emptyOnly=
false)
299 emptyOnly_(emptyOnly)
310 const bool followLink_;
312 cpOp(
const bool followLink)
314 followLink_(followLink)
319 return Foam::cp(src, dest, followLink_);
334 const bool followLink_;
336 mvOp(
const bool followLink)
338 followLink_(followLink)
343 return Foam::mv(src, dest, followLink_);
370 const bool filtergz_;
371 const bool followLink_;
377 const bool followLink
382 followLink_(followLink)
400 template<
class Type,
class FileOp>
409 template<
class Type,
class FileOp>
435 const bool checkGlobal,
450 const word& instancePath
518 const bool followLink =
true 525 const bool followLink =
true 533 const bool checkGzip=
true,
534 const bool followLink =
true 541 const bool followLink =
true 549 const bool checkGzip=
true,
550 const bool followLink =
true 557 const bool followLink =
true 564 const bool followLink =
true 571 const bool followLink =
true 579 const bool filtergz=
true,
580 const bool followLink =
true 588 const bool followLink =
true 600 const bool followLink =
false 609 const std::string& ext =
"bak" 622 const bool silent =
false,
623 const bool emptyOnly =
false 632 const bool checkGlobal,
634 const word& typeName,
642 const bool checkGlobal,
670 const word& typeName,
671 const bool valid =
true 678 const bool masterOnly,
689 const bool valid =
true 700 const bool valid =
true 709 const bool valid =
true 737 const bool masterOnly,
760 const scalar startValue,
761 const word& stopInstance
768 virtual void flush()
const;
782 class masterUncollatedFileOperationInitialise
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)
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.
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.
virtual ~masterUncollatedFileOperationInitialise()=default
Destructor.
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.
existsOp(const bool checkGzip, const bool followLink)
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.
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?
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.
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.
virtual autoPtr< OSstream > NewOFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
Generate an OSstream that writes a file.
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?
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)
virtual fileName filePathInfo(const bool checkGlobal, const bool isFile, const IOobject &io, const bool search, pathType &searchType, word &processorsDir, word &instance) const
Search (locally!) for object; return info on how it was found.
fileSizeOp(const bool followLink)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
virtual bool writeObject(const regIOobject &io, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
Writes a regIOobject (so header, contents and divider).
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)
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,.
masterUncollatedFileOperation(bool verbose)
Default construct.
const fileName & operator()(const fileName &f) const
virtual bool mvBak(const fileName &, const std::string &ext="bak") const
Rename to a corresponding backup file.
A fileOperation initialiser for unthreaded file handlers.
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.
bool operator()(const fileName &f) const
bool operator()(const fileName &f) const
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...
static void readAndSend(const fileName &filePath, const labelUList &procs, PstreamBuffers &pBufs)
Read file contents and send to processors.
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 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)
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,.
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.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.