Base class for writing single files from the function objects. More...
Inherited by binModel, turbulentTemperatureRadCoupledMixedFvPatchScalarField, DMDModel, FaceInteraction< CloudType >, AMIWeights, blendingFactor, caseInfo, continuityError, Curle, DESModelRegions, energySpectrum, extractEulerianParticles, fieldExtents, fieldMinMax, fieldValue, multiFieldValue, fluxSummary, forces, logFiles, momentum, particleDistribution, reactionsSensitivityAnalysis< chemistryType >, regionSizeDistribution, sixDoFRigidBodyState, sizeDistribution, solverInfo, specieReactionRates< ChemistryModelType >, stabilityBlendingFactor, timeInfo, valueAverageBase, viewFactorHeatFlux, wallHeatFlux, wallShearStress, yPlus, actuationDiskSource, limitTemperature, limitTurbulenceViscosity, limitVelocity, velocityDampingConstraint, heatExchangerModel, histogramModel, noiseModel, ParticleHistogram< CloudType >, ParticlePostProcessing< CloudType >, ParticleZoneInfo< CloudType >, PatchInteractionModel< CloudType >, PatchInteractionModel< Foam::DSMCCloud >, PatchInteractionModel< Foam::KinematicCloud< Cloud< basicKinematicCollidingParcel > > >, PatchInteractionModel< Foam::KinematicCloud< CloudType > >, and PatchInteractionModel< Foam::KinematicCloud< Foam::DSMCCloud > >.
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) | |
Construct from objectRegistry, prefix, fileName and read options from dictionary. More... | |
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 | canWriteToFile () const |
Flag to allow writing to the file. More... | |
virtual bool | canResetFile () const |
Flag to allow resetting the 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... | |
fileName | filePath (const fileName &fName) const |
Return the full path for the supplied file name. More... | |
virtual autoPtr< OFstream > | newFile (const fileName &fName) const |
Return autoPtr to a new file using file name. More... | |
virtual autoPtr< OFstream > | newFileAtTime (const word &name, scalar timeValue) const |
Return autoPtr to a new file for a given time. More... | |
virtual autoPtr< OFstream > | newFileAtStartTime (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... | |
virtual autoPtr< OFstream > | createFile (const word &name, scalar timeValue) const |
Deprecated(2022-09) Return autoPtr to a new file for a given time. More... | |
virtual autoPtr< OFstream > | createFile (const word &name) const |
Deprecated(2022-09) Return autoPtr to a new file using the simulation start time. 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_ |
Flag to update the header, e.g. on mesh changes. Default is true. More... | |
bool | writtenHeader_ |
Flag to identify whether the header has been written. More... | |
bool | useUserTime_ |
Flag to use the specified user time, e.g. CA deg instead of seconds. Default = true. More... | |
scalar | startTime_ |
Start time value. More... | |
Base class for writing single files from the function objects.
<dictName> { // Inherited entries ... // Optional entries writePrecision <int>; writeToFile <bool>; useUserTime <bool>; updateHeader <bool>; }
where the entries mean:
Property | Description | Type | Reqd | Deflt |
---|---|---|---|---|
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 112 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 199 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 220 of file writeFile.C.
References dict, and Foam::read().
Construct copy.
Definition at line 183 of file writeFile.C.
|
virtualdefault |
Destructor.
|
protected |
Initialise the output stream for writing.
Definition at line 35 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 43 of file writeFile.C.
References meshPtr, and functionObject::outputPrefix.
Referenced by surfaceNoise::calculate().
|
protected |
Return the base directory for the current time value.
Definition at line 66 of file writeFile.C.
|
protected |
Return the full path for the supplied file name.
Definition at line 73 of file writeFile.C.
Referenced by surfaceNoise::calculate().
|
protectedvirtual |
Return autoPtr to a new file using file name.
Note: no check for if the file already exists
Definition at line 82 of file writeFile.C.
References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, autoPtr< T >::good(), UPstream::master(), Foam::mkDir(), fileName::name(), path(), and autoPtr< T >::reset().
Referenced by surfaceNoise::calculate().
|
protectedvirtual |
Return autoPtr to a new file for a given time.
Definition at line 110 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 TimeState::timeName().
Referenced by writeFile::createFile().
|
protectedvirtual |
Return autoPtr to a new file using the simulation start time.
Definition at line 156 of file writeFile.C.
References Foam::name().
Referenced by writeFile::createFile(), logFiles::createFiles(), and binModel::read().
|
protectedvirtual |
Reset internal file pointer to new file with new name.
Definition at line 165 of file writeFile.C.
Referenced by logFiles::resetName(), and turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs().
|
protected |
Return the value width when writing to stream with optional offset.
Definition at line 173 of file writeFile.C.
References Foam::setw().
|
protecteddelete |
No copy assignment.
|
inlineprotectedvirtual |
Deprecated(2022-09) Return autoPtr to a new file for a given time.
Definition at line 244 of file writeFile.H.
References Foam::name(), and writeFile::newFileAtTime().
Deprecated(2022-09) Return autoPtr to a new file using the simulation start time.
Definition at line 261 of file writeFile.H.
References Foam::name(), and writeFile::newFileAtStartTime().
|
virtual |
Read.
Reimplemented in surfaceFieldValue, forceCoeffs, stabilityBlendingFactor, STDMD, forces, actuationDiskSource, propellerInfo, noiseModel, regionSizeDistribution, volFieldValue, extractEulerianParticles, effectivenessTable, fluxSummary, momentum, sizeDistribution, Curle, caseInfo, multiFieldValue, surfaceNoise, interfaceHeight, fieldMinMax, fieldExtents, reactionsSensitivityAnalysis< chemistryType >, particleDistribution, solverInfo, uniformBin, wallShearStress, blendingFactor, fieldValue, referenceTemperature, continuityError, velocityDampingConstraint, radialActuationDiskSource, AMIWeights, wallHeatFlux, singleDirectionUniformBin, yPlus, binModel, cloudInfo, DESModelRegions, valueAverage, heatExchangerModel, limitTemperature, valueAverageBase, DMDModel, energySpectrum, viewFactorHeatFlux, histogramModel, limitTurbulenceViscosity, limitVelocity, timeInfo, sixDoFRigidBodyState, equalBinWidth, unequalBinWidth, pointNoise, and specieReactionRates< ChemistryModelType >.
Definition at line 241 of file writeFile.C.
References IOstream::defaultPrecision(), dict, MinMax< T >::ge(), and UPstream::master().
Referenced by logFiles::logFiles(), timeInfo::read(), histogramModel::read(), energySpectrum::read(), valueAverageBase::read(), DESModelRegions::read(), cloudInfo::read(), binModel::read(), yPlus::read(), wallHeatFlux::read(), AMIWeights::read(), continuityError::read(), fieldValue::read(), blendingFactor::read(), wallShearStress::read(), particleDistribution::read(), fieldExtents::read(), fieldMinMax::read(), caseInfo::read(), sizeDistribution::read(), momentum::read(), fluxSummary::read(), extractEulerianParticles::read(), noiseModel::read(), forces::read(), and stabilityBlendingFactor::read().
|
virtual |
Return access to the file (if only 1)
Definition at line 264 of file writeFile.C.
References FatalErrorInFunction, and Foam::Snull.
Referenced by velocityDampingConstraint::addDamping(), turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs(), solverInfo::updateSolverInfo(), multiFieldValue::write(), solverInfo::writeFileHeader(), and fieldMinMax::writeFileHeader().
|
virtual |
Flag to allow writing to file.
Definition at line 281 of file writeFile.C.
Referenced by uniformBin::processField().
|
virtual |
Flag to allow writing to the file.
Definition at line 287 of file writeFile.C.
References UPstream::master().
Referenced by velocityDampingConstraint::addDamping(), and turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs().
|
virtual |
Flag to allow resetting the file.
Definition at line 293 of file writeFile.C.
References UPstream::master().
Referenced by turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs().
|
virtual |
Flag to allow writing the header.
Definition at line 299 of file writeFile.C.
References UPstream::master().
Referenced by turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs().
|
virtual |
Return width of character stream output.
Definition at line 306 of file writeFile.C.
Referenced by writeFile::initStream().
Write a commented string to stream.
Definition at line 313 of file writeFile.C.
References os(), Foam::setf(), and Foam::setw().
Referenced by histogramModel::writeFileHeader(), timeInfo::writeFileHeader(), sixDoFRigidBodyState::writeFileHeader(), energySpectrum::writeFileHeader(), limitTurbulenceViscosity::writeFileHeader(), limitVelocity::writeFileHeader(), valueAverageBase::writeFileHeader(), limitTemperature::writeFileHeader(), cloudInfo::writeFileHeader(), DESModelRegions::writeFileHeader(), AMIWeights::writeFileHeader(), wallHeatFlux::writeFileHeader(), solverInfo::writeFileHeader(), volRegion::writeFileHeader(), continuityError::writeFileHeader(), wallShearStress::writeFileHeader(), blendingFactor::writeFileHeader(), fieldExtents::writeFileHeader(), and fieldMinMax::writeFileHeader().
Write a tabbed string to stream.
Definition at line 329 of file writeFile.C.
References os(), Foam::setw(), and Foam::tab.
Referenced by histogramModel::writeFileHeader(), timeInfo::writeFileHeader(), limitTurbulenceViscosity::writeFileHeader(), limitVelocity::writeFileHeader(), valueAverageBase::writeFileHeader(), limitTemperature::writeFileHeader(), cloudInfo::writeFileHeader(), DESModelRegions::writeFileHeader(), AMIWeights::writeFileHeader(), wallHeatFlux::writeFileHeader(), wallShearStress::writeFileHeader(), blendingFactor::writeFileHeader(), fieldExtents::writeFileHeader(), and fieldMinMax::writeFileHeader().
Write a commented header to stream.
Definition at line 339 of file writeFile.C.
References Foam::nl, and os().
Referenced by histogramModel::writeFileHeader(), sixDoFRigidBodyState::writeFileHeader(), energySpectrum::writeFileHeader(), valueAverageBase::writeFileHeader(), cloudInfo::writeFileHeader(), DESModelRegions::writeFileHeader(), AMIWeights::writeFileHeader(), wallHeatFlux::writeFileHeader(), solverInfo::writeFileHeader(), continuityError::writeFileHeader(), wallShearStress::writeFileHeader(), blendingFactor::writeFileHeader(), fieldExtents::writeFileHeader(), and fieldMinMax::writeFileHeader().
|
virtual |
Write the current time to stream.
Definition at line 349 of file writeFile.C.
References os(), Foam::setw(), and TimeState::timeName().
Referenced by multiFieldValue::write().
|
virtual |
Write a break marker to the stream.
Definition at line 362 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 26 of file writeFileTemplates.C.
References Foam::nl, os(), Foam::setf(), and Foam::setw().
Referenced by sixDoFRigidBodyState::writeFileHeader(), limitTurbulenceViscosity::writeFileHeader(), limitVelocity::writeFileHeader(), limitTemperature::writeFileHeader(), volRegion::writeFileHeader(), and fieldExtents::writeFileHeader().
void writeValue | ( | Ostream & | os, |
const Type & | val | ||
) | const |
Write a given value to stream with the space delimiter.
Definition at line 40 of file writeFileTemplates.C.
References Foam::component(), Foam::expressions::Detail::nComponents(), and os().
|
protected |
Reference to the region objectRegistry.
Definition at line 121 of file writeFile.H.
Referenced by logFiles::createFiles(), and surfaceNoise::initialise().
|
protected |
Prefix.
Definition at line 126 of file writeFile.H.
|
protected |
Name of file.
Definition at line 131 of file writeFile.H.
File pointer.
Definition at line 136 of file writeFile.H.
|
protected |
|
protected |
Flag to enable/disable writing to file.
Definition at line 146 of file writeFile.H.
|
protected |
Flag to update the header, e.g. on mesh changes. Default is true.
Definition at line 152 of file writeFile.H.
|
protected |
Flag to identify whether the header has been written.
Definition at line 157 of file writeFile.H.
Referenced by uniformBin::processField(), multiFieldValue::write(), limitTurbulenceViscosity::writeFileHeader(), limitVelocity::writeFileHeader(), limitTemperature::writeFileHeader(), 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 163 of file writeFile.H.
|
protected |
Start time value.
Definition at line 168 of file writeFile.H.
|
static |
Additional characters for writing.
Definition at line 274 of file writeFile.H.