40 namespace fileOperations
46 collatedFileOperation,
56 "maxThreadFileBufferSize",
66 bool Foam::fileOperations::collatedFileOperation::appendObject
68 const regIOobject& io,
69 const fileName& pathName,
71 IOstream::versionNumber ver,
79 label proci = splitProcessorPath(io.objectPath(), prefix, postfix);
83 Pout<<
"writeObject:" <<
" : For local object : " 85 <<
" appending processor " << proci
86 <<
" data to " << pathName <<
endl;
92 <<
"Not a valid processor path " << pathName
100 OStringStream os(fmt, ver);
103 if (!io.writeHeader(os))
110 if (!io.writeData(os))
124 bool append = (proci > 0);
141 <<
"Cannot open for appending" 149 <<
" version " << os.version() <<
";\n" 150 <<
" format " << os.format() <<
";\n" 151 <<
" class " << decomposedBlockData::typeName
153 <<
" location " << pathName <<
";\n" 154 <<
" object " << pathName.name() <<
";\n" 162 const_cast<char*>(buf.data()),
165 os << nl <<
"// Processor" << proci << nl << slice <<
nl;
179 writer_(maxThreadFileBufferSize)
183 Info<<
"I/O : " << typeName
184 <<
" (maxThreadFileBufferSize " << maxThreadFileBufferSize
187 if (maxThreadFileBufferSize == 0)
189 Info<<
" Threading not activated " 190 "since maxThreadFileBufferSize = 0." << nl
191 <<
" Writing may run slowly for large file sizes." 196 Info<<
" Threading activated " 197 "since maxThreadFileBufferSize > 0." << nl
198 <<
" Requires thread support enabled in MPI, " 199 "otherwise the simulation" << nl
200 <<
" may \"hang\". If thread support cannot be " 201 "enabled, deactivate threading" << nl
202 <<
" by setting maxThreadFileBufferSize to 0 in " 203 "$FOAM_ETC/controlDict" 214 <<
"Resetting fileModificationChecking to inotify" <<
endl;
224 <<
"Resetting fileModificationChecking to timeStamp" <<
endl;
285 Pout<<
"writeObject:" 286 <<
" : For object : " << io.
name()
287 <<
" falling back to master-only output to " << io.
path()
331 Pout<<
"writeObject:" <<
" : For global object : " << io.
name()
332 <<
" falling back to master-only output to " << pathName
371 Pout<<
"writeObject:" 372 <<
" : For object : " << io.
name()
373 <<
" appending to " << pathName <<
endl;
376 return appendObject(io, pathName, fmt, ver, cmp);
382 Pout<<
"writeObject:" 383 <<
" : For object : " << io.
name()
384 <<
" starting collating output to " << pathName <<
endl;
virtual const fileName & name() const
Return the name of the stream.
bool processorCase() const
Return true if this is a processor case.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
A class for handling file names.
static Stream & writeBanner(Stream &os, bool noHint=false)
Write the standard OpenFOAM file/dictionary banner.
float floatOptimisationSwitch(const char *name, const float defaultValue=0)
Lookup optimisation switch or add default value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static Stream & writeDivider(Stream &os)
Write the standard file section divider.
collatedFileOperation(const bool verbose)
Construct null.
Master-only drop-in replacement for OFstream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool good() const
Return true if next operation might succeed.
static fileName objectPath(const IOobject &, const pathType &, const word &)
Construct filePath.
Macros for easy insertion into run-time selection tables.
fileName path() const
Return complete path.
addToRunTimeSelectionTable(fileOperation, collatedFileOperation, word)
bool isAbsolute() const
Return true if file name is absolute.
virtual fileName objectPath(const IOobject &io, const word &typeName) const
Generate disk file name for object. Opposite of filePath.
A class for handling words, derived from string.
Master-only drop-in replacement for OFstream.
streamFormat
Enumeration for the format of data in the stream.
compressionType
Enumeration for the format of data in the stream.
virtual bool writeObject(const regIOobject &, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool valid=true) const
Writes a regIOobject (so header, contents and divider).
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
static fileCheckTypes fileModificationChecking
Type of file modification checking.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
static float maxThreadFileBufferSize
Max size of thread buffer size. This is the overall size of.
virtual bool global() const
Is object global.
virtual ~collatedFileOperation()
Destructor.
static bool & parRun()
Is this a parallel run?
const fileName & instance() const
static Stream & writeEndDivider(Stream &os)
Write the standard end file divider.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const Time & time() const
Return time.
prefixOSstream Pout(cout, "Pout")
registerOptSwitch("maxThreadFileBufferSize", float, collatedFileOperation::maxThreadFileBufferSize)
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
bool writeHeader(Ostream &) const
Write header.
defineTypeNameAndDebug(collatedFileOperation, 0)
virtual bool writeData(Ostream &) const =0
Pure virtual writaData function.
fileOperations that performs all file operations on the master processor. Requires the calls to be pa...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileName objectPath() const
Return complete path + object name.