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

Generate Code for Ducts and adapt existing code base to it #887

Merged
merged 12 commits into from
Mar 21, 2022
Merged
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Pull Request CI workflow

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
Expand Down
5 changes: 5 additions & 0 deletions cpacs_gen_input/CustomTypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ CPACSFuselageStructure CCPACSFuselageStructure
CPACSStringer CCPACSFuselageStringer
CPACSPointXY CCPACSPointXY
CPACSStringerFramePosition CCPACSFuselageStringerFramePosition
CPACSSkin CCPACSSkin
CPACSSkinSegment CCPACSSkinSegment
CPACSWallSegment CCPACSFuselageWallSegment
CPACSWallPosition CCPACSWallPosition
Expand Down Expand Up @@ -142,3 +143,7 @@ CPACSProfileGeometry2D CCPACSNacelleProfile
CPACSNacelleGuideCurves CCPACSNacelleGuideCurves
CPACSRotationCurve CCPACSRotationCurve
CPACSNacelleCenterCowl CCPACSNacelleCenterCowl

// Ducts
CPACSDuct CCPACSDuct
CPACSDuctStructure CCPACSDuctStructure
100 changes: 99 additions & 1 deletion cpacs_gen_input/cpacs_schema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

f
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
Expand Down Expand Up @@ -2916,6 +2916,7 @@ marko.alder@dlr.de
<xsd:element minOccurs="0" name="engines" type="enginePositionsType"/>
<xsd:element minOccurs="0" name="enginePylons" type="enginePylonsType"/>
<xsd:element minOccurs="0" name="landingGear" type="landingGearType"/>
<xsd:element minOccurs="0" name="ducts" type="ductsType"/>
<xsd:element minOccurs="0" name="systems" type="systemsType"/>
<xsd:element minOccurs="0" name="genericGeometryComponents" type="genericGeometryComponentsType"/>
<xsd:element minOccurs="0" name="global" type="aircraftGlobalType"/>
Expand Down Expand Up @@ -33083,5 +33084,102 @@ The fuel tank volume type should also be used for the wing fuel tank</xsd:docume
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="ductsType">
<xsd:annotation>
<xsd:appinfo>
<sd:schemaDoc>
<ddue:summary>
<ddue:para>Ducts</ddue:para>
</ddue:summary>
</sd:schemaDoc>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="complexBaseType">
<xsd:sequence>
<xsd:element name="duct" maxOccurs="unbounded" type="ductType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="ductType">
<xsd:annotation>
<xsd:appinfo>
<sd:schemaDoc>
<ddue:summary>
<ddue:para>Duct</ddue:para>
</ddue:summary>
</sd:schemaDoc>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="complexBaseType">
<xsd:all>
<xsd:element name="name" type="stringBaseType">
<xsd:annotation>
<xsd:documentation>
Name
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="description" type="stringBaseType">
<xsd:annotation>
<xsd:documentation>
Description
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="parentUID" type="stringUIDBaseType">
<xsd:annotation>
<xsd:documentation>
UID of part to which the duct is
mounted (if any)
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="transformation" type="transformationType"/>
<xsd:element name="sections" type="fuselageSectionsType"/>
<xsd:element name="positionings" minOccurs="0" type="positioningsType"/>
<xsd:element name="segments" type="fuselageSegmentsType"/>
<xsd:element minOccurs="0" name="structure" type="ductStructureType"/>
</xsd:all>
<xsd:attribute name="uID" type="xsd:ID" use="required"/>
<xsd:attribute name="symmetry">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="x-y-plane"/>
<xsd:enumeration value="x-z-plane"/>
<xsd:enumeration value="y-z-plane"/>
<xsd:enumeration value="none"/>
<xsd:enumeration value="inherit"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="ductStructureType">
<xsd:annotation>
<xsd:appinfo>
<sd:schemaDoc>
<ddue:summary>
<ddue:para>Duct structure</ddue:para>
</ddue:summary>
</sd:schemaDoc>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="complexBaseType">
<xsd:all>
<xsd:element minOccurs="0" name="skin" type="skinType"/>
<xsd:element minOccurs="0" name="stringers" type="stringersAssemblyType"/>
<xsd:element minOccurs="0" name="frames" type="framesAssemblyType"/>
</xsd:all>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

</xsd:schema>

