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 globalFile,
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 globalFile,
657 const bool globalFile,
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;
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A HashTable specialisation for hashing pointers.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static const versionNumber currentVersion
Current version number.
streamFormat
Enumeration for the format of data in the stream.
compressionType
Enumeration for the format of data in the stream.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
fileState
Enumeration defining the file state.
A class for handling file names.
static const fileName null
An empty fileName.
pathType
Enumeration for the location of an IOobject.
List< dirIndex > dirIndexList
virtual word processorsDir(const IOobject &io) const
Actual name of processors dir (for use in mode PROCOBJECT,.
fileOperations that performs all file operations on the master processor. Requires the calls to be pa...
virtual ~masterUncollatedFileOperationInitialise()
Destructor.
masterUncollatedFileOperationInitialise(int &argc, char **&argv)
Construct from components.
chModOp(const mode_t mode)
bool operator()(const fileName &fName) const
bool operator()(const fileName &src, const fileName &dest) const
cpOp(const bool followLink)
bool operator()(const fileName &fName) const
existsOp(const bool checkVariants, const bool followLink)
fileOrNullOp(const bool isFile)
fileName operator()(const fileName &fName) const
fileSizeOp(const bool checkVariants, const bool followLink)
off_t operator()(const fileName &fName) const
bool operator()(const fileName &fName) const
isDirOp(const bool followLink)
bool operator()(const fileName &fName) const
isFileOp(const bool checkVariants, const bool followLink)
double operator()(const fileName &fName) const
lastModifiedHROp(const bool checkVariants, const bool followLink)
lastModifiedOp(const bool checkVariants, const bool followLink)
time_t operator()(const fileName &fName) const
bool operator()(const fileName &src, const fileName &dest) const
bool operator()(const fileName &fName) const
mkDirOp(const mode_t mode)
modeOp(const bool checkVariants, const bool followLink)
mode_t operator()(const fileName &fName) const
bool operator()(const fileName &fName) const
mvBakOp(const std::string &ext)
mvOp(const bool followLink)
bool operator()(const fileName &src, const fileName &dest) const
readDirOp(const fileType type, const bool filterVariants, const bool followLink)
fileNameList operator()(const fileName &fName) const
bool operator()(const fileName &fName) const
bool operator()(const fileName &fName) const
typeOp(const bool checkVariants, const bool followLink)
label operator()(const fileName &fName) const
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).
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
static word findInstancePath(const instantList &timeDirs, const instant &t)
Equivalent of Time::findInstance.
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.
virtual double highResLastModified(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return time of last file modification.
virtual fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return the file type: directory, file or link.
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?
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.
static void readAndSend(const fileName &fName, const labelUList &procs, PstreamBuffers &pBufs)
Detect file (possibly compressed), read file contents and send.
virtual void setTime(const Time &) const
Callback for time change.
virtual off_t fileSize(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return size of file.
virtual time_t lastModified(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return time of last file modification.
virtual fileName filePath(const bool globalFile, const IOobject &, const word &typeName) const
Search for an object. globalFile : also check undecomposed case.
const label myComm_
Any communicator allocated by me.
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 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.
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 bool rmDir(const fileName &) const
Remove a directory and its contents.
virtual label findWatch(const labelList &watchIndices, const fileName &) const
Find index (or -1) of file in list of handles.
Type masterOp(const fileName &, const fileOp &fop, const int tag, const label comm) const
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 IOobject findInstance(const IOobject &io, const scalar startValue, const word &stopInstance) const
Find instance where IOobject is. Fails if cannot be found.
bool exists(const dirIndexList &, IOobject &io) const
Helper: check IO for local existence. Like filePathInfo but.
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 autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool read=true) const
Reads header for regIOobject and returns an ISstream.
virtual bool rm(const fileName &) const
Remove a file, returning true if successful otherwise false.
const HashPtrTable< instantList > & times() const
Return cached times.
virtual bool isDir(const fileName &, const bool followLink=true) const
Does the name exist as a directory in the file system?
fileName relativeObjectPath(const IOobject &, const pathType &searchType, const word &processorsDir, const word &instancePath) const
Construct filePath.
static autoPtr< ISstream > read(IOobject &io, const label comm, const bool uniform, const fileNameList &filePaths, const boolList &read)
Read files on comms master.
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 void setUnmodified(const label) const
Set current state of file (using handle) to unmodified.
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
masterUncollatedFileOperation(const bool verbose)
Construct null.
virtual mode_t mode(const fileName &, const bool checkVariants=true, const bool followLink=true) const
Return the file mode.
static bool uniformFile(const fileNameList &)
Same file?
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
HashPtrTable< instantList > times_
Cached times for a given directory.
virtual fileName dirPath(const bool globalFile, const IOobject &) const
Search for a directory. globalFile : also check undecomposed.
TypeName("masterUncollated")
Runtime type information.
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
virtual fileName filePathInfo(const bool globalFile, const bool isFile, const IOobject &, pathType &searchType, word &processorsDir, word &instance) const
Search (locally!) for object; return info on how it was found.
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.
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.
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 string.
static instantList timeDirs
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
off_t fileSize(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return size of file.
bool mvBak(const fileName &, const std::string &ext="bak")
Rename to a corresponding backup file.
mode_t mode(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file mode.
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 rm(const fileName &)
Remove a file, returning true if successful otherwise false.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
double highResLastModified(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return time of last file modification.
bool exists(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist (as directory or file) in the file system?
bool chMod(const fileName &, const mode_t)
Set the file mode.
bool rmDir(const fileName &)
Remove a directory and its contents.
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
time_t lastModified(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return time of last file modification.
fileType
Enumeration of file types.
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy, recursively if necessary, the source to the destination.
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
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.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
word format(conversionProperties.lookup("format"))