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);
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 =
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;
GridView gridView_
Definition: vtkwriter.hh:1072
Writer for the ouput of grid functions in the vtk format.Writes arbitrary grid functions (living on c...
Definition: vtkwriter.hh:60
VTKSequenceWriter(const GridView &gridView, const std::string &name, const std::string &path, const std::string &extendpath, VTK::DataMode dm=VTK::conforming)
Definition: vtksequencewriter.hh:26
Output to the file is in ascii.
Definition: common.hh:42
void write(double time, VTK::OutputType ot=VTK::ascii)
Writes VTK data for the given time.
Definition: vtksequencewriter.hh:42
Provides file i/o for the visualization toolkit.
Writer for the ouput of grid functions in the vtk format.Writes arbitrary grid functions (living on c...
Definition: vtksequencewriter.hh:20
Grid view abstract base classInterface class for a view on grids. Grids return two types of view...
Definition: common/gridview.hh:56
OutputType
How the bulk data should be stored in the file.
Definition: common.hh:40
Output conforming data.
Definition: common.hh:70
DataMode
Whether to produce conforming or non-conforming output.
Definition: common.hh:64
~VTKSequenceWriter()
Definition: vtksequencewriter.hh:35
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: common/gridview.hh:232
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
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