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

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

Closed
MarAlder opened this issue May 16, 2024 · 1 comment · Fixed by #1010
Closed

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

MarAlder opened this issue May 16, 2024 · 1 comment · Fixed by #1010
Assignees

Comments

@MarAlder
Copy link
Collaborator

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 MarAlder changed the title Find cpacsVersion element at header/versionInfos/versionInfo/cpacsVersion Find <cpacsVersion> element at header/versionInfos/versionInfo/cpacsVersion May 16, 2024
@MarAlder
Copy link
Collaborator Author

What do you think about this approach, @joergbrech?

tigl/src/api/tigl.cpp

Lines 173 to 178 in fecb700

char* cpacsVersionStr = NULL;
ReturnCode tixiRet = tixiGetTextElement(tixiHandle, "/cpacs/header/versionInfos/versionInfo[@version=../../version]/cpacsVersion", &cpacsVersionStr);
if (tixiRet != SUCCESS) {
tixiRet = tixiGetTextElement(tixiHandle, "/cpacs/header/cpacsVersion", &cpacsVersionStr);
}

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

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

Successfully merging a pull request may close this issue.

1 participant