diff --git a/Python/pywarpx/particle_containers.py b/Python/pywarpx/particle_containers.py index 13c61395aa5..41820d589cf 100644 --- a/Python/pywarpx/particle_containers.py +++ b/Python/pywarpx/particle_containers.py @@ -575,6 +575,8 @@ def get_particle_boundary_buffer(self, species_name, boundary, comp_name, level) level : int Which AMR level to retrieve scraped particle data from. ''' + xp, cupy_status = load_cupy() + part_container = self.particle_buffer.get_particle_container( species_name, self._get_boundary_number(boundary) ) @@ -584,14 +586,14 @@ def get_particle_boundary_buffer(self, species_name, boundary, comp_name, level) comp_idx = part_container.num_int_comps() - 1 for ii, pti in enumerate(libwarpx.libwarpx_so.BoundaryBufferParIter(part_container, level)): soa = pti.soa() - data_array.append(cnp.array(soa.GetIntData(comp_idx), copy=False)) + data_array.append(xp.array(soa.GetIntData(comp_idx), copy=False)) else: mypc = libwarpx.warpx.multi_particle_container() sim_part_container_wrapper = mypc.get_particle_container_from_name(species_name) comp_idx = sim_part_container_wrapper.get_comp_index(comp_name) for ii, pti in enumerate(libwarpx.libwarpx_so.BoundaryBufferParIter(part_container, level)): soa = pti.soa() - data_array.append(cnp.array(soa.GetRealData(comp_idx), copy=False)) + data_array.append(xp.array(soa.GetRealData(comp_idx), copy=False)) return data_array