fileOperation Class Referenceabstract
Inheritance diagram for fileOperation:
Collaboration diagram for fileOperation:

Public Types

enum  pathType {
  NOTFOUND , ABSOLUTE , OBJECT , WRITEOBJECT ,
  PROCUNCOLLATED , PROCBASEOBJECT , PROCOBJECT , PARENTOBJECT ,
  FINDINSTANCE , PROCUNCOLLATEDINSTANCE , PROCBASEINSTANCE , PROCINSTANCE
}
 Enumeration for the location of an IOobject. More...
 
typedef Tuple2< fileName, Tuple2< pathType, label > > dirIndex
 Description of processor directory naming: More...
 
typedef List< dirIndexdirIndexList
 

Public Member Functions

 TypeName ("fileOperation")
 Runtime type information. More...
 
 fileOperation (const label comm)
 Construct null. More...
 
 declareRunTimeSelectionTable (autoPtr, fileOperation, word,(const bool verbose),(verbose))
 
virtual ~fileOperation ()
 Destructor. 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 checkVariants=true, const bool followLink=true) const =0
 Return the file mode. More...
 
virtual fileType type (const fileName &, const bool checkVariants=true, const bool followLink=true) const =0
 Return the file type: directory, file or link. More...
 
virtual bool exists (const fileName &, const bool checkVariants=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 checkVariants=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 checkVariants=true, const bool followLink=true) const =0
 Return size of file. More...
 
virtual time_t lastModified (const fileName &, const bool checkVariants=true, const bool followLink=true) const =0
 Return time of last file modification. More...
 
virtual double highResLastModified (const fileName &, const bool checkVariants=true, const bool followLink=true) const =0
 Return time of last file modification. More...
 
virtual fileNameList readDir (const fileName &, const fileType=fileType::file, const bool filterVariants=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 &) 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 globalFile, const IOobject &, const word &typeName) const =0
 Search for an object. globalFile : also check undecomposed case. More...
 
virtual fileName dirPath (const bool globalFile, const IOobject &) const =0
 Search for a directory. globalFile : 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 read=true) const =0
 Reads header for regIOobject and returns an ISstream. More...
 
virtual bool read (regIOobject &, const bool masterOnly, const IOstream::streamFormat defaultFormat, const word &typeName) const =0
 Top-level read. More...
 
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). More...
 
virtual fileName filePath (const fileName &) const
 Search for a file or directory. Use IOobject version in. More...
 
virtual autoPtr< ISstreamNewIFstream (const fileName &filePath, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion) const =0
 Generate an ISstream that reads a file. More...
 
virtual autoPtr< OstreamNewOFstream (const fileName &filePath, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool write=true) const =0
 Generate an Ostream 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. Fails if cannot be found. 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 autoPtr< fileOperationNew (const word &type, const bool verbose)
 Select type. More...
 
static label splitProcessorPath (const fileName &, fileName &path, fileName &procDir, fileName &local, label &groupStart, label &groupSize, label &nProcs)
 Split fileName into part before 'processor' and part after. More...
 
static label detectProcessorPath (const fileName &)
 Detect processor number from '/aa/bb/processorDDD/cc'. More...
 

Static Public Attributes

static const NamedEnum< pathType, 12 > pathTypeNames_
 
static word processorsBaseDir = "processors"
 Return the processors directory name (usually "processors") More...
 
static word defaultFileHandler
 Default fileHandler. More...
 
static autoPtr< fileOperationfileHandlerPtr_
 Static fileOperation. More...
 

Protected Member Functions

fileMonitormonitor () const
 
void cacheProcessorsPath (const fileName &fName) const
 Detect presence of processorsDDD. More...
 
tmpNrc< dirIndexListlookupProcessorsPath (const fileName &) const
 Lookup name of processorsDDD using cache. Return empty fileName. More...
 
bool exists (IOobject &io) const
 Does ioobject exist. Is either a directory (empty name()) or. More...
 

Static Protected Member Functions

static instantList sortTimes (const fileNameList &, const word &)
 Sort directory entries according to time value. 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 comm_
 Communicator to use. More...
 
HashTable< dirIndexListprocsDirs_
 Detected processors directories. More...
 
autoPtr< fileMonitormonitorPtr_
 file-change monitor for all registered files More...
 

Detailed Description

Definition at line 56 of file fileOperation.H.

