Interaction routines#

Particle-to-particle#

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

Direct applier for P2P interactions.

class sumpy.p2p.P2PMatrixGenerator(ctx, target_kernels, exclude_self, strength_usage=None, value_dtypes=None, name=None, device=None, source_kernels=None)[source]#

Generator for P2P interaction matrix entries.

class sumpy.p2p.P2PMatrixSubsetGenerator(ctx, target_kernels, exclude_self, strength_usage=None, value_dtypes=None, name=None, device=None, source_kernels=None)[source]#

Generator for a subset of P2P interaction matrix entries.

This generator evaluates a generic set of entries in the matrix. See P2PFromCSR for when a compressed row storage format is available.

__call__(queue, targets, sources, tgtindices, srcindices, **kwargs)[source]#

Evaluate a subset of the P2P matrix interactions.

Parameters:
  • targets – target point coordinates, which can be an object ndarray, list or tuple of coordinates or a single stacked array.

  • sources – source point coordinates, which can also be in any of the formats of the targets,

  • srcindices – an array of indices into sources.

  • tgtindices – an array of indices into targets, of the same size as srcindices.

Returns:

a one-dimensional array of interactions, for each index pair in (srcindices, tgtindices)

class sumpy.p2p.P2PFromCSR(ctx, target_kernels, exclude_self, strength_usage=None, value_dtypes=None, name=None, device=None, source_kernels=None)[source]#

QBX for Layer Potentials#

class sumpy.qbx.LayerPotentialBase(ctx, expansion, strength_usage=None, value_dtypes=None, name=None, device=None, source_kernels=None, target_kernels=None)[source]#
class sumpy.qbx.LayerPotential(ctx, expansion, strength_usage=None, value_dtypes=None, name=None, device=None, source_kernels=None, target_kernels=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, expansion, strength_usage=None, value_dtypes=None, name=None, device=None, source_kernels=None, target_kernels=None)[source]#

Generator for layer potential matrix entries.

class sumpy.qbx.LayerPotentialMatrixSubsetGenerator(ctx, expansion, strength_usage=None, value_dtypes=None, name=None, device=None, source_kernels=None, target_kernels=None)[source]#

Generator for a subset of the layer potential matrix entries.

__call__(queue, targets, sources, centers, expansion_radii, tgtindices, srcindices, **kwargs)[source]#

Evaluate a subset of the QBX matrix interactions.

Parameters:
  • targets – target point coordinates, which can be an object ndarray, list or tuple of coordinates or a single stacked array.

  • sources – source point coordinates, which can also be in any of the formats of the targets,

  • centers – QBX target expansion center coordinates, which can also be in any of the formats of the targets. The number of centers must match the number of targets.

  • expansion_radii – radii for each expansion center.

  • srcindices – an array of indices into sources.

  • tgtindices – an array of indices into targets, of the same size as srcindices.

Returns:

a one-dimensional array of interactions, for each index pair in (srcindices, tgtindices)

Translation routines#

Particle-to-Expansion#

class sumpy.p2e.P2EBase(ctx, expansion, kernels=None, name=None, device=None, strength_usage=None)[source]#

Common input processing for kernel computations.

__init__(ctx, expansion, kernels=None, name=None, device=None, strength_usage=None)[source]#
Parameters:
  • expansion – a subclass of sumpy.expansion.ExpansionBase

  • kernels – if not provided, the kernel of the expansion is used. The base kernel (after source or target transformation removal) of each kernel in the list should match the base kernel of the expansion.

  • strength_usage – a list of integers indicating which expression uses which source strength indicator. This implicitly specifies the number of strength arrays that need to be passed in. By default all kernels use the same strength.

class sumpy.p2e.P2EFromSingleBox(ctx, expansion, kernels=None, name=None, device=None, strength_usage=None)[source]#
__call__(queue, **kwargs)[source]#
Parameters:
  • source_boxes – an array of integer indices into box_source_starts and box_source_counts_nonchild.

  • box_source_starts – an array of integer indices into sources.

  • box_source_counts_nonchild – an array of integer sizes of each box.

  • centers – expansion centers.

  • sources – source points.

  • strengths – strengths at each source point. the strength count is given by the strength_usage list passed in to P2EBase.__init__().

  • nboxes – number of boxes.

  • tgt_base_ibox – integer for the base index of the target box.

  • rscale – expansion scale.

  • tgt_expansions – if given as an input, the array will be filled in with the expansions at boxes indexed by source_boxes[i] - tgt_base_ibox.

Returns:

an array of tgt_expansions.

class sumpy.p2e.P2EFromCSR(ctx, expansion, kernels=None, name=None, device=None, strength_usage=None)[source]#
__call__(queue, **kwargs)[source]#
Parameters:

Expansion-to-expansion#

class sumpy.e2e.E2EBase(ctx, src_expansion, tgt_expansion, name=None, device=None)[source]#
class sumpy.e2e.E2EFromCSR(ctx, src_expansion, tgt_expansion, 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, name=None, device=None)[source]#
class sumpy.e2e.E2EFromChildren(ctx, src_expansion, tgt_expansion, name=None, device=None)[source]#

Expansion-to-particle#

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

Integration with boxtree#

Integrates boxtree with sumpy.

class sumpy.fmm.SumpyTreeIndependentDataForWrangler(cl_context, multipole_expansion_factory, local_expansion_factory, target_kernels, exclude_self=False, use_rscale=None, strength_usage=None, source_kernels=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(tree_indep, traversal, dtype, fmm_level_to_order, source_extra_kwargs=None, kernel_extra_kwargs=None, self_extra_kwargs=None, translation_classes_data=None, preprocessed_mpole_dtype=None, *, _disable_translation_classes=False)[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

preprocessed_mpole_dtype#

Type for the preprocessed multipole expansion if used for M2L.