dune-grid  2.4.1
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Dune::SubsamplingVTKWriter< GridView > Class Template Reference

Writer for the output of subsampled 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). In contrast to the regular VTKWriter, this Writer allows subsampling of the elements via VirtualRefinement. The SubSamplingVTKWriter always writes nonconforming data. More...

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

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

Public Types

typedef Dune::VTKFunction
< GridView
VTKFunction
 
typedef shared_ptr< const
VTKFunction
VTKFunctionPtr
 

Public Member Functions

 SubsamplingVTKWriter (const GridView &gridView, int level_, bool coerceToSimplex_=false)
 Construct a SubsamplingVTKWriter working on a specific GridView. More...
 
void addCellData (const VTKFunctionPtr &p)
 Add a grid function that lives on the cells of the grid to the visualization. More...
 
template<typename F >
void addCellData (F &&f, VTK::FieldInfo vtkFieldInfo)
 
void addCellData (VTKFunction *p)
 Add a grid function that lives on the cells of the grid to the visualization. More...
 
void addVertexData (VTKFunction *p)
 Add a grid function that lives on the vertices of the grid to the visualization. More...
 
void addVertexData (const VTKFunctionPtr &p)
 Add a grid function that lives on the vertices of the grid to the visualization. More...
 
template<typename F >
void addVertexData (F &&f, VTK::FieldInfo vtkFieldInfo)
 
void clear ()
 clear list of registered functions More...
 
std::string write (const std::string &name, VTK::OutputType type=VTK::ascii)
 write output (interface might change later) More...
 
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) More...
 

Protected Member Functions

virtual void countEntities (int &nvertices, int &ncells, int &ncorners)
 count the vertices, cells and corners More...
 
virtual void writeCellData (VTK::VTUWriter &writer)
 write cell data More...
 
virtual void writeVertexData (VTK::VTUWriter &writer)
 write vertex data More...
 
virtual void writeGridPoints (VTK::VTUWriter &writer)
 write the positions of vertices More...
 
virtual void writeGridCells (VTK::VTUWriter &writer)
 write the connectivity array More...
 
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) More...
 
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 More...
 
std::string getParallelPieceName (const std::string &name, const std::string &path, int commRank, int commSize) const
 return name of a parallel piece file More...
 
std::string getParallelHeaderName (const std::string &name, const std::string &path, int commSize) const
 return name of a parallel header file More...
 
std::string getSerialPieceName (const std::string &name, const std::string &path) const
 return name of a serial piece file More...
 
std::string getFormatString () const
 
std::string getTypeString () const
 
template<typename T >
std::tuple< std::string,
std::string > 
getDataNames (const T &data) const
 
template<typename Data , typename Iterator >
void writeData (VTK::VTUWriter &writer, const Data &data, const Iterator begin, const Iterator end, int nentries)
 

Protected Attributes

std::list< VTKLocalFunctioncelldata
 
std::list< VTKLocalFunctionvertexdata
 
GridView gridView_
 
int ncells
 
int nvertices
 
int ncorners
 
VTK::OutputType outputtype
 

Detailed Description

template<class GridView>
class Dune::SubsamplingVTKWriter< GridView >

Writer for the output of subsampled 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). In contrast to the regular VTKWriter, this Writer allows subsampling of the elements via VirtualRefinement. The SubSamplingVTKWriter always writes nonconforming data.

Member Typedef Documentation

template<class GridView>
typedef Dune::VTKFunction< GridView > Dune::VTKWriter< GridView >::VTKFunction
inherited
template<class GridView>
typedef shared_ptr< const VTKFunction > Dune::VTKWriter< GridView >::VTKFunctionPtr
inherited

Constructor & Destructor Documentation

template<class GridView >
Dune::SubsamplingVTKWriter< GridView >::SubsamplingVTKWriter ( const GridView gridView,
int  level_,
bool  coerceToSimplex_ = false 
)
inlineexplicit

Construct a SubsamplingVTKWriter working on a specific GridView.

Parameters
gridViewThe gridView the grid functions live on. (E. g. a LevelGridView.)
level_The level for the subrefinement.
coerceToSimplex_Set this to true to always triangulate elements into simplices, even where it's not necessary (i.e. for hypercubes).

The datamode is always nonconforming.

Member Function Documentation

template<class GridView>
void Dune::VTKWriter< GridView >::addCellData ( const VTKFunctionPtr p)
inlineinherited

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

Parameters
pDune::shared_ptr to the function to visualize

References Dune::VTKWriter< GridView >::celldata.

Referenced by Dune::VTKWriter< GridView >::addCellData().

template<class GridView>
template<typename F >
void Dune::VTKWriter< GridView >::addCellData ( F &&  f,
VTK::FieldInfo  vtkFieldInfo 
)
inlineinherited
template<class GridView>
void Dune::VTKWriter< GridView >::addCellData ( VTKFunction p)
inlineinherited

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.
Deprecated:
"Don't pass raw pointers, use the version with shared_ptr"

References Dune::VTKWriter< GridView >::celldata.

template<class GridView>
void Dune::VTKWriter< GridView >::addVertexData ( VTKFunction p)
inlineinherited

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.
Deprecated:
"Don't pass raw pointers, use the version with shared_ptr"

References Dune::VTKWriter< GridView >::vertexdata.

Referenced by Dune::VTKWriter< GridView >::addVertexData().

template<class GridView>
void Dune::VTKWriter< GridView >::addVertexData ( const VTKFunctionPtr p)
inlineinherited

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

Parameters
pDune::shared_ptr to the function to visualize

References Dune::VTKWriter< GridView >::vertexdata.