Member Typedef Documentation

◆ dirIndex

Description of processor directory naming:

  • processor directory naming

whether directory contains a range (so differs on different processors)

  • index in range

Definition at line 86 of file fileOperation.H.

◆ dirIndexList

Definition at line 88 of file fileOperation.H.

Member Enumeration Documentation

◆ pathType

enum pathType

Enumeration for the location of an IOobject.

Enumerator
NOTFOUND 
ABSOLUTE 
OBJECT 
WRITEOBJECT 
PROCUNCOLLATED 
PROCBASEOBJECT 
PROCOBJECT 
PARENTOBJECT 
FINDINSTANCE 
PROCUNCOLLATEDINSTANCE 
PROCBASEINSTANCE 
PROCINSTANCE 

Definition at line 61 of file fileOperation.H.

Constructor & Destructor Documentation

◆ fileOperation()

fileOperation ( const label  comm)

Construct null.

Definition at line 403 of file fileOperation.C.

◆ ~fileOperation()

~fileOperation ( )
virtual

Destructor.

Definition at line 434 of file fileOperation.C.

Member Function Documentation

◆ monitor()

◆ sortTimes()

Foam::instantList sortTimes ( const fileNameList dirEntries,
const word constantName 
)
staticprotected

Sort directory entries according to time value.

Definition at line 98 of file fileOperation.C.

References UList< T >::end(), forAll, Foam::readScalar(), List< T >::setSize(), List< T >::size(), and Foam::sort().

Here is the call graph for this function:

◆ mergeTimes()

void mergeTimes ( const instantList extraTimes,
const word constantName,
instantList times 
)
staticprotected

Merge two times.

Definition at line 153 of file fileOperation.C.

References UList< T >::end(), forAll, Foam::name(), List< T >::setSize(), List< T >::size(), Foam::sort(), and List< T >::transfer().

Here is the call graph for this function:

◆ isFileOrDir()

bool isFileOrDir ( const bool  isFile,
const fileName f 
)
staticprotected

Helper: check for file (isFile) or directory (!isFile)

Definition at line 227 of file fileOperation.C.

References f(), Foam::isDir(), and Foam::isFile().

Here is the call graph for this function:

◆ cacheProcessorsPath()

void cacheProcessorsPath ( const fileName fName) const
protected

Detect presence of processorsDDD.

◆ lookupProcessorsPath()

Foam::tmpNrc< Foam::fileOperation::dirIndexList > lookupProcessorsPath ( const fileName fName) const
protected

Lookup name of processorsDDD using cache. Return empty fileName.

if not found

Definition at line 236 of file fileOperation.C.

References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), Foam::directory, Foam::endl(), forAll, Foam::max(), UPstream::parRun(), Foam::Pout, Foam::readDir(), Foam::returnReduce(), fileOperation::setNProcs(), and List< T >::size().

Here is the call graph for this function:

◆ exists() [1/2]

bool exists ( IOobject io) const
protected

Does ioobject exist. Is either a directory (empty name()) or.

a file

Definition at line 360 of file fileOperation.C.

References IOobject::headerOk(), Foam::isDir(), Foam::isFile(), IOobject::name(), word::null, and IOobject::objectPath().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "fileOperation"  )

Runtime type information.

◆ declareRunTimeSelectionTable()

declareRunTimeSelectionTable ( autoPtr  ,
fileOperation  ,
word  ,
(const bool verbose)  ,
(verbose)   
)

◆ New()

Foam::autoPtr< Foam::fileOperation > New ( const word type,
const bool  verbose 
)
static

Select type.

Definition at line 409 of file fileOperation.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and Foam::type().

Referenced by Foam::fileHandler(), and argList::parse().

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

◆ mkDir()

virtual bool mkDir ( const fileName ,
mode_t  = 0777 
) const
pure virtual

Make directory.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ chMod()

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

Set the file mode.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ mode()

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

Return the file mode.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ type()

virtual fileType type ( const fileName ,
const bool  checkVariants = true,
const bool  followLink = true 
) const
pure virtual

Return the file type: directory, file or link.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ exists() [2/2]

virtual bool exists ( const fileName ,
const bool  checkVariants = true,
const bool  followLink = true 
) const
pure virtual

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

Optionally enable/disable check for gzip file.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ isDir()

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

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

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ isFile()

