-
Notifications
You must be signed in to change notification settings - Fork 14
Fix as_polydata to remove duplicate entities #1192
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?
Conversation
|
The documentation for this pull request will be available at https://prime.docs.pyansys.com/pull/1192. Please allow some time for the documentation to be deployed. |
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.
Pull request overview
This PR fixes a bug in the as_polydata method where duplicate entities were being generated. The fix changes nested list comprehensions to use indexed access instead of iterating over all results, ensuring each part's data is processed only once.
Key Changes:
- Modified face polydata list comprehension to use indexed access (
facet_result.face_connectivity_result_per_part[i]) instead of iterating over all face connectivity results - Applied the same fix to edge polydata list comprehension to prevent duplicate edge entities
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/ansys/meshing/prime/core/mesh.py | Fixed nested list comprehensions to use indexed access, preventing duplicate face and edge polydata entities |
| doc/changelog.d/1192.miscellaneous.md | Added changelog entry documenting the fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| face_polydata_list = [ | ||
| self.get_face_polydata(part_id, face_fet_result, j) | ||
| for face_fet_result in facet_result.face_connectivity_result_per_part | ||
| for j in range(0, len(face_fet_result.face_zonelet_ids)) | ||
| self.get_face_polydata( | ||
| part_id, facet_result.face_connectivity_result_per_part[i], j | ||
| ) | ||
| for j in range( | ||
| 0, len(facet_result.face_connectivity_result_per_part[i].face_zonelet_ids) | ||
| ) | ||
| ] |
Copilot
AI
Dec 9, 2025
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 expression facet_result.face_connectivity_result_per_part[i] is accessed twice per iteration. Consider storing it in a variable before the list comprehension to avoid redundant indexing operations.
| edge_polydata_list = [ | ||
| self.get_edge_polydata(part_id, edge_facet_result, j) | ||
| for edge_facet_result in facet_result.edge_connectivity_result_per_part | ||
| for j in range(0, len(edge_facet_result.edge_zonelet_ids)) | ||
| self.get_edge_polydata( | ||
| part_id, facet_result.edge_connectivity_result_per_part[i], j | ||
| ) | ||
| for j in range( | ||
| 0, len(facet_result.edge_connectivity_result_per_part[i].edge_zonelet_ids) | ||
| ) | ||
| ] |
Copilot
AI
Dec 9, 2025
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 expression facet_result.edge_connectivity_result_per_part[i] is accessed twice per iteration. Consider storing it in a variable before the list comprehension to avoid redundant indexing operations.
No description provided.