Loading...
Searching...
No Matches
vtmWriter Class Reference

Provides a means of accumulating file entries for generating a vtkMultiBlockDataSet (.vtm) file. More...

#include <foamVtmWriter.H>

Public Member Functions

 vtmWriter ()
 Default construct, with autoName on.
 vtmWriter (bool autoName)
 Construct with specified behaviour for autoName.
 ~vtmWriter ()=default
 Destructor.
bool empty () const
 If there are no data sets.
label size () const
 The number of data sets.
void clear ()
 Clear all entries and reset output.
void setTime (scalar timeValue)
 Define "TimeValue" for FieldData (name as per Catalyst output).
void setTime (const Time &t)
 Define "TimeValue" for FieldData (name as per Catalyst output).
label beginBlock (const word &blockName=word::null)
 Start a new block, optionally with a name.
label endBlock (const word &blockName=word::null)
 End the previous block, optionally with name checking.
bool append (const fileName &file)
 Add a file. The name is either empty or created with autoName.
bool append (const word &name, const fileName &file)
 Add a file with name.
bool append (const fileName &file, vtk::fileTag contentType)
 Add a file with given contentType extension The name is either empty or created with autoName.
bool append (const word &name, const fileName &file, vtk::fileTag contentType)
 Add a file with name, with given contentType extension.
bool append_poly (const fileName &file)
 Add a PolyData (.vtp) file.
bool append_poly (const word &name, const fileName &file)
 Add a PolyData (.vtp) file with name.
bool append_ugrid (const fileName &file)
 Add an UnstructuredGrid (.vtu) file.
bool append_ugrid (const word &name, const fileName &file)
 Add an UnstructuredGrid (.vtu) file with name.
template<vtk::fileTag DataType = vtk::fileTag::VTK_HDF>
bool append_hdf (const fileName &file)
 Add a (.vtkhdf) file. Often need to specify the content type as well (PolyData, UnstructuredGrid).
template<vtk::fileTag DataType = vtk::fileTag::VTK_HDF>
bool append_hdf (const word &name, const fileName &file)
 Add a (.vtkhdf) file with name. Often need to specify content type as well (PolyData, UnstructuredGrid).
void repair (bool collapse=false)
 Sanity fixes on the data.
void add (const word &blockName, const vtmWriter &other)
 Add in content from another vtm and place under the given block name.
void add (const word &blockName, const fileName &prefix, const vtmWriter &other)
 Add in content from another vtm and place under the given block name. Adjust the added 'file' entries to include the given prefix.
label write_xml (std::ostream &os) const
 Write the blocks and TimeValue (xml format).
label write_xml (OSstream &os) const
 Write the blocks and TimeValue (xml format).
label write_xml (const fileName &file) const
 Open file for writing (creates parent directory) and write the blocks and TimeValue.
label write (const fileName &file) const
 Forwards to write_xml().
void dump (Ostream &os) const
 Print debug view of block and dataset contents.
bool append_vtp (const fileName &file)
 Same as append_poly - used until (2025-12).
bool append_vtu (const fileName &file)
 Same as append_ugrid - used until (2025-12).
bool append_vtp (const word &name, const fileName &file)
 Same as append_poly - used until (2025-12).
bool append_vtu (const word &name, const fileName &file)
 Same as append_ugrid - used until (2025-12).

Static Public Member Functions

static word ext ()
 File extension (always "vtm").

Detailed Description

Provides a means of accumulating file entries for generating a vtkMultiBlockDataSet (.vtm) file.

For example, to generate the following content:

<?xml version='1.0'?>
<VTKFile type='vtkMultiBlockDataSet' ...>
  <vtkMultiBlockDataSet>
    <DataSet name='internal' file='internal.vtu' />
    <Block name='boundary'>
      <DataSet name='inlet' file='boundary/inlet.vtp' />
      <DataSet name='outlet' file='boundary/outlet.vtp' />
    </Block>
  </vtkMultiBlockDataSet>
  <FieldData>
    <DataArray type='Float32' Name='TimeValue' ...>
       12.345
    </DataArray>
  </FieldData>
</VTKFile>

The following code would be used:

vtm.clear();
vtm.setTime(12.345);
vtm.append("internal", "internal.vtu");
vtm.beginBlock("boundary");
vtm.append("boundary/inlet.vtp");
vtm.append("boundary/outlet.vtp");
vtm.write("outputName");
Source files

Definition at line 90 of file foamVtmWriter.H.

Constructor & Destructor Documentation

◆ vtmWriter() [1/2]

vtmWriter ( )

Default construct, with autoName on.

Referenced by add(), and add().

Here is the caller graph for this function:

◆ vtmWriter() [2/2]

vtmWriter ( bool autoName)
explicit

Construct with specified behaviour for autoName.

◆ ~vtmWriter()

~vtmWriter ( )
default

Destructor.

Member Function Documentation

◆ ext()

Foam::word ext ( )
inlinestatic

File extension (always "vtm").

Definition at line 50 of file foamVtmWriterI.H.

References Foam::vtk::fileExtension, and Foam::vtk::MULTI_BLOCK.

◆ empty()

bool empty ( ) const

If there are no data sets.

◆ size()

label size ( ) const

The number of data sets.

◆ clear()

void clear ( )

Clear all entries and reset output.

◆ setTime() [1/2]

void setTime ( scalar timeValue)

Define "TimeValue" for FieldData (name as per Catalyst output).

