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

feature/sc 42001/add constructor #22

Merged
merged 8 commits into from
Mar 15, 2023
Merged

Conversation

sunayana
Copy link
Member

@sunayana sunayana commented Mar 14, 2023

This story is now complete and ready for review, it implements:

  • Constructor for c++ Depression class
  • Wraps constructor with libcxxwrap-julia
  • Implement push_back and constructor in C++ DepressionHierarchy
  • Modifies RichDEM.jl to accomodate this.
  • The corresponding Julia code documenting how these methods work can be found in the usual Notion page.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #42001: Add constructor for Depression in richdem.

croissant-tmp
croissant-tmp previously approved these changes Mar 14, 2023
Copy link
Collaborator

@croissant-tmp croissant-tmp left a comment

Choose a reason for hiding this comment

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

LGTM! Live demo showed that it worked very well!

…Julia code example can be found in the Notion page How to wrap C++ library in Julia.
@sunayana sunayana requested a review from croissant-tmp March 14, 2023 21:41
@sunayana sunayana dismissed croissant-tmp’s stale review March 14, 2023 21:46

More changes were added to this branch and it is now complete with all requirements of the story. It would be good to review it once again.

@sunayana
Copy link
Member Author

The issue which we see is that the conversion from CxxDepression to julia Depression consistently fails for the member field dep_label. My guess is, this is happening because on the C++ side dep_label appears right after std::vector<uint32_t> ocean_linked. The way std::vector stores values in memory is not contiguous but what we have is just a pointer to the first element of the vector. Since we only get one pointer to CxxDepression we are possibly getting garbage value dep_label. The only way I see currently to resolve this issue is to use the C++ member methods that I have defined in jldepressions.cpp, and also a similar strategy used in libcxxwrap-julia for Foo struct here
Hence I will proceed along those lines here as well.

@sunayana sunayana merged commit 101bbb0 into master Mar 15, 2023
@sunayana sunayana deleted the feature/sc-42001/add-constructor branch March 15, 2023 14:57
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.

2 participants