Skip to content

Commit

Permalink
continue work on nacelle engine nacelles
Browse files Browse the repository at this point in the history
make sure ITiglWingProfilePointList can deal with PCACSPointListXYVector (2d points also)

addresses #529
  • Loading branch information
joergbrech committed Nov 19, 2018
1 parent f92e623 commit 421069d
Show file tree
Hide file tree
Showing 46 changed files with 868 additions and 306 deletions.
14 changes: 10 additions & 4 deletions cpacs_gen_input/CustomTypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ CPACSPoint CCPACSPoint
CPACSPointAbsRel CCPACSPointAbsRel
CPACSTransformation CCPACSTransformation
CPACSStringVectorBase CCPACSStringVector
CPACSPointListXYZVector CCPACSPointListXYZ
CPACSPointListRelXYZVector CCPACSPointListRelXYZ
CPACSPointListXYZVector CCPACSPointListXYZVector
CPACSPointListRelXYZVector CCPACSPointListRelXYZVector
CPACSPointListXYVector CCPACSPointListXYVector
CPACSPointListXY CCPACSPointListXY
CPACSGenericGeometricComponent CCPACSExternalObject
CPACSGenericGeometryComponents CCPACSExternalObjects

Expand Down Expand Up @@ -98,7 +100,6 @@ CPACSFramesAssembly CCPACSFramesAssembly
CPACSLongFloorBeam CCPACSLongFloorBeam
CPACSLongFloorBeamPosition CCPACSLongFloorBeamPosition
CPACSLongFloorBeamsAssembly CCPACSLongFloorBeamsAssembly
CPACSPointListXY CCPACSPointListXY
CPACSStringersAssembly CCPACSStringersAssembly
CPACSFuselageStructure CCPACSFuselageStructure
CPACSStringer CCPACSFuselageStringer
Expand All @@ -120,4 +121,9 @@ CPACSTrailingEdgeDevices CCPACSTrailingEdgeDevices

// Pylons
CPACSEnginePylon CCPACSEnginePylon
CPACSEnginePylons CCPACSEnginePylons
CPACSEnginePylons CCPACSEnginePylons

// Engines
CPACSNacelleCowl CCPACSNacelleCowl
CPACSNacelleSections CCPACSNacelleSections
CPACSNacelleSection CCPACSNacelleSection
1 change: 1 addition & 0 deletions cpacs_gen_input/ParentPointer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ CPACSSkinSegments
CPACSEnginePylon
CPACSEnginePylons

CPACSNacelleCowl
3 changes: 3 additions & 0 deletions cpacs_gen_input/PruneList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,6 @@ CPACSUncertaintyFunction

// in pylon
CPACSPylonStructure

// in nacelle
CPACSNacelleCenterCowl
16 changes: 14 additions & 2 deletions cpacs_gen_input/cpacs_schema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -13546,11 +13546,21 @@ jonas.jepsen@dlr.de
<xsd:element name="fanCowl"
type="nacelleCowlType">
</xsd:element>
<xsd:element name="coreCowl"
<xsd:element minOccurs="0" name="coreCowl"
type="nacelleCowlType">
</xsd:element>
<xsd:element name="centerCowl" type="nacelleCenterCowlType"></xsd:element>
<xsd:element minOccurs="0" name="centerCowl" type="nacelleCenterCowlType"></xsd:element>
</xsd:all>
<xsd:attribute name="uID" type="xsd:string" 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:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Expand Down Expand Up @@ -43550,6 +43560,7 @@ jonas.jepsen@dlr.de
</xsd:element>
<xsd:element name="rotationCurve" type="rotationCurveType"></xsd:element>
</xsd:all>
<xsd:attribute name="uID" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Expand Down Expand Up @@ -43591,6 +43602,7 @@ jonas.jepsen@dlr.de
<xsd:element name="xOffset" type="doubleBaseType"></xsd:element>
<xsd:element name="curveUID" type="stringUIDBaseType"></xsd:element>
</xsd:all>
<xsd:attribute name="uID" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Expand Down
16 changes: 14 additions & 2 deletions cpacs_gen_input/cpacs_schema.xsd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -13544,11 +13544,21 @@ jonas.jepsen@dlr.de
<xsd:element name="fanCowl"
type="nacelleCowlType">
</xsd:element>
<xsd:element name="coreCowl"
<xsd:element minOccurs="0" name="coreCowl"
type="nacelleCowlType">
</xsd:element>
<xsd:element name="centerCowl" type="nacelleCenterCowlType"></xsd:element>
<xsd:element minOccurs="0" name="centerCowl" type="nacelleCenterCowlType"></xsd:element>
</xsd:all>
<xsd:attribute name="uID" type="xsd:string" 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:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Expand Down Expand Up @@ -43707,6 +43717,7 @@ jonas.jepsen@dlr.de
</xsd:element>
<xsd:element name="rotationCurve" type="rotationCurveType"></xsd:element>
</xsd:all>
<xsd:attribute name="uID" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Expand Down Expand Up @@ -43748,6 +43759,7 @@ jonas.jepsen@dlr.de
<xsd:element name="xOffset" type="doubleBaseType"></xsd:element>
<xsd:element name="curveUID" type="stringUIDBaseType"></xsd:element>
</xsd:all>
<xsd:attribute name="uID" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/


