def _init_kd_tree(self):
"""
Builds the kd tree of grid center points.
"""
# Grid cell centers.
mylog.info("Multigrid: Building kD-Tree.")
xp = self.ds["x"]
yp = self.ds["y"]
zp = self.ds["z"]
fKD.pos = np.asfortranarray(np.empty((3,xp.size), dtype='float64'))
# Normalize the grid points only within the kdtree.
fKD.pos[0, :] = xp[:] / self.period[0]
fKD.pos[1, :] = yp[:] / self.period[1]
fKD.pos[2, :] = zp[:] / self.period[2]
fKD.nn = 1
fKD.sort = False
fKD.rearrange = True
create_tree(0)
评论列表
文章目录