legacyRawFormatter Class Reference

Binary output for the VTK legacy format, always written as big-endian and with 32-bit integers. More...

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

Public Member Functions

 legacyRawFormatter (std::ostream &os)
 Construct and attach to an output stream. More...
 
virtual ~legacyRawFormatter ()=default
 Destructor. More...
 
virtual const outputOptions & opts () const
 The output is LEGACY_BINARY. More...
 
virtual const char * name () const
 Name for the legacy binary output type ("BINARY") More...
 
virtual const char * encoding () const
 Name for the XML append encoding (unused) More...
 
virtual bool writeSize (const uint64_t ignored)
 Write leading size - a no-op for legacy binary output. More...
 
virtual void write (const uint8_t val)
 
virtual void write (const label val)
 
virtual void write (const float val)
 
virtual void write (const double val)
 
virtual void flush ()
 Write a newline to the output. More...
 
virtual formatter & endTag (vtk::fileTag)
 An end XML tag with sanity check. More...
 
virtual formatter & endDataArray ()
 End "DataArray" XML section. More...
 
virtual formatter & endFieldData ()
 End "FieldData" XML section. More...
 
virtual formatter & endCellData ()
 End "CellData" XML section. More...
 
virtual formatter & endPointData ()
 End "PointData" XML section. More...
 
virtual formatter & endPiece ()
 End "Piece" XML section. More...
 
virtual formatter & endVTKFile ()
 End "VTKFile" XML section. More...
 
- Public Member Functions inherited from formatter
virtual ~formatter ()=default
 Destructor. More...
 
std::ostream & os ()
 Access to the underlying output stream. More...
 
void quoting (const quoteChar quote)
 Change quoting char for XML attributes (default: SINGLE_QUOTE) More...
 
virtual uint64_t offset (const uint64_t numbytes)
 Increase the append data offset by numbytes and sizeof(uint64_t). More...
 
virtual std::size_t encodedLength (std::size_t n) const
 The encoded length for binary output is pass-through. More...
 
void indent ()
 Add indenting according to the current XML tag depth. More...
 
void indent (label n)
 Add indenting of n spaces. More...
 
formatter & xmlHeader ()
 Write XML header. More...
 
template<class... Args>
formatter & xmlComment (const std::string &text, Args &&... args)
 Write XML comment (at the current indentation level) More...
 
template<class... Args>
formatter & openTag (const word &tagName, Args &&... args)
 Start an XML tag, optionally with attributes. More...
 
template<class... Args>
formatter & openTag (vtk::fileTag t, Args &&... args)
 Start an XML tag, optionally with attributes. More...
 
formatter & closeTag (const bool isEmpty=false)
 Finish an XML tag, optional as an empty container. More...
 
formatter & endTag (const word &tagName=word::null)
 An end XML tag, optional with sanity check. More...
 
template<class... Args>
formatter & tag (const word &t, Args &&... args)
 Write XML tag without any attributes. Combines openTag/closeTag. More...
 
template<class... Args>
formatter & tag (vtk::fileTag t, Args &&... args)
 Write XML tag without any attributes. Combines openTag/closeTag. More...
 
formatter & beginVTKFile (const word &contentType, const word &contentVersion, const bool leaveOpen=false)
 
formatter & beginVTKFile (vtk::fileTag contentType, const word &contentVersion, const bool leaveOpen=false)
 
formatter & beginVTKFile (vtk::fileTag contentType, const bool leaveOpen=false)
 
template<vtk::fileTag ContentType>
formatter & beginVTKFile (bool leaveOpen=false)
 
formatter & beginAppendedData ()
 
formatter & beginBlock (label index, std::string name="")
 Begin "Block" XML section. More...
 
formatter & endBlock ()
 End "Block" XML section. More...
 
formatter & beginPiece (label index, std::string name="")
 Begin "Piece" XML section. More...
 
formatter & DataSet (label index, std::string file="", bool autoName=true)
 Insert a single "DataSet" XML entry tag. More...
 
formatter & DataSet (label index, std::string file, std::string name)
 Insert a single "DataSet" XML entry tag. More...
 
template<class Type , direction nComp = 1, int nTuple = 0>
formatter & beginDataArray (const word &dataName, uint64_t payLoad=npos, bool leaveOpen=false)
 Begin "DataArray" XML section. More...
 
template<class Type , direction nComp = 1, int nTuple = 0>
formatter & beginDataArray (const vtk::dataArrayAttr &dataName, uint64_t payLoad=npos, bool leaveOpen=false)
 Begin "DataArray" XML section. More...
 
template<class Type , direction nComp = 1, int nTuple = 0>
formatter & PDataArray (const word &dataName)
 Insert a single "PDataArray" XML entry tag. More...
 
formatter & beginFieldData ()
 Begin "FieldData" XML section. More...
 
formatter & beginCellData ()
 Begin "CellData" XML section. More...
 
formatter & beginPointData ()
 Begin "PointData" XML section. More...
 
