Commit a13a8953 authored by Oliver Sander's avatar Oliver Sander Committed by Steffen Müthing

Add constructor for VTKSequenceWriter that takes a VTKWriter instead of a GridView

This VTKWriter is then used for writing the individual time steps.

Advantages:
- Allows to write sequences of dune-functions grid functions.  Previously, this was
  not possible, because the corresponding forwarding addCellData/addVertexData methods
  of VTKSequenceWriter are not implemented.
- It makes the SubsamplingVTKSequenceWriter class obsolete, because you can now simply
  construct a VTKSequenceWriter with a SubsamplingVTKWriter as its writer object.
- It makes the addCellData/addVertexData methods of VTKSequenceWriter obsolete,
  as one may now call the corresponding methods on VTKWriter directly.

(cherry picked from commit 519c3482)
Signed-off-by: Steffen Müthing's avatarSteffen Müthing <muething@dune-project.org>
parent 7fe1229f
......@@ -24,6 +24,30 @@ namespace Dune {
public VTKSequenceWriterBase<GridView>
{
public:
/** \brief Constructor with a given VTKWriter or SubsamplingVTKWriter
*
* At each time step, the VTKSequenceWriter writes the grid and data currently attached to the vtkWriter object.
* All calls to the addCellData and addVertexData methods of the VTKSequenceWriter class are forwarded to the
* vtkWriter, but we propose that you call the corresponding methods on the vtkWriter directly.
*/
VTKSequenceWriter ( std::shared_ptr<VTKWriter<GridView> > vtkWriter,
const std::string& name,
const std::string& path,
const std::string& extendpath )
: VTKSequenceWriterBase<GridView>(vtkWriter,
name,
path,
extendpath,
vtkWriter->gridView_.comm().rank(),
vtkWriter->gridView_.comm().size())
{}
/** \brief Constructor creating its own VTKWriter object
*
* At each time step, the VTKSequenceWriter writes the grid and data currently attached to the vtkWriter object.
* All calls to the addCellData and addVertexData methods of the VTKSequenceWriter class are forwarded to the
* vtkWriter.
*/
explicit VTKSequenceWriter ( const GridView &gridView,
const std::string& name,
const std::string& path,
......
......@@ -72,6 +72,8 @@ namespace Dune
// Forward-declaration here, so the class can be friend of VTKWriter
template <class GridView>
class VTKSequenceWriterBase;
template <class GridView>
class VTKSequenceWriter;
/**
* @brief Writer for the ouput of grid functions in the vtk format.
......@@ -87,6 +89,8 @@ namespace Dune
// VTKSequenceWriterBase needs getSerialPieceName
// and getParallelHeaderName
friend class VTKSequenceWriterBase<GridView>;
// VTKSequenceWriter needs the grid view, to get the MPI size and rank
friend class VTKSequenceWriter<GridView>;
// extract types
typedef typename GridView::Grid Grid;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment