yt.utilities.amr_kdtree.amr_kdtree module

class yt.utilities.amr_kdtree.amr_kdtree.AMRKDTree(ds, min_level=None, max_level=None, data_source=None)[source]

Bases: ParallelAnalysisInterface

A KDTree for AMR data.

Not applicable to particle or octree-based datasets.

comm = None
count_cells()[source]
count_volume()[source]
fields = None
get_brick_data(node)[source]
get_dependencies(fields)
get_node(nodeid)[source]
get_node_arrays()[source]
get_reduce_owners()[source]
initialize_source(fields, log_fields, no_ghost)[source]
join_parallel_trees()[source]
load_kd_bricks(fn=None)[source]
locate_neighbors(grid, ci)[source]

Given a grid and cell index, finds the 26 neighbor grids and cell indices.

Parameters:
  • grid (Grid Object) – Grid containing the cell of interest

  • ci (array-like) – The cell index of the cell of interest

Returns:

  • grids (Numpy array of Grid objects)

  • cis (List of neighbor cell index tuples)

  • Both of these are neighbors that, relative to the current cell

  • index (i,j,k), are ordered as

  • (i-1, j-1, k-1), (i-1, j-1, k ), (i-1, j-1, k+1), …

  • (i-1, j , k-1), (i-1, j , k ), (i-1, j , k+1), …

  • (i+1, j+1, k-1), (i-1, j-1, k ), (i+1, j+1, k+1)

  • That is they start from the lower left and proceed to upper

  • right varying the third index most frequently. Note that the

  • center cell (i,j,k) is omitted.

locate_neighbors_from_position(position)[source]

Given a position, finds the 26 neighbor grids and cell indices.

This is a mostly a wrapper for locate_neighbors.

Parameters:

position (array-like) – Position of interest

Returns:

  • grids (Numpy array of Grid objects)

  • cis (List of neighbor cell index tuples)

  • Both of these are neighbors that, relative to the current cell

  • index (i,j,k), are ordered as

  • (i-1, j-1, k-1), (i-1, j-1, k ), (i-1, j-1, k+1), …

  • (i-1, j , k-1), (i-1, j , k ), (i-1, j , k+1), …

  • (i+1, j+1, k-1), (i-1, j-1, k ), (i+1, j+1, k+1)

  • That is they start from the lower left and proceed to upper

  • right varying the third index most frequently. Note that the

  • center cell (i,j,k) is omitted.

locate_node(pos)[source]
log_fields = None
no_ghost = True
partition_index_2d(axis)
partition_index_3d(ds, padding=0.0, rank_ratio=1)
partition_index_3d_bisection_list()

Returns an array that is used to drive _partition_index_3d_bisection, below.

partition_region_3d(left_edge, right_edge, padding=0.0, rank_ratio=1)

Given a region, it subdivides it into smaller regions for parallel analysis.

rebuild_tree_from_array(nids, pids, lids, rids, les, res, gids, splitdims, splitposs)[source]
reduce_tree_images(image, viewpoint, *, use_opacity=True)[source]
set_fields(fields, log_fields, no_ghost, force=False)[source]
slice_traverse(viewpoint=None)[source]
store_kd_bricks(fn=None)[source]
traverse(viewpoint=None)[source]
class yt.utilities.amr_kdtree.amr_kdtree.Tree(ds, comm_rank=0, comm_size=1, left=None, right=None, min_level=None, max_level=None, data_source=None)[source]

Bases: object

add_grids(grids)[source]
build()[source]
check_tree()[source]
sum_cells(all_cells=False)[source]