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... | |
template<class Type > | |
void | writeValue (Ostream &os, const Type &val) const |
Write a given value to stream with the space delimiter. 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 167 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 188 of file writeFile.C.
References writeFile::createFile(), dict, writeFile::fileName_, writeFile::filePtr_, writeFile::read(), and writeFile::writeToFile_.
Construct copy.
Definition at line 152 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(), OSstream::precision(), IOstream::setf(), OSstream::width(), and writeFile::writePrecision_.
Referenced by logFiles::createFiles().
|
protected |
Return the base directory for output.
Definition at line 50 of file writeFile.C.
References fileName::clean(), meshPtr, and functionObject::outputPrefix.
|
protected |
Return the base directory for the current time value.
Definition at line 73 of file writeFile.C.
Referenced by histogram::write(), and regionSizeDistribution::write().
|
protectedvirtual |
Return autoPtr to a new file for a given time.
Definition at line 79 of file writeFile.C.
References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, IOstream::good(), autoPtr< T >::good(), splitCell::master(), Foam::mkDir(), Foam::name(), autoPtr< T >::reset(), timeName, and Time::timeName().
Referenced by logFiles::createFiles(), FaceInteraction< CloudType >::FaceInteraction(), sizeDistribution::sizeDistribution(), and writeFile::writeFile().
|
protectedvirtual |
Return autoPtr to a new file using the simulation start time.
Definition at line 124 of file writeFile.C.
References Foam::name().
|
protectedvirtual |
Reset internal file pointer to new file with new name.
Definition at line 134 of file writeFile.C.
Referenced by logFiles::resetName(), and sizeDistribution::sizeDistribution().
|
protected |
Return the value width when writing to stream with optional offset.
Definition at line 141 of file writeFile.C.
References Foam::setw().
|
protecteddelete |
No copy assignment.
|
virtual |
Read.
Reimplemented in AMIWeights, blendingFactor, continuityError, Curle, DESModelRegions, extractEulerianParticles, fieldExtents, fieldMinMax, histogram, interfaceHeight, momentum, particleDistribution, reactionsSensitivityAnalysis< chemistryType >, regionSizeDistribution, stabilityBlendingFactor, valueAverage, wallShearStress, yPlus, propellerInfo, energySpectrum, solverInfo, sixDoFRigidBodyState, binModel, singleDirectionUniformBin, uniformBin, STDMD, fieldValue, surfaceFieldValue, volFieldValue, fluxSummary, multiFieldValue, wallHeatFlux, forceCoeffs, forces, cloudInfo, sizeDistribution, timeInfo, actuationDiskSource, effectivenessHeatExchangerSource, radialActuationDiskSource, valueAverageBase, specieReactionRates< ChemistryModelType >, and DMDModel.
Definition at line 210 of file writeFile.C.
References IOstream::defaultPrecision(), dict, MinMax< T >::ge(), and splitCell::master().
Referenced by writeFile::writeFile().
|
virtual |
Return access to the file (if only 1)
Definition at line 233 of file writeFile.C.
References FatalErrorInFunction, and Foam::Snull.
Referenced by blendingFactor::blendingFactor(), valueAverageBase::calc(), continuityError::continuityError(), DESModelRegions::DESModelRegions(), effectivenessHeatExchangerSource::effectivenessHeatExchangerSource(), fieldMinMax::output(), sixDoFRigidBodyState::sixDoFRigidBodyState(), specieReactionRates< ChemistryModelType >::specieReactionRates(), stabilityBlendingFactor::stabilityBlendingFactor(), timeInfo::timeInfo(), valueAverageBase::valueAverageBase(), volFieldValue::volFieldValue(), wallHeatFlux::wallHeatFlux(), wallShearStress::wallShearStress(), fieldMinMax::writeFileHeader(), solverInfo::writeFileHeader(), and yPlus::yPlus().
|
virtual |
Flag to allow writing to file.
Definition at line 250 of file writeFile.C.
Referenced by FaceInteraction< CloudType >::FaceInteraction().
|
virtual |
Flag to allow writing the header.
Definition at line 256 of file writeFile.C.
|
virtual |
Return width of character stream output.
Definition at line 262 of file writeFile.C.
Referenced by writeFile::initStream(), and writeFile::writeHeaderValue().
Write a commented string to stream.
Definition at line 268 of file writeFile.C.
References os(), Foam::setf(), and Foam::setw().
Referenced by FaceInteraction< CloudType >::FaceInteraction(), multiFieldValue::writeFileHeader(), volRegion::writeFileHeader(), singleDirectionUniformBin::writeFileHeader(), uniformBin::writeFileHeader(), AMIWeights::writeFileHeader(), continuityError::writeFileHeader(), fieldExtents::writeFileHeader(), fieldMinMax::writeFileHeader(), energySpectrum::writeFileHeader(), solverInfo::writeFileHeader(), timeInfo::writeFileHeader(), sixDoFRigidBodyState::writeFileHeader(), blendingFactor::writeFileHeader(), DESModelRegions::writeFileHeader(), wallHeatFlux::writeFileHeader(), wallShearStress::writeFileHeader(), cloudInfo::writeFileHeader(), and valueAverageBase::writeFileHeader().
Write a tabbed string to stream.
Definition at line 284 of file writeFile.C.
References os(), Foam::setw(), and Foam::tab.
Referenced by FaceInteraction< CloudType >::FaceInteraction(), fieldMinMax::output(), multiFieldValue::writeFileHeader(), singleDirectionUniformBin::writeFileHeader(), uniformBin::writeFileHeader(), AMIWeights::writeFileHeader(), fieldExtents::writeFileHeader(), fieldMinMax::writeFileHeader(), timeInfo::writeFileHeader(), blendingFactor::writeFileHeader(), DESModelRegions::writeFileHeader(), wallHeatFlux::writeFileHeader(), wallShearStress::writeFileHeader(), cloudInfo::writeFileHeader(), valueAverageBase::writeFileHeader(), and solverInfo::writeFileHeader().
Write a commented header to stream.
Definition at line 294 of file writeFile.C.
References Foam::nl, os(), and writeFile::writeHeader().
Referenced by singleDirectionUniformBin::writeFileHeader(), uniformBin::writeFileHeader(), AMIWeights::writeFileHeader(), continuityError::writeFileHeader(), fieldExtents::writeFileHeader(), fieldMinMax::writeFileHeader(), energySpectrum::writeFileHeader(), solverInfo::writeFileHeader(), sixDoFRigidBodyState::writeFileHeader(), blendingFactor::writeFileHeader(), DESModelRegions::writeFileHeader(), wallHeatFlux::writeFileHeader(), wallShearStress::writeFileHeader(), cloudInfo::writeFileHeader(), valueAverageBase::writeFileHeader(), and writeFile::writeHeader().
|
virtual |
Write the current time to stream.
Definition at line 305 of file writeFile.C.
References os(), Foam::setw(), and Time::timeName().
Referenced by fieldMinMax::output().
|
virtual |
Write a break marker to the stream.
Definition at line 318 of file writeFile.C.
References os(), and Foam::writeHeader().
Referenced by fieldExtents::writeFileHeader(), fieldMinMax::writeFileHeader(), and solverInfo::writeFileHeader().
Write a (commented) header property and value pair.
Definition at line 32 of file writeFileTemplates.C.
References writeFile::charWidth(), Foam::nl, os(), Foam::setf(), and Foam::setw().
Referenced by FaceInteraction< CloudType >::FaceInteraction(), multiFieldValue::writeFileHeader(), volRegion::writeFileHeader(), singleDirectionUniformBin::writeFileHeader(), uniformBin::writeFileHeader(), fieldExtents::writeFileHeader(), and sixDoFRigidBodyState::writeFileHeader().
void writeValue | ( | Ostream & | os, |
const Type & | val | ||
) | const |
Write a given value to stream with the space delimiter.
Definition at line 46 of file writeFileTemplates.C.
References Foam::component(), and os().
|
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 |
|
protected |
|
protected |
Flag to enable/disable writing to file.
Definition at line 141 of file writeFile.H.
Referenced by stabilityBlendingFactor::stabilityBlendingFactor(), and writeFile::writeFile().
|
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 fieldExtents::writeFileHeader(), fieldMinMax::writeFileHeader(), and solverInfo::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.