-
Notifications
You must be signed in to change notification settings - Fork 74
Add LeadingEdgeDevices #1109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add LeadingEdgeDevices #1109
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
joergbrech
left a comment
There was a problem hiding this 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.cppthere 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 intigl.cppare 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.
src/wing/CCPACSWing.cpp
Outdated
| const CCPACSLeadingEdgeDevices& LeadingEdgeDevices = controlSurfs.GetLeadingEdgeDevices().value(); | ||
|
|
||
| for (size_t j = LeadingEdgeDevices.GetLeadingEdgeDevices().size(); j > 0; j--) { | ||
| CCPACSLeadingEdgeDevice& LeadingEdgeDevice = *LeadingEdgeDevices.GetLeadingEdgeDevices().at(j - 1); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
@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:
|
| 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>; |
There was a problem hiding this comment.
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.
| shape = GetWingCutOut()->GetLoft(ComponentSegment(*this).GetWing().GetWingCleanShape(), GetOuterShape(), | ||
| GetNormalOfControlSurfaceDevice()); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
_helperpostfix 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.
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: