dune-grid  2.1.1
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
Dune::VTKSequenceWriter< GridView > Class Template Reference

Writer for the ouput of grid functions in the vtk format.Writes arbitrary grid functions (living on cells or vertices of a grid) to a file suitable for easy visualization with The Visualization Toolkit (VTK). More...

#include <dune/grid/io/file/vtk/vtksequencewriter.hh>

Inheritance diagram for Dune::VTKSequenceWriter< GridView >:
Inheritance graph

List of all members.

Public Types

typedef Dune::VTKFunction< Grid > VTKFunction
typedef shared_ptr
< Dune::VTKFunction< Grid > > 
VTKFunctionPtr

Public Member Functions

 VTKSequenceWriter (const GridView &gridView, const std::string &name, const std::string &path, const std::string &extendpath, VTK::DataMode dm=VTK::conforming)
 ~VTKSequenceWriter ()
void write (double time, VTK::OutputType ot=VTK::ascii)
void addCellData (const VTKFunctionPtr &p)
 Add a grid function that lives on the cells of the grid to the visualization.
void addCellData (VTKFunction *p)
 Add a grid function that lives on the cells of the grid to the visualization.
template<class V >
void addCellData (const V &v, const std::string &name, int ncomps=1)
 Add a grid function (represented by container) that lives on the cells of the grid to the visualization.
void addVertexData (VTKFunction *p)
 Add a grid function that lives on the vertices of the grid to the visualization.
void addVertexData (const VTKFunctionPtr &p)
 Add a grid function that lives on the vertices of the grid to the visualization.
template<class V >
void addVertexData (const V &v, const std::string &name, int ncomps=1)
 Add a grid function (represented by container) that lives on the vertices of the grid to the visualization output.
void clear ()
 clear list of registered functions
std::string write (const std::string &name, VTK::OutputType type=VTK::ascii)
 write output (interface might change later)
std::string pwrite (const std::string &name, const std::string &path, const std::string &extendpath, VTK::OutputType type=VTK::ascii)
 write output (interface might change later)

Protected Types

typedef std::list
< VTKFunctionPtr >
::const_iterator 
FunctionIterator

Protected Member Functions

CellIterator cellBegin () const
CellIterator cellEnd () const
VertexIterator vertexBegin () const
VertexIterator vertexEnd () const
CornerIterator cornerBegin () const
CornerIterator cornerEnd () const
std::string write (const std::string &name, VTK::OutputType type, const int commRank, const int commSize)
 write output (interface might change later)
std::string pwrite (const std::string &name, const std::string &path, const std::string &extendpath, VTK::OutputType ot, const int commRank, const int commSize)
 write output; interface might change later
std::string getParallelPieceName (const std::string &name, const std::string &path, int commRank, int commSize) const
 return name of a parallel piece file
std::string getParallelHeaderName (const std::string &name, const std::string &path, int commSize) const
 return name of a parallel header file
std::string getSerialPieceName (const std::string &name, const std::string &path) const
 return name of a serial piece file
std::string getFormatString () const
std::string getTypeString () const
virtual void countEntities (int &nvertices, int &ncells, int &ncorners)
 count the vertices, cells and corners
virtual void writeCellData (VTK::VTUWriter &writer)
 write cell data
virtual void writeVertexData (VTK::VTUWriter &writer)
 write vertex data
virtual void writeGridPoints (VTK::VTUWriter &writer)
 write the positions of vertices
virtual void writeGridCells (VTK::VTUWriter &writer)
 write the connectivity array

Protected Attributes

std::list< VTKFunctionPtrcelldata
std::list< VTKFunctionPtrvertexdata
int ncells
int nvertices
int ncorners
VTK::OutputType outputtype

Detailed Description

template<class GridView>
class Dune::VTKSequenceWriter< GridView >

Writer for the ouput of grid functions in the vtk format.

Writes arbitrary grid functions (living on cells or vertices of a grid) to a file suitable for easy visualization with The Visualization Toolkit (VTK).


Member Typedef Documentation