formatter & endAppendedData ()
 End "AppendedData" XML section. More...
 
formatter & writeTimeValue (scalar timeValue)
 Emit "TimeValue" for FieldData (name as per Catalyst output) More...
 
template<class... Args>
formatter & xmlAttr (const word &k, const std::string &v, Args &&... args)
 Pair-wise write of XML key/value attributes. More...
 
template<class... Args>
formatter & xmlAttr (const word &k, const int32_t v, Args &&... args)
 Pair-wise write of XML key/value attributes. More...
 
template<class... Args>
formatter & xmlAttr (const word &k, const int64_t v, Args &&... args)
 Pair-wise write of XML key/value attributes. More...
 
template<class... Args>
formatter & xmlAttr (const word &k, const uint64_t v, Args &&... args)
 Pair-wise write of XML key/value attributes. More...
 
template<class... Args>
formatter & xmlAttr (const word &k, const scalar v, Args &&... args)
 Pair-wise write of XML key/value attributes. More...
 
template<class... Args>
formatter & xmlAttr (const vtk::fileAttr &k, const std::string &v, Args &&... args)
 Pair-wise write of XML key/value attributes. More...
 
template<class... Args>
formatter & xmlAttr (const vtk::fileAttr &k, const int32_t v, Args &&... args)
 Pair-wise write of XML key/value attributes. More...
 
template<class... Args>
formatter & xmlAttr (const vtk::fileAttr &k, const int64_t v, Args &&... args)
 Pair-wise write of XML key/value attributes. More...
 
template<class... Args>
formatter & xmlAttr (const vtk::fileAttr &k, const uint64_t v, Args &&... args)
 Pair-wise write of XML key/value attributes. More...
 
template<class... Args>
formatter & xmlAttr (const vtk::fileAttr &k, const scalar v, Args &&... args)
 Pair-wise write of XML key/value attributes. More...
 
template<class Type , direction nComp = 1, int nTuple = 0>
formatter & openDataArray (const word &dataName)
 Open "DataArray" XML tag and leave open (requires a closeTag). More...
 
template<class Type , direction nComp = 1, int nTuple = 0>
formatter & openDataArray (const vtk::dataArrayAttr &dataName)
 Open "DataArray" XML tag and leave open (requires a closeTag). More...
 
