masterUncollatedFileOperation Class Reference

fileOperations that performs all file operations on the master processor. Requires the calls to be parallel synchronised! More...

Inheritance diagram for masterUncollatedFileOperation:
[legend]
Collaboration diagram for masterUncollatedFileOperation:
[legend]

Classes

class  chModOp
 
class  cpOp
 
class  existsOp
 
class  fileOrNullOp
 
class  fileSizeOp
 
class  highResLastModifiedOp
 
class  isDirOp
 
class  isFileOp
 
class  lastModifiedOp
 
class  lnOp
 
class  mkDirOp
 
class  modeOp
 
class  mvBakOp
 
class  mvOp
 
class  readDirOp
 
class  rmDirOp
 
class  rmOp
 
class  typeOp
 

Public Member Functions

 TypeName ("masterUncollated")
 Runtime type information. More...
 
 masterUncollatedFileOperation (bool verbose)
 Default construct. More...
 
 masterUncollatedFileOperation (const label comm, bool verbose)
 Construct from communicator. More...
 
virtual ~masterUncollatedFileOperation ()
 Destructor. More...
 
virtual bool mkDir (const fileName &, mode_t=0777) const
 Make directory. More...
 
virtual bool chMod (const fileName &, const mode_t) const
 Set the file mode. More...
 
virtual mode_t mode (const fileName &, const bool followLink=true) const
 Return the file mode. More...
 
virtual fileName::Type type (const fileName &, const bool followLink=true) const
 Return the file type: DIRECTORY, FILE or SYMLINK. More...
 
virtual bool exists (const fileName &, const bool checkGzip=true, const bool followLink=true) const
 Does the name exist (as DIRECTORY or FILE) in the file system? More...
 
virtual bool isDir (const fileName &, const bool followLink=true) const
 Does the name exist as a DIRECTORY in the file system? More...
 
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? More...
 
virtual off_t fileSize (const fileName &, const bool followLink=true) const
 Return size of file. More...
 
virtual time_t lastModified (const fileName &, const bool followLink=true) const
 Return time of last file modification. More...
 
virtual double highResLastModified (const fileName &, const bool followLink=true) const
 Return time of last file modification. More...
 
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. More...
 
virtual bool cp (const fileName &src, const fileName &dst, const bool followLink=true) const
 Copy, recursively if necessary, the source to the destination. More...
 
virtual bool ln (const fileName &src, const fileName &dst) const
 Create a softlink. dst should not exist. Returns true if. More...
 
virtual bool mv (const fileName &src, const fileName &dst, const bool followLink=false) const
 Rename src to dst. More...
 
virtual bool mvBak (const fileName &, const std::string &ext="bak") const
 Rename to a corresponding backup file. More...
 
virtual bool rm (const fileName &) const
 Remove a file, returning true if successful otherwise false. More...
 
virtual bool rmDir (const fileName &dir, const bool silent=false) const
 Remove a directory and its contents. More...
 
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. More...
 
virtual fileName dirPath (const bool checkGlobal, const IOobject &io, const bool search) const
 Search for a directory. checkGlobal : also check undecomposed. More...
 