template<class GridView>
typedef std::list<VTKFunctionPtr>::const_iterator Dune::VTKWriter< GridView >::FunctionIterator [protected, inherited]
template<class GridView>
typedef Dune::VTKFunction<Grid> Dune::VTKWriter< GridView >::VTKFunction [inherited]
template<class GridView>
typedef shared_ptr< Dune::VTKFunction<Grid> > Dune::VTKWriter< GridView >::VTKFunctionPtr [inherited]

Constructor & Destructor Documentation

template<class GridView >
Dune::VTKSequenceWriter< GridView >::VTKSequenceWriter ( const GridView gridView,
const std::string &  name,
const std::string &  path,
const std::string &  extendpath,
VTK::DataMode  dm = VTK::conforming 
) [inline, explicit]
template<class GridView >
Dune::VTKSequenceWriter< GridView >::~VTKSequenceWriter ( ) [inline]

Member Function Documentation

template<class GridView>
void Dune::VTKWriter< GridView >::addCellData ( const VTKFunctionPtr p) [inline, inherited]

Add a grid function that lives on the cells of the grid to the visualization.

Parameters:
pDune::shared_ptr to the function to visualize
template<class GridView>
void Dune::VTKWriter< GridView >::addCellData ( VTKFunction p) [inline, inherited]

Add a grid function that lives on the cells of the grid to the visualization.

Parameters:
pThe function to visualize. The VTKWriter object will take ownership of the VTKFunction *p and delete it when it's done.
template<class GridView>
template<class V >
void Dune::VTKWriter< GridView >::addCellData ( const V &  v,
const std::string &  name,
int  ncomps = 1 
) [inline, inherited]

Add a grid function (represented by container) that lives on the cells of the grid to the visualization.

The container has to have random access via operator[] (e. g. std::vector). The value of the grid function for an arbitrary element will be accessed by calling operator[] with the index (corresponding with the grid view) of the element. For vector valued data all components for an element are assumed to be consecutive.

Parameters:
vThe container with the values of the grid function for each cell.
nameA name to identify the grid function.
ncompsNumber of components (default is 1).
template<class GridView>
void Dune::VTKWriter< GridView >::addVertexData ( VTKFunction p) [inline, inherited]

Add a grid function that lives on the vertices of the grid to the visualization.

Parameters:
pThe function to visualize. The VTKWriter object will take ownership of the VTKFunction *p and delete it when it's done.
template<class GridView>
void Dune::VTKWriter< GridView >::addVertexData ( const VTKFunctionPtr p) [inline, inherited]

Add a grid function that lives on the vertices of the grid to the visualization.

Parameters:
pDune::shared_ptr to the function to visualize
template<class GridView>
template<class V >
void Dune::VTKWriter< GridView >::addVertexData ( const V &  v,
const std::string &  name,
int  ncomps = 1 
) [inline, inherited]

Add a grid function (represented by container) that lives on the vertices of the grid to the visualization output.

The container has to have random access via operator[] (e. g. std::vector). The value of the grid function for an arbitrary element will be accessed by calling operator[] with the index (corresponding to the grid view) of the vertex. For vector valued data all components for a vertex are assumed to be consecutive.

Parameters:
vThe container with the values of the grid function for each cell.
nameA name to identify the grid function.
ncompsNumber of components (default is 1).
template<class GridView>
CellIterator Dune::VTKWriter< GridView >::cellBegin ( ) const [inline, protected, inherited]
template<class GridView>
CellIterator Dune::VTKWriter< GridView >::cellEnd ( ) const [inline, protected, inherited]
template<class GridView>
void Dune::VTKWriter< GridView >::clear ( ) [inline, inherited]

clear list of registered functions

Referenced by Dune::VTKWriter< Grid::LeafGridView >::~VTKWriter().

template<class GridView>
CornerIterator Dune::VTKWriter< GridView >::cornerBegin ( ) const [inline, protected, inherited]
template<class GridView>
CornerIterator Dune::VTKWriter< GridView >::cornerEnd ( ) const [inline, protected, inherited]
template<class GridView>
virtual void Dune::VTKWriter< GridView >::countEntities ( int &  nvertices,
int &  ncells,
int &  ncorners 
) [inline, protected, virtual, inherited]

