diff --git a/src/common/tiglcommonfunctions.cpp b/src/common/tiglcommonfunctions.cpp index 351467787..1a601eac1 100644 --- a/src/common/tiglcommonfunctions.cpp +++ b/src/common/tiglcommonfunctions.cpp @@ -523,7 +523,7 @@ ListPNamedShape GroupFaces(const PNamedShape shape, tigl::ShapeGroupMode groupTy shapeList.push_back(shape); return shapeList; } - + for (int iface = 1; iface <= faceMap.Extent(); ++iface) { TopoDS_Face face = TopoDS::Face(faceMap(iface)); PNamedShape origin = shape->GetFaceTraits(iface-1).Origin(); @@ -575,7 +575,7 @@ ListPNamedShape GroupFaces(const PNamedShape shape, tigl::ShapeGroupMode groupTy shapeList.push_back(shape); return shapeList; } - + for (int iface = 1; iface <= faceMap.Extent(); ++iface) { TopoDS_Face face = TopoDS::Face(faceMap(iface)); const CFaceTraits& traits = shape->GetFaceTraits(iface-1); @@ -592,7 +592,7 @@ ListPNamedShape GroupFaces(const PNamedShape shape, tigl::ShapeGroupMode groupTy faceShape->SetFaceTraits(0, shape->GetFaceTraits(iface-1)); shapeList.push_back(faceShape); } - + } return shapeList; } @@ -655,7 +655,7 @@ int GetComponentHashCode(tigl::ITiglGeometricComponent& component) TopoDS_Edge EdgeSplineFromPoints(const std::vector& points) { unsigned int pointCount = static_cast(points.size()); - + Handle(TColgp_HArray1OfPnt) hpoints = new TColgp_HArray1OfPnt(1, pointCount); for (unsigned int j = 0; j < pointCount; j++) { hpoints->SetValue(j + 1, points[j]); @@ -664,7 +664,7 @@ TopoDS_Edge EdgeSplineFromPoints(const std::vector& points) GeomAPI_Interpolate interPol(hpoints, Standard_False, Precision::Confusion()); interPol.Perform(); Handle(Geom_BSplineCurve) hcurve = interPol.Curve(); - + return BRepBuilderAPI_MakeEdge(hcurve); } @@ -672,7 +672,7 @@ TopoDS_Edge GetEdge(const TopoDS_Shape &shape, int iEdge) { TopTools_IndexedMapOfShape edgeMap; TopExp::MapShapes(shape, TopAbs_EDGE, edgeMap); - + if (iEdge < 0 || iEdge >= edgeMap.Extent()) { return TopoDS_Edge(); } @@ -699,7 +699,7 @@ Handle(Geom_BSplineCurve) GetBSplineCurve(const TopoDS_Edge& e) double u1, u2; Handle(Geom_Curve) curve = BRep_Tool::Curve(e, u1, u2); curve = new Geom_TrimmedCurve(curve, u1, u2); - + // convert to bspline Handle(Geom_BSplineCurve) bspl = GeomConvert::CurveToBSplineCurve(curve); return bspl; @@ -1122,7 +1122,7 @@ TopoDS_Face BuildRuledFace(const TopoDS_Wire& wire1, const TopoDS_Wire& wire2) TopoDS_Wire sortedWire1 = TopoDS::Wire(orderedWireSequence.First()); TopoDS_Wire sortedWire2 = TopoDS::Wire(orderedWireSequence.Last()); - // build curve adaptor, second parameter defines that the length of the single edges is used as u coordinate, + // build curve adaptor, second parameter defines that the length of the single edges is used as u coordinate, // instead normalization of the u coordinates of the single edges of the wire (each edge would have u-coords // range from 0 to 1 independent of their length otherwise) BRepAdaptor_CompCurve compCurve1(sortedWire1, Standard_True); @@ -1327,6 +1327,155 @@ TopoDS_Wire BuildWireRectangle(const double heightToWidthRatio, const double cor return wire; } +namespace +{ + class SuperEllipse : public tigl::MathFunc3d + { + public: + SuperEllipse(const double lowerHeightFraction, const double mLower, const double mUpper, + const double nLower, const double nUpper) + : tigl::MathFunc3d(), m_lowerHeightFraction(lowerHeightFraction), m_mLower(mLower), + m_mUpper(mUpper), m_nLower(nLower), m_nUpper(nUpper) {} + + double valueX(double t) override + { + return 0.; + } + + double valueY(double t) override + { + //curve is built clockwise + return 0.5*std::sin(t); + } + + double valueZ(double t) override + { + double z_0 = m_lowerHeightFraction - 0.5; + //clean angle from traversion factor (ensures that alpha <= 2*PI, to determine quadrant) + double alpha = (std::fmod(t,(2.*M_PI))); + double param = 0.5*std::sin(alpha); + + //same order as in building the profile: oriented clockwise, starting with 1. quadrant ending with 2. + + //build right upper half of semi ellipse + if((alpha>=0.)&&(alpha=M_PI/2.)&&(alpha=M_PI)&&(alpha=M_PI*3./2.)&&(alpha<=M_PI*2.)){ + double z = z_0 + (0.5 -z_0)* std::pow((1. - std::pow(std::abs(2. * param), m_mUpper)), 1. / m_nUpper); + return z; + } else { + throw tigl::CTiglError("Error building Ellipse"); + } + + } + + private: + double m_lowerHeightFraction; + double m_mLower; + double m_mUpper; + double m_nLower; + double m_nUpper; + }; + +} //anonymos namespace + +TIGL_EXPORT TopoDS_Wire BuildWireSuperEllipse(const double lowerHeightFraction, const double mLower, const double mUpper, + const double nLower, const double nUpper, const double tol) +{ + //dealing with singularities in superellipses: exponents must not be equal to 0 + //choose tolerance near double precision + double epsilon = 1e-15; + if (mLower<=epsilon){ + auto msg = std::string("BuildWireSuperEllipse: Invalid input. Exponent mLower must be > ") + + std::to_string(epsilon) + + ". mLower = " + + std::to_string(mLower); + throw tigl::CTiglError(msg, TIGL_ERROR); + } + if (mUpper<=epsilon){ + auto msg = std::string("BuildWireSuperEllipse: Invalid input. Exponent mUpper must be > ") + + std::to_string(epsilon) + + ". mUpper = " + + std::to_string(mUpper); + throw tigl::CTiglError(msg, TIGL_ERROR); + } + if (nLower<=epsilon){ + auto msg = std::string("BuildWireSuperEllipse: Invalid input. Exponent nLower must be > ") + + std::to_string(epsilon) + + ". nLower = " + + std::to_string(nLower); + throw tigl::CTiglError(msg, TIGL_ERROR); + } + if (nUpper<=epsilon){ + auto msg = std::string("BuildWireSuperEllipse: Invalid input. Exponent nUpper must be > ") + + std::to_string(epsilon) + + ". nUpper = " + + std::to_string(nUpper); + throw tigl::CTiglError(msg, TIGL_ERROR); + } + if (lowerHeightFraction<0||lowerHeightFraction>1){ + auto msg = std::string("BuildWireSuperEllipse: Invalid input. lowerHeightFraction must be >0 and <1. lowerHeightFraction = ") + + std::to_string(lowerHeightFraction); + throw tigl::CTiglError(msg, TIGL_ERROR); + } + std::vector curves; + + int degree = 3; + + //Parameter for upper right quarterellipse + double uMin = 0.; + double uMax = M_PI/2; + //Parameter for lower right quarterellipse + double uMin1 = M_PI/2; + double uMax1 = M_PI; + //Parameter for lower left quarterellipse + double uMin2 = M_PI; + double uMax2 = 3*M_PI/2; + //Parameter for upper left quarterellipse + double uMin3 = 3*M_PI/2; + double uMax3 = 2*M_PI; + + SuperEllipse ellipse(lowerHeightFraction, mLower, mUpper, nLower, nUpper); + + //build ellipse clockwise + auto curve1 = tigl::CFunctionToBspline(ellipse, uMin, uMax, degree, tol).Curve(); + curves.push_back(curve1); + auto curve2 = tigl::CFunctionToBspline(ellipse, uMin1, uMax1, degree, tol).Curve(); + curves.push_back(curve2); + auto curve3 = tigl::CFunctionToBspline(ellipse, uMin2, uMax2, degree, tol).Curve(); + curves.push_back(curve3); + auto curve4 = tigl::CFunctionToBspline(ellipse, uMin3, uMax3, degree, tol).Curve(); + curves.push_back(curve4); + + opencascade::handle curve = tigl::CTiglBSplineAlgorithms::concatCurves(curves); + + //build wire + TopoDS_Wire wire; + if(!curve.IsNull()){ + wire = BuildWireFromEdges(BRepBuilderAPI_MakeEdge(curve).Edge()); + } + if(wire.IsNull()){ + throw tigl::CTiglError("Error building profile wire"); + } + return wire; +} + void BuildWiresFromConnectedEdges(const TopoDS_Shape& shape, TopTools_ListOfShape& wireList) { // get list of edges from passed shape @@ -1803,7 +1952,7 @@ TopoDS_Shape RemoveDuplicateEdges(const TopoDS_Shape& shape) // get midpoint of checkEdge curve = BRep_Tool::Curve(checkEdge, uStart, uEnd); curve->D0((uStart + uEnd) / 2.0, p2Mid); - + if (p1Mid.Distance(p2Mid) < 1E-5) { duplicate = true; break; @@ -1932,7 +2081,7 @@ T Clamp(T val, T min, T max) if (min > max) { throw tigl::CTiglError("Minimum may not be larger than maximum in clamp!"); } - + return std::max(min, std::min(val, max)); } @@ -1977,12 +2126,12 @@ TopoDS_Shape GetFacesByName(const PNamedShape shape, const std::string &name) faces.push_back(GetFace(shape->Shape(), i)); } } - + if (faces.empty()) throw tigl::CTiglError("Could not find faces named " + name); if (faces.size() == 1) return faces[0]; - + TopoDS_Compound c; TopoDS_Builder b; b.MakeCompound(c); @@ -2020,7 +2169,7 @@ Handle(TColStd_HArray1OfReal) OccFArray(const std::vector& vector) array->SetValue(ipos, value); ipos++; } - + return array; } @@ -2031,7 +2180,7 @@ Handle(TColStd_HArray1OfInteger) OccIArray(const std::vector& vector) for (const auto& value : vector) { array->SetValue(ipos++, value); } - + return array; } diff --git a/src/common/tiglcommonfunctions.h b/src/common/tiglcommonfunctions.h index 487597107..8a2515812 100644 --- a/src/common/tiglcommonfunctions.h +++ b/src/common/tiglcommonfunctions.h @@ -300,6 +300,21 @@ TIGL_EXPORT opencascade::handle ApproximateArcOfCircleToRatio TIGL_EXPORT TopoDS_Wire BuildWireRectangle(const double heightToWidthRatio, const double cornerRadius=0.0, const double tol=Precision::Approximation()); +/** + * @brief BuildWireSuperellipse Builds a superelliptic wire in (y,z) - plane with width 1 and height 1 + * @param lowerHeightFraction Fraction of height of the lower semi_ellipse relative to the toal height + * @param mLower Exponent m for lower semi-ellipse + * @param mUpper Exponent m for upper semi-ellipse + * @param nLower Exponent n for lower semi-ellipse + * @param nUpper Exponent n for upper semi-ellipse + * @param tol Tolerance required for approximation of the superellipse as a b-spline curve + * @return + */ +TIGL_EXPORT TopoDS_Wire BuildWireSuperEllipse(const double lowerHeightFraction, + const double mLower, const double mUpper, + const double nLower, const double nUpper, + const double tol=Precision::Approximation()); + // Returns a list of wires built from all connected edges in the passed shape TIGL_EXPORT void BuildWiresFromConnectedEdges(const TopoDS_Shape& shape, TopTools_ListOfShape& wireList); diff --git a/src/fuselage/CCPACSFuselageProfile.cpp b/src/fuselage/CCPACSFuselageProfile.cpp index c099a1466..4e04d3c7c 100644 --- a/src/fuselage/CCPACSFuselageProfile.cpp +++ b/src/fuselage/CCPACSFuselageProfile.cpp @@ -184,8 +184,14 @@ void CCPACSFuselageProfile::BuildWires(WireCache& cache) const BuildWiresRectangle(cache); return; } + if(m_standardProfile_choice3->GetSuperEllipse_choice2()){ + BuildWiresSuperEllipse(cache); + return; + } + } + else{ + throw CTiglError("Fuselage profile type not supported."); } - throw CTiglError("Currently only fuselage profiles defined by pointList and rectangular fuselage profiles are supported."); } // Builds the fuselage profile wire from point list. @@ -260,7 +266,7 @@ void CCPACSFuselageProfile::BuildWiresPointList(WireCache& cache) const void CCPACSFuselageProfile::BuildWiresRectangle(WireCache& cache) const { if(!m_standardProfile_choice3->GetRectangle_choice1()){ - throw CTiglError("CCPACSFuselageProfile::BuildWire", TIGL_ERROR); + throw CTiglError("CCPACSFuselageProfile::BuildWiresRectangle: Missing rectangle definition in standardProfile.", TIGL_UNINITIALIZED); } //Get Paramenters auto& rectangle_profile = *m_standardProfile_choice3->GetRectangle_choice1(); @@ -272,6 +278,25 @@ void CCPACSFuselageProfile::BuildWiresRectangle(WireCache& cache) const cache.original = wire; } +//Builds the fuselage profile wires from lowerHeightFraction and exponents m,n for lower and upper semi-ellipse +void CCPACSFuselageProfile::BuildWiresSuperEllipse(WireCache& cache) const +{ + if(!m_standardProfile_choice3->GetSuperEllipse_choice2()){ + throw CTiglError("CCPACSFuselageProfile::BuildWiresSuperEllipse: Missing superEllipse definiton in standardProfile.", TIGL_UNINITIALIZED); + } + //Get Paramenters + auto& superellipse_profile = *m_standardProfile_choice3->GetSuperEllipse_choice2(); + double lowerHeightFraction = superellipse_profile.GetLowerHeightFraction(); + double mLower = superellipse_profile.GetMLower().GetValue(); + double mUpper = superellipse_profile.GetMUpper().GetValue(); + double nLower = superellipse_profile.GetNLower().GetValue(); + double nUpper = superellipse_profile.GetNUpper().GetValue(); + //Build wire + TopoDS_Wire wire = BuildWireSuperEllipse(lowerHeightFraction, mLower, mUpper, nLower, nUpper); + cache.closed = wire; + cache.original = wire; +} + // Transforms a point by the fuselage profile transformation gp_Pnt CCPACSFuselageProfile::TransformPoint(const gp_Pnt& aPoint) const { @@ -330,20 +355,19 @@ void CCPACSFuselageProfile::BuildDiameterPoints(DiameterPointsCache& cache) cons } } } - } else if (m_standardProfile_choice3) - { - if(m_standardProfile_choice3->GetRectangle_choice1()) - { + } else if (m_standardProfile_choice3){ + if(m_standardProfile_choice3->GetRectangle_choice1()){ //Get Paramenters auto& rectangle_profile = *m_standardProfile_choice3->GetRectangle_choice1(); double heightToWidthRatio = rectangle_profile.GetHeightToWidthRatio().GetValue(); - cache.start = gp_Pnt(0., 0, 0.5 * heightToWidthRatio); - cache.end = gp_Pnt(0., 0, -0.5 * heightToWidthRatio); + cache.start = gp_Pnt(0., 0., 0.5 * heightToWidthRatio); + cache.end = gp_Pnt(0., 0., -0.5 * heightToWidthRatio); + } else if(m_standardProfile_choice3->GetSuperEllipse_choice2()) { + cache.start = gp_Pnt(0., 0., 0.5); + cache.end = gp_Pnt(0., 0., -0.5); } else { - throw CTiglError("Unknown or unsupported profile type"); - } - } else { throw CTiglError("Unknown or unsupported profile type"); + } } } diff --git a/src/fuselage/CCPACSFuselageProfile.h b/src/fuselage/CCPACSFuselageProfile.h index d38895557..d501c44ba 100644 --- a/src/fuselage/CCPACSFuselageProfile.h +++ b/src/fuselage/CCPACSFuselageProfile.h @@ -96,6 +96,9 @@ class CCPACSFuselageProfile : public generated::CPACSProfileGeometry //Builds the fuselage profile wires from height to width ratio and corner radius void BuildWiresRectangle(WireCache& cache) const; + //Builds the fuselage profile wires from lowerHeightFraction and exponents m,n for lower and upper semi-ellipse + void BuildWiresSuperEllipse(WireCache& cache) const; + // Helper function to determine the "diameter" (the wing profile chord line equivalent) // which is defined as the line intersecting Point1 and Point2 // diff --git a/tests/unittests/TestData/simpletest_standard_profile_rectangle_circle_guides.cpacs.xml b/tests/unittests/TestData/simpletest_standard_profile_rectangle_circle_guides.cpacs.xml index 7820d8fc9..d257a775c 100644 --- a/tests/unittests/TestData/simpletest_standard_profile_rectangle_circle_guides.cpacs.xml +++ b/tests/unittests/TestData/simpletest_standard_profile_rectangle_circle_guides.cpacs.xml @@ -95,7 +95,7 @@ D150_Fuselage_1Section1 - fuselageCircleProfileuID + fuselageSuperellipse1ProfileuID 1.0 @@ -138,7 +138,7 @@ D150_Fuselage_1Section2 - fuselageRectangleProfileuID + fuselageSuperellipseProfileuID 1 @@ -594,6 +594,58 @@ + + Superellipse + Standard Profile Type Superellipse + + + 0.25 + 5.0 + 0.5 + 3.0 + 2.0 + + + + + Superellipse1 + Standard Profile Type Superellipse + + + 0.5 + 1. + 1. + 1. + 1. + + + + + Superellipse2 + Standard Profile Type Superellipse + + + 0.5 + 2. + 2. + 2. + 2. + + + + + Superellipse3 + Standard Profile Type Superellipse + + + 0.5 + 3. + 3. + 3. + 3. + + + diff --git a/tests/unittests/TestData/simpletest_standard_profile_superellipse_guides.cpacs.xml b/tests/unittests/TestData/simpletest_standard_profile_superellipse_guides.cpacs.xml new file mode 100644 index 000000000..e48ec2441 --- /dev/null +++ b/tests/unittests/TestData/simpletest_standard_profile_superellipse_guides.cpacs.xml @@ -0,0 +1,671 @@ + + +
+ Cpacs2Test + Simple Wing for unit testing + Martin Siggel + 2012-10-09T15:12:47 + 0.5.0 + 3.2 + + + Converted to cpacs 3.0 using cpacs2to3 - does not include structure update + cpacs2to3 + 2018-01-15T09:22:57 + 0.2 + 3.0 + + + Added missing UIDs. + fix_errors.py + 2019-04-29T20:48:26 + 0.3.0 + 3.0 + + + Converted to CPACS 3.1 using cpacs2to3 + cpacs2to3 + 2020-04-26T02:01:33 + 0.4.0 + 3.1 + + + Converted to CPACS 3.2 using cpacs2to3 + cpacs2to3 + 2021-04-23T18:02:00 + 0.5.0 + 3.2 + + +
+ + + + Cpacs2Test + + 1 + 1 + + 0 + 0 + 0 + + + + + name + description + + + 1.0 + 0.5 + 0.5 + + + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + + + +
+ D150_Fuselage_1Section1 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section1 + fuselageRectangleProfileuID + + + 1.0 + 1.0 + 1.0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section2 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0.5 + 0 + 0 + + + + + D150_Fuselage_1Section2 + fuselageSuperellipse1ProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section3 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section3 + fuselageSuperellipse3ProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ + + D150_Fuselage_1Positioning1 + -0.5 + 90 + 0 + D150_Fuselage_1Section1ID + + + D150_Fuselage_1Positioning3 + 2 + 90 + 0 + D150_Fuselage_1Section1ID + D150_Fuselage_1Section3ID + + + + + D150_Fuselage_1Segment2 + D150_Fuselage_1Section1IDElement1 + + + D150_Fuselage_1_Segment2_guide0 + guideCurveProfileFuselage + 0 + 0 + + + D150_Fuselage_1_Segment2_guide1 + guideCurveProfileFuselage + 0.333 + 0.333 + + + D150_Fuselage_1_Segment2_guide2 + guideCurveProfileFuselage + 0.666 + 0.666 + + + D150_Fuselage_1_Segment2_guide3 + guideCurveProfileFuselage + 1 + 1 + + + D150_Fuselage_1Section2IDElement1 + + + D150_Fuselage_1Segment3 + D150_Fuselage_1Section2IDElement1 + + + D150_Fuselage_1_Segment3_guide0 + guideCurveProfileFuselage + D150_Fuselage_1_Segment2_guide0 + 0 + + + D150_Fuselage_1_Segment3_guide1 + guideCurveProfileFuselage + D150_Fuselage_1_Segment2_guide1 + 0.333 + + + D150_Fuselage_1_Segment3_guide2 + guideCurveProfileFuselage + D150_Fuselage_1_Segment2_guide2 + 0.666 + + + D150_Fuselage_1_Segment3_guide3 + guideCurveProfileFuselage + D150_Fuselage_1_Segment2_guide3 + 1 + + + D150_Fuselage_1Section3IDElement1 + + +
+
+ + + Wing + SimpleFuselage + This wing has been generated to test CATIA2CPACS. + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + +
+ Cpacs2Test - Wing Section 1 + Cpacs2Test - Wing Section 1 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 1 Main Element + Cpacs2Test - Wing Section 1 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 2 + Cpacs2Test - Wing Section 2 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test - Wing Section 2 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 3 + Cpacs2Test - Wing Section 3 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test - Wing Section 3 Main Element + NACA0012 + + + 0.5 + 0.5 + 0.5 + + + 0 + 0 + 0 + + + 0.5 + 0 + 0 + + + + +
+
+ + + Cpacs2Test - Wing Section 1 Positioning + Cpacs2Test - Wing Section 1 Positioning + 0 + 0 + 0 + Cpacs2Test_Wing_Sec1 + + + Cpacs2Test - Wing Section 2 Positioning + Cpacs2Test - Wing Section 2 Positioning + 1 + 0 + 0 + Cpacs2Test_Wing_Sec1 + Cpacs2Test_Wing_Sec2 + + + Cpacs2Test - Wing Section 3 Positioning + Cpacs2Test - Wing Section 3 Positioning + 1 + 0 + 0 + Cpacs2Test_Wing_Sec2 + Cpacs2Test_Wing_Sec3 + + + + + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec2_El1 + + + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test_Wing_Sec2_El1 + Cpacs2Test_Wing_Sec3_El1 + + + + + Wing_CS1 + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec3_El1 + + + + + MySkinMat + 0.0 + + + + + + + MyCellMat + 0.0 + + + + 0.8 + 0.8 + + + 1.0 + 1.0 + + + + 0 + WING_CS1 + + + 0 + WING_CS1 + + + + + 0.5 + WING_CS1 + + + 0.5 + WING_CS1 + + + + + + + + + MySkinMat + + + + + + +
+
+
+
+ + + + NACA0.00.00.12 + NACA 4 Series Profile + + 1.0;0.9875;0.975;0.9625;0.95;0.9375;0.925;0.9125;0.9;0.8875;0.875;0.8625;0.85;0.8375;0.825;0.8125;0.8;0.7875;0.775;0.7625;0.75;0.7375;0.725;0.7125;0.7;0.6875;0.675;0.6625;0.65;0.6375;0.625;0.6125;0.6;0.5875;0.575;0.5625;0.55;0.5375;0.525;0.5125;0.5;0.4875;0.475;0.4625;0.45;0.4375;0.425;0.4125;0.4;0.3875;0.375;0.3625;0.35;0.3375;0.325;0.3125;0.3;0.2875;0.275;0.2625;0.25;0.2375;0.225;0.2125;0.2;0.1875;0.175;0.1625;0.15;0.1375;0.125;0.1125;0.1;0.0875;0.075;0.0625;0.05;0.0375;0.025;0.0125;0.0;0.0125;0.025;0.0375;0.05;0.0625;0.075;0.0875;0.1;0.1125;0.125;0.1375;0.15;0.1625;0.175;0.1875;0.2;0.2125;0.225;0.2375;0.25;0.2625;0.275;0.2875;0.3;0.3125;0.325;0.3375;0.35;0.3625;0.375;0.3875;0.4;0.4125;0.425;0.4375;0.45;0.4625;0.475;0.4875;0.5;0.5125;0.525;0.5375;0.55;0.5625;0.575;0.5875;0.6;0.6125;0.625;0.6375;0.65;0.6625;0.675;0.6875;0.7;0.7125;0.725;0.7375;0.75;0.7625;0.775;0.7875;0.8;0.8125;0.825;0.8375;0.85;0.8625;0.875;0.8875;0.9;0.9125;0.925;0.9375;0.95;0.9625;0.975;0.9875;1.0 + 0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0 + -0.00126;-0.0030004180415;-0.00471438572941;-0.00640256842113;-0.00806559133343;-0.00970403933653;-0.0113184567357;-0.0129093470398;-0.0144771727147;-0.0160223549226;-0.0175452732434;-0.0190462653789;-0.0205256268372;-0.0219836105968;-0.0234204267471;-0.024836242105;-0.0262311798047;-0.0276053188583;-0.0289586936852;-0.0302912936071;-0.0316030623052;-0.0328938972373;-0.0341636490097;-0.0354121207001;-0.0366390671268;-0.0378441940595;-0.0390271573644;-0.0401875620783;-0.0413249614032;-0.042438855614;-0.043528690869;-0.0445938579126;-0.0456336906587;-0.04664746464;-0.0476343953088;-0.0485936361694;-0.0495242767241;-0.0504253402064;-0.0512957810767;-0.0521344822472;-0.0529402520006;-0.0537118205596;-0.0544478362583;-0.0551468612564;-0.0558073667285;-0.0564277274483;-0.0570062156697;-0.0575409941929;-0.0580301084765;-0.0584714776309;-0.0588628840933;-0.059201961739;-0.0594861821311;-0.0597128385384;-0.059879027262;-0.0599816256958;-0.060017266394;-0.059982306219;-0.05987278938;-0.0596844028137;-0.059412421875;-0.059051643633;-0.0585963041308;-0.0580399746271;-0.0573754299024;-0.0565944788455;-0.0556877432118;-0.054644363746;-0.0534516022043;-0.0520942903127;-0.0505540468987;-0.0488081315259;-0.0468277042382;-0.0445750655553;-0.0419990347204;-0.0390266537476;-0.0355468568262;-0.0313738751622;-0.0261471986426;-0.0189390266528;0.0;0.0189390266528;0.0261471986426;0.0313738751622;0.0355468568262;0.0390266537476;0.0419990347204;0.0445750655553;0.0468277042382;0.0488081315259;0.0505540468987;0.0520942903127;0.0534516022043;0.054644363746;0.0556877432118;0.0565944788455;0.0573754299024;0.0580399746271;0.0585963041308;0.059051643633;0.059412421875;0.0596844028137;0.05987278938;0.059982306219;0.060017266394;0.0599816256958;0.059879027262;0.0597128385384;0.0594861821311;0.059201961739;0.0588628840933;0.0584714776309;0.0580301084765;0.0575409941929;0.0570062156697;0.0564277274483;0.0558073667285;0.0551468612564;0.0544478362583;0.0537118205596;0.0529402520006;0.0521344822472;0.0512957810767;0.0504253402064;0.0495242767241;0.0485936361694;0.0476343953088;0.04664746464;0.0456336906587;0.0445938579126;0.043528690869;0.042438855614;0.0413249614032;0.0401875620783;0.0390271573644;0.0378441940595;0.0366390671268;0.0354121207001;0.0341636490097;0.0328938972373;0.0316030623052;0.0302912936071;0.0289586936852;0.0276053188583;0.0262311798047;0.024836242105;0.0234204267471;0.0219836105968;0.0205256268372;0.0190462653789;0.0175452732434;0.0160223549226;0.0144771727147;0.0129093470398;0.0113184567357;0.00970403933653;0.00806559133343;0.00640256842113;0.00471438572941;0.0030004180415;0.00126 + + + + + + Circle + Profile build up from set of Points on Circle where may Dimensions are 1..-1 + + 0.0;0.0;0.0;0.0;0.0 + 0.0;1.0;0.0;-1.0;0.0 + 1.0;0.0;-1.0;0.0;1.0 + + + + Rectangle + Standard Profile Type Rectangle + + + 0.5 + + + + + Rectangle1 + Standard Profile Type Rectangle + + + 0.5 + 0.14 + + + + + Superellipse + Standard Profile Type Superellipse + + + 0.25 + 5.0 + 0.5 + 3.0 + 2.0 + + + + + Superellipse1 + Standard Profile Type Superellipse + + + 0.5 + 1. + 1. + 1. + 1. + + + + + Superellipse2 + Standard Profile Type Superellipse + + + 0.5 + 2. + 2. + 2. + 2. + + + + + Superellipse3 + Standard Profile Type Superellipse + + + 0.5 + 2. + 3. + 1. + 3. + + + + + + + GuideCurveProfileFuselage + + 0.0 + 0.5 + 0.0 + + + + +
+ + + + halfCube + 10.0 + 1. + + + +
diff --git a/tests/unittests/TestData/simpletest_standard_profile_superellipse_kink.cpacs.xml b/tests/unittests/TestData/simpletest_standard_profile_superellipse_kink.cpacs.xml new file mode 100644 index 000000000..421cd67e7 --- /dev/null +++ b/tests/unittests/TestData/simpletest_standard_profile_superellipse_kink.cpacs.xml @@ -0,0 +1,786 @@ + + +
+ Cpacs2Test + Simple Wing with 4 guide curves for testing + Martin Siggel + 2020-10-12T12:26:00 + 0.5.0 + 3.2 + + + Converted to CPACS 3.2 using cpacs2to3 + cpacs2to3 + 2021-04-23T18:02:03 + 0.5.0 + 3.2 + + +
+ + + + Cpacs2Test + + 1 + 1 + + 0 + 0 + 0 + + + + + name + description + + + 1.0 + 0.5 + 0.5 + + + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + + + +
+ D150_Fuselage_1Section1 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section1 + fuselageSuperellipseProfileuID + + + 1.0 + 1.0 + 1.0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section2 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0.01 + 0 + 0 + + + + + D150_Fuselage_1Section2 + fuselageSuperellipse1ProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section3 + + + 1.0 + 3.0 + 3.0 + + + 0.0 + 0.0 + 0.0 + + + 1 + 0 + 0 + + + + + D150_Fuselage_1Section3 + fuselageSuperellipseProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0.5 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section3 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section3 + fuselageCircle1ProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0.9 + 0 + 0 + + + + +
+
+ + + D150_Fuselage_1Positioning1 + -0.5 + 90 + 0 + D150_Fuselage_1Section1ID + + + D150_Fuselage_1Positioning3 + 2 + 90 + 0 + D150_Fuselage_1Section1ID + D150_Fuselage_1Section4ID + + + + + D150_Fuselage_1Segment2 + D150_Fuselage_1Section1IDElement1 + D150_Fuselage_1Section2IDElement1 + + + D150_Fuselage_1Segment3 + D150_Fuselage_1Section2IDElement1 + D150_Fuselage_1Section3IDElement1 + + + D150_Fuselage_1Segment4 + D150_Fuselage_1Section3IDElement1 + D150_Fuselage_1Section4IDElement1 + + +
+
+ + + Wing + SimpleFuselage + This wing has been generated to test CATIA2CPACS. + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + +
+ Cpacs2Test - Wing Section 1 + Cpacs2Test - Wing Section 1 + + + 1 + 1 + 2.5 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 1 Main Element + Cpacs2Test - Wing Section 1 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 2 + Cpacs2Test - Wing Section 2 + + + 1 + 2 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test - Wing Section 2 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 3 + Cpacs2Test - Wing Section 3 + + + 1 + 1 + 0.5 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test - Wing Section 3 Main Element + NACA0012 + + + 0.5 + 0.5 + 0.5 + + + 0 + 0 + 0 + + + 0.5 + 0 + 0 + + + + +
+
+ + + Cpacs2Test - Wing Section 1 Positioning + Cpacs2Test - Wing Section 1 Positioning + 0 + 0 + 0 + Cpacs2Test_Wing_Sec1 + + + Cpacs2Test - Wing Section 2 Positioning + Cpacs2Test - Wing Section 2 Positioning + 0.8 + 0 + 0 + Cpacs2Test_Wing_Sec1 + Cpacs2Test_Wing_Sec2 + + + Cpacs2Test - Wing Section 3 Positioning + Cpacs2Test - Wing Section 3 Positioning + 1 + 0 + 0 + Cpacs2Test_Wing_Sec2 + Cpacs2Test_Wing_Sec3 + + + + + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec2_El1 + + + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S1_UPPER_GUIDE + 0.5 + 0.5 + + + Lower Trailing Edge GuideCurve from GuideCurveModel - Wing Section 1 Main Element to GuideCurveModel - Wing Section 2 Main Element + Lower Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S1_TE_LOWER_GUIDE + -1.0 + -1.0 + + + Leading Edge GuideCurve from GuideCurveModel - Wing Section 1 Main Element to GuideCurveModel - Wing Section 2 Main Element + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 2 Main Element + S1_LE_GUIDE + 0.0 + 0.0 + + + Upper Trailing Edge GuideCurve from GuideCurveModel - Wing Section 1 Main Element to GuideCurveModel - Wing Section 2 Main Element + Upper Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 2 Main Element + S1_TE_UPPER_GUIDE + 1.0 + 1.0 + + + + + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test_Wing_Sec2_El1 + Cpacs2Test_Wing_Sec3_El1 + + + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S2_UPPER_GUIDE + C1 from previous + Wing_Seg_1_2_GuideCurve_Upper + 0.5 + + + Lower Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + Lower Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S2_TE_LOWER_GUIDE + Wing_Seg_1_2_GuideCurve_TrailingEdgeLower + -1.0 + + + Upper Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + Upper Trailing Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S2_TE_UPPER_GUIDE + Wing_Seg_1_2_GuideCurve_TrailingEdgeUpper + 1.0 + + + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element + S2_LE_GUIDE + C1 from previous + Wing_Seg_1_2_GuideCurve_LeadingEdge + 0.0 + + + + + + + Wing_CS1 + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec3_El1 + + + + + MySkinMat + 0.0 + + + + + + + MyCellMat + 0.0 + + + + 0.8 + 0.8 + + + 1.0 + 1.0 + + + + 0 + WING_CS1 + + + 0 + WING_CS1 + + + + + 0.5 + WING_CS1 + + + 0.5 + WING_CS1 + + + + + + + + + MySkinMat + + + + + + +
+
+
+
+ + + + NACA0.00.00.12 + NACA 4 Series Profile + + 1.0;0.9875;0.975;0.9625;0.95;0.9375;0.925;0.9125;0.9;0.8875;0.875;0.8625;0.85;0.8375;0.825;0.8125;0.8;0.7875;0.775;0.7625;0.75;0.7375;0.725;0.7125;0.7;0.6875;0.675;0.6625;0.65;0.6375;0.625;0.6125;0.6;0.5875;0.575;0.5625;0.55;0.5375;0.525;0.5125;0.5;0.4875;0.475;0.4625;0.45;0.4375;0.425;0.4125;0.4;0.3875;0.375;0.3625;0.35;0.3375;0.325;0.3125;0.3;0.2875;0.275;0.2625;0.25;0.2375;0.225;0.2125;0.2;0.1875;0.175;0.1625;0.15;0.1375;0.125;0.1125;0.1;0.0875;0.075;0.0625;0.05;0.0375;0.025;0.0125;0.0;0.0125;0.025;0.0375;0.05;0.0625;0.075;0.0875;0.1;0.1125;0.125;0.1375;0.15;0.1625;0.175;0.1875;0.2;0.2125;0.225;0.2375;0.25;0.2625;0.275;0.2875;0.3;0.3125;0.325;0.3375;0.35;0.3625;0.375;0.3875;0.4;0.4125;0.425;0.4375;0.45;0.4625;0.475;0.4875;0.5;0.5125;0.525;0.5375;0.55;0.5625;0.575;0.5875;0.6;0.6125;0.625;0.6375;0.65;0.6625;0.675;0.6875;0.7;0.7125;0.725;0.7375;0.75;0.7625;0.775;0.7875;0.8;0.8125;0.825;0.8375;0.85;0.8625;0.875;0.8875;0.9;0.9125;0.925;0.9375;0.95;0.9625;0.975;0.9875;1.0 + 0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0 + -0.00126;-0.0030004180415;-0.00471438572941;-0.00640256842113;-0.00806559133343;-0.00970403933653;-0.0113184567357;-0.0129093470398;-0.0144771727147;-0.0160223549226;-0.0175452732434;-0.0190462653789;-0.0205256268372;-0.0219836105968;-0.0234204267471;-0.024836242105;-0.0262311798047;-0.0276053188583;-0.0289586936852;-0.0302912936071;-0.0316030623052;-0.0328938972373;-0.0341636490097;-0.0354121207001;-0.0366390671268;-0.0378441940595;-0.0390271573644;-0.0401875620783;-0.0413249614032;-0.042438855614;-0.043528690869;-0.0445938579126;-0.0456336906587;-0.04664746464;-0.0476343953088;-0.0485936361694;-0.0495242767241;-0.0504253402064;-0.0512957810767;-0.0521344822472;-0.0529402520006;-0.0537118205596;-0.0544478362583;-0.0551468612564;-0.0558073667285;-0.0564277274483;-0.0570062156697;-0.0575409941929;-0.0580301084765;-0.0584714776309;-0.0588628840933;-0.059201961739;-0.0594861821311;-0.0597128385384;-0.059879027262;-0.0599816256958;-0.060017266394;-0.059982306219;-0.05987278938;-0.0596844028137;-0.059412421875;-0.059051643633;-0.0585963041308;-0.0580399746271;-0.0573754299024;-0.0565944788455;-0.0556877432118;-0.054644363746;-0.0534516022043;-0.0520942903127;-0.0505540468987;-0.0488081315259;-0.0468277042382;-0.0445750655553;-0.0419990347204;-0.0390266537476;-0.0355468568262;-0.0313738751622;-0.0261471986426;-0.0189390266528;0.0;0.0189390266528;0.0261471986426;0.0313738751622;0.0355468568262;0.0390266537476;0.0419990347204;0.0445750655553;0.0468277042382;0.0488081315259;0.0505540468987;0.0520942903127;0.0534516022043;0.054644363746;0.0556877432118;0.0565944788455;0.0573754299024;0.0580399746271;0.0585963041308;0.059051643633;0.059412421875;0.0596844028137;0.05987278938;0.059982306219;0.060017266394;0.0599816256958;0.059879027262;0.0597128385384;0.0594861821311;0.059201961739;0.0588628840933;0.0584714776309;0.0580301084765;0.0575409941929;0.0570062156697;0.0564277274483;0.0558073667285;0.0551468612564;0.0544478362583;0.0537118205596;0.0529402520006;0.0521344822472;0.0512957810767;0.0504253402064;0.0495242767241;0.0485936361694;0.0476343953088;0.04664746464;0.0456336906587;0.0445938579126;0.043528690869;0.042438855614;0.0413249614032;0.0401875620783;0.0390271573644;0.0378441940595;0.0366390671268;0.0354121207001;0.0341636490097;0.0328938972373;0.0316030623052;0.0302912936071;0.0289586936852;0.0276053188583;0.0262311798047;0.024836242105;0.0234204267471;0.0219836105968;0.0205256268372;0.0190462653789;0.0175452732434;0.0160223549226;0.0144771727147;0.0129093470398;0.0113184567357;0.00970403933653;0.00806559133343;0.00640256842113;0.00471438572941;0.0030004180415;0.00126 + + + + + + Circle + Profile build up from set of Points on Circle where may Dimensions are 1..-1 + + 0.0;0.0;0.0;0.0;0.0 + 0.0;1.0;0.0;-1.0;0.0 + 1.0;0.0;-1.0;0.0;1.0 + + + + Circle1 + Profile build up from set of Points on Circle where may Dimensions are 1..-1 + + 0.0;0.0;0.0;0.0;0.0 + 0.0;1.0;0.0;-1.0;0.0 + 1.0;0.0;-1.0;0.0;1.0 + 1;3 + + 1;3 + 0.25;0.75 + + + + + Rectangle + Standard Profile Type Rectangle + + + 0.5 + + + + + Rectangle1 + Standard Profile Type Rectangle + + + 1 + 0.14 + + + + + Superellipse + Standard Profile Type Superellipse + + + 0.25 + 5.0 + 0.5 + 3.0 + 2.0 + + + + + Superellipse1 + Standard Profile Type Superellipse + + + 0.5 + 1. + 1. + 1. + 1. + + + + + Superellipse2 + Standard Profile Type Superellipse + + + 0.5 + 2. + 2. + 2. + 2. + + + + + Superellipse3 + Standard Profile Type Superellipse + + + 0.5 + 3. + 3. + 3. + 3. + + + + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0;0;0 + 0.1;0.5;0.9 + 0;0;0 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0 + 0.5 + 0 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0 + 0.5 + 0.01 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0;0;0 + 0.1;0.5;0.9 + 0;0;0 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0;0;0 + 0.1;0.5;0.9 + 0;0;0 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + -0.2 + 0.5 + 0 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + -0.05 + 0.5 + -0.03 + + + + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + Linear Lower Guide Curve Profile for GuideCurveModel - Fuselage + + 0;0;0 + 0.1;0.5;0.9 + 0;0;0 + + + + +
+ + + + halfCube + 10.0 + 1. + + + +
diff --git a/tests/unittests/testFuselageStandardProfileSuperellipse.cpp b/tests/unittests/testFuselageStandardProfileSuperellipse.cpp new file mode 100644 index 000000000..8a9aa08a0 --- /dev/null +++ b/tests/unittests/testFuselageStandardProfileSuperellipse.cpp @@ -0,0 +1,152 @@ +/* +* Copyright (C) 2022 German Aerospace Center +* 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 "CTiglMakeLoft.h" +#include "test.h" +#include "tigl.h" +#include "Debugging.h" +#include "tiglcommonfunctions.h" +#include "BRepBuilderAPI_Transform.hxx" +#include +#include "CCPACSConfigurationManager.h" +#include "CCPACSConfiguration.h" +#include "CNamedShape.h" + +class FuselageStandardProfileSuperEllipse : public ::testing::Test +{ +protected: + static void SetUpTestCase() + { + // Test case on standardProfile, mixed profiles: rectangle, rectangle with rounded corners, circle, superellipse, guidecurves + + const char* filename = "TestData/simpletest_standard_profile_superellipse_guides.cpacs.xml"; + ReturnCode tixiRet; + TiglReturnCode tiglRet; + + tiglHandle = -1; + tixiHandle = -1; + + tixiRet = tixiOpenDocument(filename, &tixiHandle); + ASSERT_TRUE (tixiRet == SUCCESS); + tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "", &tiglHandle); + ASSERT_TRUE(tiglRet == TIGL_SUCCESS); + + // Test case on standardProfile rectangle with guide curves + + const char* filename1 = "TestData/simpletest_standard_profile_superellipse_kink.cpacs.xml"; + ReturnCode tixiRet1; + TiglReturnCode tiglRet1; + + tiglHandle1 = -1; + tixiHandle1 = -1; + + tixiRet1 = tixiOpenDocument(filename1, &tixiHandle1); + ASSERT_TRUE (tixiRet1 == SUCCESS); + tiglRet1 = tiglOpenCPACSConfiguration(tixiHandle1, "", &tiglHandle1); + ASSERT_TRUE(tiglRet1 == TIGL_SUCCESS); + + // Test case on standardProfile, invalid elements + + ReturnCode tixiRet2; + TiglReturnCode tiglRet2; + + tiglHandle2 = -1; + tixiHandle2 = -1; + + tixiRet2 = tixiOpenDocument(filename1, &tixiHandle2); + ASSERT_TRUE (tixiRet2 == SUCCESS); + tiglRet2 = tiglOpenCPACSConfiguration(tixiHandle2, "", &tiglHandle2); + ASSERT_TRUE(tiglRet2 == TIGL_SUCCESS); + + + } + + static void TearDownTestCase() + { + ASSERT_TRUE(tiglCloseCPACSConfiguration(tiglHandle) == TIGL_SUCCESS); + ASSERT_TRUE(tixiCloseDocument(tixiHandle) == SUCCESS); + tiglHandle = -1; + tixiHandle = -1; + + ASSERT_TRUE(tiglCloseCPACSConfiguration(tiglHandle1) == TIGL_SUCCESS); + ASSERT_TRUE(tixiCloseDocument(tixiHandle1) == SUCCESS); + tiglHandle1 = -1; + tixiHandle1 = -1; + + ASSERT_TRUE(tiglCloseCPACSConfiguration(tiglHandle2) == TIGL_SUCCESS); + ASSERT_TRUE(tixiCloseDocument(tixiHandle2) == SUCCESS); + tiglHandle2 = -1; + tixiHandle2 = -1; + + } + + void SetUp() override {} + void TearDown() override {} + + + static TixiDocumentHandle tixiHandle; + static TiglCPACSConfigurationHandle tiglHandle; + + static TixiDocumentHandle tixiHandle1; + static TiglCPACSConfigurationHandle tiglHandle1; + + + static TixiDocumentHandle tixiHandle2; + static TiglCPACSConfigurationHandle tiglHandle2; +}; + +TixiDocumentHandle FuselageStandardProfileSuperEllipse::tixiHandle = 0; +TiglCPACSConfigurationHandle FuselageStandardProfileSuperEllipse::tiglHandle = 0; +TixiDocumentHandle FuselageStandardProfileSuperEllipse::tixiHandle1 = 0; +TiglCPACSConfigurationHandle FuselageStandardProfileSuperEllipse::tiglHandle1 = 0; +TixiDocumentHandle FuselageStandardProfileSuperEllipse::tixiHandle2 = 0; +TiglCPACSConfigurationHandle FuselageStandardProfileSuperEllipse::tiglHandle2 = 0; + + +TEST_F(FuselageStandardProfileSuperEllipse, BuildFuselageMixedProfilesWithGuides_Superellipse) +{ + // read configuration + tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); + tigl::CCPACSConfiguration& config = manager.GetConfiguration(tiglHandle); + auto fuselage = config.GetFuselage(1).GetLoft(); + ASSERT_TRUE(BRepCheck_Analyzer(fuselage->Shape()).IsValid()); +} + + +TEST_F(FuselageStandardProfileSuperEllipse, BuildFuselageMixedProfilesWithKinks_Superellipse) +{ + // read configuration + tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); + tigl::CCPACSConfiguration& config = manager.GetConfiguration(tiglHandle1); + auto fuselage = config.GetFuselage(1).GetLoft(); + ASSERT_TRUE(BRepCheck_Analyzer(fuselage->Shape()).IsValid()); +} + +TEST_F(FuselageStandardProfileSuperEllipse, BuildFuselageMixedProfilesInvalidInput) +{ + tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); + //add invalid element + tixiCreateElementAtIndex(tixiHandle2, "/cpacs/vehicles/profiles/fuselageProfiles", "fuselageProfile", 1); + tixiCreateElement(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]", "invalidType"); + tixiAddTextAttribute(tixiHandle2,"/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[1]", "uID", "std2"); + + // change uid of one segment to invalid profile type + tixiUpdateTextElement(tixiHandle2, "/cpacs/vehicles/aircraft/model/fuselages/fuselage[1]/sections/section[1]/elements/element[1]/profileUID", "std2"); + tiglOpenCPACSConfiguration(tixiHandle2, "", &tiglHandle2); + tigl::CCPACSConfiguration& config1 = manager.GetConfiguration(tiglHandle2); + + // fuselage cannot be build with invalid profile + ASSERT_THROW(config1.GetFuselage(1).GetLoft(),tigl::CTiglError); +} diff --git a/tests/unittests/tiglCommonFunctions.cpp b/tests/unittests/tiglCommonFunctions.cpp index 101b55c98..1ed364c7f 100644 --- a/tests/unittests/tiglCommonFunctions.cpp +++ b/tests/unittests/tiglCommonFunctions.cpp @@ -204,6 +204,42 @@ TEST(TiglCommonFunctions, BuildWireRectangle_CornerRadiusInvalid) ASSERT_THROW(BuildWireRectangle(0.5, -1.), tigl::CTiglError); } +TEST(TiglCommonFunctions, BuildWireSuperEllipse) +{ + //test valid values + auto wire = BuildWireSuperEllipse(0.25,5.,0.5,3.,2); + ASSERT_TRUE(wire.Closed()); + auto trafo = gp_Trsf(); + auto vec = gp_Vec(-1.,0.,0.); + trafo.SetTranslation(vec); + auto wire2 = BRepBuilderAPI_Transform(wire, trafo).Shape(); + ASSERT_TRUE(wire2.Closed()); + auto loft = CTiglMakeLoft(); + loft.addProfiles(wire); + loft.addProfiles(wire2); + ASSERT_TRUE(BRepCheck_Analyzer(loft.Shape()).IsValid()); + + //check invalid values + //exponent 0 + ASSERT_THROW(BuildWireSuperEllipse(0.25,5.,0.5,3.,0.), tigl::CTiglError); + ASSERT_THROW(BuildWireSuperEllipse(0.25,5.,0.5,0.,2.), tigl::CTiglError); + ASSERT_THROW(BuildWireSuperEllipse(0.25,5.,0.,3.,2.), tigl::CTiglError); + ASSERT_THROW(BuildWireSuperEllipse(0.25,0.,0.5,3.,2.), tigl::CTiglError); + //exponent negative + ASSERT_THROW(BuildWireSuperEllipse(0.25,-5.,0.5,3.,2), tigl::CTiglError); + ASSERT_THROW(BuildWireSuperEllipse(0.25,5.,-0.5,3.,2), tigl::CTiglError); + ASSERT_THROW(BuildWireSuperEllipse(0.25,5.,0.5,-3.,2), tigl::CTiglError); + ASSERT_THROW(BuildWireSuperEllipse(0.25,5.,0.5,3.,-2), tigl::CTiglError); + //exponent outside tolerance + ASSERT_THROW(BuildWireSuperEllipse(0.25,1e-16,0.5,3.,2), tigl::CTiglError); + ASSERT_THROW(BuildWireSuperEllipse(0.25,5.,1e-16,3.,2), tigl::CTiglError); + ASSERT_THROW(BuildWireSuperEllipse(0.25,5.,0.5,1e-16,2), tigl::CTiglError); + ASSERT_THROW(BuildWireSuperEllipse(0.25,5.,0.5,3.,1e-16), tigl::CTiglError); + //invalid lowerHeightFraction + ASSERT_THROW(BuildWireSuperEllipse(2.,5.,0.5,3.,2.), tigl::CTiglError); + ASSERT_THROW(BuildWireSuperEllipse(-0.25,5.,0.5,3.,2), tigl::CTiglError); +} + TEST(TiglCommonFunctions, LinspaceWithBreaks) { std::vector breaks;