Fix ParticleHistogram2D Value Function #6391
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The documentation and code comments list
ParticleHistogram2D'svalue_functionas an optional flag, but when omitted, the code still calls the parser and accumulates 0 in every bin, yielding a histogram of all 0's without any warning or error message. This is inconsistent with the 1D histogram, which defaults to summing over particle weightw.Changes implemented:
m_do_parser_valueis assigned to `false' in the header if not declaredvalue_functiondefaults to"w"when not provided and always builds a parser from the resolved stringvalue_functionis written to the OpenPMD file metadata(t, x, y, z, ux, uy, uz, w)instead of 7; update wording so that "value" and "filter" definitions aren't conflated.This should patch an issue I was encountering where 2D Particle Histogram writing produced all-0 arrays if value function was not manually set to
w.Edited: found an old issue of a user encountering an issue with the default implementation. Fixes #4540