virtual bool isFile ( const fileName ,
const bool  checkVariants = true,
const bool  followLink = true 
) const
pure virtual

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

Optionally enable/disable check for gzip file.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ fileSize()

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

Return size of file.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ lastModified()

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

Return time of last file modification.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ highResLastModified()

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

Return time of last file modification.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ readDir()

virtual fileNameList readDir ( const fileName ,
const  fileType = fileType::file,
const bool  filterVariants = true,
const bool  followLink = true 
) const
pure virtual

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

Implemented in masterUncollatedFileOperation, and uncollatedFileOperation.

◆ cp()

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

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

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

Referenced by massFractions::execute().

Here is the caller graph for this function:

◆ ln()

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

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

successful.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ mv()

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

Rename src to dst.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

Referenced by massFractions::execute().

Here is the caller graph for this function:

◆ mvBak()

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

Rename to a corresponding backup file.

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

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ rm()

virtual bool rm ( const fileName ) const
pure virtual

Remove a file, returning true if successful otherwise false.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ rmDir()

virtual bool rmDir ( const fileName ) const
pure virtual

Remove a directory and its contents.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

Referenced by Time::writeObject().

Here is the caller graph for this function:

◆ objectPath()

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

Generate disk file name for object. Opposite of filePath.

Optional wanted typeName.

Reimplemented in collatedFileOperation.

Definition at line 440 of file fileOperation.C.

References IOobject::objectPath().

Here is the call graph for this function:

◆ filePath() [1/2]

virtual fileName filePath ( const bool  globalFile,
const IOobject ,
const word typeName 
) const
pure virtual

Search for an object. globalFile : also check undecomposed case.

Optional wanted typeName.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

Referenced by regIOobject::path().

Here is the caller graph for this function:

◆ dirPath()

virtual fileName dirPath ( const bool  globalFile,
const IOobject  
) const
pure virtual

Search for a directory. globalFile : also check undecomposed.

case

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ readObjects()

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

Search directory for objects. Used in IOobjectList.

Reimplemented in uncollatedFileOperation, and masterUncollatedFileOperation.

Definition at line 880 of file fileOperation.C.

References Foam::endl(), Foam::file, Foam::isDir(), word::null, regIOobject::objectPath(), objectRegistry::path(), Foam::Pout, and Foam::readDir().

Referenced by IOobjectList::IOobjectList(), masterUncollatedFileOperation::readObjects(), and uncollatedFileOperation::readObjects().

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

◆ readHeader()

virtual bool readHeader ( IOobject ,
const fileName ,
const word typeName 
) const
pure virtual

Read object header from supplied file.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

Referenced by regIOobject::headerOk().

Here is the caller graph for this function:

◆ readStream()

virtual autoPtr<ISstream> readStream ( regIOobject ,
const fileName ,
const word typeName,
const bool  read = true 
) const
pure virtual

Reads header for regIOobject and returns an ISstream.

to read the contents.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ read()

virtual bool read ( regIOobject ,
const bool  masterOnly,
const IOstream::streamFormat  defaultFormat,
const word typeName 
) const
pure virtual

Top-level read.

Format set to ASCII if defaultFormat and file format are ASCII

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

Referenced by regIOobject::read(), and regIOobject::readHeaderOk().

Here is the caller graph for this function:

◆ writeObject()

bool writeObject ( const regIOobject io,
IOstream::streamFormat  format = IOstream::ASCII,
IOstream::versionNumber  version = IOstream::currentVersion,
IOstream::compressionType  compression = IOstream::UNCOMPRESSED,
const bool  write = true 
) const
virtual

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

Returns success state. Default action is to write to the objectPath using writeData. If !write the file does not need to be written (this is used e.g. to suppress empty local lagrangian data)

Reimplemented in masterUncollatedFileOperation, and collatedFileOperation.

Definition at line 450 of file fileOperation.C.

References IOstream::good(), Foam::mkDir(), regIOobject::objectPath(), fileName::path(), autoPtr< T >::valid(), Foam::vtkWriteOps::write(), regIOobject::writeData(), IOobject::writeEndDivider(), and IOobject::writeHeader().

Referenced by regIOobject::writeObject().

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

◆ filePath() [2/2]

Foam::fileName filePath ( const fileName fName) const
virtual

Search for a file or directory. Use IOobject version in.

preference

Definition at line 507 of file fileOperation.C.