template<class GridView>
template<typename F >
void Dune::VTKWriter< GridView >::addVertexData ( F &&  f,
VTK::FieldInfo  vtkFieldInfo 
)
inlineinherited
template<class GridView>
CellIterator Dune::VTKWriter< GridView >::cellBegin ( ) const
inlineprotectedinherited
template<class GridView>
CellIterator Dune::VTKWriter< GridView >::cellEnd ( ) const
inlineprotectedinherited
template<class GridView>
void Dune::VTKWriter< GridView >::clear ( )
inlineinherited
template<class GridView>
CornerIterator Dune::VTKWriter< GridView >::cornerBegin ( ) const
inlineprotectedinherited
template<class GridView>
CornerIterator Dune::VTKWriter< GridView >::cornerEnd ( ) const
inlineprotectedinherited
template<class GridView >
void Dune::SubsamplingVTKWriter< GridView >::countEntities ( int &  nvertices,
int &  ncells,
int &  ncorners 
)
protectedvirtual

count the vertices, cells and corners

Reimplemented from Dune::VTKWriter< GridView >.

template<class GridView>
template<typename T >
std::tuple<std::string,std::string> Dune::VTKWriter< GridView >::getDataNames ( const T &  data) const
inlineprotectedinherited
template<class GridView>
std::string Dune::VTKWriter< GridView >::getFormatString ( ) const
inlineprotectedinherited
template<class GridView>
std::string Dune::VTKWriter< GridView >::getParallelHeaderName ( const std::string &  name,
const std::string &  path,
int  commSize 
) const
inlineprotectedinherited

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.

References Dune::GridView< ViewTraits >::dimension.

Referenced by Dune::VTKWriter< GridView >::pwrite().

template<class GridView>
std::string Dune::VTKWriter< GridView >::getParallelPieceName ( const std::string &  name,
const std::string &  path,
int  commRank,
int  commSize 
) const
inlineprotectedinherited

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.

References Dune::GridView< ViewTraits >::dimension.

Referenced by Dune::VTKWriter< GridView >::pwrite().

template<class GridView>
std::string Dune::VTKWriter< GridView >::getSerialPieceName ( const std::string &  name,
const std::string &  path 
) const
inlineprotectedinherited

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.

References Dune::GridView< ViewTraits >::dimension.

Referenced by Dune::VTKWriter< GridView >::write().

template<class GridView>
std::string Dune::VTKWriter< GridView >::getTypeString ( ) const
inlineprotectedinherited
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 
)
inlineinherited

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.

References Dune::GridView< ViewTraits >::comm(), and Dune::VTKWriter< GridView >::gridView_.

Referenced by Dune::VTKWriter< GridView >::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 
)
inlineprotectedinherited

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.

References Dune::GridView< ViewTraits >::comm(), Dune::VTKWriter< GridView >::getParallelHeaderName(), Dune::VTKWriter< GridView >::getParallelPieceName(), Dune::VTKWriter< GridView >::gridView_, and Dune::VTKWriter< GridView >::outputtype.

template<class GridView>
VertexIterator Dune::VTKWriter< GridView >::vertexBegin ( ) const
inlineprotectedinherited
template<class GridView>
VertexIterator Dune::VTKWriter< GridView >::vertexEnd ( ) const
inlineprotectedinherited
template<class GridView>
std::string Dune::VTKWriter< GridView >::write ( const std::string &  name,
VTK::OutputType  type = VTK::ascii 
)
inlineinherited

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)

References Dune::GridView< ViewTraits >::comm(), and Dune::VTKWriter< GridView >::gridView_.

template<class GridView>
std::string Dune::VTKWriter< GridView >::write ( const std::string &  name,
VTK::OutputType  type,
const int  commRank,
const int  commSize 
)
inlineprotectedinherited

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.

References Dune::VTKWriter< GridView >::getSerialPieceName(), Dune::VTKWriter< GridView >::outputtype, and Dune::VTKWriter< GridView >::pwrite().

template<class GridView >
void Dune::SubsamplingVTKWriter< GridView >::writeCellData ( VTK::VTUWriter writer)
protectedvirtual
template<class GridView>
template<typename Data , typename Iterator >
void Dune::VTKWriter< GridView >::writeData ( VTK::VTUWriter writer,
const Data &  data,
const Iterator  begin,
const Iterator  end,
int  nentries 
)
inlineprotectedinherited
template<class GridView >
void Dune::SubsamplingVTKWriter< GridView >::writeGridCells ( VTK::VTUWriter writer)
protectedvirtual
template<class GridView >
void Dune::SubsamplingVTKWriter< GridView >::writeGridPoints ( VTK::VTUWriter writer)
protectedvirtual
template<class GridView >
void Dune::SubsamplingVTKWriter< GridView >::writeVertexData ( VTK::VTUWriter writer)
protectedvirtual

Member Data Documentation

template<class GridView>
std::list<VTKLocalFunction> Dune::VTKWriter< GridView >::celldata
protectedinherited
template<class GridView>
GridView Dune::VTKWriter< GridView >::gridView_
protectedinherited
template<class GridView>
int Dune::VTKWriter< GridView >::ncells
protectedinherited
template<class GridView>
int Dune::VTKWriter< GridView >::ncorners
protectedinherited
template<class GridView>
int Dune::VTKWriter< GridView >::nvertices
protectedinherited
template<class GridView>
VTK::OutputType Dune::VTKWriter< GridView >::outputtype
protectedinherited
template<class GridView>
std::list<VTKLocalFunction> Dune::VTKWriter< GridView >::vertexdata
protectedinherited

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