template<class... Args>
Foam::vtk::formatter & xmlComment (const std::string &text, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & openTag (const word &tagName, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & openTag (vtk::fileTag t, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & tag (const word &t, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & tag (vtk::fileTag t, Args &&... args)
 
template<Foam::vtk::fileTag ContentType>
Foam::vtk::formatter & beginVTKFile (bool leaveOpen)
 
template<class Type , Foam::direction nComp, int nTuple>
Foam::vtk::formatter & beginDataArray (const vtk::dataArrayAttr &dataName, uint64_t payLoad, bool leaveOpen)
 
template<class... Args>
Foam::vtk::formatter & xmlAttr (const word &k, const std::string &v, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & xmlAttr (const word &k, const int32_t v, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & xmlAttr (const word &k, const int64_t v, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & xmlAttr (const word &k, const uint64_t v, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & xmlAttr (const word &k, const scalar v, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & xmlAttr (const vtk::fileAttr &k, const std::string &v, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & xmlAttr (const vtk::fileAttr &k, const int32_t v, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & xmlAttr (const vtk::fileAttr &k, const int64_t v, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & xmlAttr (const vtk::fileAttr &k, const uint64_t v, Args &&... args)
 
template<class... Args>
Foam::vtk::formatter & xmlAttr (const vtk::fileAttr &k, const scalar v, Args &&... args)
 
template<class Type , Foam::direction nComp, int nTuple>
Foam::vtk::formatter & beginDataArray (const word &dataName, uint64_t payLoad, bool leaveOpen)
 
template<class Type , Foam::direction nComp, int nTuple>
Foam::vtk::formatter & PDataArray (const word &dataName)
 

Protected Member Functions

void write (const char *s, std::streamsize n)
 Write. More...
 
- Protected Member Functions inherited from formatter
bool canWriteAttr (const word &k) const
 
bool canWriteToplevel (const char *what) const
 
template<class Type >
void writeAttr (const word &k, const Type &v)
 Write XML key/value attribute pair (implementation). More...
 
formatter & xmlAttr ()
 No-op write XML attribute (for templating code). More...
 
void xmlCommentLoop ()
 No-op XML comment loop (for templating code). More...
 
template<class... Args>
void xmlCommentLoop (const std::string &text, Args &&... args)
 Loop/output XML comments. More...
 
bool openTagImpl (const word &tagName)
 
 formatter (std::ostream &os)
 Construct and attach to an output stream. More...
 

Additional Inherited Members

- Public Types inherited from formatter
enum  quoteChar : char { DOUBLE_QUOTE = '\"', SINGLE_QUOTE = '\'' }
 Quoting for XML attributes. More...
 
typedef uint64_t headerType
 The header data is vtk UInt64. More...
 
- Static Public Attributes inherited from formatter
static constexpr uint64_t npos = uint64_t(-1)
 Out of range position or size. More...
 
- Protected Attributes inherited from formatter
std::ostream & os_
 The output stream for the formatter. More...
 
DynamicList< word > xmlTags_
 LIFO stack of current XML tags. More...
 
bool inTag_
 Tag open/closed/ended state. More...
 
char quote_
 Quoting character for XML attributes. More...
 

Detailed Description

Binary output for the VTK legacy format, always written as big-endian and with 32-bit integers.

This format should never be used for OpenFOAM with 64-bit label sizes.

Source files

Definition at line 55 of file foamVtkLegacyRawFormatter.H.

Constructor & Destructor Documentation

◆ legacyRawFormatter()

legacyRawFormatter ( std::ostream &  os)

Construct and attach to an output stream.

Definition at line 56 of file foamVtkLegacyRawFormatter.C.

◆ ~legacyRawFormatter()

virtual ~legacyRawFormatter ( )
virtualdefault

Destructor.

Member Function Documentation

◆ write() [1/5]

void write ( const char *  s,
std::streamsize  n 
)
protected

Write.

Definition at line 44 of file foamVtkLegacyRawFormatter.C.

References n, and s.

◆ opts()

const Foam::vtk::outputOptions & opts ( ) const
virtual

The output is LEGACY_BINARY.

Implements formatter.

Definition at line 67 of file foamVtkLegacyRawFormatter.C.

◆ name()

const char * name ( ) const
virtual

Name for the legacy binary output type ("BINARY")

Implements formatter.

Definition at line 73 of file foamVtkLegacyRawFormatter.C.

◆ encoding()

const char * encoding ( ) const
virtual

Name for the XML append encoding (unused)

Currently identical to name(), but do not rely on this.

Implements formatter.

Definition at line 79 of file foamVtkLegacyRawFormatter.C.

◆ writeSize()

bool writeSize ( const uint64_t  ignored)
virtual

Write leading size - a no-op for legacy binary output.

Returns
False - never used by this format

Implements formatter.

Definition at line 85 of file foamVtkLegacyRawFormatter.C.

◆ write() [2/5]

void write ( const uint8_t  val)
virtual

Implements formatter.

Definition at line 92 of file foamVtkLegacyRawFormatter.C.

References Foam::vtk::write().

Here is the call graph for this function:

◆ write() [3/5]

void write ( const label  val)
virtual

Implements formatter.

Definition at line 103 of file foamVtkLegacyRawFormatter.C.

References endian::swap32(), endian::swap64(), Foam::vtk::write(), and legacyRawFormatter::write().

Referenced by legacyRawFormatter::write().

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

◆ write() [4/5]

void write ( const float  val)
virtual

Implements formatter.

Definition at line 123 of file foamVtkLegacyRawFormatter.C.

References endian::swap32(), and Foam::vtk::write().

Here is the call graph for this function:

◆ write() [5/5]

void write ( const double  val)
virtual

Implements formatter.

Definition at line 141 of file foamVtkLegacyRawFormatter.C.

References Foam::max(), and Foam::vtk::write().

Here is the call graph for this function:

◆ flush()

void flush ( )
virtual

Write a newline to the output.

Implements formatter.

Definition at line 163 of file foamVtkLegacyRawFormatter.C.

◆ endTag()

virtual formatter& endTag ( vtk::fileTag  t)
inlinevirtual

An end XML tag with sanity check.

Always adds a trailing newline.

Returns
formatter for chaining

Reimplemented from formatter.

Definition at line 122 of file foamVtkLegacyRawFormatter.H.

◆ endDataArray()

virtual formatter& endDataArray ( )
inlinevirtual

End "DataArray" XML section.

Returns
formatter for chaining

Reimplemented from formatter.

Definition at line 123 of file foamVtkLegacyRawFormatter.H.

◆ endFieldData()

virtual formatter& endFieldData ( )
inlinevirtual

End "FieldData" XML section.

Reimplemented from formatter.

Definition at line 124 of file foamVtkLegacyRawFormatter.H.

◆ endCellData()

virtual formatter& endCellData ( )
inlinevirtual

End "CellData" XML section.

Reimplemented from formatter.

Definition at line 125 of file foamVtkLegacyRawFormatter.H.

◆ endPointData()

virtual formatter& endPointData ( )
inlinevirtual

End "PointData" XML section.

Reimplemented from formatter.

Definition at line 126 of file foamVtkLegacyRawFormatter.H.

◆ endPiece()

virtual formatter& endPiece ( )
inlinevirtual

End "Piece" XML section.

Returns
formatter for chaining

Reimplemented from formatter.

Definition at line 127 of file foamVtkLegacyRawFormatter.H.

◆ endVTKFile()

virtual formatter& endVTKFile ( )
inlinevirtual

End "VTKFile" XML section.

Returns
formatter for chaining

Reimplemented from formatter.

Definition at line 128 of file foamVtkLegacyRawFormatter.H.


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