#include "CCPACSPointListRelXYZ.h"
#include "CCPACSPointListRelXYZVector.h"

namespace tigl
{

void CCPACSPointListRelXYZ::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath)
void CCPACSPointListRelXYZVector::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath)
{
generated::CPACSPointListRelXYZVector::ReadCPACS(tixiHandle, xpath);

Expand All @@ -37,11 +37,11 @@ void CCPACSPointListRelXYZ::ReadCPACS(const TixiDocumentHandle& tixiHandle, cons
}
}

void CCPACSPointListRelXYZ::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const
void CCPACSPointListRelXYZVector::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const
{
// write back to CPACS fields
CCPACSPointListRelXYZ* self =
const_cast<CCPACSPointListRelXYZ*>(this); // TODO: ugly hack, but WriteCPACS() has to be const, fix this
CCPACSPointListRelXYZVector* self =
const_cast<CCPACSPointListRelXYZVector*>(this); // TODO: ugly hack, but WriteCPACS() has to be const, fix this
std::vector<double>& xs = self->GetRX().AsVector();
std::vector<double>& ys = self->GetRY().AsVector();
std::vector<double>& zs = self->GetRZ().AsVector();
Expand All @@ -57,12 +57,12 @@ void CCPACSPointListRelXYZ::WriteCPACS(const TixiDocumentHandle& tixiHandle, con
generated::CPACSPointListRelXYZVector::WriteCPACS(tixiHandle, xpath);
}

const std::vector<CTiglPoint>& CCPACSPointListRelXYZ::AsVector() const
const std::vector<CTiglPoint>& CCPACSPointListRelXYZVector::AsVector() const
{
return m_vec;
}

std::vector<CTiglPoint>& CCPACSPointListRelXYZ::AsVector()
std::vector<CTiglPoint>& CCPACSPointListRelXYZVector::AsVector()
{
return m_vec;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace tigl
{

class CCPACSPointListRelXYZ : public generated::CPACSPointListRelXYZVector
class CCPACSPointListRelXYZVector : public generated::CPACSPointListRelXYZVector
{
public:
TIGL_EXPORT void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) OVERRIDE;
Expand Down
68 changes: 68 additions & 0 deletions src/CCPACSPointListXYVector.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (c) 2018 RISC Software GmbH
*
* 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.
*/

#include "CCPACSPointListXYVector.h"

#include "CTiglLogging.h"
#include "CTiglError.h"

namespace tigl
{

void CCPACSPointListXYVector::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath)
{
generated::CPACSPointListXYVector::ReadCPACS(tixiHandle, xpath);

// create cached representation from CPACS fields
const std::vector<double>& xs = m_x.AsVector();
const std::vector<double>& ys = m_y.AsVector();
if (xs.size() != ys.size() ) {
throw CTiglError("component vectors in CCPACSPointListXYZ must all have the same number of elements");
}
m_vec.clear();
for (std::size_t i = 0; i < xs.size(); i++) {
m_vec.push_back(CTiglPoint(xs[i], ys[i], 0.0));
}
}

void CCPACSPointListXYVector::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const
{
// write back to CPACS fields
CCPACSPointListXYVector* self =
const_cast<CCPACSPointListXYVector*>(this); // TODO: ugly hack, but WriteCPACS() has to be const, fix this
std::vector<double>& xs = self->m_x.AsVector();
std::vector<double>& ys = self->m_y.AsVector();
xs.clear();
ys.clear();
for (std::vector<CTiglPoint>::const_iterator it = m_vec.begin(); it != m_vec.end(); ++it) {
xs.push_back(it->x);
ys.push_back(it->y);
}

generated::CPACSPointListXYVector::WriteCPACS(tixiHandle, xpath);
}

const std::vector<CTiglPoint>& CCPACSPointListXYVector::AsVector() const
{
return m_vec;
}

std::vector<CTiglPoint>& CCPACSPointListXYVector::AsVector()
{
return m_vec;
}

} // namespace tigl
41 changes: 41 additions & 0 deletions src/CCPACSPointListXYVector.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2018 RISC Software GmbH
*
* 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.
*/

#pragma once

#include <vector>

#include "generated/CPACSPointListXYVector.h"
#include "CTiglPoint.h"

namespace tigl
{

class CCPACSPointListXYVector : public generated::CPACSPointListXYVector
{
public:
TIGL_EXPORT void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) OVERRIDE;
TIGL_EXPORT void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const OVERRIDE;

TIGL_EXPORT const std::vector<CTiglPoint>& AsVector() const;
TIGL_EXPORT std::vector<CTiglPoint>& AsVector();

private:
// cache
std::vector<CTiglPoint> m_vec;
};

} // namespace tigl
14 changes: 7 additions & 7 deletions src/CCPACSPointListXYZ.cpp → src/CCPACSPointListXYZVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

#include "CCPACSPointListXYZ.h"
#include "CCPACSPointListXYZVector.h"

#include "CTiglLogging.h"
#include "CTiglError.h"

namespace tigl
{

void CCPACSPointListXYZ::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath)
void CCPACSPointListXYZVector::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath)
{
generated::CPACSPointListXYZVector::ReadCPACS(tixiHandle, xpath);

Expand All @@ -39,11 +39,11 @@ void CCPACSPointListXYZ::ReadCPACS(const TixiDocumentHandle& tixiHandle, const s
}
}

