vtkOpenFOAMReader, wrong default input mode
Short summary:
In the vtkOpenFOAMReader the default input mode is initialized to INPUT_MODE_ERROR, although a proper default would be INPUT_MODE_MERGE, which is the default mode that OpenFOAM uses internally. Because of the wrong default input mode, the reader will throw an error and refuse to read valid OpenFOAM files which contain duplicate entries.
The offending statement is made in https://github.com/Kitware/VTK/blob/bdb5b5d53e0ae3b2983b14ebfee076cd88e5fe62/IO/Geometry/vtkOpenFOAMReader.cxx#L1278
A simple fix would be to replace INPUT_MODE_ERROR with INPUT_MODE_MERGE as the default input mode, which is used if no #inputMode-directive is given.
Longer description:
In OpenFOAM the files are parsed from top to bottom. It is legal to have duplicate keywords and the default conflict resolution is to merge the entries. This means that if the entry is a dictionary, the contents of the old and new dictionaries are merged and if it is a simple keyword-value, the previously parsed value is replaced using the later value. This corresponds to INPUT_MODE_MERGE in the vtkOpenFOAMReader.
It is possible to change this behaviour by giving a #inputMode -directive, although this is very uncommon. If no inputMode is given, a default mode is implicitly assumed ("#inputMode default;") and this is the same as "#inputMode merge;".
Looking at the vtkOpenFOAMReader.cxx, it seems to correctly handle the "#inputMode default;"-option (in lines 1660-1663). However, for some reason the InputMode-variable is initialized to INPUT_MODE_ERROR and if no inputMode-directive is given, the reader defaults to error mode. In this mode duplicate entries are not allowed.
This is usually not a big problem as duplicate entries are typically avoided to reduce ambiguity and thus this bug is not often encountered. However, a recent commit in OF changed this and now there may be result files with duplicate entries in them, which makes it difficult to view the files in Paraview, because the reader refuses to read the files unless user manually edits the files and adds an inputmode directive.