-
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
correctly exclude flux vars from searches by default #1070
Conversation
[[noreturn]] inline void fail(std::string const &message, const char *const filename, | ||
int const linenumber) { | ||
fail(message.c_str(), filename, linenumber); | ||
} |
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.
This overload was missing for whatever reason. Added it.
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.
Fixes the problem, leaves the option, new tests + docs. LGTM.
…k its unlikely to hit this edge case
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.
Nice catch! LGTM
----------------------------------------------------- | ||
|
||
As discussed above, fluxes are themselves ``Metadata::OneCopy`` | ||
variables. A flux variable will have ``Metadata::Flux`` flag |
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.
variables. A flux variable will have ``Metadata::Flux`` flag | |
variables. A flux variable will have a ``Metadata::Flux`` flag |
the flux variable **associated** with the variable | ||
requested. ``FluxRequest::Any`` does not modify search parameters. You | ||
will get flux or non-flux variables, and variable associations will be | ||
ignored. |
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.
Can we mention how PDOPt::WithFluxes
is related here? Typically, if I want the variable and the flux, I would create a SparsePack with PDOPt::WithFluxes
. I am sure you have ensured backwards compatibility here, but this documentation led to this confusion for me...
PR Summary
PR #1043 introduced an unexpected bug/interaction. When searching for vars by flag or by unique ID, it's possible to accidentally include fluxes, since they are now variables. To retain previous behavior, I introduce an enum
FluxRequest
, which can take on the valuesAny
,NoFlux
, orOnlyFlux
. IfAny
is specified, the search does nothing special for fluxes. IfNoFlux
is specified, flux vars are explicitly excluded. IfOnlyFlux
is specified, behavior is a little special. Vars that have fluxes are searched for, and then the fluxes of those variables are returned.I add a test to ensure the unexpected behavior is no longer present and confirmed in riot that the bug is now resolved.
PR Checklist