vtkPolyDataReader2

I am making a PolyDataFileSeriesReader similar to what is found in ParaView for ImageData, but supporting streaming (to save memory) in the situation where all files are processed as a whole. Further, it supports temporal streaming when files are not read at once.

In this regards, it would be awesome if all poly data reader were inheriting from say vtkPolyDataReader2 and to create a collection and a factory for creating poly data readers.

Is there a reason why no abstract is present for all poly data reader? If there isn’t would you such an abstraction and corresponding collection and a factory?

If I would like to contribute with this, is there a nice pretty printer to make my code conform (identation etc.) to the form used in the repository?

Thanks in advance
Jens Munk

The vtkAbstractPolyDataReader already exists but it’s only used as the base for a small number of readers. It isn’t used for the classic .vtk readers or for the VTK XML readers. One of the reasons is that many VTK developers prefer to define their I/O abstractions at the level of vtkDataSet or even vtkDataObject rather than at the level of vtkPolyData.

I can’t say much about factory mechanisms for readers, I’ve generally done that at the application level rather than using VTK. In python, a simple dict with a bit of support code is easier to work with than a vtkCollection. Before making a factory, I’d suggest looking at how Paraview already handles choosing its readers.

The official “styler” for VTK is clang-format (the VTK repository has a .clang-format at its root). But because clang-format cannot automatically add braces, you might want to run the code through astyle first (e.g. astyle -s2 -j -S -K file.cxx) and then use clang-format as a second step.

I did a small factory with a wrapper object safe-down casting a vtkAlgothm to the respektive readers. I see now the challenges with generic formats which contain vtkDataSet. Looking back, I found it most elegant to create a SetReader which takes as argument a vtkAlgorithm - ParaView does the same.

Thanks for the feedback. I use astyle already with git hooks. I will change them to match those from VTK in case I make something general enough for a PR