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

Fix #2899 Problems switching barb or flow renderer between 2D and 3D variables #2960

Merged
merged 8 commits into from
Jan 10, 2022

Conversation

StasJ
Copy link
Collaborator

@StasJ StasJ commented Jan 7, 2022

Fix #2899

@clyne clyne requested review from clyne and sgpearse January 7, 2022 19:06
Copy link
Collaborator

@clyne clyne left a comment

Choose a reason for hiding this comment

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

@StasJ this fixes the problem, but it looks like a hack to work around another, larger problem. Namely, the vector version of the overloaded Box::GetExtents() method will return a two element vector if Box::IsPlanar() is true. PRegionSelector1D::sliderValueChanged calls the std::vector version of GetExtents(), modifies the two-element vector returned (when IsPlanar() is true), and then calls Box::SetExtents() with a modified two-element vector, erasing the memory of the 3-element extents that the Box previously contained. I think a more robust fix would be to change PRegionSelector1D::sliderValueChanged() to use the CoordType version of Box::{Get,Set}Extents(), which always returns/sets a 3-element array. We've been trying to move away from std::vector, with variable size, for the representation of coordinates and use the fixed size CoordType (or DimsType) instead. Thoughts?

Copy link
Collaborator

@sgpearse sgpearse left a comment

Choose a reason for hiding this comment

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

I'll approve this fix. I get what John is saying in his review.

John's suggestion isn't major but I would have done the same thing - use old Box methods that rely on std::vector. I wasn't aware of CoordType until yesterday and I think this problem is going to hurt us again unless we can fully adopt CoordType and DimsType instead of vectors.

@StasJ
Copy link
Collaborator Author

StasJ commented Jan 8, 2022

@StasJ this fixes the problem, but it looks like a hack to work around another, larger problem. Namely, the vector version of the overloaded Box::GetExtents() method will return a two element vector if Box::IsPlanar() is true. PRegionSelector1D::sliderValueChanged calls the std::vector version of GetExtents(), modifies the two-element vector returned (when IsPlanar() is true), and then calls Box::SetExtents() with a modified two-element vector, erasing the memory of the 3-element extents that the Box previously contained. I think a more robust fix would be to change PRegionSelector1D::sliderValueChanged() to use the CoordType version of Box::{Get,Set}Extents(), which always returns/sets a 3-element array. We've been trying to move away from std::vector, with variable size, for the representation of coordinates and use the fixed size CoordType (or DimsType) instead. Thoughts?

Makes sense. The CoordType version of Box::SetExtents() was added only yesterday so I didn't see it in my working branch. I changed PRegionSelector1D::sliderValueChanged() to use CoordType.

@clyne
Copy link
Collaborator

clyne commented Jan 8, 2022

@StasJ can we now back out the changes made to RenderParams::SetDefaultVariables()? That was the hope. Thanks.

@StasJ
Copy link
Collaborator Author

StasJ commented Jan 8, 2022

@StasJ can we now back out the changes made to RenderParams::SetDefaultVariables()? That was the hope. Thanks.

I think it makes sense to keep that code as a failsafe since it only ensures when switching from 2D to 3D that the renderer will have non-zero Z extents. Although redundant in this specific bug report, it could end up being useful in other cases.

@clyne
Copy link
Collaborator

clyne commented Jan 10, 2022

As implemented might it not result in an un-intensional/unnecessary reset of the Z extents for datasets such as the NOAA UGRID/geoflow data, which have Z extents from 6378000 to 6395000 (assuming FLT_EPSILON is on the order of 1e-5 as documented)?

@StasJ
Copy link
Collaborator Author

StasJ commented Jan 10, 2022

@clyne I backed out the changes made to RenderParams::SetDefaultVariables

@clyne clyne merged commit ec467b2 into main Jan 10, 2022
@clyne clyne deleted the issue2899 branch January 10, 2022 20:42
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.

Problems switching barb or flow renderer between 2D and 3D variables
3 participants