5#ifndef DUNE_IO_GNUPLOT_HH
6#define DUNE_IO_GNUPLOT_HH
18#include <dune/common/fvector.hh>
29 template<
class Gr
idView>
32 typedef typename GridView::Grid::ctype ctype;
39 static_assert(dimworld==1 || dimworld==2,
"GnuPlot export only works for worlddim==1 and worlddim==2");
41 _data.resize(_is.size(0)*2);
48 template <
class DataContainer>
49 void addCellData(
const DataContainer& data,
const std::string & name)
52 DUNE_THROW(IOError,
"Gnuplot cell data writing is only supported for grids in a 1d world!");
53 addData(cellData, data, name);
60 template <
class DataContainer>
63 addData(vertexData, data, name);
69 void write(
const std::string& filename)
const;
72 enum DataType { vertexData, cellData };
75 std::vector< std::vector< float > > _data;
76 std::vector< std::string > _names;
78 template <
class DataContainer>
79 void addData(DataType t,
const DataContainer& data,
const std::string & name);
81 void writeRow(std::ostream & file,
82 const FieldVector<ctype, dimworld>& position,
83 const std::vector<float> & data)
const;
Implementation of gnuplot output for 1D and 2D grids.
Traits::IndexSet IndexSet
type of the index set
Definition: common/gridview.hh:86
Grid< dim, dimworld, ct, GridFamily >::LeafGridView leafGridView(const Grid< dim, dimworld, ct, GridFamily > &grid)
leaf grid view for the given grid
Definition: common/grid.hh:819
Grid< dim, dimworld, ct, GridFamily >::LevelGridView levelGridView(const Grid< dim, dimworld, ct, GridFamily > &grid, int level)
level grid view for the given grid and level.
Definition: common/grid.hh:802
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition: common/gridview.hh:151
Include standard header files.
Definition: agrid.hh:60
Grid view abstract base class.
Definition: common/gridview.hh:66
Writer for 1D grids in gnuplot format.
Definition: gnuplot.hh:30
void addVertexData(const DataContainer &data, const std::string &name)
Add vertex data.
Definition: gnuplot.hh:61
void addCellData(const DataContainer &data, const std::string &name)
Add cell data.
Definition: gnuplot.hh:49
void write(const std::string &filename) const
Write Gnuplot file to disk.
Definition: gnuplot.cc:19
GnuplotWriter(const GridView &gv)
Definition: gnuplot.hh:37
GnuplotWriter on the leaf grid.
Definition: gnuplot.hh:91
LeafGnuplotWriter(const G &grid)
Construct a Gnuplot writer for the leaf level of a given grid.
Definition: gnuplot.hh:94
GnuplotWriter on a given level grid.
Definition: gnuplot.hh:104
LevelGnuplotWriter(const G &grid, int level)
Construct a Gnuplot writer for a certain level of a given grid.
Definition: gnuplot.hh:107
Different resources needed by all grid implementations.