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

Fix connectivity definition in the adapter #315

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

davidscn
Copy link
Member

Closes #313

This was already anticipated in #297 (comment)
std::map is sorted according to the key, which leads to wrong key-value pairs in the previous implementation, as the keys are resorted before we insert the (not resorted) values.

  • I updated the documentation in docs/
  • I added a changelog entry in changelog-entries/ (create directory if missing)

@davidscn davidscn requested a review from MakisH January 23, 2024 15:33
@MakisH
Copy link
Member

MakisH commented Jan 23, 2024

Wouldn't it be simpler to replace the std::map with an std::unordered_map?

@davidscn
Copy link
Member Author

Considering, which if these versions is more compact, I like the current version more. An unordered container would solve the problem, too, of course.

Copy link
Member

@MakisH MakisH left a comment

Choose a reason for hiding this comment

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

The changes make sense, I have not tested anything. I also like this implementation better, as it moves the creation of the map after the setMeshVertices call.

We could also update the example on https://precice.org/website-testing/couple-your-code-defining-mesh-connectivity.html to use an unordered_map, as I guess more people will overlook this detail in their implementations.

@MakisH MakisH merged commit 8db7f75 into precice:develop Jan 24, 2024
4 checks passed
@davidscn davidscn deleted the fix-connectivity branch January 24, 2024 08:03
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.

Mesh connectivity not defined correctly
2 participants