From 421069d99963b54fb22027eb18d9cf5e7c41798e Mon Sep 17 00:00:00 2001 From: Jan Kleinert Date: Mon, 19 Nov 2018 16:23:40 +0100 Subject: [PATCH] continue work on nacelle engine nacelles make sure ITiglWingProfilePointList can deal with PCACSPointListXYVector (2d points also) addresses #529 --- cpacs_gen_input/CustomTypes.txt | 14 ++- cpacs_gen_input/ParentPointer.txt | 1 + cpacs_gen_input/PruneList.txt | 3 + cpacs_gen_input/cpacs_schema.xsd | 16 ++- cpacs_gen_input/cpacs_schema.xsd.orig | 16 ++- ...YZ.cpp => CCPACSPointListRelXYZVector.cpp} | 14 +-- ...RelXYZ.h => CCPACSPointListRelXYZVector.h} | 2 +- src/CCPACSPointListXYVector.cpp | 68 +++++++++++ src/CCPACSPointListXYVector.h | 41 +++++++ ...stXYZ.cpp => CCPACSPointListXYZVector.cpp} | 14 +-- ...ntListXYZ.h => CCPACSPointListXYZVector.h} | 2 +- src/api/tigl.h | 1 + src/engine_nacelle/CCPACSNacelleCowl.cpp | 39 +++++++ src/engine_nacelle/CCPACSNacelleCowl.h | 41 +++++++ src/engine_nacelle/CCPACSNacelleProfile.cpp | 49 ++++++++ src/engine_nacelle/CCPACSNacelleProfile.h | 49 ++++++++ src/engine_nacelle/CCPACSNacelleSection.cpp | 35 ++++++ src/engine_nacelle/CCPACSNacelleSection.h | 39 +++++++ src/engine_nacelle/CCPACSNacelleSections.cpp | 42 +++++++ src/engine_nacelle/CCPACSNacelleSections.h | 36 ++++++ .../CTiglEngineNacelleBuilder.cpp | 62 ++++++++++ .../CTiglEngineNacelleBuilder.h | 40 +++++++ src/generated/CPACSEngineNacelle.cpp | 106 +++++++++++++----- src/generated/CPACSEngineNacelle.h | 32 ++++-- src/generated/CPACSEnginePylon.cpp | 25 +++++ src/generated/CPACSEnginePylon.h | 7 +- src/generated/CPACSEnginePylons.h | 2 +- .../CPACSGuideCurveProfileGeometry.cpp | 4 +- .../CPACSGuideCurveProfileGeometry.h | 8 +- src/generated/CPACSNacelleCenterCowl.cpp | 92 --------------- src/generated/CPACSNacelleCenterCowl.h | 71 ------------ src/generated/CPACSNacelleCowl.cpp | 50 ++++++++- src/generated/CPACSNacelleCowl.h | 29 +++-- src/generated/CPACSNacelleSection.h | 7 +- src/generated/CPACSNacelleSections.cpp | 12 +- src/generated/CPACSNacelleSections.h | 22 ++-- src/generated/CPACSPointListRelXYZVector.h | 2 +- src/generated/CPACSPointListXYVector.h | 7 +- src/generated/CPACSPointListXYZVector.h | 2 +- src/generated/CPACSProfileGeometry.cpp | 6 +- src/generated/CPACSProfileGeometry.h | 20 ++-- src/generated/CPACSProfileGeometry2D.cpp | 6 +- src/generated/CPACSProfileGeometry2D.h | 10 +- src/generated/CPACSSymmetry.h | 4 +- src/wing/CTiglWingProfilePointList.cpp | 17 ++- src/wing/CTiglWingProfilePointList.h | 9 +- 46 files changed, 868 insertions(+), 306 deletions(-) rename src/{CCPACSPointListRelXYZ.cpp => CCPACSPointListRelXYZVector.cpp} (76%) rename src/{CCPACSPointListRelXYZ.h => CCPACSPointListRelXYZVector.h} (93%) create mode 100644 src/CCPACSPointListXYVector.cpp create mode 100644 src/CCPACSPointListXYVector.h rename src/{CCPACSPointListXYZ.cpp => CCPACSPointListXYZVector.cpp} (77%) rename src/{CCPACSPointListXYZ.h => CCPACSPointListXYZVector.h} (93%) create mode 100644 src/engine_nacelle/CCPACSNacelleCowl.cpp create mode 100644 src/engine_nacelle/CCPACSNacelleCowl.h create mode 100644 src/engine_nacelle/CCPACSNacelleProfile.cpp create mode 100644 src/engine_nacelle/CCPACSNacelleProfile.h create mode 100644 src/engine_nacelle/CCPACSNacelleSection.cpp create mode 100644 src/engine_nacelle/CCPACSNacelleSection.h create mode 100644 src/engine_nacelle/CCPACSNacelleSections.cpp create mode 100644 src/engine_nacelle/CCPACSNacelleSections.h create mode 100644 src/engine_nacelle/CTiglEngineNacelleBuilder.cpp create mode 100644 src/engine_nacelle/CTiglEngineNacelleBuilder.h delete mode 100644 src/generated/CPACSNacelleCenterCowl.cpp delete mode 100644 src/generated/CPACSNacelleCenterCowl.h diff --git a/cpacs_gen_input/CustomTypes.txt b/cpacs_gen_input/CustomTypes.txt index 877076fdd..182b68228 100644 --- a/cpacs_gen_input/CustomTypes.txt +++ b/cpacs_gen_input/CustomTypes.txt @@ -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 @@ -98,7 +100,6 @@ CPACSFramesAssembly CCPACSFramesAssembly CPACSLongFloorBeam CCPACSLongFloorBeam CPACSLongFloorBeamPosition CCPACSLongFloorBeamPosition CPACSLongFloorBeamsAssembly CCPACSLongFloorBeamsAssembly -CPACSPointListXY CCPACSPointListXY CPACSStringersAssembly CCPACSStringersAssembly CPACSFuselageStructure CCPACSFuselageStructure CPACSStringer CCPACSFuselageStringer @@ -120,4 +121,9 @@ CPACSTrailingEdgeDevices CCPACSTrailingEdgeDevices // Pylons CPACSEnginePylon CCPACSEnginePylon -CPACSEnginePylons CCPACSEnginePylons \ No newline at end of file +CPACSEnginePylons CCPACSEnginePylons + +// Engines +CPACSNacelleCowl CCPACSNacelleCowl +CPACSNacelleSections CCPACSNacelleSections +CPACSNacelleSection CCPACSNacelleSection \ No newline at end of file diff --git a/cpacs_gen_input/ParentPointer.txt b/cpacs_gen_input/ParentPointer.txt index 86a299e34..158bbb6c8 100644 --- a/cpacs_gen_input/ParentPointer.txt +++ b/cpacs_gen_input/ParentPointer.txt @@ -92,3 +92,4 @@ CPACSSkinSegments CPACSEnginePylon CPACSEnginePylons +CPACSNacelleCowl diff --git a/cpacs_gen_input/PruneList.txt b/cpacs_gen_input/PruneList.txt index c0ee69f23..e8d1968ff 100644 --- a/cpacs_gen_input/PruneList.txt +++ b/cpacs_gen_input/PruneList.txt @@ -121,3 +121,6 @@ CPACSUncertaintyFunction // in pylon CPACSPylonStructure + +// in nacelle +CPACSNacelleCenterCowl \ No newline at end of file diff --git a/cpacs_gen_input/cpacs_schema.xsd b/cpacs_gen_input/cpacs_schema.xsd index c0ad18411..571c5d574 100644 --- a/cpacs_gen_input/cpacs_schema.xsd +++ b/cpacs_gen_input/cpacs_schema.xsd @@ -13546,11 +13546,21 @@ jonas.jepsen@dlr.de - - + + + + + + + + + + + @@ -43550,6 +43560,7 @@ jonas.jepsen@dlr.de + @@ -43591,6 +43602,7 @@ jonas.jepsen@dlr.de + diff --git a/cpacs_gen_input/cpacs_schema.xsd.orig b/cpacs_gen_input/cpacs_schema.xsd.orig index b307bee0a..37336492c 100644 --- a/cpacs_gen_input/cpacs_schema.xsd.orig +++ b/cpacs_gen_input/cpacs_schema.xsd.orig @@ -13544,11 +13544,21 @@ jonas.jepsen@dlr.de - - + + + + + + + + + + + @@ -43707,6 +43717,7 @@ jonas.jepsen@dlr.de + @@ -43748,6 +43759,7 @@ jonas.jepsen@dlr.de + diff --git a/src/CCPACSPointListRelXYZ.cpp b/src/CCPACSPointListRelXYZVector.cpp similarity index 76% rename from src/CCPACSPointListRelXYZ.cpp rename to src/CCPACSPointListRelXYZVector.cpp index d393d0fe9..116dc581c 100644 --- a/src/CCPACSPointListRelXYZ.cpp +++ b/src/CCPACSPointListRelXYZVector.cpp @@ -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); @@ -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(this); // TODO: ugly hack, but WriteCPACS() has to be const, fix this + CCPACSPointListRelXYZVector* self = + const_cast(this); // TODO: ugly hack, but WriteCPACS() has to be const, fix this std::vector& xs = self->GetRX().AsVector(); std::vector& ys = self->GetRY().AsVector(); std::vector& zs = self->GetRZ().AsVector(); @@ -57,12 +57,12 @@ void CCPACSPointListRelXYZ::WriteCPACS(const TixiDocumentHandle& tixiHandle, con generated::CPACSPointListRelXYZVector::WriteCPACS(tixiHandle, xpath); } -const std::vector& CCPACSPointListRelXYZ::AsVector() const +const std::vector& CCPACSPointListRelXYZVector::AsVector() const { return m_vec; } -std::vector& CCPACSPointListRelXYZ::AsVector() +std::vector& CCPACSPointListRelXYZVector::AsVector() { return m_vec; } diff --git a/src/CCPACSPointListRelXYZ.h b/src/CCPACSPointListRelXYZVector.h similarity index 93% rename from src/CCPACSPointListRelXYZ.h rename to src/CCPACSPointListRelXYZVector.h index cadce6004..82f8d069a 100644 --- a/src/CCPACSPointListRelXYZ.h +++ b/src/CCPACSPointListRelXYZVector.h @@ -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; diff --git a/src/CCPACSPointListXYVector.cpp b/src/CCPACSPointListXYVector.cpp new file mode 100644 index 000000000..173fa8a16 --- /dev/null +++ b/src/CCPACSPointListXYVector.cpp @@ -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& xs = m_x.AsVector(); + const std::vector& 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(this); // TODO: ugly hack, but WriteCPACS() has to be const, fix this + std::vector& xs = self->m_x.AsVector(); + std::vector& ys = self->m_y.AsVector(); + xs.clear(); + ys.clear(); + for (std::vector::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& CCPACSPointListXYVector::AsVector() const +{ + return m_vec; +} + +std::vector& CCPACSPointListXYVector::AsVector() +{ + return m_vec; +} + +} // namespace tigl diff --git a/src/CCPACSPointListXYVector.h b/src/CCPACSPointListXYVector.h new file mode 100644 index 000000000..6a1529fe0 --- /dev/null +++ b/src/CCPACSPointListXYVector.h @@ -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 + +#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& AsVector() const; + TIGL_EXPORT std::vector& AsVector(); + +private: + // cache + std::vector m_vec; +}; + +} // namespace tigl diff --git a/src/CCPACSPointListXYZ.cpp b/src/CCPACSPointListXYZVector.cpp similarity index 77% rename from src/CCPACSPointListXYZ.cpp rename to src/CCPACSPointListXYZVector.cpp index ec0bad280..ef1d98468 100644 --- a/src/CCPACSPointListXYZ.cpp +++ b/src/CCPACSPointListXYZVector.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "CCPACSPointListXYZ.h" +#include "CCPACSPointListXYZVector.h" #include "CTiglLogging.h" #include "CTiglError.h" @@ -22,7 +22,7 @@ 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); @@ -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(this); // TODO: ugly hack, but WriteCPACS() has to be const, fix this + CCPACSPointListXYZVector* self = + const_cast(this); // TODO: ugly hack, but WriteCPACS() has to be const, fix this std::vector& xs = self->m_x.AsVector(); std::vector& ys = self->m_y.AsVector(); std::vector& zs = self->m_z.AsVector(); @@ -59,12 +59,12 @@ void CCPACSPointListXYZ::WriteCPACS(const TixiDocumentHandle& tixiHandle, const generated::CPACSPointListXYZVector::WriteCPACS(tixiHandle, xpath); } -const std::vector& CCPACSPointListXYZ::AsVector() const +const std::vector& CCPACSPointListXYZVector::AsVector() const { return m_vec; } -std::vector& CCPACSPointListXYZ::AsVector() +std::vector& CCPACSPointListXYZVector::AsVector() { return m_vec; } diff --git a/src/CCPACSPointListXYZ.h b/src/CCPACSPointListXYZVector.h similarity index 93% rename from src/CCPACSPointListXYZ.h rename to src/CCPACSPointListXYZVector.h index 60b9fd7ca..4e0620e32 100644 --- a/src/CCPACSPointListXYZ.h +++ b/src/CCPACSPointListXYZVector.h @@ -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; diff --git a/src/api/tigl.h b/src/api/tigl.h index 187398e75..a83ce11a2 100644 --- a/src/api/tigl.h +++ b/src/api/tigl.h @@ -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 { diff --git a/src/engine_nacelle/CCPACSNacelleCowl.cpp b/src/engine_nacelle/CCPACSNacelleCowl.cpp new file mode 100644 index 000000000..58ea42515 --- /dev/null +++ b/src/engine_nacelle/CCPACSNacelleCowl.cpp @@ -0,0 +1,39 @@ +/* +* Copyright (C) 2018 German Aerospace Center (DLR/SC) +* +* Created: 2018-11-16 Jan Kleinert +* 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 diff --git a/src/engine_nacelle/CCPACSNacelleCowl.h b/src/engine_nacelle/CCPACSNacelleCowl.h new file mode 100644 index 000000000..ff21fc6af --- /dev/null +++ b/src/engine_nacelle/CCPACSNacelleCowl.h @@ -0,0 +1,41 @@ +/* +* Copyright (C) 2018 German Aerospace Center (DLR/SC) +* +* Created: 2018-11-16 Jan Kleinert +* 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 "generated/CPACSNacelleCowl.h" +#include "CTiglAbstractGeometricComponent.h" +#include "tigl_internal.h" + +namespace tigl +{ + +class CCPACSNacelleCowl : public generated::CPACSNacelleCowl, public CTiglAbstractGeometricComponent +{ +public: + // Constructor + TIGL_EXPORT CCPACSNacelleCowl(CCPACSEngineNacelle* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT std::string GetDefaultedUID() const OVERRIDE; + + TIGL_EXPORT TiglGeometricComponentType GetComponentType() const OVERRIDE { return TIGL_COMPONENT_ENGINE_NACELLE | TIGL_COMPONENT_PHYSICAL; } + +protected: + virtual PNamedShape BuildLoft() const OVERRIDE; +}; + +} //namespae tigl diff --git a/src/engine_nacelle/CCPACSNacelleProfile.cpp b/src/engine_nacelle/CCPACSNacelleProfile.cpp new file mode 100644 index 000000000..36560d8c7 --- /dev/null +++ b/src/engine_nacelle/CCPACSNacelleProfile.cpp @@ -0,0 +1,49 @@ +/* +* Copyright (C) 2018 German Aerospace Center (DLR/SC) +* +* Created: 2018-11-16 Jan Kleinert +* 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 "CCPACSNacelleProfile.h" + +namespace tigl { + +CCPACSNacelleProfile::CCPACSNacelleProfile(CTiglUIDManager* uidMgr) + : generated::CPACSProfileGeometry2D(uidMgr) + , pointListAlgo(*this,&CCPACSNacelleProfile::buildPointListAlgo) +{} + +void CCPACSNacelleProfile::buildPointListAlgo(unique_ptr& cache) const +{ + cache.reset(new CTiglWingProfilePointList(*this, *m_pointList_choice1)); +} + +ITiglWingProfileAlgo* CCPACSNacelleProfile::GetProfileAlgo() +{ + if (m_pointList_choice1) { + // in case the wing profile algorithm is a point list, create the additional algorithm instance + return &**pointListAlgo; + } else if (m_cst2D_choice2) { + return &*m_cst2D_choice2; + } else { + throw CTiglError("no profile algorithm"); + } +} + +const ITiglWingProfileAlgo* CCPACSNacelleProfile::GetProfileAlgo() const +{ + return const_cast(*this).GetProfileAlgo(); +} + +} //namepsace tigl diff --git a/src/engine_nacelle/CCPACSNacelleProfile.h b/src/engine_nacelle/CCPACSNacelleProfile.h new file mode 100644 index 000000000..7871b8236 --- /dev/null +++ b/src/engine_nacelle/CCPACSNacelleProfile.h @@ -0,0 +1,49 @@ +/* +* Copyright (C) 2018 German Aerospace Center (DLR/SC) +* +* Created: 2018-11-16 Jan Kleinert +* 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 "generated/CPACSProfileGeometry2D.h" +#include "tigl_internal.h" +#include "CTiglWingProfilePointList.h" +#include "Cache.h" + +#include "TopoDS_Wire.hxx" + +namespace tigl +{ + +class CCPACSNacelleProfile : public generated::CPACSProfileGeometry2D +{ +public: + CCPACSNacelleProfile(CTiglUIDManager* uidMgr); + + // get profile algorithm type + TIGL_EXPORT ITiglWingProfileAlgo* GetProfileAlgo(); + TIGL_EXPORT const ITiglWingProfileAlgo* GetProfileAlgo() const; + + // Checks, whether the trailing edge is blunt or not + TIGL_EXPORT bool HasBluntTE() const; + +protected: + void buildPointListAlgo(unique_ptr& cache) const; + +private: + Cache, CCPACSNacelleProfile> pointListAlgo; // is created in case the wing profile alg is a point list, otherwise cst2d constructed in the base class is used +}; + +} //namespace tigl diff --git a/src/engine_nacelle/CCPACSNacelleSection.cpp b/src/engine_nacelle/CCPACSNacelleSection.cpp new file mode 100644 index 000000000..9f4149950 --- /dev/null +++ b/src/engine_nacelle/CCPACSNacelleSection.cpp @@ -0,0 +1,35 @@ +/* +* Copyright (C) 2018 German Aerospace Center (DLR/SC) +* +* Created: 2018-11-16 Jan Kleinert +* 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 "CCPACSNacelleSection.h" +#include "CCPACSNacelleProfile.h" +#include "CTiglUIDManager.h" + +namespace tigl { + +TIGL_EXPORT CCPACSNacelleSection::CCPACSNacelleSection(CTiglUIDManager* uidMgr) + : generated::CPACSNacelleSection(uidMgr) +{}; + +TIGL_EXPORT TopoDS_Wire CCPACSNacelleSection::GetTransformedWire() +{ + CCPACSNacelleProfile& profile = m_uidMgr->ResolveObject(m_profileUID); + + return TopoDS_Wire(); +} + +} //namepsace tigl diff --git a/src/engine_nacelle/CCPACSNacelleSection.h b/src/engine_nacelle/CCPACSNacelleSection.h new file mode 100644 index 000000000..a11f862d9 --- /dev/null +++ b/src/engine_nacelle/CCPACSNacelleSection.h @@ -0,0 +1,39 @@ +/* +* Copyright (C) 2018 German Aerospace Center (DLR/SC) +* +* Created: 2018-11-16 Jan Kleinert +* 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 "generated/CPACSNacelleSection.h" +#include "TopoDS_Wire.hxx" +#include "tigl_internal.h" + +namespace tigl +{ + +class CCPACSNacelleSection : public generated::CPACSNacelleSection +{ +public: + TIGL_EXPORT CCPACSNacelleSection(CTiglUIDManager* uidMgr); + + TIGL_EXPORT TopoDS_Wire GetTransformedWire(); + +private: + //cache + TopoDS_Wire transformedWire; +}; + +} //namespace tigl diff --git a/src/engine_nacelle/CCPACSNacelleSections.cpp b/src/engine_nacelle/CCPACSNacelleSections.cpp new file mode 100644 index 000000000..c454bcc7c --- /dev/null +++ b/src/engine_nacelle/CCPACSNacelleSections.cpp @@ -0,0 +1,42 @@ +/* +* Copyright (C) 2018 German Aerospace Center (DLR/SC) +* +* Created: 2018-11-16 Jan Kleinert +* 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 "CCPACSNacelleSections.h" +#include "CTiglUIDManager.h" +#include "cassert" + +namespace tigl { + +CCPACSNacelleSections::CCPACSNacelleSections(CTiglUIDManager* uidMgr) + : generated::CPACSNacelleSections(uidMgr) +{} + +TIGL_EXPORT size_t CCPACSNacelleSections::GetSectionCount() const +{ + return GetSections().size(); +} + +TIGL_EXPORT CCPACSNacelleSection& CCPACSNacelleSections::GetSection(int index) const +{ + index--; + if (index < 0 || index >= GetSectionCount()) { + throw CTiglError("Invalid index in CCPACSNacelleSections::GetSection", TIGL_INDEX_ERROR); + } + return *m_sections[index]; +} + +} //namepsace tigl diff --git a/src/engine_nacelle/CCPACSNacelleSections.h b/src/engine_nacelle/CCPACSNacelleSections.h new file mode 100644 index 000000000..701920dd2 --- /dev/null +++ b/src/engine_nacelle/CCPACSNacelleSections.h @@ -0,0 +1,36 @@ +/* +* Copyright (C) 2018 German Aerospace Center (DLR/SC) +* +* Created: 2018-11-16 Jan Kleinert +* 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 "generated/CPACSNacelleSections.h" +#include "generated/CPACSNacelleProfiles.h" +#include "tigl_internal.h" + +namespace tigl +{ + +class CCPACSNacelleSections : public generated::CPACSNacelleSections +{ +public: + CCPACSNacelleSections(CTiglUIDManager* uidMgr); + + TIGL_EXPORT size_t GetSectionCount() const; + TIGL_EXPORT CCPACSNacelleSection& GetSection(int index) const; +}; + +} //namespace tigl diff --git a/src/engine_nacelle/CTiglEngineNacelleBuilder.cpp b/src/engine_nacelle/CTiglEngineNacelleBuilder.cpp new file mode 100644 index 000000000..498fc12c8 --- /dev/null +++ b/src/engine_nacelle/CTiglEngineNacelleBuilder.cpp @@ -0,0 +1,62 @@ +/* +* Copyright (C) 2018 German Aerospace Center (DLR/SC) +* +* Created: 2018-11-16 Jan Kleinert +* 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 "CTiglEngineNacelleBuilder.h" +#include "generated/CPACSNacelleSections.h" +#include "CCPACSNacelleSection.h" +#include "UniquePtr.h" + +namespace tigl { + +CTiglEngineNacelleBuilder::CTiglEngineNacelleBuilder(const generated::CPACSEngineNacelle& nacelle) + : m_nacelle(nacelle) +{}; + +PNamedShape CTiglEngineNacelleBuilder::BuildShape() +{ + TopoDS_Shape fanCowlShape = BuildNacelleCowl(m_nacelle.GetFanCowl()); + //TODO + // If coreCowl exists, build coreCowl + // Add both to PNamedShape(); + return PNamedShape(); + +}; + +TopoDS_Shape CTiglEngineNacelleBuilder::BuildNacelleCowl(const CCPACSNacelleCowl& cowl) +{ + // get profile curves + std::vector profiles; + for(size_t i = 1; i <= cowl.GetSections().GetSectionCount(); ++i ) { + CCPACSNacelleSection& section = cowl.GetSections().GetSection(i); + profiles.push_back(section.GetTransformedWire()); + } + +// // get guide curves +// CCPACSNacelleGuideCurves& guides = cowl.GetGuideCurves(); +// if(!guides) { +// // make custom guide curves +// } + + return TopoDS_Shape(); +} + +CTiglEngineNacelleBuilder::operator PNamedShape() +{ + return BuildShape(); +}; + +} //namespace tigl diff --git a/src/engine_nacelle/CTiglEngineNacelleBuilder.h b/src/engine_nacelle/CTiglEngineNacelleBuilder.h new file mode 100644 index 000000000..1a31ef79e --- /dev/null +++ b/src/engine_nacelle/CTiglEngineNacelleBuilder.h @@ -0,0 +1,40 @@ +/* +* Copyright (C) 2018 German Aerospace Center (DLR/SC) +* +* Created: 2018-11-16 Jan Kleinert +* 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 +#include "tigl_internal.h" + +#pragma once + +namespace tigl +{ + class CTiglEngineNacelleBuilder + { + public: + explicit CTiglEngineNacelleBuilder(const CCPACSEngineNacelle& nacelle); + + TIGL_EXPORT operator PNamedShape(); + + TIGL_EXPORT PNamedShape BuildShape(); + + private: + const CCPACSEngineNacelle& m_nacelle; + + TopoDS_Shape BuildNacelleCowl(const CCPACSNacelleCowl& cowl); + }; + +} //namespace tigl diff --git a/src/generated/CPACSEngineNacelle.cpp b/src/generated/CPACSEngineNacelle.cpp index cd7cb9800..260a24796 100644 --- a/src/generated/CPACSEngineNacelle.cpp +++ b/src/generated/CPACSEngineNacelle.cpp @@ -27,13 +27,13 @@ namespace generated { CPACSEngineNacelle::CPACSEngineNacelle(CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) - , m_fanCowl(m_uidMgr) - , m_coreCowl(m_uidMgr) + , m_fanCowl(this, m_uidMgr) { } CPACSEngineNacelle::~CPACSEngineNacelle() { + if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); } CTiglUIDManager& CPACSEngineNacelle::GetUIDManager() @@ -48,6 +48,22 @@ namespace generated void CPACSEngineNacelle::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { + // read attribute uID + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { + m_uID = tixi::TixiGetAttribute(tixiHandle, xpath, "uID"); + if (m_uID.empty()) { + LOG(WARNING) << "Required attribute uID is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; + } + + // read attribute symmetry + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "symmetry")) { + m_symmetry = stringToTiglSymmetryAxis(tixi::TixiGetAttribute(tixiHandle, xpath, "symmetry")); + } + // read element fanCowl if (tixi::TixiCheckElement(tixiHandle, xpath + "/fanCowl")) { m_fanCowl.ReadCPACS(tixiHandle, xpath + "/fanCowl"); @@ -58,66 +74,104 @@ namespace generated // read element coreCowl if (tixi::TixiCheckElement(tixiHandle, xpath + "/coreCowl")) { - m_coreCowl.ReadCPACS(tixiHandle, xpath + "/coreCowl"); + m_coreCowl = boost::in_place(this, m_uidMgr); + try { + m_coreCowl->ReadCPACS(tixiHandle, xpath + "/coreCowl"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read coreCowl at xpath " << xpath << ": " << e.what(); + m_coreCowl = boost::none; + } + } + + if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); + } + + void CPACSEngineNacelle::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write attribute uID + tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); + + // write attribute symmetry + if (m_symmetry) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "symmetry", TiglSymmetryAxisToString(*m_symmetry)); } else { - LOG(ERROR) << "Required element coreCowl is missing at xpath " << xpath; + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "symmetry")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "symmetry"); + } } - // read element centerCowl - if (tixi::TixiCheckElement(tixiHandle, xpath + "/centerCowl")) { - m_centerCowl.ReadCPACS(tixiHandle, xpath + "/centerCowl"); + // write element fanCowl + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/fanCowl"); + m_fanCowl.WriteCPACS(tixiHandle, xpath + "/fanCowl"); + + // write element coreCowl + if (m_coreCowl) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/coreCowl"); + m_coreCowl->WriteCPACS(tixiHandle, xpath + "/coreCowl"); } else { - LOG(ERROR) << "Required element centerCowl is missing at xpath " << xpath; + if (tixi::TixiCheckElement(tixiHandle, xpath + "/coreCowl")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/coreCowl"); + } } } - void CPACSEngineNacelle::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + const std::string& CPACSEngineNacelle::GetUID() const { - // write element fanCowl - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/fanCowl"); - m_fanCowl.WriteCPACS(tixiHandle, xpath + "/fanCowl"); + return m_uID; + } - // write element coreCowl - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/coreCowl"); - m_coreCowl.WriteCPACS(tixiHandle, xpath + "/coreCowl"); + void CPACSEngineNacelle::SetUID(const std::string& value) + { + if (m_uidMgr) { + m_uidMgr->TryUnregisterObject(m_uID); + m_uidMgr->RegisterObject(value, *this); + } + m_uID = value; + } - // write element centerCowl - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/centerCowl"); - m_centerCowl.WriteCPACS(tixiHandle, xpath + "/centerCowl"); + const boost::optional& CPACSEngineNacelle::GetSymmetry() const + { + return m_symmetry; + } + void CPACSEngineNacelle::SetSymmetry(const boost::optional& value) + { + m_symmetry = value; } - const CPACSNacelleCowl& CPACSEngineNacelle::GetFanCowl() const + const CCPACSNacelleCowl& CPACSEngineNacelle::GetFanCowl() const { return m_fanCowl; } - CPACSNacelleCowl& CPACSEngineNacelle::GetFanCowl() + CCPACSNacelleCowl& CPACSEngineNacelle::GetFanCowl() { return m_fanCowl; } - const CPACSNacelleCowl& CPACSEngineNacelle::GetCoreCowl() const + const boost::optional& CPACSEngineNacelle::GetCoreCowl() const { return m_coreCowl; } - CPACSNacelleCowl& CPACSEngineNacelle::GetCoreCowl() + boost::optional& CPACSEngineNacelle::GetCoreCowl() { return m_coreCowl; } - const CPACSNacelleCenterCowl& CPACSEngineNacelle::GetCenterCowl() const + CCPACSNacelleCowl& CPACSEngineNacelle::GetCoreCowl(CreateIfNotExistsTag) { - return m_centerCowl; + if (!m_coreCowl) + m_coreCowl = boost::in_place(this, m_uidMgr); + return *m_coreCowl; } - CPACSNacelleCenterCowl& CPACSEngineNacelle::GetCenterCowl() + void CPACSEngineNacelle::RemoveCoreCowl() { - return m_centerCowl; + m_coreCowl = boost::none; } } // namespace generated diff --git a/src/generated/CPACSEngineNacelle.h b/src/generated/CPACSEngineNacelle.h index 9fc03cc1e..b2c092d27 100644 --- a/src/generated/CPACSEngineNacelle.h +++ b/src/generated/CPACSEngineNacelle.h @@ -17,10 +17,13 @@ #pragma once +#include +#include +#include #include +#include #include -#include "CPACSNacelleCenterCowl.h" -#include "CPACSNacelleCowl.h" +#include "CreateIfNotExists.h" #include "tigl_internal.h" namespace tigl @@ -45,21 +48,28 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const CPACSNacelleCowl& GetFanCowl() const; - TIGL_EXPORT virtual CPACSNacelleCowl& GetFanCowl(); + TIGL_EXPORT virtual const std::string& GetUID() const; + TIGL_EXPORT virtual void SetUID(const std::string& value); - TIGL_EXPORT virtual const CPACSNacelleCowl& GetCoreCowl() const; - TIGL_EXPORT virtual CPACSNacelleCowl& GetCoreCowl(); + TIGL_EXPORT virtual const boost::optional& GetSymmetry() const; + TIGL_EXPORT virtual void SetSymmetry(const boost::optional& value); - TIGL_EXPORT virtual const CPACSNacelleCenterCowl& GetCenterCowl() const; - TIGL_EXPORT virtual CPACSNacelleCenterCowl& GetCenterCowl(); + TIGL_EXPORT virtual const CCPACSNacelleCowl& GetFanCowl() const; + TIGL_EXPORT virtual CCPACSNacelleCowl& GetFanCowl(); + + TIGL_EXPORT virtual const boost::optional& GetCoreCowl() const; + TIGL_EXPORT virtual boost::optional& GetCoreCowl(); + + TIGL_EXPORT virtual CCPACSNacelleCowl& GetCoreCowl(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveCoreCowl(); protected: CTiglUIDManager* m_uidMgr; - CPACSNacelleCowl m_fanCowl; - CPACSNacelleCowl m_coreCowl; - CPACSNacelleCenterCowl m_centerCowl; + std::string m_uID; + boost::optional m_symmetry; + CCPACSNacelleCowl m_fanCowl; + boost::optional m_coreCowl; private: #ifdef HAVE_CPP11 diff --git a/src/generated/CPACSEnginePylon.cpp b/src/generated/CPACSEnginePylon.cpp index 10e0da9f0..9650671aa 100644 --- a/src/generated/CPACSEnginePylon.cpp +++ b/src/generated/CPACSEnginePylon.cpp @@ -73,6 +73,11 @@ namespace generated LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; } + // read attribute symmetry + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "symmetry")) { + m_symmetry = stringToTiglSymmetryAxis(tixi::TixiGetAttribute(tixiHandle, xpath, "symmetry")); + } + // read element name if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); @@ -149,6 +154,16 @@ namespace generated // write attribute uID tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); + // write attribute symmetry + if (m_symmetry) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "symmetry", TiglSymmetryAxisToString(*m_symmetry)); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "symmetry")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "symmetry"); + } + } + // write element name if (m_name) { tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); @@ -228,6 +243,16 @@ namespace generated m_uID = value; } + const boost::optional& CPACSEnginePylon::GetSymmetry() const + { + return m_symmetry; + } + + void CPACSEnginePylon::SetSymmetry(const boost::optional& value) + { + m_symmetry = value; + } + const boost::optional& CPACSEnginePylon::GetName() const { return m_name; diff --git a/src/generated/CPACSEnginePylon.h b/src/generated/CPACSEnginePylon.h index be2b663e2..61b5c3bf0 100644 --- a/src/generated/CPACSEnginePylon.h +++ b/src/generated/CPACSEnginePylon.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "CreateIfNotExists.h" #include "tigl_internal.h" @@ -38,7 +39,7 @@ namespace generated // This class is used in: // CPACSEnginePylons - // generated from /xsd:schema/xsd:complexType[311] + // generated from /xsd:schema/xsd:complexType[316] class CPACSEnginePylon { public: @@ -59,6 +60,9 @@ namespace generated TIGL_EXPORT virtual const std::string& GetUID() const; TIGL_EXPORT virtual void SetUID(const std::string& value); + TIGL_EXPORT virtual const boost::optional& GetSymmetry() const; + TIGL_EXPORT virtual void SetSymmetry(const boost::optional& value); + TIGL_EXPORT virtual const boost::optional& GetName() const; TIGL_EXPORT virtual void SetName(const boost::optional& value); @@ -95,6 +99,7 @@ namespace generated CTiglUIDManager* m_uidMgr; std::string m_uID; + boost::optional m_symmetry; boost::optional m_name; boost::optional m_description; std::string m_parentUID; diff --git a/src/generated/CPACSEnginePylons.h b/src/generated/CPACSEnginePylons.h index 8d3f286be..abec8c892 100644 --- a/src/generated/CPACSEnginePylons.h +++ b/src/generated/CPACSEnginePylons.h @@ -34,7 +34,7 @@ namespace generated // This class is used in: // CPACSAircraftModel - // generated from /xsd:schema/xsd:complexType[312] + // generated from /xsd:schema/xsd:complexType[317] class CPACSEnginePylons { public: diff --git a/src/generated/CPACSGuideCurveProfileGeometry.cpp b/src/generated/CPACSGuideCurveProfileGeometry.cpp index 9a391e504..04832b834 100644 --- a/src/generated/CPACSGuideCurveProfileGeometry.cpp +++ b/src/generated/CPACSGuideCurveProfileGeometry.cpp @@ -173,12 +173,12 @@ namespace generated m_description = value; } - const CCPACSPointListRelXYZ& CPACSGuideCurveProfileGeometry::GetPointList() const + const CCPACSPointListRelXYZVector& CPACSGuideCurveProfileGeometry::GetPointList() const { return m_pointList; } - CCPACSPointListRelXYZ& CPACSGuideCurveProfileGeometry::GetPointList() + CCPACSPointListRelXYZVector& CPACSGuideCurveProfileGeometry::GetPointList() { return m_pointList; } diff --git a/src/generated/CPACSGuideCurveProfileGeometry.h b/src/generated/CPACSGuideCurveProfileGeometry.h index c3ae0b9bc..7ed256837 100644 --- a/src/generated/CPACSGuideCurveProfileGeometry.h +++ b/src/generated/CPACSGuideCurveProfileGeometry.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -59,8 +59,8 @@ namespace generated TIGL_EXPORT virtual const boost::optional& GetDescription() const; TIGL_EXPORT virtual void SetDescription(const boost::optional& value); - TIGL_EXPORT virtual const CCPACSPointListRelXYZ& GetPointList() const; - TIGL_EXPORT virtual CCPACSPointListRelXYZ& GetPointList(); + TIGL_EXPORT virtual const CCPACSPointListRelXYZVector& GetPointList() const; + TIGL_EXPORT virtual CCPACSPointListRelXYZVector& GetPointList(); protected: CTiglUIDManager* m_uidMgr; @@ -69,7 +69,7 @@ namespace generated std::string m_uID; std::string m_name; boost::optional m_description; - CCPACSPointListRelXYZ m_pointList; + CCPACSPointListRelXYZVector m_pointList; private: #ifdef HAVE_CPP11 diff --git a/src/generated/CPACSNacelleCenterCowl.cpp b/src/generated/CPACSNacelleCenterCowl.cpp deleted file mode 100644 index df8ba7294..000000000 --- a/src/generated/CPACSNacelleCenterCowl.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2018 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// 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 "CPACSNacelleCenterCowl.h" -#include "CTiglError.h" -#include "CTiglLogging.h" -#include "TixiHelper.h" - -namespace tigl -{ -namespace generated -{ - CPACSNacelleCenterCowl::CPACSNacelleCenterCowl() - : m_xOffset(0) - { - } - - CPACSNacelleCenterCowl::~CPACSNacelleCenterCowl() - { - } - - void CPACSNacelleCenterCowl::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) - { - // read element xOffset - if (tixi::TixiCheckElement(tixiHandle, xpath + "/xOffset")) { - m_xOffset = tixi::TixiGetElement(tixiHandle, xpath + "/xOffset"); - } - else { - LOG(ERROR) << "Required element xOffset is missing at xpath " << xpath; - } - - // read element curveUID - if (tixi::TixiCheckElement(tixiHandle, xpath + "/curveUID")) { - m_curveUID = tixi::TixiGetElement(tixiHandle, xpath + "/curveUID"); - if (m_curveUID.empty()) { - LOG(WARNING) << "Required element curveUID is empty at xpath " << xpath; - } - } - else { - LOG(ERROR) << "Required element curveUID is missing at xpath " << xpath; - } - - } - - void CPACSNacelleCenterCowl::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const - { - // write element xOffset - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/xOffset"); - tixi::TixiSaveElement(tixiHandle, xpath + "/xOffset", m_xOffset); - - // write element curveUID - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/curveUID"); - tixi::TixiSaveElement(tixiHandle, xpath + "/curveUID", m_curveUID); - - } - - const double& CPACSNacelleCenterCowl::GetXOffset() const - { - return m_xOffset; - } - - void CPACSNacelleCenterCowl::SetXOffset(const double& value) - { - m_xOffset = value; - } - - const std::string& CPACSNacelleCenterCowl::GetCurveUID() const - { - return m_curveUID; - } - - void CPACSNacelleCenterCowl::SetCurveUID(const std::string& value) - { - m_curveUID = value; - } - -} // namespace generated -} // namespace tigl diff --git a/src/generated/CPACSNacelleCenterCowl.h b/src/generated/CPACSNacelleCenterCowl.h deleted file mode 100644 index 9b3dc7319..000000000 --- a/src/generated/CPACSNacelleCenterCowl.h +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2018 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// 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 -#include -#include "tigl_internal.h" - -namespace tigl -{ -namespace generated -{ - // This class is used in: - // CPACSEngineNacelle - - // generated from /xsd:schema/xsd:complexType[998] - class CPACSNacelleCenterCowl - { - public: - TIGL_EXPORT CPACSNacelleCenterCowl(); - TIGL_EXPORT virtual ~CPACSNacelleCenterCowl(); - - TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); - TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - - TIGL_EXPORT virtual const double& GetXOffset() const; - TIGL_EXPORT virtual void SetXOffset(const double& value); - - TIGL_EXPORT virtual const std::string& GetCurveUID() const; - TIGL_EXPORT virtual void SetCurveUID(const std::string& value); - - protected: - double m_xOffset; - std::string m_curveUID; - - private: -#ifdef HAVE_CPP11 - CPACSNacelleCenterCowl(const CPACSNacelleCenterCowl&) = delete; - CPACSNacelleCenterCowl& operator=(const CPACSNacelleCenterCowl&) = delete; - - CPACSNacelleCenterCowl(CPACSNacelleCenterCowl&&) = delete; - CPACSNacelleCenterCowl& operator=(CPACSNacelleCenterCowl&&) = delete; -#else - CPACSNacelleCenterCowl(const CPACSNacelleCenterCowl&); - CPACSNacelleCenterCowl& operator=(const CPACSNacelleCenterCowl&); -#endif - }; -} // namespace generated - -// Aliases in tigl namespace -#ifdef HAVE_CPP11 -using CCPACSNacelleCenterCowl = generated::CPACSNacelleCenterCowl; -#else -typedef generated::CPACSNacelleCenterCowl CCPACSNacelleCenterCowl; -#endif -} // namespace tigl diff --git a/src/generated/CPACSNacelleCowl.cpp b/src/generated/CPACSNacelleCowl.cpp index 7e093ea50..ef7099375 100644 --- a/src/generated/CPACSNacelleCowl.cpp +++ b/src/generated/CPACSNacelleCowl.cpp @@ -15,6 +15,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include "CPACSEngineNacelle.h" #include "CPACSNacelleCowl.h" #include "CTiglError.h" #include "CTiglLogging.h" @@ -25,15 +27,28 @@ namespace tigl { namespace generated { - CPACSNacelleCowl::CPACSNacelleCowl(CTiglUIDManager* uidMgr) + CPACSNacelleCowl::CPACSNacelleCowl(CPACSEngineNacelle* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) , m_transformation(m_uidMgr) , m_sections(m_uidMgr) { + //assert(parent != NULL); + m_parent = parent; } CPACSNacelleCowl::~CPACSNacelleCowl() { + if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); + } + + const CPACSEngineNacelle* CPACSNacelleCowl::GetParent() const + { + return m_parent; + } + + CPACSEngineNacelle* CPACSNacelleCowl::GetParent() + { + return m_parent; } CTiglUIDManager& CPACSNacelleCowl::GetUIDManager() @@ -48,6 +63,17 @@ namespace generated void CPACSNacelleCowl::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { + // read attribute uID + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { + m_uID = tixi::TixiGetAttribute(tixiHandle, xpath, "uID"); + if (m_uID.empty()) { + LOG(WARNING) << "Required attribute uID is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; + } + // read element transformation if (tixi::TixiCheckElement(tixiHandle, xpath + "/transformation")) { m_transformation.ReadCPACS(tixiHandle, xpath + "/transformation"); @@ -80,10 +106,14 @@ namespace generated LOG(ERROR) << "Required element rotationCurve is missing at xpath " << xpath; } + if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); } void CPACSNacelleCowl::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const { + // write attribute uID + tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); + // write element transformation tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/transformation"); m_transformation.WriteCPACS(tixiHandle, xpath + "/transformation"); @@ -102,6 +132,20 @@ namespace generated } + const std::string& CPACSNacelleCowl::GetUID() const + { + return m_uID; + } + + void CPACSNacelleCowl::SetUID(const std::string& value) + { + if (m_uidMgr) { + m_uidMgr->TryUnregisterObject(m_uID); + m_uidMgr->RegisterObject(value, *this); + } + m_uID = value; + } + const CCPACSTransformation& CPACSNacelleCowl::GetTransformation() const { return m_transformation; @@ -112,12 +156,12 @@ namespace generated return m_transformation; } - const CPACSNacelleSections& CPACSNacelleCowl::GetSections() const + const CCPACSNacelleSections& CPACSNacelleCowl::GetSections() const { return m_sections; } - CPACSNacelleSections& CPACSNacelleCowl::GetSections() + CCPACSNacelleSections& CPACSNacelleCowl::GetSections() { return m_sections; } diff --git a/src/generated/CPACSNacelleCowl.h b/src/generated/CPACSNacelleCowl.h index b84a42cdc..e77e43349 100644 --- a/src/generated/CPACSNacelleCowl.h +++ b/src/generated/CPACSNacelleCowl.h @@ -17,11 +17,11 @@ #pragma once +#include #include #include #include #include "CPACSNacelleGuideCurves.h" -#include "CPACSNacelleSections.h" #include "CPACSRotationCurve.h" #include "tigl_internal.h" @@ -31,6 +31,8 @@ class CTiglUIDManager; namespace generated { + class CPACSEngineNacelle; + // This class is used in: // CPACSEngineNacelle @@ -38,20 +40,28 @@ namespace generated class CPACSNacelleCowl { public: - TIGL_EXPORT CPACSNacelleCowl(CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSNacelleCowl(CPACSEngineNacelle* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT virtual ~CPACSNacelleCowl(); + TIGL_EXPORT CPACSEngineNacelle* GetParent(); + + TIGL_EXPORT const CPACSEngineNacelle* GetParent() const; + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + TIGL_EXPORT virtual const std::string& GetUID() const; + TIGL_EXPORT virtual void SetUID(const std::string& value); + TIGL_EXPORT virtual const CCPACSTransformation& GetTransformation() const; TIGL_EXPORT virtual CCPACSTransformation& GetTransformation(); - TIGL_EXPORT virtual const CPACSNacelleSections& GetSections() const; - TIGL_EXPORT virtual CPACSNacelleSections& GetSections(); + TIGL_EXPORT virtual const CCPACSNacelleSections& GetSections() const; + TIGL_EXPORT virtual CCPACSNacelleSections& GetSections(); TIGL_EXPORT virtual const CPACSNacelleGuideCurves& GetGuideCurves() const; TIGL_EXPORT virtual CPACSNacelleGuideCurves& GetGuideCurves(); @@ -60,10 +70,13 @@ namespace generated TIGL_EXPORT virtual CPACSRotationCurve& GetRotationCurve(); protected: + CPACSEngineNacelle* m_parent; + CTiglUIDManager* m_uidMgr; + std::string m_uID; CCPACSTransformation m_transformation; - CPACSNacelleSections m_sections; + CCPACSNacelleSections m_sections; CPACSNacelleGuideCurves m_guideCurves; CPACSRotationCurve m_rotationCurve; @@ -81,10 +94,12 @@ namespace generated }; } // namespace generated +// CPACSNacelleCowl is customized, use type CCPACSNacelleCowl directly + // Aliases in tigl namespace #ifdef HAVE_CPP11 -using CCPACSNacelleCowl = generated::CPACSNacelleCowl; +using CCPACSEngineNacelle = generated::CPACSEngineNacelle; #else -typedef generated::CPACSNacelleCowl CCPACSNacelleCowl; +typedef generated::CPACSEngineNacelle CCPACSEngineNacelle; #endif } // namespace tigl diff --git a/src/generated/CPACSNacelleSection.h b/src/generated/CPACSNacelleSection.h index 0034b8732..df252cdc5 100644 --- a/src/generated/CPACSNacelleSection.h +++ b/src/generated/CPACSNacelleSection.h @@ -84,10 +84,5 @@ namespace generated }; } // namespace generated -// Aliases in tigl namespace -#ifdef HAVE_CPP11 -using CCPACSNacelleSection = generated::CPACSNacelleSection; -#else -typedef generated::CPACSNacelleSection CCPACSNacelleSection; -#endif +// CPACSNacelleSection is customized, use type CCPACSNacelleSection directly } // namespace tigl diff --git a/src/generated/CPACSNacelleSections.cpp b/src/generated/CPACSNacelleSections.cpp index 998e35ed8..96c868af6 100644 --- a/src/generated/CPACSNacelleSections.cpp +++ b/src/generated/CPACSNacelleSections.cpp @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "CPACSNacelleSection.h" +#include #include "CPACSNacelleSections.h" #include "CTiglError.h" #include "CTiglLogging.h" @@ -61,23 +61,23 @@ namespace generated } - const std::vector >& CPACSNacelleSections::GetSections() const + const std::vector >& CPACSNacelleSections::GetSections() const { return m_sections; } - std::vector >& CPACSNacelleSections::GetSections() + std::vector >& CPACSNacelleSections::GetSections() { return m_sections; } - CPACSNacelleSection& CPACSNacelleSections::AddSection() + CCPACSNacelleSection& CPACSNacelleSections::AddSection() { - m_sections.push_back(make_unique(m_uidMgr)); + m_sections.push_back(make_unique(m_uidMgr)); return *m_sections.back(); } - void CPACSNacelleSections::RemoveSection(CPACSNacelleSection& ref) + void CPACSNacelleSections::RemoveSection(CCPACSNacelleSection& ref) { for (std::size_t i = 0; i < m_sections.size(); i++) { if (m_sections[i].get() == &ref) { diff --git a/src/generated/CPACSNacelleSections.h b/src/generated/CPACSNacelleSections.h index 857d129b7..ed3657ee9 100644 --- a/src/generated/CPACSNacelleSections.h +++ b/src/generated/CPACSNacelleSections.h @@ -26,11 +26,10 @@ namespace tigl { class CTiglUIDManager; +class CCPACSNacelleSection; namespace generated { - class CPACSNacelleSection; - // This class is used in: // CPACSNacelleCowl @@ -47,16 +46,16 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const std::vector >& GetSections() const; - TIGL_EXPORT virtual std::vector >& GetSections(); + TIGL_EXPORT virtual const std::vector >& GetSections() const; + TIGL_EXPORT virtual std::vector >& GetSections(); - TIGL_EXPORT virtual CPACSNacelleSection& AddSection(); - TIGL_EXPORT virtual void RemoveSection(CPACSNacelleSection& ref); + TIGL_EXPORT virtual CCPACSNacelleSection& AddSection(); + TIGL_EXPORT virtual void RemoveSection(CCPACSNacelleSection& ref); protected: CTiglUIDManager* m_uidMgr; - std::vector > m_sections; + std::vector > m_sections; private: #ifdef HAVE_CPP11 @@ -72,12 +71,5 @@ namespace generated }; } // namespace generated -// Aliases in tigl namespace -#ifdef HAVE_CPP11 -using CCPACSNacelleSections = generated::CPACSNacelleSections; -using CCPACSNacelleSection = generated::CPACSNacelleSection; -#else -typedef generated::CPACSNacelleSections CCPACSNacelleSections; -typedef generated::CPACSNacelleSection CCPACSNacelleSection; -#endif +// CPACSNacelleSections is customized, use type CCPACSNacelleSections directly } // namespace tigl diff --git a/src/generated/CPACSPointListRelXYZVector.h b/src/generated/CPACSPointListRelXYZVector.h index 0fc5c8415..38dabb9ec 100644 --- a/src/generated/CPACSPointListRelXYZVector.h +++ b/src/generated/CPACSPointListRelXYZVector.h @@ -67,5 +67,5 @@ namespace generated }; } // namespace generated -// CPACSPointListRelXYZVector is customized, use type CCPACSPointListRelXYZ directly +// CPACSPointListRelXYZVector is customized, use type CCPACSPointListRelXYZVector directly } // namespace tigl diff --git a/src/generated/CPACSPointListXYVector.h b/src/generated/CPACSPointListXYVector.h index 1eccf6c55..bc7c1fc20 100644 --- a/src/generated/CPACSPointListXYVector.h +++ b/src/generated/CPACSPointListXYVector.h @@ -63,10 +63,5 @@ namespace generated }; } // namespace generated -// Aliases in tigl namespace -#ifdef HAVE_CPP11 -using CCPACSPointListXYVector = generated::CPACSPointListXYVector; -#else -typedef generated::CPACSPointListXYVector CCPACSPointListXYVector; -#endif +// CPACSPointListXYVector is customized, use type CCPACSPointListXYVector directly } // namespace tigl diff --git a/src/generated/CPACSPointListXYZVector.h b/src/generated/CPACSPointListXYZVector.h index cab463a29..e71f38e8f 100644 --- a/src/generated/CPACSPointListXYZVector.h +++ b/src/generated/CPACSPointListXYZVector.h @@ -67,5 +67,5 @@ namespace generated }; } // namespace generated -// CPACSPointListXYZVector is customized, use type CCPACSPointListXYZ directly +// CPACSPointListXYZVector is customized, use type CCPACSPointListXYZVector directly } // namespace tigl diff --git a/src/generated/CPACSProfileGeometry.cpp b/src/generated/CPACSProfileGeometry.cpp index e137d0b97..4b75cd5bb 100644 --- a/src/generated/CPACSProfileGeometry.cpp +++ b/src/generated/CPACSProfileGeometry.cpp @@ -238,12 +238,12 @@ namespace generated m_description = value; } - const boost::optional& CPACSProfileGeometry::GetPointList_choice1() const + const boost::optional& CPACSProfileGeometry::GetPointList_choice1() const { return m_pointList_choice1; } - boost::optional& CPACSProfileGeometry::GetPointList_choice1() + boost::optional& CPACSProfileGeometry::GetPointList_choice1() { return m_pointList_choice1; } @@ -258,7 +258,7 @@ namespace generated return m_cst2D_choice2; } - CCPACSPointListXYZ& CPACSProfileGeometry::GetPointList_choice1(CreateIfNotExistsTag) + CCPACSPointListXYZVector& CPACSProfileGeometry::GetPointList_choice1(CreateIfNotExistsTag) { if (!m_pointList_choice1) m_pointList_choice1 = boost::in_place(); diff --git a/src/generated/CPACSProfileGeometry.h b/src/generated/CPACSProfileGeometry.h index 2f9d19c15..2f5fe70b5 100644 --- a/src/generated/CPACSProfileGeometry.h +++ b/src/generated/CPACSProfileGeometry.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -67,13 +67,13 @@ namespace generated TIGL_EXPORT virtual const boost::optional& GetDescription() const; TIGL_EXPORT virtual void SetDescription(const boost::optional& value); - TIGL_EXPORT virtual const boost::optional& GetPointList_choice1() const; - TIGL_EXPORT virtual boost::optional& GetPointList_choice1(); + TIGL_EXPORT virtual const boost::optional& GetPointList_choice1() const; + TIGL_EXPORT virtual boost::optional& GetPointList_choice1(); TIGL_EXPORT virtual const boost::optional& GetCst2D_choice2() const; TIGL_EXPORT virtual boost::optional& GetCst2D_choice2(); - TIGL_EXPORT virtual CCPACSPointListXYZ& GetPointList_choice1(CreateIfNotExistsTag); + TIGL_EXPORT virtual CCPACSPointListXYZVector& GetPointList_choice1(CreateIfNotExistsTag); TIGL_EXPORT virtual void RemovePointList_choice1(); TIGL_EXPORT virtual CCPACSWingProfileCST& GetCst2D_choice2(CreateIfNotExistsTag); @@ -82,12 +82,12 @@ namespace generated protected: CTiglUIDManager* m_uidMgr; - boost::optional m_symmetry; - std::string m_uID; - std::string m_name; - boost::optional m_description; - boost::optional m_pointList_choice1; - boost::optional m_cst2D_choice2; + boost::optional m_symmetry; + std::string m_uID; + std::string m_name; + boost::optional m_description; + boost::optional m_pointList_choice1; + boost::optional m_cst2D_choice2; private: #ifdef HAVE_CPP11 diff --git a/src/generated/CPACSProfileGeometry2D.cpp b/src/generated/CPACSProfileGeometry2D.cpp index 45e3b7f88..257b6a1a3 100644 --- a/src/generated/CPACSProfileGeometry2D.cpp +++ b/src/generated/CPACSProfileGeometry2D.cpp @@ -238,12 +238,12 @@ namespace generated m_description = value; } - const boost::optional& CPACSProfileGeometry2D::GetPointList_choice1() const + const boost::optional& CPACSProfileGeometry2D::GetPointList_choice1() const { return m_pointList_choice1; } - boost::optional& CPACSProfileGeometry2D::GetPointList_choice1() + boost::optional& CPACSProfileGeometry2D::GetPointList_choice1() { return m_pointList_choice1; } @@ -258,7 +258,7 @@ namespace generated return m_cst2D_choice2; } - CPACSPointListXYVector& CPACSProfileGeometry2D::GetPointList_choice1(CreateIfNotExistsTag) + CCPACSPointListXYVector& CPACSProfileGeometry2D::GetPointList_choice1(CreateIfNotExistsTag) { if (!m_pointList_choice1) m_pointList_choice1 = boost::in_place(); diff --git a/src/generated/CPACSProfileGeometry2D.h b/src/generated/CPACSProfileGeometry2D.h index d37fdf693..19259ef73 100644 --- a/src/generated/CPACSProfileGeometry2D.h +++ b/src/generated/CPACSProfileGeometry2D.h @@ -19,11 +19,11 @@ #include #include +#include #include #include #include #include -#include "CPACSPointListXYVector.h" #include "CPACSProfileGeometry2DType_symmetry.h" #include "CreateIfNotExists.h" #include "CTiglError.h" @@ -66,13 +66,13 @@ namespace generated TIGL_EXPORT virtual const boost::optional& GetDescription() const; TIGL_EXPORT virtual void SetDescription(const boost::optional& value); - TIGL_EXPORT virtual const boost::optional& GetPointList_choice1() const; - TIGL_EXPORT virtual boost::optional& GetPointList_choice1(); + TIGL_EXPORT virtual const boost::optional& GetPointList_choice1() const; + TIGL_EXPORT virtual boost::optional& GetPointList_choice1(); TIGL_EXPORT virtual const boost::optional& GetCst2D_choice2() const; TIGL_EXPORT virtual boost::optional& GetCst2D_choice2(); - TIGL_EXPORT virtual CPACSPointListXYVector& GetPointList_choice1(CreateIfNotExistsTag); + TIGL_EXPORT virtual CCPACSPointListXYVector& GetPointList_choice1(CreateIfNotExistsTag); TIGL_EXPORT virtual void RemovePointList_choice1(); TIGL_EXPORT virtual CCPACSWingProfileCST& GetCst2D_choice2(CreateIfNotExistsTag); @@ -85,7 +85,7 @@ namespace generated std::string m_uID; std::string m_name; boost::optional m_description; - boost::optional m_pointList_choice1; + boost::optional m_pointList_choice1; boost::optional m_cst2D_choice2; private: diff --git a/src/generated/CPACSSymmetry.h b/src/generated/CPACSSymmetry.h index 8f7359dee..825a6b351 100644 --- a/src/generated/CPACSSymmetry.h +++ b/src/generated/CPACSSymmetry.h @@ -28,6 +28,8 @@ namespace tigl namespace generated { // This enum is used in: + // CPACSEngineNacelle + // CPACSEnginePylon // CPACSFuselage // CPACSGenericGeometricComponent // CPACSGuideCurveProfileGeometry @@ -35,7 +37,7 @@ namespace generated // CPACSRotor // CPACSWing - // generated from /xsd:schema/xsd:complexType[314]/xsd:complexContent/xsd:extension/xsd:attribute[2]/xsd:simpleType + // generated from /xsd:schema/xsd:complexType[311]/xsd:complexContent/xsd:extension/xsd:attribute[2]/xsd:simpleType enum CPACSSymmetry { x_y_plane, diff --git a/src/wing/CTiglWingProfilePointList.cpp b/src/wing/CTiglWingProfilePointList.cpp index 983ec454c..d3b57f5b3 100644 --- a/src/wing/CTiglWingProfilePointList.cpp +++ b/src/wing/CTiglWingProfilePointList.cpp @@ -35,6 +35,7 @@ #include "CTiglTransformation.h" #include "math.h" #include "CCPACSWingProfile.h" +#include "CCPACSNacelleProfile.h" #include "tiglcommonfunctions.h" #include "gp_Pnt2d.hxx" @@ -83,8 +84,16 @@ const double CTiglWingProfilePointList::c_trailingEdgeRelGap = 1E-2; const double CTiglWingProfilePointList::c_blendingDistance = 0.1; // Constructor -CTiglWingProfilePointList::CTiglWingProfilePointList(const CCPACSWingProfile& profile, const CCPACSPointListXYZ& cpacsPointList) - : profileRef(profile) +CTiglWingProfilePointList::CTiglWingProfilePointList(const CCPACSWingProfile& profile, const CCPACSPointListXYZVector& cpacsPointList) + : profileUID(profile.GetUID()) + , coordinates(cpacsPointList.AsVector()) + , profileWireAlgo(new CTiglInterpolateBsplineWire) + , wireCache(*this, &CTiglWingProfilePointList::BuildWires) +{ +} + +CTiglWingProfilePointList::CTiglWingProfilePointList(const CCPACSNacelleProfile& profile, const CCPACSPointListXYVector& cpacsPointList) + : profileUID(profile.GetUID()) , coordinates(cpacsPointList.AsVector()) , profileWireAlgo(new CTiglInterpolateBsplineWire) , wireCache(*this, &CTiglWingProfilePointList::BuildWires) @@ -444,7 +453,7 @@ void CTiglWingProfilePointList::trimUpperLowerCurve(WireCache& cache, Handle(Geo if (w > lowerCurve->FirstParameter() + Precision::Confusion() && w < lowerCurve->LastParameter()) { double relDist = lowerCurve->Value(w).Distance(firstPnt) / cache.tePoint.Distance(cache.lePoint); if (relDist > tolerance) { - LOG(WARNING) << "The wing profile " << profileRef.GetUID() << " will be trimmed" + LOG(WARNING) << "The wing profile " << profileUID << " will be trimmed" << " to avoid a skewed trailing edge." << " The lower part is trimmed about " << relDist*100. << " % w.r.t. the chord length." << " Please correct the wing profile!"; @@ -460,7 +469,7 @@ void CTiglWingProfilePointList::trimUpperLowerCurve(WireCache& cache, Handle(Geo if (w < upperCurve->LastParameter() - Precision::Confusion() && w > upperCurve->FirstParameter()) { double relDist = upperCurve->Value(w).Distance(lastPnt) / cache.tePoint.Distance(cache.lePoint); if (relDist > tolerance) { - LOG(WARNING) << "The wing profile " << profileRef.GetUID() << " will be trimmed" + LOG(WARNING) << "The wing profile " << profileUID << " will be trimmed" << " to avoid a skewed trailing edge." << " The upper part is trimmed about " << relDist*100. << " % w.r.t. the chord length." << " Please correct the wing profile!"; diff --git a/src/wing/CTiglWingProfilePointList.h b/src/wing/CTiglWingProfilePointList.h index 41e9401ec..18533eb2f 100644 --- a/src/wing/CTiglWingProfilePointList.h +++ b/src/wing/CTiglWingProfilePointList.h @@ -39,20 +39,23 @@ #include "Geom_TrimmedCurve.hxx" #include "TopoDS_Wire.hxx" #include "TopoDS_Edge.hxx" -#include "CCPACSPointListXYZ.h" +#include "CCPACSPointListXYZVector.h" +#include "CCPACSPointListXYVector.h" #include "Cache.h" namespace tigl { class CCPACSWingProfile; +class CCPACSNacelleProfile; class CTiglWingProfilePointList : public ITiglWingProfileAlgo { public: // Constructor - TIGL_EXPORT CTiglWingProfilePointList(const CCPACSWingProfile& profile, const CCPACSPointListXYZ& cpacsPointlist); + TIGL_EXPORT CTiglWingProfilePointList(const CCPACSWingProfile& profile, const CCPACSPointListXYZVector& cpacsPointlist); + TIGL_EXPORT CTiglWingProfilePointList(const CCPACSNacelleProfile& profile, const CCPACSPointListXYVector& cpacsPointlist); TIGL_EXPORT void Invalidate() OVERRIDE; @@ -126,7 +129,7 @@ class CTiglWingProfilePointList : public ITiglWingProfileAlgo const std::vector& coordinates; /**< Coordinates of a wing profile element */ unique_ptr profileWireAlgo;/**< Pointer to wire algorithm (e.g. CTiglInterpolateBsplineWire) */ - const CCPACSWingProfile& profileRef; /**< Reference to the wing profile */ + const std::string profileUID; /**< Reference to the wing profile */ Cache wireCache; };