def __init__(self, points, rho, dimension):
"""Constructor
Initializes the grid and helper structures using the provided points
and rho parameter.
Args:
points: A numpy array containing the coordinates of the particles.
rho: Needed to compute the rho-boundary of the system.
dimension: The dimension of the particle system.
"""
self.points = points
self.rho = rho
self.dimension = dimension
self.cell_size = 2.0 * rho
self.aabb_min = np.amin(points, axis=0)
self.aabb_max = np.amax(points, axis=0)
self.grid_dims = (self.aabb_max - self.aabb_min) / self.cell_size
# Regarding the + 3: 1 for left side, 1 for right side, 1 for rounding
# up
self.grid_dims = np.trunc(self.grid_dims) + 3
self.grid_dims = self.grid_dims.astype(int)
self.grid_min = self.aabb_min - self.cell_size
self.grid_max = self.grid_min + self.grid_dims * self.cell_size
self.grid_count = np.zeros(self.grid_dims, dtype=int)
self.grid_elems = np.empty(self.grid_dims, dtype=object)
self.update_grid()
self.tree = NeighborsTree(
self.points, leaf_size=10, metric='euclidean')
self.neighbor_cell_list = self.compute_neighbor_cell_list()
评论列表
文章目录