5 changes: 5 additions & 0 deletions src/CCPACSPositionings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ CCPACSPositionings::CCPACSPositionings(CCPACSFuselage* parent, CTiglUIDManager*
{
}

CCPACSPositionings::CCPACSPositionings(CCPACSDuct* parent, CTiglUIDManager* uidMgr)
: generated::CPACSPositionings(parent, uidMgr), invalidated(true)
{
}

CCPACSPositionings::CCPACSPositionings(CCPACSWing* parent, CTiglUIDManager* uidMgr)
: generated::CPACSPositionings(parent, uidMgr), invalidated(true)
{
Expand Down
1 change: 1 addition & 0 deletions src/CCPACSPositionings.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class CCPACSPositionings : public generated::CPACSPositionings
// Constructor
TIGL_EXPORT CCPACSPositionings(CCPACSEnginePylon* parent, CTiglUIDManager* uidMgr);
TIGL_EXPORT CCPACSPositionings(CCPACSFuselage* parent, CTiglUIDManager* uidMgr);
TIGL_EXPORT CCPACSPositionings(CCPACSDuct* parent, CTiglUIDManager* uidMgr);
TIGL_EXPORT CCPACSPositionings(CCPACSWing* parent, CTiglUIDManager* uidMgr);

// Virtual Destructor
Expand Down
6 changes: 3 additions & 3 deletions src/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ class Version
auto results = std::match_results<std::string::const_iterator>();

if (std::regex_search(str, results, expr)) {
m_major = atof(results[1].str().c_str());
m_minor = atof(results[2].str().c_str());
m_patch = atof(results[4].str().c_str());
m_major = (int)atof(results[1].str().c_str());
m_minor = (int)atof(results[2].str().c_str());
m_patch = (int)atof(results[4].str().c_str());
m_label = results[5];
m_build = results[6];
}
Expand Down
9 changes: 7 additions & 2 deletions src/api/tigl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2439,7 +2439,7 @@ TIGL_COMMON_EXPORT TiglReturnCode tiglGetControlSurfaceUID(TiglCPACSConfiguratio
const auto& config = tigl::CCPACSConfigurationManager::GetInstance().GetConfiguration(cpacsHandle);
const auto& uidMgr = config.GetUIDManager();
const auto& compSeg = uidMgr.ResolveObject<tigl::CCPACSWingComponentSegment>(componentSegmentUID);
if (!compSeg.GetControlSurfaces() || controlSurfaceIndex > compSeg.GetControlSurfaces()->ControlSurfaceCount())
if (!compSeg.GetControlSurfaces() || controlSurfaceIndex > (int)compSeg.GetControlSurfaces()->ControlSurfaceCount())
return TIGL_INDEX_ERROR;

*controlSurfaceUID = const_cast<char*>(compSeg.GetControlSurfaces()->GetTrailingEdgeDevices() \
Expand Down Expand Up @@ -3757,7 +3757,12 @@ TIGL_COMMON_EXPORT TiglReturnCode tiglFuselageGetSegmentIndex(TiglCPACSConfigura

const tigl::CCPACSFuselageSegment& segment = uidMgr.ResolveObject<tigl::CCPACSFuselageSegment>(segmentUID);

const auto& pfuselage = segment.GetParent()->GetParent();
if (!segment.GetParent()->IsParent<tigl::CCPACSFuselage>()){
LOG(ERROR) << "Error in tiglFuselageGetSegmentIndex: The segment with given uid \"" << segmentUID << "\" is not part of a fuselage.";
return TIGL_NOT_FOUND;
}

const auto& pfuselage = segment.GetParent()->GetParent<tigl::CCPACSFuselage>();
const auto& pfuselages = pfuselage->GetParent();

*fuselageIndex = static_cast<int>(IndexFromUid(pfuselages->GetFuselages(), pfuselage->GetUID())) + 1;
Expand Down
5 changes: 4 additions & 1 deletion src/api/tigl.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ TIGL_COMPONENT_ENGINE_PYLON, /**< The Component is a engine pylon */
TIGL_COMPONENT_ENGINE_NACELLE, /**< The Component is a engine nacelle */
TIGL_COMPONENT_FUSELAGE_WALL, /**< The Component is a fuselage wall */
TIGL_COMPONENT_CONTROL_SURFACE_DEVICE, /**< The component is a control surface device (flap) */
TIGL_COMPONENT_DUCT, /**< The Component belongs to a duct */
TIGL_COMPONENT_OTHER
};

Expand Down Expand Up @@ -2622,7 +2623,9 @@ TIGL_COMMON_EXPORT TiglReturnCode tiglFuselageGetSegmentUID(TiglCPACSConfigurati
*
* @return
* - TIGL_SUCCESS if no error occurred
* - TIGL_NOT_FOUND if no configuration was found for the given handle
* - TIGL_NOT_FOUND if no configuration was found for the given handle, or if the segmentUID is not
* part of any fuselage. This could be the case if the segment is part of a duct
* for instance.
* - TIGL_INDEX_ERROR if fuselageIndex is not valid
* - TIGL_UID_ERROR if the segmentUID does not exist
* - TIGL_NULL_POINTER if segmentUID is a null pointer
Expand Down
57 changes: 57 additions & 0 deletions src/ducts/CCPACSDuct.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (C) 2007-2022 German Aerospace Center (DLR/SC)
*
* Created: 2022-03-15 Anton Reiswich <Anton.Reiswich@dlr.de>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief Implementation of CPACS duct handling routines.
*/

#include "CCPACSDuct.h"
#include "generated/CPACSDucts.h"

namespace tigl {

CCPACSDuct::CCPACSDuct(CCPACSDucts* parent, CTiglUIDManager* uidMgr)
: generated::CPACSDuct(parent, uidMgr)
, CTiglRelativelyPositionedComponent(&m_parentUID, &m_transformation, &m_symmetry)
{}

CCPACSConfiguration& CCPACSDuct::GetConfiguration() const
{
return GetParent()->GetParent()->GetConfiguration();
}

std::string CCPACSDuct::GetDefaultedUID() const
{
return generated::CPACSDuct::GetUID();
}

TiglGeometricComponentType CCPACSDuct::GetComponentType() const
{
return TIGL_COMPONENT_DUCT;
}

TiglGeometricComponentIntent CCPACSDuct::GetComponentIntent() const
{
return TIGL_INTENT_LOGICAL;
}

PNamedShape CCPACSDuct::BuildLoft() const
{
throw CTiglError("Not implemented yet");
}

} //namespace tigl
48 changes: 48 additions & 0 deletions src/ducts/CCPACSDuct.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2007-2022 German Aerospace Center (DLR/SC)
*
* Created: 2022-03-15 Anton Reiswich <Anton.Reiswich@dlr.de>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief Implementation of CPACS duct handling routines.
*/

#pragma once

#include "generated/CPACSDuct.h"
#include "CTiglRelativelyPositionedComponent.h"
#include "CCPACSConfiguration.h"

namespace tigl
{

class CCPACSDuct : public generated::CPACSDuct, public CTiglRelativelyPositionedComponent
{
public:

TIGL_EXPORT CCPACSDuct(CCPACSDucts* parent, CTiglUIDManager* uidMgr);

TIGL_EXPORT CCPACSConfiguration& GetConfiguration() const;

TIGL_EXPORT std::string GetDefaultedUID() const override;
// Returns the Component Type TIGL_COMPONENT_DUCT
TIGL_EXPORT TiglGeometricComponentType GetComponentType() const override;
TIGL_EXPORT TiglGeometricComponentIntent GetComponentIntent() const override;

protected:
PNamedShape BuildLoft() const override;
};

}
33 changes: 33 additions & 0 deletions src/ducts/CCPACSDuctStructure.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2007-2022 German Aerospace Center (DLR/SC)
*
* Created: 2022-03-15 Anton Reiswich <Anton.Reiswich@dlr.de>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief Implementation of CPACS duct structure handling routines.
*/

#include "CCPACSDuctStructure.h"
#include "CCPACSDuct.h"


namespace tigl {

CCPACSDuctStructure::CCPACSDuctStructure(CCPACSDuct* parent, CTiglUIDManager* uidMgr)
: generated::CPACSDuctStructure(parent, uidMgr)
, ITiglFuselageDuctStructure(parent)
{}

} //namespace tigl
37 changes: 37 additions & 0 deletions src/ducts/CCPACSDuctStructure.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2007-2022 German Aerospace Center (DLR/SC)
*
* Created: 2022-03-15 Anton Reiswich <Anton.Reiswich@dlr.de>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief Implementation of CPACS duct structure handling routines.
*/

#pragma once

#include "generated/CPACSDuctStructure.h"
#include "CTiglRelativelyPositionedComponent.h"
#include "ITiglFuselageDuctStructure.h"

namespace tigl
{

class CCPACSDuctStructure : public generated::CPACSDuctStructure, public ITiglFuselageDuctStructure
{
public:
TIGL_EXPORT CCPACSDuctStructure(CCPACSDuct* parent, CTiglUIDManager* uidMgr);
};

} //namespace tigl
Loading