Skip to content

ENH: Keep the .dream3d and .xdmf files consistent when Write DREAM3D NX File cannot write the .xdmf file #1993

Open

Description

@imikejackson

Summary

Make Write DREAM3D NX File leave a consistent pair of files when the .xdmf file cannot be written.

How it works now. With Write Xdmf File on, WriteDREAM3D::operator() in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/WriteDREAM3D.cpp writes the two files to temporary paths. It then moves the .dream3d file to its final path (AtomicFile::commit()), and after that it moves the .xdmf file to its final path. If the second move fails, the filter returns error -78500 (added in #1990). At that time the new .dream3d file is already in its place, and an .xdmf file from an earlier run is still next to it.

Why it is needed. The old .xdmf file describes the datasets of the earlier .dream3d file. A program that opens it later (for example ParaView) reads the new .dream3d file with the old description. It can show the wrong arrays or fail to load, and it gives no sign that the two files do not match. The filter does report the error, and its message says that the existing .xdmf file can be out of date. A user who does not read the message, or a pipeline that runs without supervision, still keeps the bad pair.

What is requested. After a failed write of the .xdmf file, no .xdmf file that describes other data stays next to the new .dream3d file. The design is open. Possible directions:

  • move the .xdmf file first, and move the .dream3d file only when that succeeds (the bad pair is then possible only when the second move fails),
  • remove or rename the old .xdmf file when its replacement fails,
  • write the identity of its .dream3d file into the .xdmf file, so that a reader can detect a pair that does not match.

Where it applies. WriteDREAM3D.cpp and its tests in src/Plugins/SimplnxCore/test/DREAM3DFileTest.cpp. #1853 is related (a failed write of the .xdmf file was reported as success) but does not cover the order of the two moves.

This was found by code review of #1990. No test shows the bad pair at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions