[yt-dev] kdtree tiles and pf.h.grids
Matthew Turk
matthewturk at gmail.com
Fri Feb 14 07:11:29 PST 2014
Hi Alex,
On Thu, Feb 13, 2014 at 4:07 PM, Alex Bogert <bogart.alex at gmail.com> wrote:
> Hi,
>
> Matt asked me to write yt-dev about yt-3.0 kdtree decomposition tutorials.
> I'm looking for a robust data flow to do volume rendering of AMR data on the
> GPU.
>
>
> From our email chain :
> " But the grids can just be accessed by getting pf.h.grids. To get blocks
> from the tree in 3.0 we have a .tiles attribute on the data source which
> will do the full decomposition into non overlapping tiles. If you write to
> yt-dev this will also help me remember to document this." -mjturk
>
> Alex
The two interfaces are as follows; note that this is in yt-3.0; as you
might have seen there are some tricky bits with the unit refactor for
this right now. The first is for getting spatially contiguous blocks
from a data source; this will work for both octree structures and
patch structures, but for octree structures will be slow. You can do:
for block, mask in some_source.blocks:
the block object will be something that is similar to an AMRGridPatch
object, in that it has LeftEdge, RightEdge, ActiveDimensions,
get_global_startindex() and so on, and it respects dictionary-like
access. So for instance:
v1, v2 = 0.0, 0.0
for block, mask in some_source.blocks:
v1 += block["CellVolume"].sum()
v2 += block["CellVolume"][mask].sum()
print v1, v2
The mask describes which cells are covered by finer cells.
The other interface, tiles, provides a slicing interface to
non-overlapping objects. For instance:
v1, v2 = 0.0, 0.0
for grid, node, (sl, dims, gi) in tiles.slice_traverse():
v1 += grid["CellVolume"].sum()
v2 += grid["CellVolume"][sl].sum()
I hope that helps,
Matt
>
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
More information about the yt-dev
mailing list