Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes
functionObjectFile Class Reference

Base class for output file data handling. More...

Inheritance diagram for functionObjectFile:
Inheritance graph
[legend]
Collaboration diagram for functionObjectFile:
Collaboration graph
[legend]

Public Member Functions

 functionObjectFile (const objectRegistry &obr, const word &prefix)
 Construct null. More...
 
 functionObjectFile (const objectRegistry &obr, const word &prefix, const word &fileName, const dictionary &dict)
 Construct from components and read options from dictionary. More...
 
virtual ~functionObjectFile ()
 Destructor. More...
 
void read (const dictionary &dict)
 Read. More...
 
OFstreamfile ()
 Return access to the file (if only 1) More...
 
bool writeToFile () const
 Return true if can write to file. More...
 
void writeCommented (Ostream &os, const string &str) const
 Write a commented string to stream. More...
 
void writeTabbed (Ostream &os, const string &str) const
 Write a tabbed string to stream. More...
 
void writeHeader (Ostream &os, const string &str) const
 Write a commented header to stream. More...
 
void writeTime (Ostream &os) const
 Write the current time to 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...
 
label charWidth () const
 Return width of character stream output. More...
 

Static Public Attributes

static const word outputPrefix = "postProcessing"
 Directory prefix. More...
 
static label addChars = 7
 Additional characters for writing. More...
 

Protected Member Functions

virtual void initStream (Ostream &os) const
 Initialise the output stream for writing. More...
 
virtual fileName baseFileDir () const
 Return the base directory for output. More...
 
virtual fileName baseTimeDir () const
 Return the base directory for the current time value. More...
 
virtual autoPtr< OFstreamcreateFile (const word &name) const
 Return an autoPtr to a new file. More...
 
virtual void resetFile (const word &name)
 Reset internal file pointer to new file with new name. More...
 
virtual Omanip< int > valueWidth (const label offset=0) const
 Return the value width when writing to stream with optional offset. More...
 
 functionObjectFile (const functionObjectFile &)
 Disallow default bitwise copy construct. More...
 
void operator= (const functionObjectFile &)
 Disallow default bitwise assignment. More...
 

Protected Attributes

bool writeToFile_
 Flag to enable/disable writing to file. More...
 

Private Attributes

const objectRegistryobr_
 Reference to the database. More...
 
const word prefix_
 Prefix. More...
 
word fileName_
 Name of file. More...
 
autoPtr< OFstreamfilePtr_
 File pointer. More...
 
label writePrecision_
 Write precision. More...
 

Detailed Description

Base class for output file data handling.

See also
Foam::functionObject Foam::OutputFilterFunctionObject
Source files

Definition at line 57 of file functionObjectFile.H.

Constructor & Destructor Documentation

◆ functionObjectFile() [1/3]

functionObjectFile ( const functionObjectFile )
protected

Disallow default bitwise copy construct.

◆ functionObjectFile() [2/3]

functionObjectFile ( const objectRegistry obr,
const word prefix 
)

Construct null.

Definition at line 132 of file functionObjectFile.C.

◆ functionObjectFile() [3/3]

functionObjectFile ( const objectRegistry obr,
const word prefix,
const word fileName,
const dictionary dict 
)

Construct from components and read options from dictionary.

Definition at line 147 of file functionObjectFile.C.

References dict, and Foam::read().

Here is the call graph for this function:

◆ ~functionObjectFile()

~functionObjectFile ( )
virtual

Destructor.

Definition at line 172 of file functionObjectFile.C.

Member Function Documentation

◆ initStream()

void initStream ( Ostream os) const
protectedvirtual

Initialise the output stream for writing.

Definition at line 39 of file functionObjectFile.C.

References functionObjectFile::charWidth(), Ostream::precision(), Foam::scientific(), IOstream::setf(), Ostream::width(), and functionObjectFile::writePrecision_.

Here is the call graph for this function:

◆ baseFileDir()

Foam::fileName baseFileDir ( ) const
protectedvirtual

Return the base directory for output.

Definition at line 47 of file functionObjectFile.C.

References polyMesh::defaultRegion, mesh, fvMesh::name(), UPstream::parRun(), and fileName::path().

Here is the call graph for this function:

◆ baseTimeDir()

Foam::fileName baseTimeDir ( ) const
protectedvirtual

Return the base directory for the current time value.

Definition at line 76 of file functionObjectFile.C.

◆ createFile()

Foam::autoPtr< Foam::OFstream > createFile ( const word name) const
protectedvirtual

