def check_tree(self): for node in depth_traverse(self.trunk): if node.grid == -1: continue grid = self.ds.index.grids[node.grid - self._id_offset] dds = grid.dds gle = grid.LeftEdge nle = self.ds.arr(get_left_edge(node), input_units="code_length") nre = self.ds.arr(get_right_edge(node), input_units="code_length") li = np.rint((nle - gle) / dds).astype('int32') ri = np.rint((nre - gle) / dds).astype('int32') dims = (ri - li).astype('int32') assert (np.all(grid.LeftEdge <= nle)) assert (np.all(grid.RightEdge >= nre)) assert (np.all(dims > 0)) # print grid, dims, li, ri # Calculate the Volume vol = kd_sum_volume(self.trunk) mylog.debug('AMRKDTree volume = %e' % vol) kd_node_check(self.trunk)
def check_tree(self): for node in depth_traverse(self.trunk): if node.grid == -1: continue grid = self.ds.index.grids[node.grid - self._id_offset] dds = grid.dds gle = grid.LeftEdge nle = self.ds.arr(get_left_edge(node), input_units="code_length") nre = self.ds.arr(get_right_edge(node), input_units="code_length") li = np.rint((nle-gle)/dds).astype('int32') ri = np.rint((nre-gle)/dds).astype('int32') dims = (ri - li).astype('int32') assert(np.all(grid.LeftEdge <= nle)) assert(np.all(grid.RightEdge >= nre)) assert(np.all(dims > 0)) # print grid, dims, li, ri # Calculate the Volume vol = kd_sum_volume(self.trunk) mylog.debug('AMRKDTree volume = %e' % vol) kd_node_check(self.trunk)
if gids[i] != -1: n.grid = gids[i] if splitdims[i] != -1: n.create_split(splitdims[i], splitposs[i]) mylog.info('AMRKDTree rebuilt, Final Volume: %e' % kd_sum_volume(self.tree.trunk)) return self.tree.trunk def count_volume(self): return kd_sum_volume(self.tree.trunk) def count_cells(self): return self.tree.sum_cells() if __name__ == "__main__": from yt.mods import * from time import time ds = load('/Users/skillman/simulations/DD1717/DD1717') ds.index t1 = time() hv = AMRKDTree(ds) t2 = time() print kd_sum_volume(hv.tree.trunk) print kd_node_check(hv.tree.trunk) print 'Time: %e seconds' % (t2 - t1)
np.zeros(3, dtype='float64'), -1, rids[i]) if gids[i] != -1: n.grid = gids[i] if splitdims[i] != -1: n.create_split(splitdims[i], splitposs[i]) mylog.info('AMRKDTree rebuilt, Final Volume: %e' % kd_sum_volume(self.tree.trunk)) return self.tree.trunk def count_volume(self): return kd_sum_volume(self.tree.trunk) def count_cells(self): return self.tree.sum_cells() if __name__ == "__main__": from yt.mods import * from time import time ds = load('/Users/skillman/simulations/DD1717/DD1717') ds.index t1 = time() hv = AMRKDTree(ds) t2 = time() print(kd_sum_volume(hv.tree.trunk)) print(kd_node_check(hv.tree.trunk)) print('Time: %e seconds' % (t2-t1))
if gids[i] != -1: n.grid = gids[i] if splitdims[i] != -1: n.create_split(splitdims[i], splitposs[i]) mylog.info('AMRKDTree rebuilt, Final Volume: %e' % kd_sum_volume(self.tree.trunk)) return self.tree.trunk def count_volume(self): return kd_sum_volume(self.tree.trunk) def count_cells(self): return self.tree.sum_cells() if __name__ == "__main__": from yt.mods import * from time import time ds = load('/Users/skillman/simulations/DD1717/DD1717') ds.index t1 = time() hv = AMRKDTree(ds) t2 = time() print(kd_sum_volume(hv.tree.trunk)) print(kd_node_check(hv.tree.trunk)) print('Time: %e seconds' % (t2 - t1))