virtual fileNameList readObjects (const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
 Search directory for objects. Used in IOobjectList. More...
 
virtual bool readHeader (IOobject &, const fileName &, const word &typeName) const
 Read object header from supplied file. More...
 
virtual autoPtr< ISstreamreadStream (regIOobject &, const fileName &, const word &typeName, const bool valid=true) const
 Reads header for regIOobject and returns an ISstream. More...
 
virtual bool read (regIOobject &, const bool masterOnly, const IOstreamOption::streamFormat format, const word &typeName) const
 Top-level read. More...
 
virtual bool writeObject (const regIOobject &io, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
 Writes a regIOobject (so header, contents and divider). More...
 
virtual autoPtr< ISstreamNewIFstream (const fileName &) const
 Generate an ISstream that reads a file. More...
 
virtual autoPtr< OSstreamNewOFstream (const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
 Generate an OSstream that writes a file. More...
 
virtual label addWatch (const fileName &) const
 Add watching of a file. Returns handle. More...
 
virtual bool removeWatch (const label) const
 Remove watch on a file (using handle) More...
 
virtual label findWatch (const labelList &watchIndices, const fileName &) const
 Find index (or -1) of file in list of handles. More...
 
virtual void addWatches (regIOobject &, const fileNameList &) const
 Helper: add watches for list of regIOobjects. More...
 
virtual fileName getFile (const label) const
 Get name of file being watched (using handle) More...
 
virtual void updateStates (const bool masterOnly, const bool syncPar) const
 Update state of all files. More...
 
virtual fileMonitor::fileState getState (const label) const
 Get current state of file (using handle) More...
 
virtual void setUnmodified (const label) const
 Set current state of file (using handle) to unmodified. More...
 
virtual instantList findTimes (const fileName &, const word &) const
 Get sorted list of times. More...
 
virtual IOobject findInstance (const IOobject &io, const scalar startValue, const word &stopInstance) const
 Find instance where IOobject is. More...
 
virtual void setTime (const Time &) const
 Callback for time change. More...
 
virtual void flush () const
 Forcibly wait until all output done. Flush any cached data. More...
 
const HashPtrTable< DynamicList< instant > > & times () const noexcept
 Return cached times. More...
 
- Public Member Functions inherited from fileOperation
 TypeName ("fileOperation")
 Runtime type information. More...
 
 fileOperation (const label comm, const bool distributedRoots=false)
 Construct from communicator, optionally with distributed roots. More...
 
 declareRunTimeSelectionTable (autoPtr, fileOperation, word,(bool verbose),(verbose))
 
virtual ~fileOperation ()=default
 Destructor. More...
 
bool distributed () const noexcept
 Distributed roots (parallel run) More...
 
bool distributed (bool on) const noexcept
 Set distributed roots on/off (mutable) More...
 
virtual bool mkDir (const fileName &, mode_t=0777) const =0
 Make directory. More...
 
virtual bool chMod (const fileName &, const mode_t) const =0
 Set the file mode. More...
 
virtual mode_t mode (const fileName &, const bool followLink=true) const =0
 Return the file mode. More...
 
virtual fileName::Type type (const fileName &, const bool followLink=true) const =0
 Return the file type: DIRECTORY, FILE or SYMLINK. More...
 
virtual bool exists (const fileName &, const bool checkGzip=true, const bool followLink=true) const =0
 Does the name exist (as DIRECTORY or FILE) in the file system? More...
 
virtual bool isDir (const fileName &, const bool followLink=true) const =0
 Does the name exist as a DIRECTORY in the file system? More...
 
virtual bool isFile (const fileName &, const bool checkGzip=true, const bool followLink=true) const =0
 Does the name exist as a FILE in the file system? More...
 
virtual off_t fileSize (const fileName &, const bool followLink=true) const =0
 Return size of file. More...
 
virtual time_t lastModified (const fileName &, const bool followLink=true) const =0
 Return time of last file modification. More...
 
virtual double highResLastModified (const fileName &, const bool followLink=true) const =0
 Return time of last file modification. More...
 
virtual fileNameList readDir (const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true, const bool followLink=true) const =0
 Read a directory and return the entries as a string list. More...
 
virtual bool cp (const fileName &src, const fileName &dst, const bool followLink=true) const =0
 Copy, recursively if necessary, the source to the destination. More...
 
virtual bool ln (const fileName &src, const fileName &dst) const =0
 Create a softlink. dst should not exist. Returns true if. More...
 
virtual bool mv (const fileName &src, const fileName &dst, const bool followLink=false) const =0
 Rename src to dst. More...
 
virtual bool mvBak (const fileName &, const std::string &ext="bak") const =0
 Rename to a corresponding backup file. More...
 
virtual bool rm (const fileName &) const =0
 Remove a file, returning true if successful otherwise false. More...
 
virtual bool rmDir (const fileName &dir, const bool silent=false) const =0
 Remove a directory and its contents. More...
 
virtual fileName objectPath (const IOobject &io, const word &typeName) const
 Generate disk file name for object. Opposite of filePath. More...
 
virtual fileName filePath (const bool checkGlobal, const IOobject &, const word &typeName, const bool search=true) const =0
 Search for an object. checkGlobal : also check undecomposed case. More...
 
virtual fileName dirPath (const bool checkGlobal, const IOobject &io, const bool search=true) const =0
 Search for a directory. checkGlobal : also check undecomposed. More...
 
virtual fileNameList readObjects (const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
 Search directory for objects. Used in IOobjectList. More...
 
virtual bool readHeader (IOobject &, const fileName &, const word &typeName) const =0
 Read object header from supplied file. More...
 
virtual autoPtr< ISstreamreadStream (regIOobject &, const fileName &, const word &typeName, const bool valid=true) const =0
 Reads header for regIOobject and returns an ISstream. More...
 
virtual bool read (regIOobject &, const bool masterOnly, const IOstreamOption::streamFormat format, const word &typeName) const =0
 Top-level read. More...
 
virtual bool writeObject (const regIOobject &io, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
 Writes a regIOobject (so header, contents and divider). More...
 
virtual fileName filePath (const fileName &) const
 Search for a file or directory. Use IOobject version in. More...
 
virtual autoPtr< ISstreamNewIFstream (const fileName &) const =0
 Generate an ISstream that reads a file. More...
 
virtual autoPtr< OSstreamNewOFstream (const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const =0
 Generate an OSstream that writes a file. More...
 
virtual label addWatch (const fileName &) const
 Add watching of a file. Returns handle. More...
 
virtual bool removeWatch (const label) const
 Remove watch on a file (using handle) More...
 
virtual label findWatch (const labelList &watchIndices, const fileName &) const
 Find index (or -1) of file in list of handles. More...
 
virtual void addWatches (regIOobject &, const fileNameList &) const
 Helper: add watches for list of regIOobjects. More...
 
virtual fileName getFile (const label) const
 Get name of file being watched (using handle) More...
 
virtual void updateStates (const bool masterOnly, const bool syncPar) const
 Update state of all files. More...
 
virtual fileMonitor::fileState getState (const label) const
 Get current state of file (using handle) More...
 
virtual void setUnmodified (const label) const
 Set current state of file (using handle) to unmodified. More...
 
virtual word processorsDir (const IOobject &io) const
 Actual name of processors dir (for use in mode PROCOBJECT,. More...
 
virtual word processorsDir (const fileName &) const
 Actual name of processors dir (for use in mode PROCOBJECT,. More...
 
virtual void setNProcs (const label nProcs)
 Set number of processor directories/results. Only used in. More...
 
virtual label nProcs (const fileName &dir, const fileName &local="") const
 Get number of processor directories/results. Used for e.g. More...
 
virtual instantList findTimes (const fileName &, const word &) const
 Get sorted list of times. More...
 
virtual IOobject findInstance (const IOobject &io, const scalar startValue, const word &stopInstance) const
 Find instance where IOobject is. More...
 
virtual void setTime (const Time &) const
 Callback for time change. More...
 
virtual void flush () const
 Forcibly wait until all output done. Flush any cached data. More...
 
fileName processorsCasePath (const IOobject &, const word &procDir) const
 Generate path (like io.path) from root+casename with any. More...
 
fileName processorsPath (const IOobject &, const word &instance, const word &procDir) const
 Generate path (like io.path) with provided instance and any. More...
 
fileName processorsPath (const fileName &, const word &procDir) const
 Operating on fileName: replace processorXXX with procDir. More...
 

Static Public Member Functions

static bool uniformFile (const fileNameList &)
 Same file? More...
 
- Static Public Member Functions inherited from fileOperation
static autoPtr< fileOperationNewUncollated ()
 Static construct the commonly used uncollatedFileOperation. More...
 
static autoPtr< fileOperationNew (const word &handlerType, bool verbose=false)
 Select fileHandler-type. More...
 
static instantList sortTimes (const fileNameList &dirEntries, const word &constantName="constant")
 Sort directory entries according to time value,. More...
 
static label splitProcessorPath (const fileName &objectPath, fileName &path, fileName &procDir, fileName &local, procRangeType &group, label &nProcs)
 Split objectPath into part before 'processor' and part after. More...
 
static label detectProcessorPath (const fileName &objPath)
 Detect processor number from '/aa/bb/processorDDD/cc'. More...
 

Static Public Attributes

static float maxMasterFileBufferSize
 Max size of parallel communications. Switches from non-blocking. More...
 
- Static Public Attributes inherited from fileOperation
static const Enum< pathTypepathTypeNames_
 
static word processorsBaseDir = "processors"
 Return the processors directory name (usually "processors") More...
 
static word defaultFileHandler
 Name of the default fileHandler. More...
 
static autoPtr< fileOperationfileHandlerPtr_
 Static fileOperation. More...
 

Protected Member Functions

template<class Type >
Type scatterList (const UList< Type > &, const int, const label comm) const
 
template<class Type , class FileOp >
Type masterOp (const fileName &fName, const FileOp &fop, const int tag, const label comm) const
 
template<class Type , class FileOp >
Type masterOp (const fileName &src, const fileName &dest, const FileOp &fop, const int tag, const label comm) const
 
virtual fileName filePathInfo (const bool checkGlobal, const bool isFile, const IOobject &, const bool search, pathType &searchType, word &processorsDir, word &instance) const
 Search (locally!) for object; return info on how it was found. More...
 
fileName localObjectPath (const IOobject &, const pathType &searchType, const word &processorsDir, const word &instancePath) const
 Construct filePath. More...
 
bool exists (const dirIndexList &, IOobject &io) const
 Helper: check IO for local existence. Like filePathInfo but. More...
 
- Protected Member Functions inherited from fileOperation
fileMonitormonitor () const
 Get or create fileMonitor singleton. More...
 
refPtr< dirIndexListlookupAndCacheProcessorsPath (const fileName &objectPath, const bool syncPar) const
 Lookup name of processorsDDD using cache. More...
 
virtual refPtr< dirIndexListlookupProcessorsPath (const fileName &objectPath) const
 Lookup name of processorsDDD using cache. More...
 
bool exists (IOobject &io) const
 

Static Protected Member Functions

static labelList subRanks (const label n)
 Get the list of processors that are part of this communicator. More...
 
static word findInstancePath (const instantList &timeDirs, const instant &t)
 Equivalent of Time::findInstance. More...
 
static void readAndSend (const fileName &filePath, const labelUList &procs, PstreamBuffers &pBufs)
 Read file contents and send to processors. More...
 
static autoPtr< ISstreamread (IOobject &io, const label comm, const bool uniform, const fileNameList &filePaths, const boolList &procValid)
 Read files on comms master. More...
 
- Static Protected Member Functions inherited from fileOperation
static labelList ioRanks ()
 Retrieve list of IO ranks from FOAM_IORANKS env variable. More...
 
static void mergeTimes (const instantList &extraTimes, const word &constantName, instantList &times)
 Merge two times. More...
 
static bool isFileOrDir (const bool isFile, const fileName &)
 Helper: check for file (isFile) or directory (!isFile) More...
 

Protected Attributes

const label myComm_
 Any communicator allocated by me. More...
 
HashPtrTable< DynamicList< instant > > times_
 Cached times for a given directory. More...
 
- Protected Attributes inherited from fileOperation
const label comm_
 Communicator to use. More...
 
bool distributed_
 Distributed roots (parallel run) More...
 
HashTable< dirIndexListprocsDirs_
 Detected processors directories. More...
 
autoPtr< fileMonitormonitorPtr_
 File-change monitor for all registered files. More...
 

Additional Inherited Members

- Public Types inherited from fileOperation
enum  pathType : int {
  NOTFOUND = 0 , ABSOLUTE , OBJECT , WRITEOBJECT ,
  PROCUNCOLLATED , PROCBASEOBJECT = PROCUNCOLLATED + 1 , PROCOBJECT = PROCBASEOBJECT + 1 , PARENTOBJECT ,
  FINDINSTANCE , PROCUNCOLLATEDINSTANCE , PROCBASEINSTANCE , PROCINSTANCE
}
 Enumeration for the location of an IOobject. More...
 
typedef Tuple2< fileName, Tuple2< pathType, int > > dirIndex
 Augment fileName with pathType and local offset. More...
 
typedef List< dirIndexdirIndexList
 
typedef IntRange< int > procRangeType
 

Detailed Description

fileOperations that performs all file operations on the master processor. Requires the calls to be parallel synchronised!

Limitations

  • no /processor in filename
  • no /uniform/ in the filename

The main logic is in filePath which returns a

  • same path on all processors. This can either be a global file (system/controlDict, processorXXX/0/uniform/) or a collated file (processors/0/p)
  • same path on all processors of the local communicator (processors4_0-1/0/p)
  • different path on all processors (processor0/0/p)

system/controlDict: filePath worldmaster: <globalRoot>/system/controlDict localmaster: ,, slave : ,,

processor0/uniform/time filePath worldmaster: <globalRoot>/processorXXX/uniform/time localmaster: ,, slave : ,,

processors0/0/p processors10/0/p processors10_2-4/0/p

Definition at line 86 of file masterUncollatedFileOperation.H.

Constructor & Destructor Documentation

◆ masterUncollatedFileOperation() [1/2]

masterUncollatedFileOperation ( bool  verbose)
explicit

Default construct.

Definition at line 718 of file masterUncollatedFileOperation.C.

References DetailInfo, Foam::endl(), IOobject::fileModificationChecking, Foam::infoDetailLevel, IOobject::inotify, IOobject::inotifyMaster, masterUncollatedFileOperation::maxMasterFileBufferSize, IOobject::timeStamp, IOobject::timeStampMaster, and WarningInFunction.

Here is the call graph for this function:

◆ masterUncollatedFileOperation() [2/2]

masterUncollatedFileOperation ( const label  comm,
bool  verbose 
)

Construct from communicator.

Definition at line 766 of file masterUncollatedFileOperation.C.

References DetailInfo, Foam::endl(), IOobject::fileModificationChecking, Foam::infoDetailLevel, IOobject::inotify, IOobject::inotifyMaster, masterUncollatedFileOperation::maxMasterFileBufferSize, IOobject::timeStamp, IOobject::timeStampMaster, and WarningInFunction.

Here is the call graph for this function:

◆ ~masterUncollatedFileOperation()

Destructor.

Definition at line 810 of file masterUncollatedFileOperation.C.

References UPstream::freeCommunicator(), and UPstream::worldComm.

Here is the call graph for this function:

Member Function Documentation

◆ subRanks()

Foam::labelList subRanks ( const label  n)
staticprotected

Get the list of processors that are part of this communicator.

Definition at line 83 of file masterUncollatedFileOperation.C.

References List< T >::append(), UList< T >::empty(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, UList< T >::found(), Foam::identity(), fileOperation::ioRanks(), processorFaPatch::myProcNo(), n, Foam::nl, and masterUncollatedFileOperation::subRanks().

Referenced by masterUncollatedFileOperation::subRanks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scatterList()

Type scatterList ( const UList< Type > &  allValues,
const int  tag,
const label  comm 
) const
protected

Definition at line 35 of file masterUncollatedFileOperationTemplates.C.

References PstreamBuffers::finishedScatters(), splitCell::master(), UPstream::masterNo(), UPstream::nonBlocking, os(), and PstreamBuffers::subProcs().

Here is the call graph for this function:

◆ masterOp() [1/2]

Type masterOp ( const fileName fName,
const FileOp &  fop,
const int  tag,
const label  comm 
) const
protected

Definition at line 70 of file masterUncollatedFileOperationTemplates.C.

References Foam::endl(), Pstream::gatherList(), splitCell::master(), processorFaPatch::myProcNo(), Foam::name(), PstreamBuffers::nProcs(), UPstream::parRun(), Foam::Pout, and UList< T >::size().

Here is the call graph for this function:

◆ masterOp() [2/2]

Type masterOp ( const fileName src,
const fileName dest,
const FileOp &  fop,
const int  tag,
const label  comm 
) const
protected

Definition at line 113 of file masterUncollatedFileOperationTemplates.C.

References Foam::endl(), Pstream::gatherList(), splitCell::master(), processorFaPatch::myProcNo(), PstreamBuffers::nProcs(), UPstream::parRun(), Foam::Pout, and UList< T >::size().

Here is the call graph for this function:

◆ findInstancePath()

Foam::word findInstancePath ( const instantList timeDirs,
const instant t 
)
staticprotected

Equivalent of Time::findInstance.

Definition at line 133 of file masterUncollatedFileOperation.C.

References Instant< T >::equal(), forAllReverse, and word::null.

Here is the call graph for this function:

◆ filePathInfo()

Foam::fileName filePathInfo ( const bool  checkGlobal,
const bool  isFile,
const IOobject io,
const bool  search,
pathType searchType,
word processorsDir,
word instance 
) const
protectedvirtual

Search (locally!) for object; return info on how it was found.

Does not do any parallel communication. checkGlobal : also check undecomposed case isFile : true:check for file false:check for directory searchType : how was found processorsDir : name of processor directory instance : instance

Definition at line 158 of file masterUncollatedFileOperation.C.

References fileOperation::ABSOLUTE, fileOperation::FINDINSTANCE, io(), Foam::isFile(), fileOperation::NOTFOUND, fileName::null, word::null, fileOperation::OBJECT, fileOperation::PARENTOBJECT, fileOperation::PROCBASEINSTANCE, fileOperation::PROCBASEOBJECT, fileOperation::PROCINSTANCE, fileOperation::PROCOBJECT, fileOperation::PROCUNCOLLATED, fileOperation::PROCUNCOLLATEDINSTANCE, Foam::search(), and fileOperation::WRITEOBJECT.

Here is the call graph for this function:

◆ localObjectPath()

Foam::fileName localObjectPath ( const IOobject io,
const pathType searchType,
const word processorsDir,
const word instancePath 
) const
protected

Construct filePath.

Definition at line 335 of file masterUncollatedFileOperation.C.

References fileOperation::ABSOLUTE, fileOperation::FINDINSTANCE, io(), processorFaPatch::myProcNo(), Foam::name(), fileOperation::NOTFOUND, NotImplemented, fileName::null, fileOperation::OBJECT, fileOperation::PARENTOBJECT, UPstream::parRun(), fileOperation::PROCBASEINSTANCE, fileOperation::PROCBASEOBJECT, fileOperation::PROCINSTANCE, fileOperation::PROCOBJECT, fileOperation::PROCUNCOLLATED, fileOperation::PROCUNCOLLATEDINSTANCE, UPstream::worldComm, and fileOperation::WRITEOBJECT.

Referenced by collatedFileOperation::objectPath().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readAndSend()

void readAndSend ( const fileName filePath,
const labelUList procs,
PstreamBuffers pBufs 
)
staticprotected

Read file contents and send to processors.

Handles compressed or uncompressed files

Definition at line 495 of file masterUncollatedFileOperation.C.

References IOstreamOption::BINARY, bool, UList< T >::cdata(), IOstreamOption::COMPRESSED, IOstreamOption::compression(), UList< T >::data(), Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, Foam::fileSize(), IOstream::good(), os(), Foam::Pout, UList< T >::size(), and IFstream::stdStream().

Here is the call graph for this function:

◆ read() [1/2]

Foam::autoPtr< Foam::ISstream > read ( IOobject io,
const label  comm,
const bool  uniform,
const fileNameList filePaths,
const boolList procValid 
)
staticprotected

◆ exists() [1/2]

bool exists ( const dirIndexList pDirs,
IOobject io 
) const
protected

Helper: check IO for local existence. Like filePathInfo but.

without parent searchign and instance searching

Definition at line 1381 of file masterUncollatedFileOperation.C.

References io(), and Foam::isFile().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "masterUncollated"  )

Runtime type information.

◆ mkDir()

bool mkDir ( const fileName dir,
mode_t  mode = 0777 
) const
virtual

Make directory.

Implements fileOperation.

Definition at line 822 of file masterUncollatedFileOperation.C.

References Foam::mode(), and UPstream::msgType().

Here is the call graph for this function:

◆ chMod()

bool chMod ( const fileName fName,
const  mode_t 
) const
virtual

Set the file mode.

Implements fileOperation.

Definition at line 838 of file masterUncollatedFileOperation.C.

References Foam::mode(), and UPstream::msgType().

Here is the call graph for this function:

◆ mode()

mode_t mode ( const fileName fName,
const bool  followLink = true 
) const
virtual

Return the file mode.

Implements fileOperation.

Definition at line 854 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ type()

Foam::fileName::Type type ( const fileName fName,
const bool  followLink = true 
) const
virtual

Return the file type: DIRECTORY, FILE or SYMLINK.

Implements fileOperation.

Definition at line 870 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Referenced by collatedFileOperation::printBanner().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ exists() [2/2]

bool exists ( const fileName fName,
const bool  checkGzip = true,
const bool  followLink = true 
) const
virtual

Does the name exist (as DIRECTORY or FILE) in the file system?

Optionally enable/disable check for gzip file.

Implements fileOperation.

Definition at line 889 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ isDir()

bool isDir ( const fileName fName,
const bool  followLink = true 
) const
virtual

Does the name exist as a DIRECTORY in the file system?

Implements fileOperation.

Definition at line 906 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ isFile()

bool isFile ( const fileName fName,
const bool  checkGzip = true,
const bool  followLink = true 
) const
virtual

Does the name exist as a FILE in the file system?

Optionally enable/disable check for gzip file.

Implements fileOperation.

Definition at line 922 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ fileSize()

off_t fileSize ( const fileName fName,
const bool  followLink = true 
) const
virtual

Return size of file.

Implements fileOperation.

Definition at line 939 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ lastModified()

time_t lastModified ( const fileName fName,
const bool  followLink = true 
) const
virtual

Return time of last file modification.

Implements fileOperation.

Definition at line 955 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ highResLastModified()

double highResLastModified ( const fileName fName,
const bool  followLink = true 
) const
virtual

Return time of last file modification.

Implements fileOperation.

Definition at line 971 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ readDir()

Foam::fileNameList readDir ( const fileName dir,
const fileName::Type  type = fileName::FILE,
const bool  filtergz = true,
const bool  followLink = true 
) const
virtual

Read a directory and return the entries as a string list.

Implements fileOperation.

Definition at line 1034 of file masterUncollatedFileOperation.C.

References UPstream::msgType(), and Foam::type().

Here is the call graph for this function:

◆ cp()

bool cp ( const fileName src,
const fileName dst,
const bool  followLink = true 
) const
virtual

Copy, recursively if necessary, the source to the destination.

Implements fileOperation.

Definition at line 1052 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ ln()

bool ln ( const fileName src,
const fileName dst 
) const
virtual

Create a softlink. dst should not exist. Returns true if.

successful.

Implements fileOperation.

Definition at line 1070 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ mv()

bool mv ( const fileName src,
const fileName dst,
const bool  followLink = false 
) const
virtual

Rename src to dst.

Implements fileOperation.

Definition at line 1087 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ mvBak()

bool mvBak ( const fileName fName,
const std::string &  ext = "bak" 
) const
virtual

Rename to a corresponding backup file.

If the backup file already exists, attempt with "01" .. "99" suffix

Implements fileOperation.

Definition at line 987 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ rm()

bool rm ( const fileName fName) const
virtual

Remove a file, returning true if successful otherwise false.

Implements fileOperation.

Definition at line 1003 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ rmDir()

bool rmDir ( const fileName dir,
const bool  silent = false 
) const
virtual

Remove a directory and its contents.

Parameters
silentdo not report missing directory

Implements fileOperation.

Definition at line 1018 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ filePath()

Foam::fileName filePath ( const bool  checkGlobal,
const IOobject io,
const word typeName,
const bool  search 
) const
virtual

◆ dirPath()

Foam::fileName dirPath ( const bool  checkGlobal,
const IOobject io,
const bool  search 
) const
virtual

◆ readObjects()

Foam::fileNameList readObjects ( const objectRegistry db,
const fileName instance,
const fileName local,
word newInstance 
) const
virtual

Search directory for objects. Used in IOobjectList.

Use non-time searching version

Reimplemented from fileOperation.

Definition at line 1660 of file masterUncollatedFileOperation.C.

References Pstream::broadcasts(), TimePaths::constant(), Foam::endl(), Instant< T >::equal(), fileOperation::findTimes(), forAllReverse, splitCell::master(), Foam::name(), word::null, IOobject::objectPath(), UPstream::parRun(), Time::path(), Foam::Pout, fileOperation::readObjects(), objectRegistry::time(), and UPstream::worldComm.

Here is the call graph for this function:

◆ readHeader()

bool readHeader ( IOobject io,
const fileName fName,
const word typeName 
) const
virtual

◆ readStream()

◆ read() [2/2]

bool read ( regIOobject io,
const bool  masterOnly,
const IOstreamOption::streamFormat  format,
const word typeName 
) const
virtual

Top-level read.

Implements fileOperation.

Definition at line 2103 of file masterUncollatedFileOperation.C.

References Pstream::broadcasts(), Foam::endl(), format(), io(), splitCell::master(), UPstream::masterNo(), UPstream::parRun(), Foam::Pout, and UPstream::worldComm.

Here is the call graph for this function:

◆ writeObject()

bool writeObject ( const regIOobject io,
IOstreamOption  streamOpt = IOstreamOption(),
const bool  valid = true 
) const
virtual

Writes a regIOobject (so header, contents and divider).

Returns success state.

Reimplemented from fileOperation.

Reimplemented in collatedFileOperation.

Definition at line 2183 of file masterUncollatedFileOperation.C.

References Foam::endl(), io(), os(), Foam::Pout, setTime(), and IOobject::writeEndDivider().

Here is the call graph for this function:

◆ NewIFstream()

Foam::autoPtr< Foam::ISstream > NewIFstream ( const fileName filePath) const
virtual

◆ NewOFstream()

Foam::autoPtr< Foam::OSstream > NewOFstream ( const fileName pathname,
IOstreamOption  streamOpt = IOstreamOption(),
const bool  valid = true 
) const
virtual

Generate an OSstream that writes a file.

Implements fileOperation.

Definition at line 2448 of file masterUncollatedFileOperation.C.

◆ addWatch()

Foam::label addWatch ( const fileName fName) const
virtual

Add watching of a file. Returns handle.

Reimplemented from fileOperation.

Definition at line 2475 of file masterUncollatedFileOperation.C.

References Pstream::broadcast(), and splitCell::master().

Here is the call graph for this function:

◆ removeWatch()

bool removeWatch ( const label  watchIndex) const
virtual

Remove watch on a file (using handle)

Reimplemented from fileOperation.

Definition at line 2490 of file masterUncollatedFileOperation.C.

References Pstream::broadcast(), and splitCell::master().

Here is the call graph for this function:

◆ findWatch()

Foam::label findWatch ( const labelList watchIndices,
const fileName fName 
) const
virtual

Find index (or -1) of file in list of handles.

Reimplemented from fileOperation.

Definition at line 2505 of file masterUncollatedFileOperation.C.

References Pstream::broadcast(), forAll, and splitCell::master().

Here is the call graph for this function:

◆ addWatches()

void addWatches ( regIOobject rio,
const fileNameList files 
) const
virtual

Helper: add watches for list of regIOobjects.

Reimplemented from fileOperation.

Definition at line 2529 of file masterUncollatedFileOperation.C.

References DynamicList< T, SizeMin >::append(), HashTable< T, Key, Hash >::erase(), f(), and regIOobject::watchIndices().

Here is the call graph for this function:

◆ getFile()

Foam::fileName getFile ( const label  watchIndex) const
virtual

Get name of file being watched (using handle)

Reimplemented from fileOperation.

Definition at line 2566 of file masterUncollatedFileOperation.C.

References Pstream::broadcast(), and splitCell::master().

Here is the call graph for this function:

◆ updateStates()

void updateStates ( const bool  masterOnly,
const bool  syncPar 
) const
virtual

Update state of all files.

Reimplemented from fileOperation.

Definition at line 2581 of file masterUncollatedFileOperation.C.

References splitCell::master().

Here is the call graph for this function:

◆ getState()

Foam::fileMonitor::fileState getState ( const label  watchFd) const
virtual

Get current state of file (using handle)

Reimplemented from fileOperation.

Definition at line 2595 of file masterUncollatedFileOperation.C.

References Pstream::broadcast(), splitCell::master(), and fileMonitor::UNMODIFIED.

Here is the call graph for this function:

◆ setUnmodified()

void setUnmodified ( const label  watchFd) const
virtual

Set current state of file (using handle) to unmodified.

Reimplemented from fileOperation.

Definition at line 2610 of file masterUncollatedFileOperation.C.

References splitCell::master().

Here is the call graph for this function:

◆ uniformFile()

bool uniformFile ( const fileNameList filePaths)
static

Same file?

Definition at line 477 of file masterUncollatedFileOperation.C.

References UList< T >::size().

Here is the call graph for this function:

◆ findTimes()

Foam::instantList findTimes ( const fileName directory,
const word constantName 
) const
virtual

Get sorted list of times.

Reimplemented from fileOperation.

Definition at line 2225 of file masterUncollatedFileOperation.C.

References Pstream::broadcast(), Foam::endl(), fileOperation::findTimes(), splitCell::master(), Foam::nl, UPstream::parRun(), and Foam::Pout.

Here is the call graph for this function:

◆ findInstance()

Foam::IOobject findInstance ( const IOobject io,
const scalar  startValue,
const word stopInstance 
) const
virtual

Find instance where IOobject is.

FatalError if it cannot be found and readOpt is (MUST_READ or MUST_READ_IF_MODIFIED). Otherwise it returns the stopInstance.

Reimplemented from fileOperation.

Definition at line 1430 of file masterUncollatedFileOperation.C.

References Pstream::broadcast(), TimePaths::constant(), UList< T >::empty(), Foam::endl(), Foam::exists(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, IOobject::instance(), io(), IOobject::local(), splitCell::master(), IOobject::MUST_READ, IOobject::MUST_READ_IF_MODIFIED, IOobject::name(), Foam::name(), UPstream::parRun(), Foam::Pout, IOobject::readOpt(), UList< T >::size(), IOobject::time(), Time::timeName(), TimePaths::times(), and UPstream::worldComm.

Here is the call graph for this function:

◆ setTime()

void setTime ( const Time tm) const
virtual

◆ flush()

void flush ( ) const
virtual

Forcibly wait until all output done. Flush any cached data.

Reimplemented from fileOperation.

Reimplemented in collatedFileOperation.

Definition at line 2468 of file masterUncollatedFileOperation.C.

References fileOperation::flush().

Referenced by collatedFileOperation::flush().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ times()

const HashPtrTable< DynamicList< instant > > & times ( ) const
inlinenoexcept

Return cached times.

Definition at line 759 of file masterUncollatedFileOperation.H.

References masterUncollatedFileOperation::times_.

Member Data Documentation

◆ myComm_

const label myComm_
protected

Any communicator allocated by me.

Definition at line 95 of file masterUncollatedFileOperation.H.

◆ times_

HashPtrTable<DynamicList<instant> > times_
mutableprotected

Cached times for a given directory.

Definition at line 98 of file masterUncollatedFileOperation.H.

Referenced by masterUncollatedFileOperation::times().

◆ maxMasterFileBufferSize

float maxMasterFileBufferSize
static

Max size of parallel communications. Switches from non-blocking.

to scheduled when reading/writing files. Read as float to enable easy specification of large sizes.

Definition at line 477 of file masterUncollatedFileOperation.H.

Referenced by masterUncollatedFileOperation::masterUncollatedFileOperation().


The documentation for this class was generated from the following files: