Interaction routines

Particle-to-particle

class sumpy.p2p.P2PBase(ctx, kernels, exclude_self, strength_usage=None, value_dtypes=None, options=[], name=None, device=None)[source]
class sumpy.p2p.P2P(ctx, kernels, exclude_self, strength_usage=None, value_dtypes=None, options=[], name=None, device=None)[source]

Direct applier for P2P interactions.

class sumpy.p2p.P2PMatrixGenerator(ctx, kernels, exclude_self, strength_usage=None, value_dtypes=None, options=[], name=None, device=None)[source]

Generator for P2P interaction matrix entries.

class sumpy.p2p.P2PMatrixBlockGenerator(ctx, kernels, exclude_self, strength_usage=None, value_dtypes=None, options=[], name=None, device=None)[source]

Generator for a subset of P2P interaction matrix entries.

__call__(queue, targets, sources, index_set, **kwargs)[source]

Construct a set of blocks of the full P2P interaction matrix.

The blocks are returned as one-dimensional arrays, for performance and storage reasons. If the two-dimensional form is desired, it can be obtained using the information in the index_set for a block \(i\) in the following way:

blkranges = index_set.linear_ranges()
blkshape = index_set.block_shape(i)

block2d = result[blkranges[i]:blkranges[i + 1]].reshape(*blkshape)
Parameters
  • targets – target point coordinates.

  • sources – source point coordinates.

  • index_set – a sumpy.tools.MatrixBlockIndexRanges used to define the blocks.

Returns

a tuple of one-dimensional arrays of kernel evaluations at target-source pairs described by index_set.

class sumpy.p2p.P2PFromCSR(ctx, kernels, exclude_self, strength_usage=None, value_dtypes=None, options=[], name=None, device=None)[source]

QBX for Layer Potentials

class sumpy.qbx.LayerPotentialBase(ctx, expansions, strength_usage=None, value_dtypes=None, options=[], name=None, device=None)[source]
class sumpy.qbx.LayerPotential(ctx, expansions, strength_usage=None, value_dtypes=None, options=[], name=None, device=None)[source]

Direct applier for the layer potential.

__call__(queue, targets, sources, centers, strengths, expansion_radii, **kwargs)[source]
Parameters

strengths – are required to have area elements and quadrature weights already multiplied in.

class sumpy.qbx.LayerPotentialMatrixGenerator(ctx, expansions, strength_usage=None, value_dtypes=None, options=[], name=None, device=None)[source]

Generator for layer potential matrix entries.

class sumpy.qbx.LayerPotentialMatrixBlockGenerator(ctx, expansions, strength_usage=None, value_dtypes=None, options=[], name=None, device=None)[source]

Generator for a subset of the layer potential matrix entries.

__call__(queue, targets, sources, centers, expansion_radii, index_set, **kwargs)[source]
Parameters
  • targets – target point coordinates.

  • sources – source point coordinates.

  • centers – QBX target expansion centers.

  • expansion_radii – radii for each expansion center.

  • index_set – a sumpy.tools.MatrixBlockIndexRanges used to define the blocks.

Returns

a tuple of one-dimensional arrays of kernel evaluations at target-source pairs described by index_set.

Translation routines

Particle-to-expansion

class sumpy.p2e.P2EBase(ctx, expansion, options=[], name=None, device=None)[source]
class sumpy.p2e.P2EFromSingleBox(ctx, expansion, options=[], name=None, device=None)[source]
class sumpy.p2e.P2EFromCSR(ctx, expansion, options=[], name=None, device=None)[source]

Expansion-to-expansion

class sumpy.e2e.E2EBase(ctx, src_expansion, tgt_expansion, options=[], name=None, device=None)[source]
class sumpy.e2e.E2EFromCSR(ctx, src_expansion, tgt_expansion, options=[], name=None, device=None)[source]

Implements translation from a “compressed sparse row”-like source box list.

class sumpy.e2e.E2EFromParent(ctx, src_expansion, tgt_expansion, options=[], name=None, device=None)[source]
class sumpy.e2e.E2EFromChildren(ctx, src_expansion, tgt_expansion, options=[], name=None, device=None)[source]

Expansion-to-particle

class sumpy.e2p.E2PBase(ctx, expansion, kernels, options=[], name=None, device=None)[source]
class sumpy.e2p.E2PFromCSR(ctx, expansion, kernels, options=[], name=None, device=None)[source]
class sumpy.e2p.E2PFromSingleBox(ctx, expansion, kernels, options=[], name=None, device=None)[source]

Integration with boxtree

Integrates boxtree with sumpy.

class sumpy.fmm.SumpyExpansionWranglerCodeContainer(cl_context, multipole_expansion_factory, local_expansion_factory, out_kernels, exclude_self=False, use_rscale=None)[source]

Objects of this type serve as a place to keep the code needed for SumpyExpansionWrangler. Since SumpyExpansionWrangler necessarily must have a pyopencl.CommandQueue, but this queue is allowed to be more ephemeral than the code, the code’s lifetime is decoupled by storing it in this object.

Timing results returned by this wrangler contain the values wall_elapsed which measures elapsed wall time. This requires a command queue with profiling enabled.

class sumpy.fmm.SumpyExpansionWrangler(code_container, queue, tree, dtype, fmm_level_to_order, source_extra_kwargs, kernel_extra_kwargs=None, self_extra_kwargs=None)[source]

Implements the boxtree.fmm.ExpansionWranglerInterface by using sumpy expansions/translations.

source_extra_kwargs

Keyword arguments to be passed to interactions that involve source particles.

kernel_extra_kwargs

Keyword arguments to be passed to interactions that involve expansions, but not source particles.

self_extra_kwargs

Keyword arguments to be passed for handling self interactions (source and target particles are the same), provided special handling is needed