3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Classes | Public Types | Public Member Functions | List of all members
Dumux::VtkMultiWriter< GridView, OutputValue > Class Template Reference

Simplifies writing multi-file VTK datasets. More...

#include <dumux/io/vtkmultiwriter.hh>

Description

template<class GridView, Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
class Dumux::VtkMultiWriter< GridView, OutputValue >

Simplifies writing multi-file VTK datasets.

This class automatically keeps the meta file up to date and simplifies writing datasets consisting of multiple files. (i.e. multiple time steps or grid refinements within a time step.)

Todo:
This class can most likely be replaced by Dune::VTKSequenceWriter

Public Types

using VtkWriter = Dune::VTKWriter< GridView >
 

Public Member Functions

 VtkMultiWriter (const GridView &gridView, const std::string &simName="", std::string multiFileName="")
 
 ~VtkMultiWriter ()
 
int curWriterNum () const
 Returns the number of the current VTK file. More...
 
void gridChanged ()
 Updates the internal data structures after mesh refinement. More...
 
void beginWrite (double t)
 Called when ever a new time step or a new grid must be written. More...
 
template<class Scalar , int nComp>
Dune::BlockVector< Dune::FieldVector< Scalar, nComp > > * allocateManagedBuffer (int nEntities)
 Allocate a managed buffer for a scalar field. More...
 
template<class Scalar >
Dune::BlockVector< Dune::FieldVector< Scalar, 1 > > * allocateManagedBuffer (int nEntities)
 
Dune::BlockVector< Dune::FieldVector< double, 1 > > * allocateManagedBuffer (int nEntities)
 
template<class DataBuffer >
void attachVertexData (DataBuffer &buf, std::string name, int nComps=1)
 Add a finished vertex centered vector field to the output. More...
 
template<class DataBuffer >
void attachCellData (DataBuffer &buf, std::string name, int nComps=1)
 Add a cell centered quantity to the output. More...
 
template<class DataBuffer >
void attachDofData (DataBuffer &buf, std::string name, bool isVertexData, int nComps=1)
 Add data associated with degrees of freedom to the output. More...
 
void endWrite (bool onlyDiscard=false)
 Finalizes the current writer. More...
 
template<class Restarter >
void serialize (Restarter &res)
 Write the multi-writer's state to a restart file. More...
 
template<class Restarter >
void deserialize (Restarter &res)
 Read the multi-writer's state from a restart file. More...
 

Member Typedef Documentation

◆ VtkWriter

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
using Dumux::VtkMultiWriter< GridView, OutputValue >::VtkWriter = Dune::VTKWriter<GridView>

Constructor & Destructor Documentation

◆ VtkMultiWriter()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
Dumux::VtkMultiWriter< GridView, OutputValue >::VtkMultiWriter ( const GridView &  gridView,
const std::string &  simName = "",
std::string  multiFileName = "" 
)
inline

◆ ~VtkMultiWriter()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
Dumux::VtkMultiWriter< GridView, OutputValue >::~VtkMultiWriter ( )
inline

Member Function Documentation

◆ allocateManagedBuffer() [1/3]

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
template<class Scalar , int nComp>
Dune::BlockVector< Dune::FieldVector< Scalar, nComp > > * Dumux::VtkMultiWriter< GridView, OutputValue >::allocateManagedBuffer ( int  nEntities)
inline

Allocate a managed buffer for a scalar field.

The buffer will be deleted automatically after the data has been written by to disk.

◆ allocateManagedBuffer() [2/3]

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
template<class Scalar >
Dune::BlockVector< Dune::FieldVector< Scalar, 1 > > * Dumux::VtkMultiWriter< GridView, OutputValue >::allocateManagedBuffer ( int  nEntities)
inline

◆ allocateManagedBuffer() [3/3]

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
Dune::BlockVector< Dune::FieldVector< double, 1 > > * Dumux::VtkMultiWriter< GridView, OutputValue >::allocateManagedBuffer ( int  nEntities)
inline

◆ attachCellData()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
template<class DataBuffer >
void Dumux::VtkMultiWriter< GridView, OutputValue >::attachCellData ( DataBuffer &  buf,
std::string  name,
int  nComps = 1 
)
inline

Add a cell centered quantity to the output.

If the buffer is managed by the VtkMultiWriter, it must have been created using createField() and may not be used by anywhere after calling this method. After the data is written to disk, it will be deleted automatically.

If the buffer is not managed by the MultiWriter, the buffer must exist at least until the call to endWrite() finishes.

In both cases, modifying the buffer between the call to this method and endWrite() results in undefined behaviour.

◆ attachDofData()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
template<class DataBuffer >
void Dumux::VtkMultiWriter< GridView, OutputValue >::attachDofData ( DataBuffer &  buf,
std::string  name,
bool  isVertexData,
int  nComps = 1 
)
inline

Add data associated with degrees of freedom to the output.

This is a wrapper for the functions attachVertexData and attachCelldata. Depending on the value of isVertexData, the appropriate function is selected.

◆ attachVertexData()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
template<class DataBuffer >
void Dumux::VtkMultiWriter< GridView, OutputValue >::attachVertexData ( DataBuffer &  buf,
std::string  name,
int  nComps = 1 
)
inline

Add a finished vertex centered vector field to the output.

Add a vertex-centered quantity to the output.

If the buffer is managed by the VtkMultiWriter, it must have been created using createField() and may not be used by anywhere after calling this method. After the data is written to disk, it will be deleted automatically.

If the buffer is not managed by the MultiWriter, the buffer must exist at least until the call to endWrite() finishes.

In both cases, modifying the buffer between the call to this method and endWrite() results in undefined behaviour.

◆ beginWrite()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
void Dumux::VtkMultiWriter< GridView, OutputValue >::beginWrite ( double  t)
inline

Called when ever a new time step or a new grid must be written.

◆ curWriterNum()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
int Dumux::VtkMultiWriter< GridView, OutputValue >::curWriterNum ( ) const
inline

Returns the number of the current VTK file.

◆ deserialize()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
template<class Restarter >
void Dumux::VtkMultiWriter< GridView, OutputValue >::deserialize ( Restarter &  res)
inline

Read the multi-writer's state from a restart file.

◆ endWrite()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
void Dumux::VtkMultiWriter< GridView, OutputValue >::endWrite ( bool  onlyDiscard = false)
inline

Finalizes the current writer.

This means that everything will be written to disk, except if the onlyDiscard argument is true. In this case only all managed buffers are deleted, but no output is written.

◆ gridChanged()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
void Dumux::VtkMultiWriter< GridView, OutputValue >::gridChanged ( )
inline

Updates the internal data structures after mesh refinement.

If the grid changes between two calls of beginWrite(), this method must be called before the second beginWrite()!

◆ serialize()

template<class GridView , Dune::VTK::OutputType OutputValue = Dune::VTK::ascii>
template<class Restarter >
void Dumux::VtkMultiWriter< GridView, OutputValue >::serialize ( Restarter &  res)
inline

Write the multi-writer's state to a restart file.


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