Return an autoPtr to a new file.

Definition at line 83 of file functionObjectFile.C.

References IOstream::good(), UPstream::master(), Foam::mkDir(), Foam::name(), and autoPtr::set().

Referenced by forceCoeffs::createFiles().

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

◆ resetFile()

void resetFile ( const word name)
protectedvirtual

Reset internal file pointer to new file with new name.

Definition at line 116 of file functionObjectFile.C.

◆ valueWidth()

Foam::Omanip< int > valueWidth ( const label  offset = 0) const
protectedvirtual

Return the value width when writing to stream with optional offset.

Definition at line 123 of file functionObjectFile.C.

References IOstream::defaultPrecision(), and Foam::setw().

Here is the call graph for this function:

◆ operator=()

void operator= ( const functionObjectFile )
protected

Disallow default bitwise assignment.

◆ read()

void read ( const dictionary dict)

◆ file()

Foam::OFstream & file ( )

Return access to the file (if only 1)

Definition at line 189 of file functionObjectFile.C.

References FatalErrorInFunction, and Foam::Snull.

Referenced by blendingFactor::calc(), and residuals::writeResidual().

Here is the caller graph for this function:

◆ writeToFile()

bool writeToFile ( ) const

Return true if can write to file.

Definition at line 206 of file functionObjectFile.C.

Referenced by forceCoeffs::createFiles().

Here is the caller graph for this function:

◆ writeCommented()

void writeCommented ( Ostream os,
const string str 
) const

◆ writeTabbed()

void writeTabbed ( Ostream os,
const string str 
) const

Write a tabbed string to stream.

Definition at line 230 of file functionObjectFile.C.

References Foam::setw(), and Foam::tab.

Referenced by residuals::writeFileHeader(), DESModelRegions::writeFileHeader(), yPlus::writeFileHeader(), cloudInfo::writeFileHeader(), wallShearStress::writeFileHeader(), valueAverage::writeFileHeader(), blendingFactor::writeFileHeader(), and fieldMinMax::writeFileHeader().

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

◆ writeHeader()

void writeHeader ( Ostream os,
const string str 
) const

Write a commented header to stream.

Definition at line 240 of file functionObjectFile.C.

References Foam::nl, Foam::setf(), and Foam::setw().

Referenced by residuals::writeFileHeader(), DESModelRegions::writeFileHeader(), yPlus::writeFileHeader(), cloudInfo::writeFileHeader(), wallShearStress::writeFileHeader(), valueAverage::writeFileHeader(), blendingFactor::writeFileHeader(), and fieldMinMax::writeFileHeader().

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

◆ writeTime()

void writeTime ( Ostream os) const

Write the current time to stream.

Definition at line 250 of file functionObjectFile.C.

References Foam::setw().

Here is the call graph for this function:

◆ writeHeaderValue()

void writeHeaderValue ( Ostream os,
const string property,
const Type &  value 
) const

Write a (commented) header property and value pair.

Definition at line 32 of file functionObjectFileTemplates.C.

References Foam::nl, Foam::setf(), and Foam::setw().

Referenced by fieldValueDelta::writeFileHeader().

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

◆ charWidth()

Foam::label charWidth ( ) const

Return width of character stream output.

Definition at line 212 of file functionObjectFile.C.

References IOstream::defaultPrecision().

Referenced by functionObjectFile::initStream().

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

Field Documentation

◆ obr_

const objectRegistry& obr_
private

Reference to the database.

Definition at line 64 of file functionObjectFile.H.

◆ prefix_

const word prefix_
private

Prefix.

Definition at line 67 of file functionObjectFile.H.

◆ fileName_

word fileName_
private

Name of file.

Definition at line 70 of file functionObjectFile.H.

◆ filePtr_

autoPtr<OFstream> filePtr_
private

File pointer.

Definition at line 73 of file functionObjectFile.H.

◆ writePrecision_

label writePrecision_
private

Write precision.

Definition at line 76 of file functionObjectFile.H.

Referenced by functionObjectFile::initStream().

◆ writeToFile_

bool writeToFile_
protected

Flag to enable/disable writing to file.

Definition at line 84 of file functionObjectFile.H.

◆ outputPrefix

const Foam::word outputPrefix = "postProcessing"
static

Directory prefix.

Definition at line 117 of file functionObjectFile.H.

◆ addChars

Foam::label addChars = 7
static

Additional characters for writing.

Definition at line 120 of file functionObjectFile.H.


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