FreeFOAM The Cross-Platform CFD Toolkit
ensightFile Class Reference

Ensight output with specialized write() for strings, integers and floats. Correctly handles binary write as well. More...

#include <conversion/ensightFile.H>


Detailed Description

Ensight output with specialized write() for strings, integers and floats. Correctly handles binary write as well.

Definition at line 48 of file ensightFile.H.

+ Inheritance diagram for ensightFile:
+ Collaboration diagram for ensightFile:

List of all members.

Public Member Functions

 ensightFile (const fileName &pathname, IOstream::streamFormat format=IOstream::BINARY)
 Construct from pathname.
 ~ensightFile ()
virtual Ostreamwrite (const char *buf, std::streamsize count)
 binary write
virtual OstreamwriteKeyword (const string &key)
 write element keyword with trailing newline, optionally with undef
OstreamwriteBinaryHeader ()
 write "C Binary" for binary files (eg, geometry/measured)
OstreamwriteUndef ()
 write undef value
Ostreamwrite (const string &value)
 write string as "%80s" or as binary
Ostreamwrite (const label &value)
 write integer as "%10d" or as binary
Ostreamwrite (const label &value, const label fieldWidth)
 write integer with specified width or as binary
Ostreamwrite (const scalar &value)
 write float as "%12.5e" or as binary
void newline ()
 Add carriage return to ascii stream.
- Public Member Functions inherited from OFstream
 ClassName ("OFstream")
 OFstream (const fileName &pathname, streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED)
 Construct from pathname.
 ~OFstream ()
const fileNamename () const
 Return the name of the stream.
fileNamename ()
 Return non-const access to the name of the stream.
void print (Ostream &) const
 Print description of IOstream to Ostream.
- Public Member Functions inherited from OSstream
 OSstream (ostream &os, const string &name, streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED)
 Set stream status.
virtual ios_base::fmtflags flags () const
 Return flags of output stream.
virtual Ostreamwrite (const token &)
 Write next token to stream.
virtual Ostreamwrite (const char)
 Write character.
virtual Ostreamwrite (const char *)
 Write character string.
virtual Ostreamwrite (const word &)
 Write word.
virtual OstreamwriteQuoted (const std::string &, const bool quoted=true)
 Write std::string surrounded by quotes.
virtual Ostreamwrite (const label)
 Write label.
virtual Ostreamwrite (const floatScalar)
 Write floatScalar.
virtual Ostreamwrite (const doubleScalar)
 Write doubleScalar.
virtual void indent ()
 Add indentation characters.
virtual ios_base::fmtflags flags (const ios_base::fmtflags flags)
 Set flags of output stream.
virtual void flush ()
 Flush stream.
virtual void endl ()
 Add newline and flush stream.
virtual int width () const
 Get width of output field.
virtual int width (const int)
 Set width of output field (and return old width)
virtual int precision () const
 Get precision of output field.
virtual int precision (const int)
 Set precision of output field (and return old precision)
- Public Member Functions inherited from Ostream
 Ostream (streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED)
 Set stream status.
virtual ~Ostream ()
 Destructor.
virtual Ostreamwrite (const keyType &)
 Write keyType.
unsigned short indentLevel () const
 Return indent level.
unsigned short & indentLevel ()
 Access to indent level.
void incrIndent ()
 Incrememt the indent level.
void decrIndent ()
 Decrememt the indent level.
OstreamwriteKeyword (const keyType &)
 Write the keyword followed by an appropriate indentation.
Ostreamoperator() () const
 Return a non-const reference to const Ostream.
- Public Member Functions inherited from IOstream
 IOstream (streamFormat format, versionNumber version, compressionType compression=UNCOMPRESSED)
 Construct setting format and version.
virtual ~IOstream ()
virtual bool check (const char *operation) const
 Check IOstream status for given operation.
void fatalCheck (const char *operation) const
 Check IOstream status for given operation.
bool opened () const
 Return true if stream has been opened.
bool closed () const
 Return true if stream is closed.
bool good () const
 Return true if next operation might succeed.
bool eof () const
 Return true if end of input seen.
bool fail () const
 Return true if next operation will fail.
bool bad () const
 Return true if stream is corrupted.
 operator void * () const
 Return non-zero if the stream has not failed.
bool operator! () const
 Return true if the stream has failed.
streamFormat format () const
 Return current stream format.
streamFormat format (const streamFormat fmt)
 Set the stream format.
streamFormat format (const word &fmt)
 Set the stream format from word.
versionNumber version () const
 Return the stream version.