◆ setTime() [2/2]

void setTime ( const Time & t)

Define "TimeValue" for FieldData (name as per Catalyst output).

◆ beginBlock()

label beginBlock ( const word & blockName = word::null)

Start a new block, optionally with a name.

Returns
block depth

References word::null.

◆ endBlock()

label endBlock ( const word & blockName = word::null)

End the previous block, optionally with name checking.

Returns
block depth

References word::null.

◆ append() [1/4]

bool append ( const fileName & file)

Add a file. The name is either empty or created with autoName.

Returns
True if file is non-empty

◆ append() [2/4]

bool append ( const word & name,
const fileName & file )

Add a file with name.

Returns
True if file is non-empty

References Foam::name().

Here is the call graph for this function:

◆ append() [3/4]

bool append ( const fileName & file,
vtk::fileTag contentType )

Add a file with given contentType extension The name is either empty or created with autoName.

Returns
True if file is non-empty

◆ append() [4/4]

bool append ( const word & name,
const fileName & file,
vtk::fileTag contentType )

Add a file with name, with given contentType extension.

Returns
True if file is non-empty

References Foam::name().

Here is the call graph for this function:

◆ append_poly() [1/2]

bool append_poly ( const fileName & file)
inline

Add a PolyData (.vtp) file.

Returns
True if file is non-empty

Definition at line 56 of file foamVtmWriterI.H.

Referenced by append_vtp(), and append_vtp().

Here is the caller graph for this function:

◆ append_poly() [2/2]

bool append_poly ( const word & name,
const fileName & file )
inline

Add a PolyData (.vtp) file with name.

Returns
True if file is non-empty

Definition at line 62 of file foamVtmWriterI.H.

References Foam::name().

Here is the call graph for this function:

◆ append_ugrid() [1/2]

bool append_ugrid ( const fileName & file)
inline

Add an UnstructuredGrid (.vtu) file.

Returns
True if file is non-empty

Definition at line 72 of file foamVtmWriterI.H.

Referenced by append_vtu(), and append_vtu().

Here is the caller graph for this function:

◆ append_ugrid() [2/2]

bool append_ugrid ( const word & name,
const fileName & file )
inline

Add an UnstructuredGrid (.vtu) file with name.

Returns
True if file is non-empty

Definition at line 78 of file foamVtmWriterI.H.

References Foam::name().

Here is the call graph for this function:

◆ append_hdf() [1/2]

template<Foam::vtk::fileTag DataType>
bool append_hdf ( const fileName & file)
inline

Add a (.vtkhdf) file. Often need to specify the content type as well (PolyData, UnstructuredGrid).

Returns
True if file is non-empty

Definition at line 89 of file foamVtmWriterI.H.

◆ append_hdf() [2/2]

template<Foam::vtk::fileTag DataType>
bool append_hdf ( const word & name,
const fileName & file )
inline

Add a (.vtkhdf) file with name. Often need to specify content type as well (PolyData, UnstructuredGrid).

Returns
True if file is non-empty

Definition at line 96 of file foamVtmWriterI.H.

References Foam::name().

Here is the call graph for this function:

◆ repair()

void repair ( bool collapse = false)

Sanity fixes on the data.

◆ add() [1/2]

void add ( const word & blockName,
const vtmWriter & other )

Add in content from another vtm and place under the given block name.

References vtmWriter().

Here is the call graph for this function:

◆ add() [2/2]

void add ( const word & blockName,
const fileName & prefix,
const vtmWriter & other )

Add in content from another vtm and place under the given block name. Adjust the added 'file' entries to include the given prefix.

References vtmWriter().

Here is the call graph for this function:

◆ write_xml() [1/3]

label write_xml ( std::ostream & os) const

Write the blocks and TimeValue (xml format).

Returns
number of data sets

References os().

Here is the call graph for this function:

◆ write_xml() [2/3]

label write_xml ( OSstream & os) const

Write the blocks and TimeValue (xml format).

Returns
number of data sets

References os().

Here is the call graph for this function:

◆ write_xml() [3/3]

label write_xml ( const fileName & file) const

Open file for writing (creates parent directory) and write the blocks and TimeValue.

The file name is with/without an extension.

Returns
number of data sets

◆ write()

label write ( const fileName & file) const

Forwards to write_xml().

Returns
number of data sets

◆ dump()

void dump ( Ostream & os) const

Print debug view of block and dataset contents.

References os().

Here is the call graph for this function:

◆ append_vtp() [1/2]

bool append_vtp ( const fileName & file)
inline

Same as append_poly - used until (2025-12).

Definition at line 536 of file foamVtmWriter.H.

References append_poly().

Here is the call graph for this function:

◆ append_vtu() [1/2]

bool append_vtu ( const fileName & file)
inline

Same as append_ugrid - used until (2025-12).

Definition at line 541 of file foamVtmWriter.H.

References append_ugrid().

Here is the call graph for this function:

◆ append_vtp() [2/2]

bool append_vtp ( const word & name,
const fileName & file )
inline

Same as append_poly - used until (2025-12).

Definition at line 546 of file foamVtmWriter.H.

References append_poly(), and Foam::name().

Here is the call graph for this function:

◆ append_vtu() [2/2]

bool append_vtu ( const word & name,
const fileName & file )
inline

Same as append_ugrid - used until (2025-12).

Definition at line 554 of file foamVtmWriter.H.

References append_ugrid(), and Foam::name().

Here is the call graph for this function:

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