Skip to content

Add slice plotting functionality#12

Closed
chrishavlin wants to merge 2 commits intoyt-project:mainfrom
chrishavlin:slice_as_meshes
Closed

Add slice plotting functionality#12
chrishavlin wants to merge 2 commits intoyt-project:mainfrom
chrishavlin:slice_as_meshes

Conversation

@chrishavlin
Copy link
Copy Markdown
Contributor

@chrishavlin chrishavlin commented Apr 6, 2021

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 YTSlice and build a uniform hexahedral mesh with the frb values as element-center values (which is then triangulated following MeshData). The slice thickness is small (but finite), calculated as a fraction of the cell spacing in the other axes. The new SliceData class handles all this for a single slice (see examples/amr_slices.py) while SliceDataComposite can concatenate multiple SliceData objects without re-generating the meshes so that the rendering will use a single colormap across the slices (see examples/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 SliceData objects. 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:

snap_0000
snap_0001

@chrishavlin
Copy link
Copy Markdown
Contributor Author

Closing in favor of the better/simpler implementation in #14

@chrishavlin chrishavlin closed this May 4, 2021
@chrishavlin chrishavlin deleted the slice_as_meshes branch August 5, 2021 15:00
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.

1 participant