Add slice plotting functionality#12
Closed
chrishavlin wants to merge 2 commits intoyt-project:mainfrom
Closed
Conversation
Contributor
Author
|
Closing in favor of the better/simpler implementation in #14 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds a couple of mesh rendering data classes to allow 2d slices to be plotted in 3d. The basic approach is to generate a fixed resolution buffer from a
YTSliceand build a uniform hexahedral mesh with the frb values as element-center values (which is then triangulated followingMeshData). The slice thickness is small (but finite), calculated as a fraction of the cell spacing in the other axes. The newSliceDataclass handles all this for a single slice (seeexamples/amr_slices.py) whileSliceDataCompositecan concatenate multipleSliceDataobjects without re-generating the meshes so that the rendering will use a single colormap across the slices (seeexamples/amr_slices_composites.py).Currently a draft PR because assembling the unstructured mesh is slow -- started with a brute force nested loop that needs to be improved (should be vectorizable, or maybe yt has some utility to help here...). The examples here take ~15 seconds per slice to generate the
SliceDataobjects. Once generated and added to the rendering context, it's fast! (also haven't run any style checks yet...)Here's a couple screen shots from the single slice example: