4#ifndef DUNE_VTKSEQUENCE_HH
5#define DUNE_VTKSEQUENCE_HH
19 template<
class Gr
idView >
23 std::string name_,path_,extendpath_;
24 std::vector<double> timesteps_;
27 const std::string& name,
28 const std::string& path,
29 const std::string& extendpath,
32 name_(name), path_(path),
33 extendpath_(extendpath)
45 unsigned int count = timesteps_.size();
46 timesteps_.push_back(time);
52 std::string pvtuName =
BaseType::pwrite(seqName(count), path_,extendpath_,ot);
55 if (this->gridView_.
comm().rank()==0) {
56 std::ofstream pvdFile;
57 pvdFile.exceptions(std::ios_base::badbit | std::ios_base::failbit |
58 std::ios_base::eofbit);
59 std::string pvdname = name_ +
".pvd";
60 pvdFile.open(pvdname.c_str());
61 pvdFile <<
"<?xml version=\"1.0\"?> \n"
62 <<
"<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"LittleEndian\"> \n"
64 for (
unsigned int i=0; i<=count; i++)
67 std::string piecepath =
concatPaths(path_, extendpath_);
68 std::string fullname =
70 this->gridView_.
comm().rank(),
71 this->gridView_.comm().size());
72 pvdFile <<
"<DataSet timestep=\"" << timesteps_[i]
73 <<
"\" group=\"\" part=\"0\" name=\"\" file=\""
74 << fullname <<
"\"/> \n";
76 pvdFile <<
"</Collection> \n"
77 <<
"</VTKFile> \n" << std::flush;
84 std::string seqName(
unsigned int count)
const
88 n << name_ <<
"-" << std::setw(5) << count;
Grid view abstract base class.
Definition: gridview.hh:57
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: gridview.hh:232
Writer for the ouput of grid functions in the vtk format.
Definition: vtksequencewriter.hh:20
void write(double time, VTK::OutputType ot=VTK::ascii)
Writes VTK data for the given time.
Definition: vtksequencewriter.hh:42
Writer for the ouput of grid functions in the vtk format.
Definition: vtkwriter.hh:60
std::string getParallelPieceName(const std::string &name, const std::string &path, int commRank, int commSize) const
return name of a parallel piece file
Definition: vtkwriter.hh:534
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)
Definition: vtkwriter.hh:515
OutputType
How the bulk data should be stored in the file.
Definition: common.hh:40
DataMode
Whether to produce conforming or non-conforming output.
Definition: common.hh:64
std::string concatPaths(const std::string &base, const std::string &p)
concatenate two paths
Definition: path.cc:30
Dune namespace.
Definition: alignment.hh:14
Provides file i/o for the visualization toolkit.