Fix EnSight Reader for double quotes issue and scripts variable #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is to fix the following issue:
https://gitlab.kitware.com/paraview/paraview/-/issues/20819
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.