References Foam::endl(), Foam::exists(), forAll, fileName::null, Foam::Pout, and WarningInFunction.

Here is the call graph for this function:

◆ NewIFstream()

virtual autoPtr<ISstream> NewIFstream ( const fileName filePath,
IOstream::streamFormat  format = IOstream::ASCII,
IOstream::versionNumber  version = IOstream::currentVersion 
) const
pure virtual

Generate an ISstream that reads a file.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ NewOFstream()

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
pure virtual

Generate an Ostream that writes a file.

Implemented in uncollatedFileOperation, and masterUncollatedFileOperation.

◆ addWatch()

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

Add watching of a file. Returns handle.

Reimplemented in masterUncollatedFileOperation.

Definition at line 568 of file fileOperation.C.

◆ removeWatch()

bool removeWatch ( const label  watchIndex) const
virtual

Remove watch on a file (using handle)

Reimplemented in masterUncollatedFileOperation.

Definition at line 574 of file fileOperation.C.

Referenced by regIOobject::addWatch(), regIOobject::checkOut(), and regIOobject::read().

Here is the caller 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 in masterUncollatedFileOperation.

Definition at line 580 of file fileOperation.C.

References forAll.

Referenced by regIOobject::addWatch().

Here is the caller graph for this function:

◆ addWatches()

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

Helper: add watches for list of regIOobjects.

Reimplemented in masterUncollatedFileOperation.

Definition at line 597 of file fileOperation.C.

References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), HashTable< T, Key, Hash >::erase(), f(), forAll, forAllConstIter, 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 in masterUncollatedFileOperation.

Definition at line 635 of file fileOperation.C.

Referenced by regIOobject::addWatch(), and regIOobject::read().

Here is the caller graph for this function:

◆ updateStates()

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

Update state of all files.

Reimplemented in masterUncollatedFileOperation.

Definition at line 641 of file fileOperation.C.

References UPstream::parRun().

Referenced by Time::readModifiedObjects().

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

◆ getState()

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

Get current state of file (using handle)

Reimplemented in masterUncollatedFileOperation.

Definition at line 651 of file fileOperation.C.

◆ setUnmodified()

void setUnmodified ( const label  watchFd) const
virtual

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

Reimplemented in masterUncollatedFileOperation.

Definition at line 660 of file fileOperation.C.

Referenced by regIOobject::writeObject().

Here is the caller graph for this function:

◆ processorsDir() [1/2]

virtual word processorsDir ( const IOobject io) const
inlinevirtual

Actual name of processors dir (for use in mode PROCOBJECT,.

PROCINSTANCE)

Reimplemented in collatedFileOperation.

Definition at line 457 of file fileOperation.H.

◆ processorsDir() [2/2]

virtual word processorsDir ( const fileName ) const
inlinevirtual

Actual name of processors dir (for use in mode PROCOBJECT,.

PROCINSTANCE)

Reimplemented in collatedFileOperation.

Definition at line 464 of file fileOperation.H.

◆ setNProcs()

void setNProcs ( const label  nProcs)
virtual

Set number of processor directories/results. Only used in.

decomposePar

Reimplemented in collatedFileOperation.

Definition at line 921 of file fileOperation.C.

Referenced by fileOperation::lookupProcessorsPath().

Here is the caller graph for this function:

◆ nProcs()

Foam::label nProcs ( const fileName dir,
const fileName local = "" 
) const
virtual

Get number of processor directories/results. Used for e.g.

reconstructPar, argList checking

Definition at line 925 of file fileOperation.C.

References Foam::directory, Foam::endl(), forAll, Foam::isDir(), Foam::isFile(), UPstream::master(), Foam::max(), polyMesh::meshSubDir, UPstream::msgType(), n, decomposedBlockData::numBlocks(), Foam::readDir(), Pstream::scatter(), and WarningInFunction.

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 in masterUncollatedFileOperation.

Definition at line 666 of file fileOperation.C.

References Foam::directory, Foam::endl(), forAll, Foam::Pout, and Foam::readDir().

Referenced by masterUncollatedFileOperation::findTimes(), Time::findTimes(), and masterUncollatedFileOperation::readObjects().

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

◆ findInstance()

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

Find instance where IOobject is. Fails if cannot be found.

and readOpt() is MUST_READ/MUST_READ_IF_MODIFIED. Otherwise returns stopInstance.

