58 #ifndef fileOperations_masterUncollatedFileOperation_H 59 #define fileOperations_masterUncollatedFileOperation_H 74 namespace fileOperations
130 const bool checkVariants_;
131 const bool followLink_;
133 modeOp(
const bool checkVariants,
const bool followLink)
135 checkVariants_(checkVariants),
136 followLink_(followLink)
141 return Foam::mode(fName, checkVariants_, followLink_);
147 const bool checkVariants_;
148 const bool followLink_;
150 typeOp(
const bool checkVariants,
const bool followLink)
152 checkVariants_(checkVariants),
153 followLink_(followLink)
164 const bool checkVariants_;
165 const bool followLink_;
167 existsOp(
const bool checkVariants,
const bool followLink)
169 checkVariants_(checkVariants),
170 followLink_(followLink)
175 return Foam::exists(fName, checkVariants_, followLink_);
181 const bool followLink_;
185 followLink_(followLink)
197 const bool checkVariants_;
198 const bool followLink_;
200 isFileOp(
const bool checkVariants,
const bool followLink)
202 checkVariants_(checkVariants),
203 followLink_(followLink)
208 return Foam::isFile(fName, checkVariants_, followLink_);
214 const bool checkVariants_;
215 const bool followLink_;
217 fileSizeOp(
const bool checkVariants,
const bool followLink)
219 checkVariants_(checkVariants),
220 followLink_(followLink)
232 const bool checkVariants_;
233 const bool followLink_;
237 checkVariants_(checkVariants),
238 followLink_(followLink)
250 const bool checkVariants_;
251 const bool followLink_;
255 const bool checkVariants,
256 const bool followLink
259 checkVariants_(checkVariants),
260 followLink_(followLink)
280 mvBakOp(
const std::string& ext)
311 const bool followLink_;
313 cpOp(
const bool followLink)
315 followLink_(followLink)
321 return Foam::cp(src, dest, followLink_);
336 const bool followLink_;
338 mvOp(
const bool followLink)
340 followLink_(followLink)
346 return Foam::mv(src, dest, followLink_);
374 const bool filterVariants_;
375 const bool followLink_;
382 const bool filterVariants,
383 const bool followLink
387 filterVariants_(filterVariants),
388 followLink_(followLink)
412 template<
class Type,
class fileOp>
421 template<
class Type,
class fileOp>
447 const bool checkGlobal,
460 const word& processorsDir,
461 const word& instancePath
529 const bool checkVariants =
true,
530 const bool followLink =
true 537 const bool checkVariants =
true,
538 const bool followLink =
true 546 const bool checkVariants =
true,
547 const bool followLink =
true 554 const bool followLink =
true 562 const bool checkVariants =
true,
563 const bool followLink =
true 570 const bool checkVariants =
true,
571 const bool followLink =
true 578 const bool checkVariants =
true,
579 const bool followLink =
true 586 const bool checkVariants =
true,
587 const bool followLink =
true 595 const bool filterVariants =
true,
596 const bool followLink =
true 604 const bool followLink =
true 616 const bool followLink =
false 625 const std::string& ext =
"bak" 648 const bool checkGlobal,
657 const bool checkGlobal,
684 const word& typeName,
685 const bool read =
true 693 const bool masterOnly,
706 const bool write =
true 724 const bool write =
true 752 const bool masterOnly,
777 const scalar startValue,
778 const word& stopInstance
785 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
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
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 specialisation 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)
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.
virtual autoPtr< ISstream > NewIFstream(const fileName &filePath, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion) const
Generate an ISstream that reads a file.
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.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
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 autoPtr< Ostream > NewOFstream(const fileName &filePath, 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.
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.