Skip to content

Conversation

@ole-alb
Copy link
Contributor

@ole-alb ole-alb commented Jul 22, 2025

In TiGL 3 we only provide the implementation for TrailingEdgeDevices. This will be extended by LeadingEdgeDevices.

Closes #1101

Description

How Has This Been Tested?

Screenshots, that help to understand the changes(if applicable):

Checklist:

Task Finished Reviewer Approved
At least one test for the new functionality was added.
  • yes
  • does not apply
  • OK
New classes have been added to the Python interface.
  • yes
  • does not apply
  • OK
The code is properly documented with doxygen docstrings
  • yes
  • does not apply
  • OK
Changes are documented at the top of ChangeLog.md
  • yes
  • does not apply
  • OK

@codecov
Copy link

codecov bot commented Jul 22, 2025

Codecov Report

❌ Patch coverage is 72.08738% with 230 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.48%. Comparing base (08f4898) to head (72393f9).

Files with missing lines Patch % Lines
...control_devices/CCPACSControlSurfaceWingCutOut.cpp 0.00% 82 Missing ⚠️
..._devices/CCPACSControlSurfaceBorderLeadingEdge.cpp 50.00% 40 Missing ⚠️
src/api/tigl.cpp 67.67% 32 Missing ⚠️
src/wing/CCPACSWing.cpp 90.73% 24 Missing ⚠️
src/control_devices/CCPACSLeadingEdgeDevice.cpp 75.00% 21 Missing ⚠️
...c/control_devices/CControlSurfaceBorderBuilder.cpp 77.58% 13 Missing ⚠️
src/control_devices/ControlSurfaceDeviceHelper.cpp 87.03% 7 Missing ⚠️
...devices/CCPACSControlSurfaceBorderTrailingEdge.cpp 63.63% 4 Missing ⚠️
...ices/CCPACSControlSurfaceOuterShapeLeadingEdge.cpp 87.50% 4 Missing ⚠️
src/wing/CCPACSWingCSStructure.cpp 0.00% 2 Missing ⚠️
... and 1 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1109      +/-   ##
==========================================
- Coverage   72.75%   72.48%   -0.27%     
==========================================
  Files         308      313       +5     
  Lines       26993    27381     +388     
==========================================
+ Hits        19638    19848     +210     
- Misses       7355     7533     +178     
Flag Coverage Δ
unittests 72.48% <72.08%> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/CCPACSEtaIsoLine.cpp 71.42% <100.00%> (+2.19%) ⬆️
src/CCPACSXsiIsoLine.cpp 25.00% <100.00%> (+10.71%) ⬆️
...ces/CCPACSControlSurfaceOuterShapeTrailingEdge.cpp 87.09% <100.00%> (-1.80%) ⬇️
src/control_devices/CCPACSControlSurfaceSteps.cpp 100.00% <100.00%> (ø)
src/control_devices/CCPACSControlSurfaces.cpp 100.00% <100.00%> (ø)
src/control_devices/CCPACSTrailingEdgeDevice.cpp 88.09% <95.83%> (+2.29%) ⬆️
src/wing/CCPACSWingCSStructure.cpp 42.62% <0.00%> (-1.45%) ⬇️
...devices/CCPACSControlSurfaceBorderTrailingEdge.cpp 50.70% <63.63%> (ø)
...ices/CCPACSControlSurfaceOuterShapeLeadingEdge.cpp 87.50% <87.50%> (ø)
src/control_devices/ControlSurfaceDeviceHelper.cpp 87.03% <87.03%> (ø)
... and 6 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ole-alb ole-alb changed the base branch from tigl-3-4-1 to main September 11, 2025 14:39
@ole-alb ole-alb changed the title Add LeadingEdgeDevices and Spoilers Add LeadingEdgeDevices Sep 19, 2025
@ole-alb ole-alb marked this pull request as ready for review September 25, 2025 09:23
@ole-alb ole-alb requested a review from joergbrech September 26, 2025 08:55
Copy link
Contributor

@joergbrech joergbrech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed in parts. I still have to look at the unit tests and the implementation in src/control_devices.

I do have a few comments so far, see below.

