Skip to content

Commit

Permalink
Update get_particle_id/cpu
Browse files Browse the repository at this point in the history
As implemented in pyAMReX with
AMReX-Codes/pyamrex#165
  • Loading branch information
ax3l committed Aug 2, 2023
1 parent c9f44bd commit ffdbd00
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions Python/pywarpx/particle_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,8 @@ def get_particle_id(self, level=0):
numbers on each tile.
'''
raise NotImplementedError()
ids = []
structs = self.get_particle_structs(level)
for ptile_of_structs in structs:
arr = np.empty(ptile_of_structs.shape, np.int64)
self.libwarpx_so.warpx_convert_id_to_long(arr, ptile_of_structs, arr.size)
ids.append(arr)
return ids
return [amr.unpack_ids(struct['cpuid']) for struct in structs]

def get_particle_cpu(self, level=0):
'''
Expand All @@ -264,14 +258,8 @@ def get_particle_cpu(self, level=0):
numbers on each tile.
'''
raise NotImplementedError()
cpus = []
structs = self.get_particle_structs(level)
for ptile_of_structs in structs:
arr = np.empty(ptile_of_structs.shape, np.int32)
self.libwarpx_so.warpx_convert_cpu_to_int(arr, ptile_of_structs, arr.size)
cpus.append(arr)
return cpus
return [amr.unpack_cpus(struct['cpuid']) for struct in structs]

def get_particle_x(self, level=0):
'''
Expand Down

0 comments on commit ffdbd00

Please sign in to comment.