vtkXMLUnstructuredGridReader double update creates inconsistent dataset
The following script shows an inconsistency in the XML VTU reader
#include <string>
#include "vtkNew.h"
#include "vtkXMLUnstructuredGridReader.h"
#include "vtkUnstructuredGrid.h"
int main() {
const std::string baseName = {"cube-with-time.vtu"};
vtkNew<vtkXMLUnstructuredGridReader> baselineReader;
baselineReader->SetFileName(baseName.c_str());
baselineReader->SetTimeStep(0);
baselineReader->Update();
vtkUnstructuredGrid *baseData =
vtkUnstructuredGrid::SafeDownCast(baselineReader->GetOutputAsDataSet());
std::cout << baseData->GetNumberOfCells() << std::endl; // 1
baselineReader->Update();
baseData =
vtkUnstructuredGrid::SafeDownCast(baselineReader->GetOutputAsDataSet());
std::cout << baseData->GetNumberOfCells() << std::endl; // 2
}
using the cube-with-time.vtu
dataset from the VTK testing data. The dataset contains a single cube at each timestep, expected output would be 1 and 1 cells but it is not.