versionNumber version (const versionNumber ver)
 Set the stream version.
compressionType compression () const
 Return the stream compression.
compressionType compression (const compressionType cmp)
 Set the stream compression.
compressionType compression (const word &cmp)
 Set the stream compression from word.
label lineNumber () const
 Return current stream line number.
label & lineNumber ()
 Return current stream line number.
label lineNumber (const label ln)
 Set the stream line number.
void setEof ()
 Set stream to have reached eof.
void setFail ()
 Set stream to have failed.
void setBad ()
 Set stream to be bad.
virtual ios::fmtflags flags (const ios::fmtflags f)=0
 Set flags of stream.
ios::fmtflags setf (const ios::fmtflags f)
 Set flags of stream.
ios::fmtflags setf (const ios::fmtflags f, const ios::fmtflags mask)
 Set flags of given field of stream.
void unsetf (const ios::fmtflags uf)
 Unset flags of stream.
void print (Ostream &, const int streamState) const
 Check given stream state bits.
InfoProxy< IOstreaminfo () const
 Return info proxy.

Static Public Member Functions

static bool allowUndef ()
 Return setting for whether 'undef' values are allowed in results.
static string mask ()
 '*' mask appropriate for subDir
static string subDir (const label)
 consistent zero-padded numbers for subdirectories
static bool allowUndef (bool)
static scalar undefValue (const scalar &)
 Assign the value to represent undef in the results.

Constructor & Destructor Documentation

ensightFile ( const fileName pathname,
IOstream::streamFormat  format = IOstream::BINARY 
)

Construct from pathname.

Definition at line 37 of file ensightFile.C.

References Foam::scientific(), and Foam::setf().

Definition at line 56 of file ensightFile.C.


Member Function Documentation

bool allowUndef ( )
static

Return setting for whether 'undef' values are allowed in results.

Definition at line 62 of file ensightFile.C.

Referenced by ensightPart::writeScalarField(), and ensightPart::writeVectorField().

Foam::string mask ( )
static

'*' mask appropriate for subDir

Definition at line 252 of file ensightFile.C.

Foam::string subDir ( const label  n)
static

consistent zero-padded numbers for subdirectories

Definition at line 259 of file ensightFile.C.

bool allowUndef ( bool  value)
static

Definition at line 68 of file ensightFile.C.

Foam::scalar undefValue ( const scalar &  value)
static

Assign the value to represent undef in the results.

Returns the previous value NB: do not use values larger than floatScalarVGREAT

Definition at line 76 of file ensightFile.C.

Foam::Ostream & write ( const char *  buf,
std::streamsize  count 
)
virtual

binary write

Reimplemented from OSstream.

Definition at line 88 of file ensightFile.C.

References Ostream::write().

Referenced by ensightPart::writeFieldList(), ensightPart::writeGeometry(), and ensightPart::writeHeader().

Foam::Ostream & writeKeyword ( const string key)
virtual

write element keyword with trailing newline, optionally with undef

Reimplemented in ensightGeoFile.

Definition at line 221 of file ensightFile.C.

Referenced by ensightPart::writeField(), ensightPart::writeScalarField(), and ensightPart::writeVectorField().

Foam::Ostream & writeBinaryHeader ( )

write "C Binary" for binary files (eg, geometry/measured)

Definition at line 239 of file ensightFile.C.

References IOstream::BINARY, and format().

Foam::Ostream & writeUndef ( )

write undef value

Definition at line 214 of file ensightFile.C.

Referenced by ensightPart::writeFieldList().

Foam::Ostream & write ( const string value)
virtual

write string as "%80s" or as binary

Reimplemented from OSstream.

Definition at line 98 of file ensightFile.C.

References IOstream::BINARY, and format().

Foam::Ostream & write ( const label &  value)

write integer as "%10d" or as binary

Definition at line 135 of file ensightFile.C.

References IOstream::BINARY, and format().

Foam::Ostream & write ( const label &  value,
const label  fieldWidth 
)

write integer with specified width or as binary

Definition at line 158 of file ensightFile.C.

References IOstream::BINARY, and format().

Foam::Ostream & write ( const scalar &  value)

write float as "%12.5e" or as binary

Definition at line 183 of file ensightFile.C.

References IOstream::BINARY, and format().

void newline ( )

Add carriage return to ascii stream.

Definition at line 205 of file ensightFile.C.

References IOstream::ASCII, format(), and Foam::nl.

Referenced by ensightPart::writeFieldList(), ensightPart::writeGeometry(), and ensightPart::writeHeader().


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