logFiles Class Reference

functionObject base class for creating, maintaining and writing log files e.g. integrated or averaged field data vs time. More...

Inheritance diagram for logFiles:
[legend]
Collaboration diagram for logFiles:
[legend]

Public Member Functions

 logFiles (const objectRegistry &obr, const word &prefix)
 Construct from objectRegistry and prefix. More...
 
 logFiles (const objectRegistry &obr, const word &prefix, const dictionary &dict)
 Construct from objectRegistry and prefix, and read options. More...
 
virtual ~logFiles ()=default
 Destructor. More...
 
const wordListnames () const
 Return const access to the names. More...
 
PtrList< OFstream > & files ()
 Return access to the files. More...
 
OFstreamfiles (const label i)
 Return file 'i'. More...
 
virtual bool write ()
 Write function. More...
 
- Public Member Functions inherited from writeFile
 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 OFstreamfile ()
 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...
 

Protected Member Functions

virtual void createFiles ()
 Create the output file. More...
 
virtual void resetNames (const wordList &names)
 Reset the list of names from a wordList. More...
 
virtual void resetName (const word &name)
 Reset the list of names to a single name entry. More...
 
- Protected Member Functions inherited from writeFile
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< OFstreamcreateFile (const word &name, scalar timeValue) const
 Return autoPtr to a new file for a given time. More...
 
virtual autoPtr< OFstreamcreateFile (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

wordList names_
 File names. More...
 
PtrList< OFstreamfilePtrs_
 File pointer. More...
 
- Protected Attributes inherited from writeFile
const objectRegistryfileObr_
 Reference to the region objectRegistry. More...
 
const fileName prefix_
 Prefix. More...
 
word fileName_
 Name of file. More...
 
autoPtr< OFstreamfilePtr_
 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...
 

Additional Inherited Members

- Static Public Attributes inherited from writeFile
static label addChars = 8
 Additional characters for writing. More...
 

Detailed Description

functionObject base class for creating, maintaining and writing log files e.g. integrated or averaged field data vs time.

See also
Foam::functionObject Foam::functionObjects::writeFile
Source files

Definition at line 59 of file logFiles.H.

Constructor & Destructor Documentation

◆ logFiles() [1/2]

logFiles ( const objectRegistry obr,
const word prefix 
)

Construct from objectRegistry and prefix.

Definition at line 81 of file logFiles.C.

◆ logFiles() [2/2]

logFiles ( const objectRegistry obr,
const word prefix,
const dictionary dict 
)

Construct from objectRegistry and prefix, and read options.

from dictionary

Definition at line 93 of file logFiles.C.

References dict, and kEpsilonLopesdaCosta< BasicTurbulenceModel >::read().

Here is the call graph for this function:

◆ ~logFiles()

virtual ~logFiles ( )
virtualdefault

Destructor.

Member Function Documentation

◆ createFiles()

void createFiles ( )
protectedvirtual

Create the output file.

Definition at line 35 of file logFiles.C.

References writeFile::createFile(), writeFile::fileObr_, logFiles::filePtrs_, forAll, writeFile::initStream(), splitCell::master(), logFiles::names_, Time::startTime(), objectRegistry::time(), Time::timeName(), and dimensioned< Type >::value().

Here is the call graph for this function:

◆ resetNames()

void resetNames ( const wordList names)
protectedvirtual

Reset the list of names from a wordList.

Definition at line 55 of file logFiles.C.

References splitCell::master().

Referenced by interfaceHeight::interfaceHeight(), and cloudInfo::read().

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

◆ resetName()

void resetName ( const word name)
protectedvirtual

Reset the list of names to a single name entry.

Definition at line 70 of file logFiles.C.

References Foam::name(), and writeFile::resetFile().

Here is the call graph for this function:

◆ names()

const Foam::wordList & names ( ) const

Return const access to the names.

Definition at line 110 of file logFiles.C.

◆ files() [1/2]

Foam::PtrList< Foam::OFstream > & files ( )

Return access to the files.

Definition at line 116 of file logFiles.C.

References Foam::FatalError, FatalErrorInFunction, and splitCell::master().

Referenced by interfaceHeight::files().

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

◆ files() [2/2]

Foam::OFstream & files ( const label  i)

Return file 'i'.

Definition at line 129 of file logFiles.C.

◆ write()

bool write ( )
virtual

Write function.

Reimplemented in interfaceHeight, and cloudInfo.

Definition at line 149 of file logFiles.C.

Referenced by interfaceHeight::write().

Here is the caller graph for this function:

Member Data Documentation

◆ names_

wordList names_
protected

File names.

Definition at line 69 of file logFiles.H.

Referenced by logFiles::createFiles().

◆ filePtrs_

PtrList<OFstream> filePtrs_
protected

File pointer.

Definition at line 72 of file logFiles.H.

Referenced by logFiles::createFiles().


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