count the vertices, cells and corners

Reimplemented in Dune::SubsamplingVTKWriter< GridView >.

template<class GridView>
std::string Dune::VTKWriter< GridView >::getFormatString ( ) const [inline, protected, inherited]
template<class GridView>
std::string Dune::VTKWriter< GridView >::getParallelHeaderName ( const std::string &  name,
const std::string &  path,
int  commSize 
) const [inline, protected, inherited]

return name of a parallel header file

Parameters:
nameBase name of the VTK output. This should be without any directory parts and without a filename extension.
pathDirectory part of the resulting header name. May be empty, in which case the resulting name will not have a directory part. If non-empty, may or may not have a trailing '/'. If a trailing slash is missing, one is appended implicitly.
commSizeNumber of processes writing a parallel vtk output.

Referenced by Dune::VTKWriter< Grid::LeafGridView >::pwrite().

template<class GridView>
std::string Dune::VTKWriter< GridView >::getParallelPieceName ( const std::string &  name,
const std::string &  path,
int  commRank,
int  commSize 
) const [inline, protected, inherited]

return name of a parallel piece file

Parameters:
nameBase name of the VTK output. This should be without any directory parts and without a filename extension.
pathDirectory part of the resulting piece name. May be empty, in which case the resulting name will not have a directory part. If non-empty, may or may not have a trailing '/'. If a trailing slash is missing, one is appended implicitly.
commRankRank of the process to generate a piece name for.
commSizeNumber of processes writing a parallel vtk output.

Referenced by Dune::VTKWriter< Grid::LeafGridView >::pwrite().

template<class GridView>
std::string Dune::VTKWriter< GridView >::getSerialPieceName ( const std::string &  name,
const std::string &  path 
) const [inline, protected, inherited]

return name of a serial piece file

This is similar to getParallelPieceName, but skips the prefixes for commSize ("s####:") and commRank ("p####:").

Parameters:
nameBase name of the VTK output. This should be without any directory parts and without a filename extension.
pathDirectory part of the resulting piece name. May be empty, in which case the resulting name will not have a directory part. If non-empty, may or may not have a trailing '/'. If a trailing slash is missing, one is appended implicitly.

Referenced by Dune::VTKWriter< Grid::LeafGridView >::write().

template<class GridView>
std::string Dune::VTKWriter< GridView >::getTypeString ( ) const [inline, protected, inherited]
template<class GridView>
std::string Dune::VTKWriter< GridView >::pwrite ( const std::string &  name,
const std::string &  path,
const std::string &  extendpath,
VTK::OutputType  type = VTK::ascii 
) [inline, inherited]

write output (interface might change later)

"pwrite" means "path write" (i.e. write somewhere else than the current directory). The "p" does not mean this method has a monopoly on parallel writing, the regular write(const std::string &, VTK::OutputType) method can do that just fine.

Parameters:
nameBase name of the output files. This should not contain any directory part and not filename extensions. It will be used both for each processes piece as well as the parallel collection file.
pathDirectory where to put the parallel collection (.pvtu/.pvtp) file. If it is relative, it is taken realtive to the current directory.
extendpathDirectory where to put the piece file (.vtu/.vtp) of this process. If it is relative, it is taken relative to the directory denoted by path.
typeHow to encode the data in the file.
Note:
Currently, extendpath may not be absolute unless path is absolute, because that would require the value of the current directory.
Exceptions:
NotImplementedExtendpath is absolute but path is relative.
IOErrorFailed to open a file.

Referenced by Dune::VTKWriter< Grid::LeafGridView >::pwrite(), Dune::VTKSequenceWriter< GridView >::write(), and Dune::VTKWriter< Grid::LeafGridView >::write().

template<class GridView>
std::string Dune::VTKWriter< GridView >::pwrite ( const std::string &  name,
const std::string &  path,
const std::string &  extendpath,
VTK::OutputType  ot,
const int  commRank,
const int  commSize 
) [inline, protected, inherited]

write output; interface might change later

