Collection: Particles

class h2tools.collections.particles.Particles(ndim, count, vertex)

Class for computing particle-to-particle interactions.

Predefined class for N-body problems. Interacting object are simply called particles and are represented only by vertices (in n-dimensional space). Uses recursive inertial bisection to build cluster trees. Two subclusters of particles are considered to be far (far-field interactions), if distance between centers of bounding boxes of subclusters is greater, than diameters of bounding boxes.

Parameters:

ndim : int

Dimensionality of space

count : int

Number of particles

vertex : 2-dimensional array

Coordinates of particles. Shape is (ndim, count).

check_far(self_aux, other_aux)

Returns True if bounding boxes are far.

If maximum diagonal of bounding boxes is larger, than distance between centers of bounding boxes, then bounding boxes are assumed to be far.

Parameters:

self_aux, other_aux: 2-dimensional array of shape (2, *ndim*)

Each bounding box contains minimum values of corresponding coordinates in [0,:] and maximum values of corresponding coordinates in [1,:].

Returns:

boolean

True if bounding boxes are far, False otherwise.

compute_aux(index)

Computes bounding box of cluster, corresponding to index.

divide(index)

Divides cluster, corresponding to indexes index.

Clusters is divided by inertial bisection procedure.

h2tools.collections.particles.inv_distance(data1, list1, data2, list2)

Returns 1/r for each pair of particles from two sets.

Function 1/r is used as interaction between two particles.

Parameters:

data1 : Python object

Destination of interactions

list1 : array

Indices of particles from data1 to compute interactions

data2 : Python object

Source of interactions

list2 : array

Indices of particles from data1 to compute interactions

Returns:

numpy.ndarray(ndim=2)

Array of interactions of corresponding particles.

h2tools.collections.particles.log_distance(data1, list1, data2, list2)

Returns -log(r) for each pair of particles from two sets.

Function -log(r) is used as interaction between two particles.

Parameters:

data1 : Python object

Destination of interactions

list1 : array

Indices of particles from data1 to compute interactions

data2 : Python object

Source of interactions

list2 : array

Indices of particles from data1 to compute interactions

Returns:

numpy.ndarray(ndim=2)

Array of interactions of corresponding particles.