Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for masterUncollatedFileOperation:
Collaboration graph
[legend]

Classes

class  chModOp
 
class  cpOp
 
class  existsOp
 
class  fileOrNullOp
 
class  fileSizeOp
 
class  isDirOp
 
class  isFileOp
 
class  lastModifiedHROp
 
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")
 
 masterUncollatedFileOperation (bool verbose)
 
 masterUncollatedFileOperation (const label comm, bool verbose)
 
virtual ~masterUncollatedFileOperation ()
 
virtual bool mkDir (const fileName &, mode_t=0777) const
 
virtual bool chMod (const fileName &, const mode_t) const
 
virtual mode_t mode (const fileName &, const bool followLink=true) const
 
virtual fileName::Type type (const fileName &, const bool followLink=true) const
 
virtual bool exists (const fileName &, const bool checkGzip=true, const bool followLink=true) const
 
virtual bool isDir (const fileName &, const bool followLink=true) const
 
virtual bool isFile (const fileName &, const bool checkGzip=true, const bool followLink=true) const
 
virtual off_t fileSize (const fileName &, const bool followLink=true) const
 
virtual time_t lastModified (const fileName &, const bool followLink=true) const
 
virtual double highResLastModified (const fileName &, const bool followLink=true) const
 
virtual fileNameList readDir (const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true, const bool followLink=true) const
 
virtual bool cp (const fileName &src, const fileName &dst, const bool followLink=true) const
 
virtual bool ln (const fileName &src, const fileName &dst) const
 
virtual bool mv (const fileName &src, const fileName &dst, const bool followLink=false) const
 
virtual bool mvBak (const fileName &, const std::string &ext="bak") const
 
virtual bool rm (const fileName &) const
 
virtual bool rmDir (const fileName &dir, const bool silent=false) const
 
virtual fileName filePath (const bool checkGlobal, const IOobject &io, const word &typeName, const bool search) const
 
virtual fileName dirPath (const bool checkGlobal, const IOobject &io, const bool search) const
 
virtual fileNameList readObjects (const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
 
virtual bool readHeader (IOobject &, const fileName &, const word &typeName) const
 
virtual autoPtr< ISstreamreadStream (regIOobject &, const fileName &, const word &typeName, const bool valid=true) const
 
virtual bool read (regIOobject &, const bool masterOnly, const IOstreamOption::streamFormat format, const word &typeName) const
 
virtual bool writeObject (const regIOobject &io, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
 
virtual autoPtr< ISstreamNewIFstream (const fileName &) const
 
virtual autoPtr< OSstreamNewOFstream (const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
 
virtual label addWatch (const fileName &) const
 
virtual bool removeWatch (const label) const
 
virtual label findWatch (const labelList &watchIndices, const fileName &) const
 
virtual void addWatches (regIOobject &, const fileNameList &) const
 
virtual fileName getFile (const label) const
 
virtual void updateStates (const bool masterOnly, const bool syncPar) const
 
virtual fileMonitor::fileState getState (const label) const
 
virtual void setUnmodified (const label) const
 
virtual instantList findTimes (const fileName &, const word &) const
 
virtual IOobject findInstance (const IOobject &io, const scalar startValue, const word &stopInstance) const
 
virtual void setTime (const Time &) const
 
virtual void flush () const
 
const HashPtrTable< instantList > & times () const
 
- Public Member Functions inherited from fileOperation
 TypeName ("fileOperation")
 
 fileOperation (const label comm, const bool distributedRoots=false)
 
 declareRunTimeSelectionTable (autoPtr, fileOperation, word,(bool verbose),(verbose))
 
virtual ~fileOperation ()=default
 
bool distributed () const noexcept
 
bool distributed (bool on) const noexcept
 
virtual fileName objectPath (const IOobject &io, const word &typeName) const
 
virtual fileName filePath (const fileName &) const
 
virtual word processorsDir (const IOobject &io) const
 
virtual word processorsDir (const fileName &) const
 
virtual void setNProcs (const label nProcs)
 
virtual label nProcs (const fileName &dir, const fileName &local="") const
 
fileName processorsCasePath (const IOobject &, const word &procDir) const
 
fileName processorsPath (const IOobject &, const word &instance, const word &procDir) const
 
fileName processorsPath (const fileName &, const word &procDir) const
 

Static Public Member Functions

static bool uniformFile (const fileNameList &)
 
- Static Public Member Functions inherited from fileOperation
static autoPtr< fileOperationNewUncollated ()
 
static autoPtr< fileOperationNew (const word &handlerType, bool verbose=false)
 
static instantList sortTimes (const fileNameList &dirEntries, const word &constantName="constant")
 
static label splitProcessorPath (const fileName &objectPath, fileName &path, fileName &procDir, fileName &local, procRangeType &group, label &nProcs)
 
static label detectProcessorPath (const fileName &objPath)
 

Static Public Attributes

static float maxMasterFileBufferSize
 
- Static Public Attributes inherited from fileOperation
static const Enum< pathTypepathTypeNames_
 
static word processorsBaseDir = "processors"
 
static word defaultFileHandler
 
static autoPtr< fileOperationfileHandlerPtr_
 

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 &, const fileOp &fop, const int tag, const label comm) const
 
template<class Type , class fileOp >
Type masterOp (const fileName &, const fileName &, 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
 
fileName localObjectPath (const IOobject &, const pathType &searchType, const word &processorsDir, const word &instancePath) const
 
bool exists (const dirIndexList &, IOobject &io) const
 
- Protected Member Functions inherited from fileOperation
fileMonitormonitor () const
 
refPtr< dirIndexListlookupAndCacheProcessorsPath (const fileName &objectPath, const bool syncPar) const
 
virtual refPtr< dirIndexListlookupProcessorsPath (const fileName &objectPath) const
 
bool exists (IOobject &io) const
 

Static Protected Member Functions

static labelList subRanks (const label n)
 
static word findInstancePath (const instantList &timeDirs, const instant &t)
 
static void readAndSend (const fileName &filePath, const labelUList &procs, PstreamBuffers &pBufs)
 
static autoPtr< ISstreamread (IOobject &io, const label comm, const bool uniform, const fileNameList &filePaths, const boolList &procValid)
 
- Static Protected Member Functions inherited from fileOperation
static labelList ioRanks ()
 
static void mergeTimes (const instantList &extraTimes, const word &constantName, instantList &times)
 
static bool isFileOrDir (const bool isFile, const fileName &)
 

Protected Attributes

const label myComm_
 
HashPtrTable< instantListtimes_
 
- Protected Attributes inherited from fileOperation
const label comm_
 
bool distributed_
 
HashTable< dirIndexListprocsDirs_
 
autoPtr< fileMonitormonitorPtr_
 

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
}
 
typedef Tuple2< fileName, Tuple2< pathType, int > > dirIndex
 
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

The main logic is in ::filePath which returns a

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 78 of file masterUncollatedFileOperation.H.

Constructor & Destructor Documentation

◆ masterUncollatedFileOperation() [1/2]

masterUncollatedFileOperation ( bool  verbose)
explicit

Definition at line 717 of file masterUncollatedFileOperation.C.

References DetailInfo, Foam::endl(), Foam::infoDetailLevel, and WarningInFunction.

Here is the call graph for this function:

◆ masterUncollatedFileOperation() [2/2]

masterUncollatedFileOperation ( const label  comm,
bool  verbose 
)

Definition at line 765 of file masterUncollatedFileOperation.C.

References DetailInfo, Foam::endl(), Foam::infoDetailLevel, and WarningInFunction.

Here is the call graph for this function:

◆ ~masterUncollatedFileOperation()

Definition at line 808 of file masterUncollatedFileOperation.C.

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

Here is the call graph for this function:

Member Function Documentation

◆ subRanks()

Foam::labelList subRanks ( const label  n)
staticprotected

Definition at line 77 of file masterUncollatedFileOperation.C.

References DynamicList::append(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::identity(), n, and Foam::nl.

Here is the call graph for this function:

◆ scatterList()

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

Definition at line 29 of file masterUncollatedFileOperationTemplates.C.

References PstreamBuffers::finishedSends(), and os().

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 64 of file masterUncollatedFileOperationTemplates.C.

References Foam::expressions::patchExpr::debug, Foam::endl(), Foam::name(), and Foam::Pout.

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 107 of file masterUncollatedFileOperationTemplates.C.

References Foam::expressions::patchExpr::debug, Foam::endl(), and Foam::Pout.

Here is the call graph for this function:

◆ findInstancePath()

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

Definition at line 127 of file masterUncollatedFileOperation.C.

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

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

◆ localObjectPath()

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

◆ readAndSend()

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

◆ 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

◆ TypeName()

TypeName ( "masterUncollated"  )

◆ mkDir()

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

Implements fileOperation.

Definition at line 820 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

Implements fileOperation.

Definition at line 836 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

Implements fileOperation.

Definition at line 852 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

Implements fileOperation.

Definition at line 868 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ exists() [2/2]

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

Implements fileOperation.

Definition at line 887 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

Implements fileOperation.

Definition at line 904 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

Implements fileOperation.

Definition at line 920 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

Implements fileOperation.

Definition at line 937 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

Implements fileOperation.

Definition at line 953 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

Implements fileOperation.

Definition at line 969 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

Implements fileOperation.

Definition at line 1032 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

Implements fileOperation.

Definition at line 1050 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

Implements fileOperation.

Definition at line 1068 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

Implements fileOperation.

Definition at line 1085 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

Implements fileOperation.

Definition at line 985 of file masterUncollatedFileOperation.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ rm()

bool rm ( const fileName fName) const
virtual

Implements fileOperation.

Definition at line 1001 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

Implements fileOperation.

Definition at line 1016 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

◆ readHeader()

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

◆ readStream()

Foam::autoPtr< Foam::ISstream > readStream ( regIOobject io,
const fileName fName,
const word typeName,
const bool  valid = true 
) const
virtual

◆ read() [2/2]

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

◆ writeObject()

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

◆ 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

Implements fileOperation.

Definition at line 2391 of file masterUncollatedFileOperation.C.

◆ addWatch()

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

Reimplemented from fileOperation.

Definition at line 2418 of file masterUncollatedFileOperation.C.

References UPstream::master(), and Pstream::scatter().

Here is the call graph for this function:

◆ removeWatch()

bool removeWatch ( const label  watchIndex) const
virtual

Reimplemented from fileOperation.

Definition at line 2433 of file masterUncollatedFileOperation.C.

References UPstream::master(), and Pstream::scatter().

Here is the call graph for this function:

◆ findWatch()

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

Reimplemented from fileOperation.

Definition at line 2448 of file masterUncollatedFileOperation.C.

References forAll, UPstream::master(), and Pstream::scatter().

Here is the call graph for this function:

◆ addWatches()

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

Reimplemented from fileOperation.

Definition at line 2472 of file masterUncollatedFileOperation.C.

References DynamicList::append(), f(), and regIOobject::watchIndices().

Here is the call graph for this function:

◆ getFile()

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

Reimplemented from fileOperation.

Definition at line 2509 of file masterUncollatedFileOperation.C.

References UPstream::master(), and Pstream::scatter().

Here is the call graph for this function:

◆ updateStates()

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

Reimplemented from fileOperation.

Definition at line 2524 of file masterUncollatedFileOperation.C.

References UPstream::master().

Here is the call graph for this function:

◆ getState()

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

Reimplemented from fileOperation.

Definition at line 2538 of file masterUncollatedFileOperation.C.

References UPstream::master(), Pstream::scatter(), and fileMonitor::UNMODIFIED.

Here is the call graph for this function:

◆ setUnmodified()

void setUnmodified ( const label  watchFd) const
virtual

Reimplemented from fileOperation.

Definition at line 2553 of file masterUncollatedFileOperation.C.

References UPstream::master().

Here is the call graph for this function:

◆ uniformFile()

bool uniformFile ( const fileNameList filePaths)
static

Definition at line 471 of file masterUncollatedFileOperation.C.

◆ findTimes()

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

◆ findInstance()

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

◆ setTime()

void setTime ( const Time tm) const
virtual

◆ flush()

void flush ( ) const
virtual

Reimplemented from fileOperation.

Reimplemented in collatedFileOperation.

Definition at line 2410 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<instantList>& times ( ) const
inline

Member Data Documentation

◆ myComm_

const label myComm_
protected

◆ times_

HashPtrTable<instantList> times_
mutableprotected

◆ maxMasterFileBufferSize

float maxMasterFileBufferSize
static

Definition at line 478 of file masterUncollatedFileOperation.H.


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