Skip to content
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

Try replacing next_handle_from based iteration #32

Open
LukasKalbertodt opened this issue Apr 18, 2023 · 0 comments
Open

Try replacing next_handle_from based iteration #32

LukasKalbertodt opened this issue Apr 18, 2023 · 0 comments
Labels
area:datastructures Area: mesh datastructures category:improvement Category: Improvement priority:medium Priority: Medium

Comments

@LukasKalbertodt
Copy link
Owner

Iterating over all vertices/faces/edges of a mesh is currently implemented via next_vertex_handle_from and last_vertex_handle. This was originally done to work around the lack of GATs. Now we have GATs and could solve this properly... except for vertex_handles_mut: an iterator that iterates over vertex handles but also gives mutable access to the underlying mesh. It's not possible to easily implement it due to borrowing the vertices.iter() immutable for the handles, but also the whole mesh. So it is necessary to pull out the iteration logic instead of using the provided one of the relevant DenseMap.

I'm not yet sure how to best solve this. Maybe use the GAT solution for element_handles() and elements(), but still use the manual iteration for the mut iterator. But that should probably be hidden as well, i.e. have a IterMut<'s> type in the trait and remove the next_handle_from functions from the Mesh trait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:datastructures Area: mesh datastructures category:improvement Category: Improvement priority:medium Priority: Medium
Projects
None yet
Development

No branches or pull requests

1 participant