Parameters:
nameBase name of the output files. This should not contain any directory part and not filename extensions. It will be used both for each processes piece as well as the parallel collection file.
pathDirectory where to put the parallel collection (.pvtu/.pvtp) file. If it is relative, it is taken realtive to the current directory.
extendpathDirectory where to put the piece file (.vtu/.vtp) of this process. If it is relative, it is taken relative to the directory denoted by path.
otHow to encode the data in the file.
commRankRank of the current process.
commSizeNumber of processes taking part in this write operation.
Note:
Currently, extendpath may not be absolute unless path is absolute, because that would require the value of the current directory.
Exceptions:
NotImplementedExtendpath is absolute but path is relative.
IOErrorFailed to open a file.
template<class GridView>
VertexIterator Dune::VTKWriter< GridView >::vertexBegin ( ) const [inline, protected, inherited]
template<class GridView>
VertexIterator Dune::VTKWriter< GridView >::vertexEnd ( ) const [inline, protected, inherited]
template<class GridView >
void Dune::VTKSequenceWriter< GridView >::write ( double  time,
VTK::OutputType  ot = VTK::ascii 
) [inline]
template<class GridView>
std::string Dune::VTKWriter< GridView >::write ( const std::string &  name,
VTK::OutputType  type = VTK::ascii 
) [inline, inherited]

write output (interface might change later)

This method can be used in parallel as well as in serial programs. For serial runs (commSize=1) it chooses other names without the "s####:p####:" prefix for the .vtu/.vtp files and omits writing of the .pvtu/pvtp file however. For parallel runs (commSize > 1) it is the same as a call to pwrite() with path="" and extendpath="".

Parameters:
[in]namebasic name to write (may not contain a path)
[in]typetype of output (e.g,, ASCII) (optional)

Referenced by Dune::VTKWriter< Grid::LeafGridView >::write().

template<class GridView>
std::string Dune::VTKWriter< GridView >::write ( const std::string &  name,
VTK::OutputType  type,
const int  commRank,
const int  commSize 
) [inline, protected, inherited]

write output (interface might change later)

This method can be used in parallel as well as in serial programs. For serial runs (commSize=1) it chooses other names without the "s####:p####:" prefix for the .vtu/.vtp files and omits writing of the .pvtu/pvtp file however. For parallel runs (commSize > 1) it is the same as a call to pwrite() with path="" and extendpath="".

Parameters:
nameBase name of the output files. This should not contain any directory part and no filename extensions.
typeHow to encode the data in the file.
commRankRank of the current process.
commSizeNumber of processes taking part in this write operation.
template<class GridView>
virtual void Dune::VTKWriter< GridView >::writeCellData ( VTK::VTUWriter writer) [inline, protected, virtual, inherited]

write cell data

Reimplemented in Dune::SubsamplingVTKWriter< GridView >.

template<class GridView>
virtual void Dune::VTKWriter< GridView >::writeGridCells ( VTK::VTUWriter writer) [inline, protected, virtual, inherited]

write the connectivity array

Reimplemented in Dune::SubsamplingVTKWriter< GridView >.

template<class GridView>
virtual void Dune::VTKWriter< GridView >::writeGridPoints ( VTK::VTUWriter writer) [inline, protected, virtual, inherited]

write the positions of vertices

Reimplemented in Dune::SubsamplingVTKWriter< GridView >.

template<class GridView>
virtual void Dune::VTKWriter< GridView >::writeVertexData ( VTK::VTUWriter writer) [inline, protected, virtual, inherited]

write vertex data

Reimplemented in Dune::SubsamplingVTKWriter< GridView >.


Member Data Documentation

template<class GridView>
std::list<VTKFunctionPtr> Dune::VTKWriter< GridView >::celldata [protected, inherited]
template<class GridView>
int Dune::VTKWriter< GridView >::ncells [protected, inherited]
template<class GridView>
int Dune::VTKWriter< GridView >::ncorners [protected, inherited]
template<class GridView>
int Dune::VTKWriter< GridView >::nvertices [protected, inherited]
template<class GridView>
VTK::OutputType Dune::VTKWriter< GridView >::outputtype [protected, inherited]
template<class GridView>
std::list<VTKFunctionPtr> Dune::VTKWriter< GridView >::vertexdata [protected, inherited]

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