I also have some general comments/questions:

  • In tigl.cpp there are two places where we iterate over TEDs and LEDs. In the first, we are building a fused shape of the control surface cutout shapes to buil the wing loft with cutouts. In the second place, we are collecting all LED and TED shapes. I see a chance of moving both functionalities into the CCPACSControlSurfaces class, so that the function bodies in tigl.cpp are less daunting. It feels like a better seperation of concerns to me.
  • Currently, the control surface cutout shapes are first fused individually one-by-one to one big cutout shape, which is then removed from the wing (if I am not mistaken). Building the cutout shape take quite a long time and I wonder if we can improve the performance here by doing n Boolean cuts instead of n Boolean fuses and then one big complicated cut. But we would have to experiment if we actually gain anything from it I suppose. Could also be part of a separate PR.

const CCPACSLeadingEdgeDevices& LeadingEdgeDevices = controlSurfs.GetLeadingEdgeDevices().value();

for (size_t j = LeadingEdgeDevices.GetLeadingEdgeDevices().size(); j > 0; j--) {
CCPACSLeadingEdgeDevice& LeadingEdgeDevice = *LeadingEdgeDevices.GetLeadingEdgeDevices().at(j - 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above. I don't understand why we go from back to front.

};

std::map<std::string, DeviceWidgets> _guiMap;
std::map<std::string, tigl::CTiglAbstractGeometricComponent*> _deviceMap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code works and reflects the previous implementation for TEDs. But I have a suggestion for refactoring.

Problems: We store pointers to CTiglAbstractGeometricComponent in a map here. One conceptual issue is that not all CTiglAbstractGeometricComponents are control devices. Another issue is that we already manage a map that gives us geometric components given a uid.

Solution: At all places where we currently use the _deviceMap, let's use the uid manager instead. We can query if a given uid is of an expected type, e.g. LED or TED and then resolve this object through the UID manager interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some adjustements based on your suggestion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do completely without the _deviceMap.

}
}

PNamedShape CCPACSControlSurfaceOuterShapeLeadingEdge::CutoutShape(PNamedShape wingShape, gp_Vec upDir) const
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion for more DRYness.

I believe that this function can be made more generic and I have seen this calculation (ThruSections from inner and outer border) twice in CCPACSControlSurfaceWingCutout.

}

TopoDS_Wire
CCPACSControlSurfaceBorderLeadingEdge::GetAirfoilWire(CTiglControlSurfaceBorderCoordinateSystem& coords) const
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion for more DRYness

This function really only uses a CCPACSWingProfile. So most of the implemenation can move to a function that is shared in the implementation for CCPACSControlSurfaceBorderLeadingEdge and CCPACSControlSurfaceBorderTrailingEdge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if that works since there is a the difference in the GetAirfoil_choiceX

@joergbrech
Copy link
Contributor

joergbrech commented Nov 21, 2025

@ole-alb I finally managed to look at the whole PR. Sorry it took so long. Apart from the comments above, I have two additional remarks:

  • I noticed that the file CCPACSControlSurfaceWingCutOut.cpp isn't covered by any unit test. Is there a chance we can change that?
  • We still have to find and fix the one bug with the F25 before merging this.

Comment on lines 79 to 93
struct TED
{
tigl::CCPACSTrailingEdgeDevice* device;
std::string uid() const { return device->GetUID(); }
double control_parameter() const { return device->GetControlParameter(); }
};

struct LED
{
tigl::CCPACSLeadingEdgeDevice* device;
std::string uid() const { return device->GetUID(); }
double control_parameter() const { return device->GetControlParameter(); }
};

using ControlDevice = std::variant<TED, LED>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the extra structs? Why not

using ControlDevice = std::variant<tigl::CCPACSTrailingEdgeDevice*, tigl::CCPACSLeadingEdgeDevice*>;

This could be a one-liner header file in src/conrol_devices, so that you can reuse the variant interface for other shared functionality between LEDs and TEDs, not just here in the TiGLCreator code.

Comment on lines 255 to 256
shape = GetWingCutOut()->GetLoft(ComponentSegment(*this).GetWing().GetWingCleanShape(), GetOuterShape(),
GetNormalOfControlSurfaceDevice());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can delete this, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine, I just have two style comments:

  • Personally, i would remove the _helper postfix in the method names.
  • Since the class does not have any data and doesn't need an implicit this argument in any of its functions, it could be made a namespace and all methods become free functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add LeadingEdgeDevices

3 participants