62#ifndef Foam_fileOperations_masterUncollatedFileOperation_H
63#define Foam_fileOperations_masterUncollatedFileOperation_H
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)
393 template<
class Type,
class FileOp>
402 template<
class Type,
class FileOp>
417 const bool checkGlobal,
437 const word& instancePath
487 const bool distributedRoots,
515 const bool followLink =
true
522 const bool followLink =
true
530 const bool checkGzip=
true,
531 const bool followLink =
true
538 const bool followLink =
true
546 const bool checkGzip=
true,
547 const bool followLink =
true
554 const bool followLink =
true
561 const bool followLink =
true
568 const bool followLink =
true
576 const bool filtergz=
true,
577 const bool followLink =
true
585 const bool followLink =
true
597 const bool followLink =
false
606 const std::string& ext =
"bak"
619 const bool silent =
false,
620 const bool emptyOnly =
false
630 const bool checkGlobal,
640 const bool checkGlobal,
669 const bool readOnProc =
true
676 const bool masterOnly,
689 const bool writeOnProc =
true
700 const bool writeOnProc =
true
709 const bool writeOnProc =
true
737 const bool masterOnly,
756 const word& constantName =
"constant"
772 const scalar startValue,
774 const word& stopInstance =
"",
776 const bool constant_fallback =
true
783 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,...
A simple container for options an IOstream can normally have.
streamFormat
Data format (ascii | binary | coherent).
atomicType
Atomic operations (output).
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
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.
static const fileName null
An empty fileName.
List< dirIndex > dirIndexList
virtual word processorsDir(const IOobject &io) const
Actual name of processors dir (for use in mode PROCOBJECT, PROCINSTANCE).
pathType
Enumeration for the location of an IOobject.
label comm() const noexcept
Communicator to use.
fileOperation(const label comm, const labelUList &ioRanks=labelUList::null(), const bool distributedRoots=false)
Construct from communicator, optionally with specified io-ranks and/or distributed roots.
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
fileSizeOp(bool followLink) noexcept
off_t operator()(const fileName &f) const
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(bool silent=false, bool emptyOnly=false)
bool operator()(const fileName &f) const
int operator()(const fileName &f) const
typeOp(const bool followLink)
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.
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.
virtual autoPtr< OSstream > NewOFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool writeOnProc=true) const
Generate an OSstream that writes a file.
const HashPtrTable< DynamicList< instant > > & times() const noexcept
Return cached times.
virtual instantList findTimes(const fileName &directory, const word &constantName="constant") const
Get sorted list of times.
virtual label addWatch(const fileName &) const
Add watching of a file. Returns handle.
static void readAndSend(const fileName &filePath, const labelUList &recvProcs, PstreamBuffers &pBufs)
Read file contents and send to processors.
virtual bool rmDir(const fileName &dir, const bool silent=false, const bool emptyOnly=false) const
Remove a directory and its contents.
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 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.
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.
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
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.
masterUncollatedFileOperation(bool verbose=false)
Default construct.
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?
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.
virtual void setUnmodified(const label) const
Set current state of file (using handle) to unmodified.
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.
virtual void storeComm() const
Transfer ownership of communicator to this fileOperation. Use with caution.
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
virtual IOobject findInstance(const IOobject &io, const scalar startValue, const word &stopInstance="", const bool constant_fallback=true) const
Find time instance where IOobject is located. The name of the IOobject can be empty,...
virtual fileName::Type type(const fileName &, const bool followLink=true) const
Return the file type: DIRECTORY, FILE or SYMLINK.
virtual void sync()
Forcibly parallel sync.
virtual bool writeObject(const regIOobject &io, IOstreamOption streamOpt=IOstreamOption(), const bool writeOnProc=true) const
Writes a regIOobject (so header, contents and divider).
TypeName("masterUncollated")
Runtime type information.
static autoPtr< ISstream > read(IOobject &io, const label comm, const bool uniform, const fileNameList &filePaths, const boolUList &readOnProcs)
Read files on comms master.
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const
Rename src to dst.
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.
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.
Namespace for implementations of a fileOperation.
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?
List< label > labelList
A List of labels.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
List< fileName > fileNameList
List of fileName.
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
List< instant > instantList
List of instants.
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.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
off_t fileSize(const fileName &name, const bool followLink=true)
Return size of file or -1 on failure (normally follows symbolic links).
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
double highResLastModified(const fileName &, const bool followLink=true)
Return time of last file modification.
UList< bool > boolUList
A UList of bools.
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.
UList< label > labelUList
A UList of labels.
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.
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.
word format(conversionProperties.get< word >("format"))
const volScalarField & cp
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.