VTKHDF generated with Fortran flagged as unrecognized type

Hello all. I am working on a module to export data to VTKHDF using Fortran. I am able to create the file and h5dump shows the expected data fields. Unfortunately, Paraview fails to read the file with an error flagged by the vtk library indicating the data type is unsupported. The datafile was written using the MPI IO features of the HDF5 library. The intended structure is an UnstructuredGrid type. The linked archive contains a valid vtkxml file for the data which reads in Paraview and the generated vtkhdf file that fails to load.

I am unable to upload files as a new user, but I have uploaded them to our company fileshare at the link below. Inside the archive are the following contents:

  1. paraview_log.txt - contains the error output from Paraview 5.13.0-RC2-335-g80f5b300cc (recent nightly build).
  2. beam_detector_paraview.py - contains a python Paraview statefile which can be used to read in the vtkxml version of the data generated by the software. The data named as “Geometry” is the test case I am mentioning.
  3. beam_detector_GEOM.vtkhdf - contains the VTKHDF that was generated with Fortran that fails to load.

https://fileshare.jensenhughes.com/link/HgV3fURsER0MxfJKDuFjKK

I am able to visualize the data in the VTK library if I call the reader directly. CXX and CMakeList files below. Thoughts?

HDFReader_JLH.cxx:

#include <string>
#include <vtkCamera.h>
#include <vtkDataSetMapper.h>
#include "vtkHDFReader.h"
#include <vtkNamedColors.h>
#include "vtkNew.h"
#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include "vtkUnstructuredGrid.h"

int main(int, char*[]){
  std::string fileName;
  vtkNew<vtkHDFReader> reader;
  fileName = "/home/jhodges/vtk_tests/smoke_vis/beam_detector_GEOM.vtkhdf";
  
  // Vis Pipeline
  vtkNew<vtkNamedColors> colors;

  vtkNew<vtkRenderer> renderer;

  vtkNew<vtkRenderWindow> renderWindow;
  renderWindow->SetSize(640, 480);
  renderWindow->AddRenderer(renderer);

  vtkNew<vtkRenderWindowInteractor> interactor;
  interactor->SetRenderWindow(renderWindow);

  renderer->SetBackground(colors->GetColor3d("Wheat").GetData());
  renderer->UseHiddenLineRemovalOn();

  std::cout << "Loading: " << fileName << std::endl;

  reader->SetFileName(fileName.c_str());
  reader->Update();
  vtkUnstructuredGrid* data = vtkUnstructuredGrid::SafeDownCast(reader->GetOutputAsDataSet());
  
  // Visualize
  vtkNew<vtkDataSetMapper> mapper;
  mapper->SetInputData(data);
  mapper->ScalarVisibilityOff();

  vtkNew<vtkProperty> backProp;
  backProp->SetDiffuseColor(colors->GetColor3d("Banana").GetData());
  backProp->SetSpecular(.6);
  backProp->SetSpecularPower(30);

  vtkNew<vtkActor> actor;
  actor->SetMapper(mapper);
  actor->SetBackfaceProperty(backProp);
  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d("Tomato").GetData());
  actor->GetProperty()->SetSpecular(.3);
  actor->GetProperty()->SetSpecularPower(30);
  actor->GetProperty()->EdgeVisibilityOn();
  renderer->AddActor(actor);
  renderer->GetActiveCamera()->Azimuth(45);
  renderer->GetActiveCamera()->Elevation(45);
  renderer->ResetCamera();
  renderWindow->SetWindowName("ReadAllUnstructuredGridTypes");
  renderWindow->Render();
  interactor->Start();
  
  return EXIT_SUCCESS;
}

CMakeLists.txt here:


cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

project(VTKHDF5READER_JLH)

find_package(VTK COMPONENTS 
  CommonColor
  CommonCore
  CommonDataModel
  FiltersCore
  FiltersSources
  IOHDF
  InteractionStyle
  RenderingContextOpenGL2
  RenderingCore
  RenderingFreeType
  RenderingGL2PSOpenGL2
  RenderingOpenGL2
)

add_executable(ReaderExample MACOSX_BUNDLE HDFReader_JLH.cxx )
  target_link_libraries(ReaderExample PRIVATE ${VTK_LIBRARIES}
)
# vtk_module_autoinit is needed
vtk_module_autoinit(
  TARGETS ReaderExample
  MODULES ${VTK_LIBRARIES}
)

Hello @johodges,

Thanks for the data

I am able to visualize the data in the VTK library if I call the reader directly. CXX and CMakeList files below. Thoughts?

Good to know, I will take a look today to see what’s going on

On my side, I can open your data correctly without having an issue with paraview master:

Your error in the paraview_log.txt is about FilesSeriesReader, did you try to open multiple .vtkhdf file in the same time?

Based on your vtu, I guess this should be temporal right?

Thanks for checking and that is interesting. How are you importing the data? When I go through File->Open and select the VTKHDF file directly the “Open Data With…” window pops up and does not show the VTKHDF reader as an option. I get the error I posted when I go into the File->Open and click the drop down and select the VTKHDF as the potential options then click on it.

Regarding the intended data, yes there will be time series eventually. This file is the static geometry but there will be other data sets included in additional files. The current plan is to have a separate file per time stamp but we might try out the temporal option.

Sorry for the double message. I just built the Paraview master through my windows subsystem for linux. I am able to load the data there. That makes me think the issue is either windows specific or an issue with the deployed build. Are you able to visualize in windows?

How are you importing the data?

I do File > open Data and select only the .vtkhdf file, and it works. And yes, I try it on Linux

That makes me think the issue is either windows specific or an issue with the deployed build.

Indeed it could be, I will try it with the nightly on Windows when I can (probably tomorrow)

I try it on windows and it works too:

I wonder if it could be due to some issue in your user setting, on windows it should be under a folder named ParaView in AppData\Roaming.

Could you please try to delete this folder and try it again? Doing a copy of this folder before deleting it, might be safer especially if you care about your user setting :slightly_smiling_face:

Alternatively, you can run paraview in dry run (with the option --dr)

Thanks, gave that a try and it still was unable to read. However, I copied the vtkhdf outside of my WSL environment and it was able to read it from the windows filesystem. A bit odd that it doesn’t work within WSL since the XML files read fine from that environment.

ok, I didn’t understand that you try to open the vtkhdf file in paraview via wsl even on Windows initially.

Its definitely a setup that we don’t test so I’m not surprised if you encounter some issue.

I’m also curious, what is the benefit to use wsl in such context instead of directly via the Windows filesystem?

The main reasons I am currently working in that environment are compilation issues with the HDF library and the intel compiler used to build the CFD code which is outputting the VTKHDF. I plan to get them sorted out eventually, but getting a working version on linux is a higher priority so we can use the outputs on a linux HPC.