BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Types | Public Member Functions | Private Member Functions | List of all members
Bempp::VtkWriter Class Referenceabstract

Abstract exporter of data in the vtk format. More...

#include </home/wojtek/Projects/BEM/bempp-sven/bempp/lib/grid/vtk_writer.hpp>

Inheritance diagram for Bempp::VtkWriter:
Bempp::ConcreteVtkWriter< DuneGridView >

Public Types

enum  OutputType { ASCII, BASE_64, APPENDED_RAW, APPENDED_BASE_64 }
 How data should be stored in a VTK file. More...
 
enum  DataType { CELL_DATA, VERTEX_DATA }
 Dataset type.
 

Public Member Functions

virtual ~VtkWriter ()
 Destructor.
 
void addCellData (const arma::Mat< double > &data, const std::string &name)
 Add a grid function (represented by a container) that lives on the cells of the grid to the visualization output. More...
 
void addCellData (const arma::Mat< float > &data, const std::string &name)
 
void addVertexData (const arma::Mat< double > &data, const std::string &name)
 Add a grid function (represented by a container) that lives on the vertices of the grid to the visualization output. More...
 
void addVertexData (const arma::Mat< float > &data, const std::string &name)
 
virtual void clear ()=0
 Clear the list of registered functions.
 
virtual std::string write (const std::string &name, OutputType type=ASCII)=0
 Write output (interface might change later). More...
 
virtual std::string pwrite (const std::string &name, const std::string &path, const std::string &extendpath, OutputType type=ASCII)=0
 Write output (interface might change later). More...
 

Private Member Functions

virtual void addCellDataDoubleImpl (const arma::Mat< double > &data, const std::string &name)=0
 
virtual void addCellDataFloatImpl (const arma::Mat< float > &data, const std::string &name)=0
 
virtual void addVertexDataDoubleImpl (const arma::Mat< double > &data, const std::string &name)=0
 
virtual void addVertexDataFloatImpl (const arma::Mat< float > &data, const std::string &name)=0
 

Detailed Description

Abstract exporter of data in the vtk format.

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

Instances of concrete subclasses of this class can be created by GridView::vtkWriter().

Member Enumeration Documentation

How data should be stored in a VTK file.

Enumerator
ASCII 

Output to the file is in ascii.

BASE_64 

Output to the file is in inline base64 binary.

APPENDED_RAW 

Output to the file is in appended raw binary.

APPENDED_BASE_64 

Output to the file is in appended base64 binary.

Member Function Documentation

void Bempp::VtkWriter::addCellData ( const arma::Mat< double > &  data,
const std::string &  name 
)
inline

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

Parameters
dataMatrix whose (m, n)th entry contains the value of the mth component of the grid function in the nth cell.
nameName to identify the grid function.
void Bempp::VtkWriter::addCellData ( const arma::Mat< float > &  data,
const std::string &  name 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void Bempp::VtkWriter::addVertexData ( const arma::Mat< double > &  data,
const std::string &  name 
)
inline

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

Parameters
dataMatrix whose (m, n)th entry contains the value of the mth component of the grid function at the nth vertex.
nameName to identify the grid function.
void Bempp::VtkWriter::addVertexData ( const arma::Mat< float > &  data,
const std::string &  name 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

virtual std::string Bempp::VtkWriter::pwrite ( const std::string &  name,
const std::string &  path,
const std::string &  extendpath,
OutputType  type = ASCII 
)
pure virtual

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 &, OutputType) method can do that just fine.

Parameters
nameBase name of the output files. This should not contain any directory part or filename extensions. It will be used both for the piece file of each process and the parallel collection file.
pathDirectory where to put the parallel collection (.pvtu/.pvtp) file. If it is relative, it is taken relative 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.
Returns
Name of the created file.
Note
Currently, extendpath may not be absolute unless path is absolute, because that would require the value of the current directory.
Exceptions
Dune::NotImplementedExtendpath is absolute but path is relative.
Dune::IOErrorFailed to open a file.

Implemented in Bempp::ConcreteVtkWriter< DuneGridView >.

virtual std::string Bempp::VtkWriter::write ( const std::string &  name,
OutputType  type = ASCII 
)
pure virtual

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).
Returns
Name of the created file.

Implemented in Bempp::ConcreteVtkWriter< DuneGridView >.


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