void CCPACSPointListXYZ::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const
void CCPACSPointListXYZVector::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const
{
// write back to CPACS fields
CCPACSPointListXYZ* self =
const_cast<CCPACSPointListXYZ*>(this); // TODO: ugly hack, but WriteCPACS() has to be const, fix this
CCPACSPointListXYZVector* self =
const_cast<CCPACSPointListXYZVector*>(this); // TODO: ugly hack, but WriteCPACS() has to be const, fix this
std::vector<double>& xs = self->m_x.AsVector();
std::vector<double>& ys = self->m_y.AsVector();
std::vector<double>& zs = self->m_z.AsVector();
Expand All @@ -59,12 +59,12 @@ void CCPACSPointListXYZ::WriteCPACS(const TixiDocumentHandle& tixiHandle, const
generated::CPACSPointListXYZVector::WriteCPACS(tixiHandle, xpath);
}

const std::vector<CTiglPoint>& CCPACSPointListXYZ::AsVector() const
const std::vector<CTiglPoint>& CCPACSPointListXYZVector::AsVector() const
{
return m_vec;
}

std::vector<CTiglPoint>& CCPACSPointListXYZ::AsVector()
std::vector<CTiglPoint>& CCPACSPointListXYZVector::AsVector()
{
return m_vec;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace tigl
{

class CCPACSPointListXYZ : public generated::CPACSPointListXYZVector
class CCPACSPointListXYZVector : public generated::CPACSPointListXYZVector
{
public:
TIGL_EXPORT void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) OVERRIDE;
Expand Down
1 change: 1 addition & 0 deletions src/api/tigl.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ typedef unsigned int TiglGeometricComponentType;

#define TIGL_COMPONENT_LONG_FLOOR_BEAM 65536 /**< The Component is a long floor beam */
#define TIGL_COMPONENT_ENGINE_PYLON 131072 /**< The Component is a engine pylon */
#define TIGL_COMPONENT_ENGINE_NACELLE 262144 /**< The Component is a engine nacelle */

enum TiglStructureType
{
Expand Down
39 changes: 39 additions & 0 deletions src/engine_nacelle/CCPACSNacelleCowl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2018 German Aerospace Center (DLR/SC)
*
* Created: 2018-11-16 Jan Kleinert <jan.kleinert@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.
*/

#include "CCPACSNacelleCowl.h"

namespace tigl
{

CCPACSNacelleCowl::CCPACSNacelleCowl(CCPACSEngineNacelle* parent, CTiglUIDManager* uidMgr)
: generated::CPACSNacelleCowl(parent, uidMgr)
, CTiglAbstractGeometricComponent()
{}

std::string CCPACSNacelleCowl::GetDefaultedUID() const
{
return generated::CPACSNacelleCowl::GetUID();
}

PNamedShape CCPACSNacelleCowl::BuildLoft() const
{
//TODO
return PNamedShape();
}

} //namespace tigl
Loading

0 comments on commit 421069d

Please sign in to comment.