/usr/include/dune/pdelab/instationary/pvdwriter.hh is in libdune-pdelab-dev 2.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=8 sw=2 sts=2:
#ifndef DUNE_VTK_PVDWRITER_HH
#define DUNE_VTK_PVDWRITER_HH
#warning dune/pdelab/instationary/pvdwriter.hh and the class PVDWriter are deprecated, please use VTKSequenceWriter or SubsamplingVTKSequenceWriter from dune-grid instead
#include <vector>
#include <fstream>
#include <dune/common/deprecated.hh>
#include <dune/grid/io/file/vtk/vtkwriter.hh>
#include "onestep.hh"
#include <stdlib.h>
namespace Dune
{
template< class GridView, class VTK = VTKWriter<GridView> >
class DUNE_DEPRECATED_MSG("Use VTKSequenceWriter from dune-grid instead") PVDWriter : public VTK
{
GridView gv;
std::string basename;
PDELab::FilenameHelper fn;
std::string path;
std::vector<double> timesteps;
Dune::VTK::OutputType outputtype;
unsigned int offset;
public:
PVDWriter(const GridView & gv_, std::string basename_,
Dune::VTK::DataMode datamode_ = Dune::VTK::conforming,
Dune::VTK::OutputType outputtype_ = Dune::VTK::appendedraw,
std::string path_="vtk", unsigned int offset_=0) :
VTK(gv_,datamode_), gv(gv_),
basename(basename_), fn(basename_,offset_),
path(path_), outputtype(outputtype_),
offset(offset_){}
void write(double time)
{
/* remember current time step */
timesteps.push_back(time);
/* make sure the directory exists */
// mkdir("vtk", 777);
/* write VTK file */
VTK::pwrite(fn.getName(),path,"",outputtype);
/* write pvd file */
std::string pvdname = basename + ".pvd";
std::ofstream pvd(pvdname.c_str());
//std::cout << "WRITE PVD FILE " << pvdname << std::endl;
assert(pvd.is_open());
pvd << std::fixed;
pvd << "<?xml version=\"1.0\"?>\n"
<< "<VTKFile type=\"Collection\" version=\"0.1\">\n"
<< "<Collection>\n";
PDELab::FilenameHelper fnloop(basename,offset);
for (unsigned int i=0; i<timesteps.size(); i++)
{
std::string fname = this->getParallelHeaderName(fnloop.getName(), path, gv.comm().size());
pvd << " <DataSet timestep=\"" << timesteps[i]
<< "\" file=\"" << fname << "\"/>\n";
fnloop.increment();
}
pvd << "</Collection>\n"
<< "</VTKFile>\n";
pvd.close();
/* increment counter */
fn.increment();
}
};
} // end namespace Dune
#endif // DUNE_VTK_PVDWRITER_HH
|