Unverified Commit 08da9513 authored by Simip's avatar Simip Committed by GitHub
Browse files

Update README.md

parent bd80ca32
...@@ -52,82 +52,44 @@ proposed one. A comparions: ...@@ -52,82 +52,44 @@ proposed one. A comparions:
| NonConforming Data | **x** | **x** | | NonConforming Data | **x** | **x** |
| Quadratic Data | - | **x** | | Quadratic Data | - | **x** |
| Subdivided Data | **x** | - | | Subdivided Data | **x** | - |
| Sequence (PVD) | **x** | **x** |
| Timeseries | - | x |
## Example ## Writers and Readers
Create a fine structured YaspGrid and write it in parallel with 8 cores with Dune-Vtk provides nearly all file formats specified in VTK + 2 time series formats: PVD and VTK-Timeseries.
different write modi:
### 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++ ### VtkStructuredGridWriter
const int dim = 3; 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.
FieldVector<double,dim> upperRight; upperRight = 1.0;
auto numElements = filledArray<dim,int>(16);
YaspGrid<dim> grid(upperRight,numElements,0,0); // no overlap
auto gridView = grid.leafGridView();
### 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.
```c++ ### VtkImageDataWriter
auto fct = makeAnalyticGridViewFunction([](auto const& x) { 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.
return std::sin(10*x[0]) * std::cos(10*x[1]) + std::sin(10*x[2]);
}, gridView);
### 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.
```c++ **TODO:**
Vtk[FORMAT]Writer<decltype(gridView)> vtkWriter(gridView);
vtkWriter.addPointData(fct, "fct"); - Just append the new timestep to the file instead of recreating it.
vtkWriter.write("filename.vtu", [FORMAT_TYPE], [DATA_TYPE]);
``` ### 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.
- 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.
where `FORMAT` one of - Provide an interface to read the points-/cell-data from the file
- Extent the implementation to other file formats
- `UnstructuredGrid`,
- `StructuredGrid` (structured connectivity, arbitrary coordinates),
- `RectilinearGrid` (structured connectivity, tensor-product coordinates), or
- `ImageData` (structured connectivity, axis-parallel coordinates with constant grid-spacing),
`FORMAT_TYPE` one of
- `Vtk::ASCII` (inline ascii format),
- `Vtk::BINARY` (appended raw format), or
- `Vtk::COMPRESSED` (appended compressed raw format),
and `DATA_TYPE` one of
- `Vtk::FLOAT32` (single precision), or
- `Vtk::FLOAT64` (double precision).
We measure the file size (per processor) and the memory requirement of ParaView
to visualize the data.
| **Setup** | **Filesize** | **Memory** |
| ----------------------------------- | ------------ | ---------- |
| UnstructuredGrid, ASCII, FLOAT32 | 26M | 330M |
| *UnstructuredGrid, ASCII, FLOAT64* | *29M* | *360M* |
| UnstructuredGrid, BINAR, FLOAT32 | 23M | 330M |
| UnstructuredGrid, BINAR, FLOAT64 | 27M | 360M |
| UnstructuredGrid, COMPR, FLOAT32 | 4.5M | 330M |
| UnstructuredGrid, COMPR, FLOAT64 | 5.7M | 360M |
| StructuredGrid, ASCII, FLOAT32 | 10M | 34M |
| StructuredGrid, ASCII, FLOAT64 | 13M | 67M |
| StructuredGrid, BINAR, FLOAT32 | 4.2M | 34M |
| StructuredGrid, BINAR, FLOAT64 | 8.4M | 67M |
| StructuredGrid, COMPR, FLOAT32 | 1.4M | 34M |
| StructuredGrid, COMPR, FLOAT64 | 2.6M | 67M |
| RectilinearGrid, ASCII, FLOAT32 | 3.0M | 8.4M |
| RectilinearGrid, ASCII, FLOAT64 | 5.3M | 17M |
| RectilinearGrid, BINAR, FLOAT32 | 1.1M | 8.4M |
| RectilinearGrid, BINAR, FLOAT64 | 2.1M | 17M |
| RectilinearGrid, COMPR, FLOAT32 | 970K | 8.4M |
| RectilinearGrid, COMPR, FLOAT64 | 2.0M | 17M |
| ImageData, ASCII, FLOAT32 | 3.0M | 8.4M |
| ImageData, ASCII, FLOAT64 | 5.3M | 17M |
| ImageData, BINAR, FLOAT32 | 1.1M | 8.4M |
| ImageData, BINAR, FLOAT64 | 2.1M | 17M |
| **ImageData, COMPR, FLOAT32** | **970K** | **8.4M** |
| ImageData, COMPR, FLOAT64 | 2.0M | 17M |
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment