Bug in vtkMultiBlockPLOT3DReader
There appears to be a bug in vtkMultiBlockPLOT3DReader, specifically in the way it guesses the format of the file. I’m using whatever version of VTK is distributed with ParaView 5.8.1.
First, I try to read the file with auto-detect turned on:
import vtk
reader = vtk.vtkMultiBlockPLOT3DReader()
reader.SetXYZFileName(‘CARTBody00001200.x’)
reader.AutoDetectFormatOn()
reader.Update()
40.633s) [main thread ]vtkMultiBlockPLOT3DRead:2504 ERR| vtkMultiBlockPLOT3DReader (0x1748090): Could not determine settings for file. Cannot read.
Since I know what “flavor” of Plot3d this is, I’ll try disabling auto-detect and specifying all the options myself:
reader = vtk.vtkMultiBlockPLOT3DReader()
reader.SetXYZFileName(‘CARTBody00001200.x’)
reader.BinaryFileOn()
reader.MultiGridOn()
reader.AutoDetectFormatOff()
reader.BinaryFileOn()
reader.MultiGridOn()
reader.HasByteCountOff()
reader.IBlankingOn()
reader.DoublePrecisionOff()
reader.SetByteOrderToBigEndian()
reader.Update()
( 324.724s) [main thread ]vtkMultiBlockPLOT3DRead:2504 ERR| vtkMultiBlockPLOT3DReader (0x15a8590): Could not determine settings for file. Cannot read.
I’ve tried reading the file manually with a small Python script, and everything appears to be in order with it. It appears that VTK tries to do the auto-detect regardless of what the user asked for. I've included a gzipped example dataset.
The specific issue with this file may be that it’s a C binary file with 512 blocks. If you byte-swap 512, you get 131072, which is a large but plausible number of blocks. That ends up confusing the endianness auto-detection.