-
Notifications
You must be signed in to change notification settings - Fork 40
Extra SparsePack indexers #1308
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: develop
Are you sure you want to change the base?
Conversation
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.
LGTM! Would it be possible to unify the index access methods with something like this? Or would that be ambiguous with the other definitions?
template <class TIn, typename... Args, REQUIRES(sizeof...(Args) > 0), REQUIRES(IncludesType<TIn, Ts...>::value)>
KOKKOS_INLINE_FUNCTION auto &operator()(const int b, const TIn &t, const Args... args) const {
PARTHENON_DEBUG_REQUIRE(!flat_, "Accessor cannot be used for flat packs");
const int vidx = GetLowerBound(b, t) + t.idx;
return pack_(0, b, vidx)(std::forward<Args>(args)...);
}Also ping @lroberts36
Yeah, that seems better. I've made the change with a slight modification to |
That looks reasonable, I might also add a |
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.
Approved, but needs a changelog update
Done |
Done |
|
Should this get a quick unit test in the existing sparse pack machinery? |
PR Summary
Working with
Metadata::Nonefields in artemis that are defined as e.g.,pkg->AddField<name>(Metadata({Metadata::None, Metadata::OneCopy}, \ std::vector<int>({nx1})));To index into this in a pack, parthenon currently supports
This MR adds the ability to index as,
which is a little cleaner.
Tested in artemis. I don't think this clashes with the other available indexers (at least in artemis), but we may not cover everything.
PR Checklist