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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bindings/python_internal/core.i
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
#include "CTiglMemoryPool.h"
#include "CTiglError.h"
#include "CCPACSStringVector.h"
#include "generated/CPACSUpdates.h"
#include "generated/CPACSVersionInfo.h"
#include "generated/CPACSVersionInfos.h"
#include "generated/CPACSHeader.h"
#include "CTiglUIDObject.h"
#include "ITiglUIDRefObject.h"
Expand All @@ -49,6 +50,7 @@
%include "CTiglMemoryPool.h"
%include "generated/CPACSStringVectorBase.h"
%include "CCPACSStringVector.h"
%include "generated/CPACSUpdates.h"
%include "generated/CPACSVersionInfo.h"
%include "generated/CPACSVersionInfos.h"
%include "generated/CPACSHeader.h"

3 changes: 3 additions & 0 deletions cpacs_gen_input/PruneList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ CPACSMissionDefinitions
CPACSStudies
CPACSMaterial

// in header
CPACSChangeLog

// in toolspecific
CPACSToolspecific

Expand Down
146 changes: 125 additions & 21 deletions cpacs_gen_input/cpacs_schema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -823,40 +823,26 @@ marko.alder@dlr.de
<xsd:documentation>Name of CPACS dataset</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="description" type="stringBaseType">
<xsd:element name="description" minOccurs="0" type="stringBaseType">
<xsd:annotation>
<xsd:documentation>Description of CPACS dataset
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="creator" type="stringBaseType">
<xsd:annotation>
<xsd:documentation>Creator of initial CPACS dataset
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="timestamp" type="dateTimeBaseType">
<xsd:annotation>
<xsd:documentation>Timestamp of initial CPACS dataset creation
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="version" type="stringBaseType">
<xsd:element name="version" type="xsd:string">
<xsd:annotation>
<xsd:documentation>Version of initial CPACS dataset
<xsd:documentation>Version of initial CPACS dataset according to the Semantic Versioning 2.0.0 standard.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="cpacsVersion" minOccurs="0" type="stringBaseType">
<xsd:element name="cpacsVersion" minOccurs="0" type="xsd:string">
<xsd:annotation>
<xsd:documentation>CPACS version that the dataset is valid to. The element is optional, since data sets
can be valid for several CPACS versions. However, we strongly recommend to assign data sets to a
specific CPACS version as far as possible, especially since some tools and libraries (e.g. TiGL)
require this specification.
<xsd:documentation>DEPRECATED: Should only be set to allow TiGL to open the file until TiGL is adopted accordingly.
Will be replaced by the cpacsVersion element in versionInfos.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="updates" type="updatesType"/>
<xsd:element name="versionInfos" type="versionInfosType"/>
</xsd:all>
</xsd:extension>
</xsd:complexContent>
Expand Down Expand Up @@ -34132,4 +34118,122 @@ The fuel tank volume type should also be used for the wing fuel tank</xsd:docume
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="versionInfosType">
<xsd:annotation>
<xsd:appinfo>
<sd:schemaDoc>
<ddue:summary>
<ddue:para>Version Informations</ddue:para>
</ddue:summary>
</sd:schemaDoc>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="complexBaseType">
<xsd:sequence>
<xsd:element name="versionInfo" maxOccurs="unbounded" type="versionInfoType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="versionInfoType">
<xsd:annotation>
<xsd:appinfo>
<sd:schemaDoc>
<ddue:summary>
<ddue:para>Version Information</ddue:para>
</ddue:summary>
</sd:schemaDoc>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="complexBaseType">
<xsd:all>
<xsd:element name="cpacsVersion" type="xsd:string">
<xsd:annotation>
<xsd:documentation>CPACS version of the dataset
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="description" type="stringBaseType">
<xsd:annotation>
<xsd:documentation>Description of CPACS dataset
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="timestamp" type="dateTimeBaseType">
<xsd:annotation>
<xsd:documentation>Timestamp of initial CPACS dataset creation
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="creator" type="stringBaseType">
<xsd:annotation>
<xsd:documentation>Creator of initial CPACS dataset
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="changeLog" minOccurs="0" type="changeLogType"/>
</xsd:all>
<xsd:attribute name="version" use="required" type="xsd:string"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="changeLogType">
<xsd:annotation>
<xsd:appinfo>
<sd:schemaDoc>
<ddue:summary>
<ddue:para>Change log</ddue:para>
</ddue:summary>
</sd:schemaDoc>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="complexBaseType">
<xsd:sequence>
<xsd:element name="logEntry" maxOccurs="unbounded" type="logEntryType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="logEntryType">
<xsd:annotation>
<xsd:appinfo>
<sd:schemaDoc>
<ddue:summary>
<ddue:para>Log entry</ddue:para>
</ddue:summary>
</sd:schemaDoc>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="complexBaseType">
<xsd:all>
<xsd:element name="description" type="stringBaseType">
<xsd:annotation>
<xsd:documentation>Description of CPACS dataset
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="timestamp" type="dateTimeBaseType">
<xsd:annotation>
<xsd:documentation>Timestamp
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="creator" type="stringBaseType">
<xsd:annotation>
<xsd:documentation>Creator (tool, person, etc.)
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:all>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

</xsd:schema>
10 changes: 9 additions & 1 deletion src/api/tigl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,15 @@ TIGL_COMMON_EXPORT TiglReturnCode tiglOpenCPACSConfiguration(TixiDocumentHandle
/* check CPACS Version */
{
char* cpacsVersionStr = NULL;
ReturnCode tixiRet = tixiGetTextElement(tixiHandle, "/cpacs/header/cpacsVersion", &cpacsVersionStr);

// Default behavior: CPACS versioning since v3.5
ReturnCode tixiRet = tixiGetTextElement(tixiHandle, "/cpacs/header/versionInfos/versionInfo[@version=../../version]/cpacsVersion", &cpacsVersionStr);

// CPACS versioning until v3.4
// Note: should return a deprication warning when TiGL is at v3.5
if (tixiRet != SUCCESS) {
tixiRet = tixiGetTextElement(tixiHandle, "/cpacs/header/cpacsVersion", &cpacsVersionStr);
}

if (tixiRet != SUCCESS) {
// NO CPACS Version Information in Header
Expand Down
97 changes: 14 additions & 83 deletions src/generated/CPACSHeader.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading