def get_neighbor_particle_locator(self, src, dst, locator_type=SPHNeighborLocator, variable_h=False, radius_scale=2.0): """ Return a neighbor locator from the NNPSManager """ cell_manager = CellManager(arrays_to_bin=[src, dst]) nnps_manager = NNPSManager(cell_manager, locator_type=locator_type, variable_h=variable_h) return nnps_manager.get_neighbor_particle_locator( src, dst, radius_scale)
def __init__(self, arrays=[], in_parallel=False, variable_h=False, load_balancing=True, update_particles=True, locator_type=SPHNeighborLocator, periodic_domain=None, min_cell_size=-1): """ Constructor Parameters: ----------- arrays -- list of particle arrays in the simulation in_parallel -- flag for parallel runs variable_h -- flag for variable smoothing lengths load_balancing -- flag for dynamic load balancing. periodic_domain -- the periodic domain for periodicity """ # set the flags self.variable_h = variable_h self.in_parallel = in_parallel self.load_balancing = load_balancing self.locator_type = locator_type # Some sanity checks on the input arrays. assert len(arrays) > 0, "Particles must be given some arrays!" prec = arrays[0].cl_precision msg = "All arrays must have the same cl_precision" for arr in arrays[1:]: assert arr.cl_precision == prec, msg self.arrays = arrays self.kernel = None # create the cell manager if not in_parallel: self.cell_manager = CellManager(arrays_to_bin=arrays, min_cell_size=min_cell_size, periodic_domain=periodic_domain) else: self.cell_manager = ParallelCellManager( arrays_to_bin=arrays, load_balancing=load_balancing) self.pid = self.cell_manager.pid # create the nnps manager self.nnps_manager = NNPSManager(cell_manager=self.cell_manager, variable_h=variable_h, locator_type=self.locator_type) # set defaults self.correction_manager = None self.misc_prop_update_functions = [] # call an update on the particles (i.e index) if update_particles: self.update()