yt.utilities.lib.geometry_utils module

Simple integrators for the radiative transfer equation

yt.utilities.lib.geometry_utils.bitwise_addition(x, y0, stride=1, start=0)
yt.utilities.lib.geometry_utils.compact_bits(x)
yt.utilities.lib.geometry_utils.compare_morton(p0, q0)
yt.utilities.lib.geometry_utils.compute_morton(pos_x, pos_y, pos_z, domain_left_edge, domain_right_edge, filter_bbox=False, order=20)
yt.utilities.lib.geometry_utils.csearch_morton(P, k, i, Ai, l, h, order, DLE, DRE, nu=4)

Expand search concentrically to determine set of k nearest neighbors for point i.

Parameters:
  • P (np.ndarray) – (N,d) array of points to search sorted by Morton order.

  • k (int) – number of nearest neighbors to find.

  • i (int) – index of point that nearest neighbors should be found for.

  • Ai (np.ndarray) – (N,k) array of partial nearest neighbor indices.

  • l (int) – index of lowest point to consider in addition to Ai.

  • h (int) – index of highest point to consider in addition to Ai.

  • order (int) – Maximum depth that Morton order quadtree should reach.

  • DLE (np.float64[3]) – 3 floats defining domain lower bounds in each dim.

  • DRE (np.float64[3]) – 3 floats defining domain upper bounds in each dim.

  • nu (int) – minimum number of points before a direct knn search is performed. (default = 4)

Returns:

(N,k) array of nearest neighbor indices.

Return type:

np.ndarray

Raises:

ValueError – If l<i<h. l and h must be on the same side of i.

yt.utilities.lib.geometry_utils.dist(p0, q0)
yt.utilities.lib.geometry_utils.dist_to_box(p, cbox, rbox)
yt.utilities.lib.geometry_utils.get_hilbert_indices(order, left_index)
yt.utilities.lib.geometry_utils.get_hilbert_points(order, indices)
yt.utilities.lib.geometry_utils.get_morton_argsort1(pos, start, end, ind)
yt.utilities.lib.geometry_utils.get_morton_index(left_index)
yt.utilities.lib.geometry_utils.get_morton_indices(left_index)
yt.utilities.lib.geometry_utils.get_morton_indices_unravel(left_x, left_y, left_z)
yt.utilities.lib.geometry_utils.get_morton_neighbors(mi, order=20, periodic=False)

Returns array of neighboring morton indices

yt.utilities.lib.geometry_utils.get_morton_neighbors_coarse(mi1, max_index1, periodic, nn)
yt.utilities.lib.geometry_utils.get_morton_neighbors_refined(mi1, mi2, max_index1, max_index2, periodic, nn)
yt.utilities.lib.geometry_utils.get_morton_point(index)
yt.utilities.lib.geometry_utils.get_morton_points(indices)
yt.utilities.lib.geometry_utils.ifrexp_cy(x)
yt.utilities.lib.geometry_utils.knn_direct(P, k, i, idx, return_dist=False, return_rad=False)

Directly compute the k nearest neighbors by sorting on distance.

Parameters:
  • P (np.ndarray) – (N,d) array of points to search sorted by Morton order.

  • k (int) – number of nearest neighbors to find.

  • i (int) – index of point that nearest neighbors should be found for.

  • idx (np.ndarray) – indices of points from P to be considered.

  • return_dist (Optional[bool]) – If True, distances to the k nearest neighbors are also returned (in order of proximity). (default = False)

  • return_rad (Optional[bool]) – If True, distance to farthest nearest neighbor is also returned. This is set to False if return_dist is True. (default = False)

Returns:

Indices of k nearest neighbors to point i.

Return type:

np.ndarray

yt.utilities.lib.geometry_utils.knn_morton(P0, k, i0, c=1.0, nu=4, issorted=False, order=20, DLE=array([0., 0., 0.]), DRE=array([0., 0., 0.]))

Get the indices of the k nearest neighbors to point i.

Parameters:
  • P (np.ndarray) – (N,d) array of points to search.

  • k (int) – number of nearest neighbors to find for each point in P.

  • i (np.uint64) – index of point to find neighbors for.

  • c (float) – factor determining how many indices before/after i are used in the initial search (i-c*k to i+c*k, default = 1.0)

  • nu (int) – minimum number of points before a direct knn search is performed. (default = 4)

  • issorted (Optional[bool]) – if True, P is assumed to be sorted already according to Morton order.

  • order (int) – Maximum depth that Morton order quadtree should reach. If not provided, ORDER_MAX is used.

  • DLE (np.ndarray) – (d,) array of domain lower bounds in each dimension. If not provided, this is determined from the points.

  • DRE (np.ndarray) – (d,) array of domain upper bounds in each dimension. If not provided, this is determined from the points.

Returns:

(N,k) indices of k nearest neighbors for each point in P.

Return type:

np.ndarray

yt.utilities.lib.geometry_utils.lsb(v, stride=1, start=0)
yt.utilities.lib.geometry_utils.lsz(v, stride=1, start=0)
yt.utilities.lib.geometry_utils.morton_neighbor(p, dim_list, num_list, max_index, periodic=False)
yt.utilities.lib.geometry_utils.morton_neighbor_bounded(p, dim_list, num_list, max_index)
yt.utilities.lib.geometry_utils.morton_neighbor_periodic(p, dim_list, num_list, max_index)
yt.utilities.lib.geometry_utils.morton_qsort(pos, l, h, ind, recursive=False, use_loop=False)
yt.utilities.lib.geometry_utils.morton_qsort_iterative(pos, l, h, ind, use_loop=False)
yt.utilities.lib.geometry_utils.morton_qsort_partition(pos, l, h, ind, use_loop=False)
yt.utilities.lib.geometry_utils.morton_qsort_recursive(pos, l, h, ind, use_loop=False)
yt.utilities.lib.geometry_utils.morton_qsort_swap(ind, a, b)
yt.utilities.lib.geometry_utils.msdb_cy(a, b)
yt.utilities.lib.geometry_utils.quadtree_box(p, q, order, DLE, DRE, c)
yt.utilities.lib.geometry_utils.solution_radius(P, k, i, idx, order, DLE, DRE)
yt.utilities.lib.geometry_utils.spread_bits(x)
yt.utilities.lib.geometry_utils.triangle_plane_intersect(ax, coord, triangles)
yt.utilities.lib.geometry_utils.xor_msb_cy(a, b)