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
ortuple
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)
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.
- 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
ortuple
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:
target_boxes β array of integer indices into source_box_starts and centers.
source_box_starts β array of integer indices into source_box_lists, i.e. source_box_starts[i]:source_box_starts[i + 1] gives all the source boxes for a given target box
i = target_boxes[itgt_box]
.source_box_lists β an array of integer indices into box_source_starts and box_source_counts_nonchild.
box_source_starts β see
P2EFromSingleBox.__call__()
.box_source_counts_nonchild β see
P2EFromSingleBox.__call__()
.centers β see
P2EFromSingleBox.__call__()
.sources β see
P2EFromSingleBox.__call__()
.strengths β see
P2EFromSingleBox.__call__()
.rscale β see
P2EFromSingleBox.__call__()
.tgt_base_ibox β see
P2EFromSingleBox.__call__()
.tgt_expansion β see
P2EFromSingleBox.__call__()
.
Expansion-to-expansion#
Expansion-to-particle#
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
. SinceSumpyExpansionWrangler
necessarily must have apyopencl.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 usingsumpy
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.