DLR-SC / tigl

The TiGL Geometry Library to process aircraft geometries in pre-design.
https://dlr-sc.github.io/tigl/
Apache License 2.0
235 stars 60 forks source link

Find `<cpacsVersion>` element at `header/versionInfos/versionInfo/cpacsVersion` #1009

Closed MarAlder closed 4 months ago

MarAlder commented 4 months ago

CPACS 3.5 has a new header node: see docs

To allow TiGL to open CPACS 3.5 files the <cpacsVersion> element is still available in the old location, although optional and marked as deprecated. Also the examples show this:

grafik

<?xml version="1.0" encoding="UTF-8"?>
<cpacs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schema/cpacs_schema.xsd">
  <header>
    <name>Canard example</name>
    <version>0.4.0</version>
    <!-- Deprecated: The <cpacsVersion> is needed to open the file in TiGL. TiGL will soon be adapted to get this information from the versinInfo node. -->
    <cpacsVersion>3.5</cpacsVersion>
    <versionInfos>
      <versionInfo version="0.4.0">
        <creator>DLR-SL</creator>
        <timestamp>2023-08-07T10:30:00</timestamp>
        <description>Example for Canard wing</description>
        <cpacsVersion>3.5</cpacsVersion>
      </versionInfo>
      <versionInfo version="0.3.0">
        <creator>Martin Siggel</creator>
        <timestamp>2012-10-09T15:12:47</timestamp>
        <description>Example for Canard wing</description>
        <cpacsVersion>3.2</cpacsVersion>
      </versionInfo>
    </versionInfos>
  </header>

Apparently, however, I have not explained reading the documentation or the existence of the examples well enough. Therefore, there is a growing opinion that TiGL does not support CPACS v3.5. I have just learned of a project that therefore decided to use v3.2.

Therefore, we should implement and release a patch that prevents TiGL from searching for the element not only at the old position but also at the new position in the header.

MarAlder commented 4 months ago

What do you think about this approach, @joergbrech?

https://github.com/DLR-SC/tigl/blob/fecb70059c3e2f2e47ab67b5405c74ab5fcaf879/src/api/tigl.cpp#L173-L178

This would find the correct cpacsVersion as it is implemented in CPACS v3.5: https://github.com/DLR-SC/tigl/blob/versionInfo/tests/unittests/TestData/testversion_new_header.xml