Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TiGL not opening CPACS v3.5 data sets #1010

Merged
merged 3 commits into from
Jun 3, 2024
Merged

Fix TiGL not opening CPACS v3.5 data sets #1010

merged 3 commits into from
Jun 3, 2024

Conversation

MarAlder
Copy link
Collaborator

This change enables TiGL to search for the cpacsVersion element according to both CPACS v<3.5 and v>=3.5.

Description

See #1009 for discussions on this topic.

A new CPACS v3.5 header could look like this:

  <header>
    <name>Cpacs2Test</name>
    <description>Test file to check versioning according to new CPACS header</description>
    <version>2.0.0</version>
    <versionInfos>
      <versionInfo version="2.0.0">
        <description>Test for version 2.0.0</description>
        <cpacsVersion>3.5</cpacsVersion>
        <creator>Marko Alder</creator>
        <timestamp>2024-05-31T10:00:00</timestamp>
      </versionInfo>
      <versionInfo version="1.0.0">
        <description>Test for version 1.0.0</description>
        <cpacsVersion>3.3</cpacsVersion>
        <creator>Marko Alder</creator>
        <timestamp>2024-05-30T10:00:00</timestamp>
      </versionInfo>
    </versionInfos>
  </header>

I suggest that the default behavior is already to search for the versionElement in the versionInfo node, as this is always the most up-to-date in case of doubt (currently CPACS XSD still allows the element in the old location, where it is labeled as deprecated). As soon as TiGL has been upgraded to v3.5, we could also return a deprecation warning.

Since the query is only made via XPath, changes to the generated classes have no influence on the version query (as far as I have seen). Nevertheless, I have generated the classes up to the versionInfo element, as they were previously also available for the old update node.

This would fix #1009.

How Has This Been Tested?

  • I added a new unittest CPACSVersion.newCPACSHeader
  • I opened old and new CPACS files in TiGL viewer and checked the output

Screenshots, that help to understand the changes(if applicable):

Current behavior:
grafik

New behavior:
grafik

Checklist:

  • A test for the new functionality was added.
  • All tests run without failure.
  • The new code complies with the TiGL style guide.
  • New classes have been added to the Python interface.
  • API changes were documented properly in tigl.h.

@MarAlder MarAlder changed the title Version info Fix TiGL not opening CPACS v3.5 data sets May 31, 2024
@MarAlder MarAlder self-assigned this May 31, 2024
Copy link
Contributor

@joergbrech joergbrech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks a lot @MarAlder.

PS: If needed, we could add the versionInfo change also to this tool: https://github.com/DLR-SC/cpacs2to3

@joergbrech joergbrech merged commit 21c1611 into master Jun 3, 2024
14 of 15 checks passed
@joergbrech joergbrech deleted the versionInfo branch June 3, 2024 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find <cpacsVersion> element at header/versionInfos/versionInfo/cpacsVersion
2 participants