Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
collatedFileOperation Class Reference

Version of masterUncollatedFileOperation that collates regIOobjects into a container in the processors/ subdirectory. More...

Inheritance diagram for collatedFileOperation:
Inheritance graph
[legend]
Collaboration diagram for collatedFileOperation:
Collaboration graph
[legend]

Public Member Functions

 TypeName ("collated")
 
 collatedFileOperation (bool verbose)
 
 collatedFileOperation (const label comm, const labelList &ioRanks, const word &typeName, bool verbose)
 
virtual ~collatedFileOperation ()
 
virtual fileName objectPath (const IOobject &io, const word &typeName) const
 
virtual bool writeObject (const regIOobject &, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
 
virtual void flush () const
 
virtual word processorsDir (const IOobject &) const
 
virtual word processorsDir (const fileName &) const
 
virtual void setNProcs (const label nProcs)
 
- Public Member Functions inherited from masterUncollatedFileOperation
 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 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
 
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 filePath (const fileName &) const
 
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 Attributes

static float maxThreadFileBufferSize
 
- Static Public Attributes inherited from masterUncollatedFileOperation
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

void printBanner (const bool printRanks=false) const
 
bool isMasterRank (const label proci) const
 
bool appendObject (const regIOobject &io, const fileName &pathName, IOstreamOption streamOpt) const
 
- Protected Member Functions inherited from masterUncollatedFileOperation
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
 

Protected Attributes

const label myComm_
 
OFstreamCollator writer_
 
label nProcs_
 
const labelList ioRanks_
 
- Protected Attributes inherited from masterUncollatedFileOperation
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
 
- Static Public Member Functions inherited from masterUncollatedFileOperation
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 Protected Member Functions inherited from masterUncollatedFileOperation
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 &)
 

Detailed Description

Version of masterUncollatedFileOperation that collates regIOobjects into a container in the processors/ subdirectory.

Uses threading if maxThreadFileBufferSize != 0. > 0 : Can use mpi inside thread to collect data if buffer is not large enough. Does need full thread support inside MPI.

< 0 : special : -maxThreadFileBufferSize is guaranteed large enough for all writing. Initialises MPI without thread support.

See also
masterUncollatedFileOperation
Source files

Definition at line 61 of file collatedFileOperation.H.

Constructor & Destructor Documentation

◆ collatedFileOperation() [1/2]

collatedFileOperation ( bool  verbose)
explicit

Definition at line 252 of file collatedFileOperation.C.

References Foam::infoDetailLevel.

◆ collatedFileOperation() [2/2]

collatedFileOperation ( const label  comm,
const labelList ioRanks,
const word typeName,
bool  verbose 
)

Definition at line 282 of file collatedFileOperation.C.

References Foam::infoDetailLevel.

◆ ~collatedFileOperation()

~collatedFileOperation ( )
virtual

Definition at line 304 of file collatedFileOperation.C.

References collatedFileOperation::flush(), UPstream::freeCommunicator(), collatedFileOperation::myComm_, and UPstream::worldComm.

Here is the call graph for this function:

Member Function Documentation

◆ printBanner()

void printBanner ( const bool  printRanks = false) const
protected

Definition at line 73 of file collatedFileOperation.C.

References DynamicList::append(), DetailInfo, stdFoam::end(), Foam::endl(), forAll, Foam::constant::atomic::group, Foam::hostName(), and Foam::nl.

Here is the call graph for this function:

◆ isMasterRank()

bool isMasterRank ( const label  proci) const
protected

Definition at line 158 of file collatedFileOperation.C.

◆ appendObject()

bool appendObject ( const regIOobject io,
const fileName pathName,
IOstreamOption  streamOpt 
) const
protected

◆ TypeName()

TypeName ( "collated"  )

◆ objectPath()

Foam::fileName objectPath ( const IOobject io,
const word typeName 
) const
virtual

◆ writeObject()

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

◆ flush()

void flush ( ) const
virtual

Reimplemented from masterUncollatedFileOperation.

Definition at line 512 of file collatedFileOperation.C.

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

Referenced by collatedFileOperation::~collatedFileOperation().

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

◆ processorsDir() [1/2]

Foam::word processorsDir ( const IOobject io) const
virtual

Reimplemented from fileOperation.

Definition at line 590 of file collatedFileOperation.C.

References IOobject::objectPath().

Here is the call graph for this function:

◆ processorsDir() [2/2]

Foam::word processorsDir ( const fileName fName) const
virtual

Reimplemented from fileOperation.

Definition at line 526 of file collatedFileOperation.C.

References Foam::name(), UPstream::nProcs(), UPstream::parRun(), and UPstream::procID().

Here is the call graph for this function:

◆ setNProcs()

void setNProcs ( const label  nProcs)
virtual

Reimplemented from fileOperation.

Definition at line 598 of file collatedFileOperation.C.

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

Here is the call graph for this function:

Member Data Documentation

◆ myComm_

const label myComm_
protected

◆ writer_

OFstreamCollator writer_
mutableprotected

Definition at line 73 of file collatedFileOperation.H.

◆ nProcs_

label nProcs_
protected

Definition at line 78 of file collatedFileOperation.H.

◆ ioRanks_

const labelList ioRanks_
protected

Definition at line 81 of file collatedFileOperation.H.

◆ maxThreadFileBufferSize

float maxThreadFileBufferSize
static

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