Skip to content

Fix EnSight Reader for double quotes issue and scripts variable

Original GitHub PR at https://github.com/Kitware/VTK/pull/61.

This MR is to fix the following issue:

paraview/paraview#20819 (closed) https://discourse.paraview.org/t/fluent-2021-r1-ensight-case-gold-solution-files-to-paraview-5-9-0/7512/2

The Fluent export of EnSight files is now adding double quotes to the geo file and the to variable files. This is to allow paths with spaces or special characters. The VTK EnSight Reader creates the full path to the geo/var files adding to the path of the folder containing the case/encase file the string that is found using sscanf from the case file, but of course something like

C:\path\to\encas/"my file.encas"

cannot be handled by Fopen. So the trick is to search for the double quotes, and if they are in the string they are being just removed. Of course I am supposing that the double quotes are just at the beginning and at the end of the string, since hopefully using double quotes in the name of the file should not be allowed.

So, VTK should now create the path like:

C:\path\to\encas/my file.encas which can be handled by Fopen. The only additional change required was to fix the sscanf calls looking the the filename string, where the formatter %s is no more enough to find the filename since it can contain spaces, so the code is now looking for every character up until you get a newline or a tab. For simplicity I have not considered this eventuality for complex variables, since Fluent doesn't export files with complex variable. Also, I have changed the code only for the EnSight Gold Reader (binary and not) since Fluent only exports Gold Files.

Finally, in vtkEnSightReader I have also added functionality to check for the SCRIPTS variable of the encas file. This is a new optional variable which is used to give EnSight metadata stored in a xml file, where the metadata are units. So, I am finding this area of the encas file and skipping it, since not required for Paraview.

I have tested the changes locally on Windows, pointing to the files supplied in the above issue and a modified version where the geo file contained spaces, all of them loaded using pvpython.

Edited by Cory Quammen

Merge request reports