-
Notifications
You must be signed in to change notification settings - Fork 37
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 meshblock pack issues coming from template shadowing and add a test #572
Conversation
…st to check for this
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.
Pending the minor question, looks good! Thanks.
I'm also fine with merging this in while #571 is not fixed yet, but we should still run the full test suite here manually and see if nothing else new fails.
const auto &PackVariablesAndFluxes(const std::vector<int> &sparse_ids, | ||
vpack_types::StringPair &key) { | ||
return PackVariablesAndFluxesImpl(nullptr, &key, sparse_ids); | ||
} | ||
const auto &PackVariablesAndFluxes(const std::vector<int> &sparse_ids, | ||
PackIndexMap &map) { | ||
return PackVariablesAndFluxesImpl(&map, nullptr, sparse_ids); | ||
} | ||
const auto &PackVariablesAndFluxes(const std::vector<int> &sparse_ids) { | ||
return PackVariablesAndFluxesImpl(nullptr, nullptr, sparse_ids); | ||
} |
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.
Are these actually required?
If I'm not missing something they're matching the
const auto &PackVariablesAndFluxes(const std::vector<Elem> &names_or_flags,
PackIndexMap &map, vpack_types::StringPair &key)
above, aren't they?
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.
These exclude either the PackIndexMap
or the key, or both. Whereas the one you quoted has both of them. They're just syntactic sugar overloads.
Thanks @pgrete . Agreed, I'll run the full test suite |
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.
Just one question for my own edification. Looks good, thanks for adding a typical use case to the calculate_pi
example.
Looks like the only error is the |
PR Summary
Downstream, @brryan noticed that calls to
MeshData::PackVariables
with aPackIndexMap
, for examplecause compile-time errors. The issue was introduced in the sparse interface update, #535 , where this machinery changed significantly. In short, in that update, explicit overloads were replaced with variatic templates. Unfortunately, C++ does not resolve these templates appropriately, and they shadow each other, causing bugs. We didn't catch this until now because templated functions are optimized out if they're not called.
This MR resolves #570 . I replace the variatics with explicit overloads again, with a few changes to reduce line number as best I can. I also add a call to this machinery in the calculate pi example, so this issue should be caught by regression tests in the future.
Note that the full regression test suite is currently failing. (See #571 ). So we should either merge this in without triggering the full suite on the CI, or we should wait for #571 to be resolved. I lean towards the former. Thoughts?
PR Checklist