ppmd.data.particle_dat module

This module contains the ParticleDat class for adding data to particles.

class ppmd.data.particle_dat.ParticleDat(npart=0, ncomp=1, initial_value=None, name=None, dtype=<class 'ctypes.c_double'>)

Bases: ppmd.host.Matrix

Base class to hold properties of particles. This could be considered as a two dimensional matrix with each row representing the stored properties of a particle.

Parameters
  • npart (int) – Number of particles (Number of row in matrix).

  • ncol (int) – Dimension of property to store per particle (Number of columns in matrix).

  • initial_value – Value to initialise array with, default zeros.

  • name (str) – Collective name of stored vars eg positions.

broadcast_data_from(rank=0, _resize_callback=True)
copy()
ctypes_data_access(mode=Read and write., pair=True)
Parameters

mode (access) – Access type required by the calling method.

Returns

The pointer to the data.

ctypes_data_post(mode=Read and write.)

Call after excuting a method on the data. :arg access mode: Access type required by the calling method.

property data
gather_data_on(rank=0, _resize_callback=False)
halo_exchange()

Perform a halo exchange for the particle dat.

halo_start
Returns

The starting index of the halo region of the particle dat.

halo_start_reset()
Reset the starting postion of the halo region in the particle dat to

the end of the local particles.

halo_start_set(index)
Set the start of the halo region in the particle dat to the specified

index.

halo_start_shift(shift)

Shift the starting point of the halo in the particle dat by the specified shift. :param int shift: Offset to shift by.

mark_halos_old()
max()
Returns

Maximum of local particles

max_npart
Returns

The maximum number of particles which can be stored within this particle dat.

modify_view()
name
Returns

The name of the ParticleDat instance.

ncomp
Returns

The number of components stored for each particle.

norm_linf()

return the L1 norm of the array

npart_local
Returns

The number of particles with properties stored in the particle dat.

npart_local_halo
Returns

The number of particles currently stored within the halo region of the particle dat.

property npart_total

Get the total number of particles in the dat including halo particles.

Returns

resize(n, _callback=True)

Resize particle dat to be at least a certain size, does not resize if already large enough. :arg int n: New minimum size.

sync_view_to_data()
property view
zero(n=None)
class ppmd.data.particle_dat.PositionDat(npart=0, ncomp=3, initial_value=None, name=None, dtype=<class 'ctypes.c_double'>)

Bases: ppmd.data.particle_dat.ParticleDat

class ppmd.data.particle_dat.TypedDat

Bases: object