58 #ifndef fileOperations_masterUncollatedFileOperation_H 59 #define fileOperations_masterUncollatedFileOperation_H 75 namespace fileOperations
131 const bool checkVariants_;
132 const bool followLink_;
134 modeOp(
const bool checkVariants,
const bool followLink)
136 checkVariants_(checkVariants),
137 followLink_(followLink)
142 return Foam::mode(fName, checkVariants_, followLink_);
148 const bool checkVariants_;
149 const bool followLink_;
151 typeOp(
const bool checkVariants,
const bool followLink)
153 checkVariants_(checkVariants),
154 followLink_(followLink)
165 const bool checkVariants_;
166 const bool followLink_;
168 existsOp(
const bool checkVariants,
const bool followLink)
170 checkVariants_(checkVariants),
171 followLink_(followLink)
176 return Foam::exists(fName, checkVariants_, followLink_);
182 const bool followLink_;
186 followLink_(followLink)
198 const bool checkVariants_;
199 const bool followLink_;
201 isFileOp(
const bool checkVariants,
const bool followLink)
203 checkVariants_(checkVariants),
204 followLink_(followLink)
209 return Foam::isFile(fName, checkVariants_, followLink_);
215 const bool checkVariants_;
216 const bool followLink_;
218 fileSizeOp(
const bool checkVariants,
const bool followLink)
220 checkVariants_(checkVariants),
221 followLink_(followLink)
233 const bool checkVariants_;
234 const bool followLink_;
238 checkVariants_(checkVariants),
239 followLink_(followLink)
251 const bool checkVariants_;
252 const bool followLink_;
256 const bool checkVariants,
257 const bool followLink
260 checkVariants_(checkVariants),
261 followLink_(followLink)
281 mvBakOp(
const std::string& ext)
312 const bool followLink_;
314 cpOp(
const bool followLink)
316 followLink_(followLink)
322 return Foam::cp(src, dest, followLink_);
337 const bool followLink_;
339 mvOp(
const bool followLink)
341 followLink_(followLink)
347 return Foam::mv(src, dest, followLink_);
375 const bool filterVariants_;
376 const bool followLink_;
383 const bool filterVariants,
384 const bool followLink
388 filterVariants_(filterVariants),
389 followLink_(followLink)
413 template<
class Type,
class fileOp>
422 template<
class Type,
class fileOp>
448 const bool checkGlobal,
461 const word& processorsDir,
462 const word& instancePath
530 const bool checkVariants =
true,
531 const bool followLink =
true 538 const bool checkVariants =
true,
539 const bool followLink =
true 547 const bool checkVariants =
true,
548 const bool followLink =
true 555 const bool followLink =
true 563 const bool checkVariants =
true,
564 const bool followLink =
true 571 const bool checkVariants =
true,
572 const bool followLink =
true 579 const bool checkVariants =
true,
580 const bool followLink =
true 587 const bool checkVariants =
true,
588 const bool followLink =
true 596 const bool filterVariants =
true,
597 const bool followLink =
true 605 const bool followLink =
true 617 const bool followLink =
false 626 const std::string& ext =
"bak" 649 const bool checkGlobal,
658 const bool checkGlobal,
685 const word& typeName,
686 const bool read =
true 693 const bool masterOnly,
706 const bool write =
true 719 const bool write =
true 747 const bool masterOnly,
772 const scalar startValue,
773 const word& stopInstance
780 virtual void flush()
const;
pathType
Enumeration for the location of an IOobject.
static word findInstancePath(const instantList &timeDirs, const instant &t)
Equivalent of Time::findInstance.
fileName localObjectPath(const IOobject &, const pathType &searchType, const word &processorsDir, const word &instancePath) const
Construct filePath.
time_t lastModified(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return time of last file modification.
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 autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool read=true) const
Reads header for regIOobject and returns an ISstream.
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.
bool exists(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist (as directory or file) in the file system?
mode_t mode(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file mode.
fileOperations that performs all file operations on the master processor. Requires the calls to be pa...
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 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< ISstream > NewIFstream(const fileName &) const
Generate an ISstream that reads a file.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
fileState
Enumeration defining the file state.
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 double highResLastModified(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return time of last file modification.
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.
virtual fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true) const
Read a directory and return the entries as a string list.
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)
virtual autoPtr< Ostream > NewOFstream(const fileName &pathname, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool write=true) const
Generate an Ostream that writes a file.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
static void readAndSend(const fileName &fName, const labelUList &procs, PstreamBuffers &pBufs)
Detect file (possibly compressed), read file contents and send.
static instantList timeDirs
static float maxMasterFileBufferSize
Max size of parallel communications. Switches from non-blocking.
virtual bool writeObject(const regIOobject &, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool write=true) const
Writes a regIOobject (so header, contents and divider).
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
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
virtual off_t fileSize(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return size of file.
streamFormat
Enumeration for the format of data in the stream.
fileType
Enumeration of file types.
fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
Read a directory and return the entries as a string list.
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
virtual fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return the file type: directory, file or link.
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.
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.
virtual bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Does the name exist as a file in the file system?
const label myComm_
Any communicator allocated by me.
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 autoPtr< ISstream > read(IOobject &io, const label comm, const bool uniform, const fileNameList &filePaths, const boolList &read)
Read files on comms master.
static bool uniformFile(const fileNameList &)
Same file?
double highResLastModified(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return time of last file modification.
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.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
virtual mode_t mode(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return 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...
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
off_t fileSize(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return size of file.
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.
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.
virtual time_t lastModified(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return time of last file modification.