Base class for writing single files from the function objects. More...
Public Member Functions | |
writeFile (const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true) | |
Construct from objectRegistry, prefix, fileName. More... | |
writeFile (const objectRegistry &obr, const fileName &prefix, const word &name, const dictionary &dict, const bool writeToFile=true) | |
writeFile (const writeFile &wf) | |
Construct copy. More... | |
virtual | ~writeFile ()=default |
Destructor. More... | |
virtual bool | read (const dictionary &dict) |
Read. More... | |
virtual OFstream & | file () |
Return access to the file (if only 1) More... | |
virtual bool | writeToFile () const |
Flag to allow writing to file. More... | |
virtual bool | canWriteHeader () const |
Flag to allow writing the header. More... | |
virtual label | charWidth () const |
Return width of character stream output. More... | |
virtual void | writeCommented (Ostream &os, const string &str) const |
Write a commented string to stream. More... | |
virtual void | writeTabbed (Ostream &os, const string &str) const |
Write a tabbed string to stream. More... | |
virtual void | writeHeader (Ostream &os, const string &str) const |
Write a commented header to stream. More... | |
virtual void | writeCurrentTime (Ostream &os) const |
Write the current time to stream. More... | |
virtual void | writeBreak (Ostream &os) const |
Write a break marker to the stream. More... | |
template<class Type > | |
void | writeHeaderValue (Ostream &os, const string &property, const Type &value) const |
Write a (commented) header property and value pair. More... | |
Static Public Attributes | |
static label | addChars = 8 |
Additional characters for writing. More... | |
Protected Member Functions | |
void | initStream (Ostream &os) const |
Initialise the output stream for writing. More... | |
fileName | baseFileDir () const |
Return the base directory for output. More... | |
fileName | baseTimeDir () const |
Return the base directory for the current time value. More... | |
virtual autoPtr< OFstream > | createFile (const word &name, scalar timeValue) const |
Return autoPtr to a new file for a given time. More... | |
virtual autoPtr< OFstream > | createFile (const word &name) const |
Return autoPtr to a new file using the simulation start time. More... | |
virtual void | resetFile (const word &name) |
Reset internal file pointer to new file with new name. More... | |
Omanip< int > | valueWidth (const label offset=0) const |
Return the value width when writing to stream with optional offset. More... | |
void | operator= (const writeFile &)=delete |
No copy assignment. More... | |
Protected Attributes | |
const objectRegistry & | fileObr_ |
Reference to the region objectRegistry. More... | |
const fileName | prefix_ |
Prefix. More... | |
word | fileName_ |
Name of file. More... | |
autoPtr< OFstream > | filePtr_ |
File pointer. More... | |
label | writePrecision_ |
Write precision. More... | |
bool | writeToFile_ |
Flag to enable/disable writing to file. More... | |
bool | updateHeader_ |
bool | writtenHeader_ |
Flag to identify whether the header has been written. More... | |
bool | useUserTime_ |
scalar | startTime_ |
Start time value. More... | |
Base class for writing single files from the function objects.
<userDefinedSubDictName1> { // Mandatory and other optional entries ... // Optional (inherited) entries (runtime modifiable) writePrecision 8; writeToFile true; useUserTime true; }
where the entries mean:
Property | Description | Type | Reqd | Dflt |
---|---|---|---|---|
writePrecision | Number of decimal points | int | no | <system dflt> |
writeToFile | Produce text file output? | bool | no | true |
useUserTime | Use user time (e.g. degrees)? | bool | no | true |
updateHeader | Update header on mesh changes? | bool | no | true |
updateHeader
flag to override the default behaviour.Definition at line 119 of file writeFile.H.
writeFile | ( | const objectRegistry & | obr, |
const fileName & | prefix, | ||
const word & | name = "undefined" , |
||
const bool | writeToFile = true |
||
) |
Construct from objectRegistry, prefix, fileName.
Definition at line 171 of file writeFile.C.
writeFile | ( | const objectRegistry & | obr, |
const fileName & | prefix, | ||
const word & | name, | ||
const dictionary & | dict, | ||
const bool | writeToFile = true |
||
) |
Construct from objectRegistry, prefix, fileName and read options from dictionary
Definition at line 192 of file writeFile.C.
References dict, and Foam::read().
Construct copy.
Definition at line 155 of file writeFile.C.
|
virtualdefault |
Destructor.
|
protected |
Initialise the output stream for writing.
Definition at line 42 of file writeFile.C.
References writeFile::charWidth(), os(), Foam::scientific(), and writeFile::writePrecision_.
Referenced by logFiles::createFiles().
|
protected |
Return the base directory for output.
Definition at line 50 of file writeFile.C.
References polyMesh::defaultRegion, mesh, and functionObject::outputPrefix.
|
protected |
Return the base directory for the current time value.
Definition at line 76 of file writeFile.C.
|
protectedvirtual |
Return autoPtr to a new file for a given time.
Definition at line 83 of file writeFile.C.
References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, autoPtr< T >::good(), IOstream::good(), UPstream::master(), Foam::mkDir(), Foam::name(), autoPtr< T >::reset(), timeName, and Time::timeName().
Referenced by logFiles::createFiles(), forces::createFiles(), and forceCoeffs::createFiles().
|
protectedvirtual |
Return autoPtr to a new file using the simulation start time.
Definition at line 128 of file writeFile.C.
References Foam::name().
|
protectedvirtual |
Reset internal file pointer to new file with new name.
Definition at line 137 of file writeFile.C.
Referenced by logFiles::resetName().
|
protected |
Return the value width when writing to stream with optional offset.
Definition at line 145 of file writeFile.C.
References Foam::setw().
|
protecteddelete |
No copy assignment.
|
virtual |
Read.
Reimplemented in DMDModel, surfaceFieldValue, STDMD, actuationDiskSource, volFieldValue, fluxSummary, sizeDistribution, multiFieldValue, radialActuationDiskSource, fieldValue, wallHeatFlux, timeInfo, cloudInfo, specieReactionRates< ChemistryModelType >, stabilityBlendingFactor, propellerInfo, regionSizeDistribution, forces, extractEulerianParticles, forceCoeffs, momentum, Curle, fieldMinMax, interfaceHeight, fieldExtents, blendingFactor, particleDistribution, histogram, valueAverage, solverInfo, reactionsSensitivityAnalysis< chemistryType >, continuityError, wallShearStress, AMIWeights, yPlus, DESModelRegions, energySpectrum, and sixDoFRigidBodyState.
Definition at line 213 of file writeFile.C.
References IOstream::defaultPrecision(), dict, MinMax< T >::ge(), and UPstream::master().
Referenced by logFiles::logFiles(), cloudInfo::read(), timeInfo::read(), energySpectrum::read(), DESModelRegions::read(), yPlus::read(), AMIWeights::read(), wallHeatFlux::read(), fieldValue::read(), wallShearStress::read(), continuityError::read(), valueAverage::read(), histogram::read(), particleDistribution::read(), blendingFactor::read(), fieldExtents::read(), fieldMinMax::read(), sizeDistribution::read(), momentum::read(), fluxSummary::read(), extractEulerianParticles::read(), forces::read(), regionSizeDistribution::read(), and stabilityBlendingFactor::read().
|
virtual |
Return access to the file (if only 1)
Definition at line 236 of file writeFile.C.
References FatalErrorInFunction, and Foam::Snull.
Referenced by solverInfo::updateSolverInfo(), multiFieldValue::write(), solverInfo::writeFileHeader(), and fieldMinMax::writeFileHeader().
|
virtual |
Flag to allow writing to file.
Definition at line 253 of file writeFile.C.
Referenced by forces::createFiles(), and forceCoeffs::createFiles().
|
virtual |
Flag to allow writing the header.
Definition at line 259 of file writeFile.C.
|
virtual |
Return width of character stream output.
Definition at line 265 of file writeFile.C.
Referenced by writeFile::initStream().
Write a commented string to stream.
Definition at line 272 of file writeFile.C.
References os(), Foam::setf(), and Foam::setw().
Referenced by cloudInfo::writeFileHeader(), timeInfo::writeFileHeader(), sixDoFRigidBodyState::writeFileHeader(), energySpectrum::writeFileHeader(), DESModelRegions::writeFileHeader(), AMIWeights::writeFileHeader(), volRegion::writeFileHeader(), wallHeatFlux::writeFileHeader(), wallShearStress::writeFileHeader(), solverInfo::writeFileHeader(), continuityError::writeFileHeader(), valueAverage::writeFileHeader(), fieldExtents::writeFileHeader(), blendingFactor::writeFileHeader(), and fieldMinMax::writeFileHeader().
Write a tabbed string to stream.
Definition at line 288 of file writeFile.C.
References os(), Foam::setw(), and Foam::tab.
Referenced by cloudInfo::writeFileHeader(), timeInfo::writeFileHeader(), DESModelRegions::writeFileHeader(), AMIWeights::writeFileHeader(), wallHeatFlux::writeFileHeader(), wallShearStress::writeFileHeader(), valueAverage::writeFileHeader(), fieldExtents::writeFileHeader(), blendingFactor::writeFileHeader(), and fieldMinMax::writeFileHeader().
Write a commented header to stream.
Definition at line 298 of file writeFile.C.
References Foam::nl, and os().
Referenced by cloudInfo::writeFileHeader(), sixDoFRigidBodyState::writeFileHeader(), energySpectrum::writeFileHeader(), DESModelRegions::writeFileHeader(), AMIWeights::writeFileHeader(), wallHeatFlux::writeFileHeader(), wallShearStress::writeFileHeader(), solverInfo::writeFileHeader(), continuityError::writeFileHeader(), valueAverage::writeFileHeader(), fieldExtents::writeFileHeader(), blendingFactor::writeFileHeader(), and fieldMinMax::writeFileHeader().
|
virtual |
Write the current time to stream.
Definition at line 308 of file writeFile.C.
References os(), Foam::setw(), and Time::timeName().
Referenced by multiFieldValue::write().
|
virtual |
Write a break marker to the stream.
Definition at line 321 of file writeFile.C.
References os(), and Foam::writeHeader().
Referenced by solverInfo::writeFileHeader(), fieldExtents::writeFileHeader(), and fieldMinMax::writeFileHeader().
Write a (commented) header property and value pair.
Definition at line 32 of file writeFileTemplates.C.
References Foam::nl, os(), Foam::setf(), and Foam::setw().
Referenced by sixDoFRigidBodyState::writeFileHeader(), volRegion::writeFileHeader(), and fieldExtents::writeFileHeader().
|
protected |
Reference to the region objectRegistry.
Definition at line 126 of file writeFile.H.
Referenced by logFiles::createFiles().
|
protected |
Prefix.
Definition at line 129 of file writeFile.H.
|
protected |
Name of file.
Definition at line 132 of file writeFile.H.
File pointer.
Definition at line 135 of file writeFile.H.
|
protected |
|
protected |
Flag to enable/disable writing to file.
Definition at line 141 of file writeFile.H.
|
protected |
Flag to update the header, e.g. on mesh changes. Default is true.
Definition at line 145 of file writeFile.H.
|
protected |
Flag to identify whether the header has been written.
Definition at line 148 of file writeFile.H.
Referenced by solverInfo::writeFileHeader(), fieldExtents::writeFileHeader(), and fieldMinMax::writeFileHeader().
|
protected |
Flag to use the specified user time, e.g. CA deg instead of seconds. Default = true
Definition at line 152 of file writeFile.H.
|
protected |
Start time value.
Definition at line 155 of file writeFile.H.
|
static |
Additional characters for writing.
Definition at line 196 of file writeFile.H.