"""
hash_size = self.hash_dims
center = np.floor(point.pos/self.box_size)
if any(center >= hash_size) or any(center < 0):
raise Hash_table.Out_of_hash_excpt("cord out of range")
rrange = int(np.ceil(rrange/ self.box_size))
// check if we have already computed the shifts
if rrange == self.cached_rrange and self.cached_shifts is not None:
shifts = self.cached_shifts // if we have, use them
// Other wise, generate them
else:
if self.spat_dims == 2:
shifts = [np.array([j,k])
for j in range(-rrange,rrange + 1)
for k in range(-rrange,rrange + 1)]
elif self.spat_dims ==3:
shifts = [np.array([j,k,m])
for j in range(-rrange,rrange + 1)
for k in range(-rrange,rrange + 1)
for m in range(-rrange,rrange + 1)]
else:
raise NotImplementedError("only 2 and 3 dimensions implemented")
self.cached_rrange = rrange // and save them
self.cached_shifts = shifts
region = []
for s in shifts:
cord = center + s
if any(cord >= hash_size) or any(cord < 0):
continue
indx = int(sum(cord * self.strides))
region.extend(self.hash_table[indx])
return region
def add_point(self,point):
Adds the `point` to the hash table. Assumes that :py:attr:`point.pos` exists and