Reimplemented in masterUncollatedFileOperation.

Definition at line 724 of file fileOperation.C.

References TimePaths::constant(), Foam::endl(), Foam::exists(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, InfoInFunction, IOobject::instance(), IOobject::local(), IOobject::MUST_READ, IOobject::MUST_READ_IF_MODIFIED, IOobject::name(), Foam::name(), IOobject::readOpt(), List< T >::size(), IOobject::time(), and Time::times().

Here is the call graph for this function:

◆ setTime()

virtual void setTime ( const Time ) const
inlinevirtual

Callback for time change.

Reimplemented in masterUncollatedFileOperation.

Definition at line 495 of file fileOperation.H.

Referenced by Time::setTime(), and masterUncollatedFileOperation::setTime().

Here is the caller graph for this function:

◆ flush()

void flush ( ) const
virtual

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

Reimplemented in masterUncollatedFileOperation, and collatedFileOperation.

Definition at line 988 of file fileOperation.C.

References Foam::endl(), and Foam::Pout.

Referenced by masterUncollatedFileOperation::flush().

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

◆ processorsCasePath()

Foam::fileName processorsCasePath ( const IOobject io,
const word procDir 
) const

Generate path (like io.path) from root+casename with any.

'processorXXX' replaced by procDir (usually 'processors')

Definition at line 999 of file fileOperation.C.

References TimePaths::globalCaseName(), IOobject::rootPath(), and IOobject::time().

Here is the call graph for this function:

◆ processorsPath() [1/2]

Foam::fileName processorsPath ( const IOobject io,
const word instance,
const word procDir 
) const

Generate path (like io.path) with provided instance and any.

'processorXXX' replaced by procDir (usually 'processors')

Definition at line 1009 of file fileOperation.C.

References IOobject::db(), objectRegistry::dbDir(), and IOobject::local().

Here is the call graph for this function:

◆ processorsPath() [2/2]

Foam::fileName processorsPath ( const fileName dir,
const word procDir 
) const

Operating on fileName: replace processorXXX with procDir.

Definition at line 1024 of file fileOperation.C.

References Foam::endl(), fileName::name(), fileName::null, fileName::path(), Foam::pos(), and WarningInFunction.

Here is the call graph for this function:

◆ splitProcessorPath()

Foam::label splitProcessorPath ( const fileName objectPath,
fileName path,
fileName procDir,
fileName local,
label groupStart,
label groupSize,
label nProcs 
)
static

Split fileName into part before 'processor' and part after.

Returns -1 or processor number and optionally number of processors. Use with care.

  • path/"processor"+Foam::name(proci)/local reconstructs input
  • path/"processors"+Foam::name(nProcs)/local reconstructs collated processors equivalence

Definition at line 1051 of file fileOperation.C.

References f(), n, Foam::pos(), Foam::read(), and List< T >::size().

Here is the call graph for this function:

◆ detectProcessorPath()

Foam::label detectProcessorPath ( const fileName fName)
static

Detect processor number from '/aa/bb/processorDDD/cc'.

Definition at line 1173 of file fileOperation.C.

Member Data Documentation

◆ pathTypeNames_

const NamedEnum< fileOperation::pathType, 12 > pathTypeNames_
static

Definition at line 79 of file fileOperation.H.

Referenced by masterUncollatedFileOperation::filePath().

◆ comm_

const label comm_
protected

◆ procsDirs_

HashTable<dirIndexList> procsDirs_
mutableprotected

Detected processors directories.

Definition at line 99 of file fileOperation.H.

◆ monitorPtr_

autoPtr<fileMonitor> monitorPtr_
mutableprotected

file-change monitor for all registered files

Definition at line 102 of file fileOperation.H.

Referenced by fileOperation::monitor().

◆ processorsBaseDir

word processorsBaseDir = "processors"
static

Return the processors directory name (usually "processors")

Definition at line 140 of file fileOperation.H.

◆ defaultFileHandler

word defaultFileHandler
static

Default fileHandler.

Definition at line 143 of file fileOperation.H.

Referenced by argList::argList(), Foam::fileHandler(), and argList::parse().

◆ fileHandlerPtr_

autoPtr< fileOperation > fileHandlerPtr_
static

Static fileOperation.

Definition at line 153 of file fileOperation.H.

Referenced by Foam::fileHandler().


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