add python bindings for writer
At the moment we have a function in dune.grid
def writeVTK(grid, outputBase,
celldata=None, pointdata=None,
cellvector=None, pointvector=None,
number=None, subsampling=None,outputType=OutputType.appendedbase64,
write=True, nonconforming=False):
this will either write the file (write=True
) or return a vtkWriter(name)
object with a write
method. The method can be called as a method on the grid (e.g. grid.vtkWriter(...)
) or as a standalone function vtkWriter(grid,...)
.
There is also a sequenced writer:
def sequencedVTK(grid, name, celldata=None, pointdata=None, cellvector=None, pointvector=None,
number=0, subsampling=None, outputType=OutputType.appendedbase64):
which allows to write vtk()
to generate a sequence of output files.
Add a function
def vtkWriter(grid, outputbase,
celldata=None, pointdata=None,
cellvector=None, pointvector=None,
writer="unstructured", collector="dafault", outputType=OutputType.binary):
to create an instance of the class:
template <class GridView, class DataCollector = DefaultDataCollector<GridView>>
class Vtk[Type]Writer
can then add special method for typical cases for writerType, Of course we can't write
grid.vtkWriteranymore but that is perhaps not so problematic. This would return an object with a
__call__` option. So one would have to write
from dune.vtk import vtkWriter
vtk = vtkWriter(grid,"result",pointdata=[...])
vtk()
Depending on writer
this would generate a single file (and calling vtk()
would always overwrite this file) or a sequence of files.
Any other suggestions?