Create a fine structured YaspGrid and write it in parallel with 8 cores with
different write modi:
## Writers and Readers
Dune-Vtk provides nearly all file formats specified in VTK + 2 time series formats: PVD and VTK-Timeseries.
### 1. Create the grid
### VtkUnstructuredGridWriter
Implements a VTK file format for unstructured grids with arbitrary element types in 1d, 2d, and 3d. Coordinates are specified explicitly and a connectivity table + element types are specified for all grid elements (of codim 0). Can be used with all Dune grid types.
```c++
constintdim=3;
FieldVector<double,dim>upperRight;upperRight=1.0;
autonumElements=filledArray<dim,int>(16);
YaspGrid<dim>grid(upperRight,numElements,0,0);// no overlap
grid.globalRefine(3);
autogridView=grid.leafGridView();
```
### VtkStructuredGridWriter
Implements a writer for grid composed of cube elements (lines, pixels, voxels) with local numbering similar to Dunes `cube(d)` numbering. The coordinates of the vertices can be arbitrary but the connectivity is implicitly given and equals that of `Dune::YaspGrid` or `Dune::SPGrid`. Might be chosen as writer for a transformed structured grid, using, e.g., a `GeometryGrid` meta-grid. See `src/geometrygrid.cc` for an example.
### 2. Create a function to write
### VtkRectilinearGridWriter
Rectilinear grids are tensor-product grids with given coordinates along the x, y, and z axes. Therefore, the grid must allow to extract these 1d coordinates and a specialization for a `StructuredDataCollector` must be provided, that implements the `ordinates()` function. By default, it assumes constant grid spacing starting from a lower left corner. For `YaspGrid` a specialization is implemented if the coordinates type is `TensorProductCoordinates`. See `src/structuredgridwriter.cc` for an example.
The *most structured* grid is composed of axis-parallel cube elements with constant size along each axis. The is implemented in the VtkImageDataWriter. A specialization of the `StructuredDataCollector` must implement `origin()` for the lower left corner, `wholeExtent()` for the range of cell numbers along each axis in the global grid, `extent()` for the range in the local grid, and `spacing()` for the constant grid spacing in each direction.
### 3. Write the grid and data to file
### PvdWriter
A sequence writer, i.e. a collection of timestep files, in the ParaView Data (PVD) format. Supports all VtkWriters for the timestep output. In each timestep a collection (.pvd) file is created.
- Just append the new timestep to the file instead of recreating it.
### VtkTimseriesWriter
A timeseries is a collection of timesteps stored in one file, instead of separate files for each timestep value. Since in the `Vtk::APPENDED` mode, the data is written as binary blocks in the appended section of the file and references by an offset in the XML DataArray attributes, it allows to reuse written data. An example of usage is when the grid points and cells do not change over time, but just the point-/cell-data. Then, the grid is written only once and the data is just appended.
Timeseries file are create a bit differently from other Vtk file. There, in the first write the grid points and cells are stored in a separate file, and in each timestep just the data is written also to temporary files. When you need the timeseries file, these stored temporaries are collected and combined to one VTK file. Thus, only the minimum amount of data is written in each timestep. The intermediate files are stored, by default, in a `/tmp` folder, with (hopefully) fast write access.
**TODO:**
- Allow to specify the `/tmp` folder by the user.
### VtkReader
Read in unstructured grid files (.vtu files) and create a new grid, using a GridFactory.