volumential.volume_fmm#

Drive the volume FMM and interpolate its output.

drive_volume_fmm() evaluates the volume potential over the internal box mesh; interpolate_volume_potential() carries those values to an arbitrary set of target points. The interpolation is \(O(N \log N)\), but it is almost always indistinguishable from \(O(N)\) in practice, since the geometry lookup takes a very small fraction of the total runtime.

class volumential.volume_fmm.TimingRecorder[source]#

Bases: object

Stand-in for boxtree’s recorder, when boxtree has none.

Reached only if neither boxtree.timing nor boxtree.fmm exports a TimingRecorder. It collects the per-stage timing futures the volume FMM hands it and resolves them on demand, which is all this module asks of the real one.

add(stage, future)[source]#

Record future as the timing result of stage stage.

summarize()[source]#

Resolve the recorded futures into a stage -> result map.

A stage whose future is None is left out, and one that is already a value rather than a callable is taken as it stands.

volumential.volume_fmm.drive_volume_fmm(traversal, expansion_wrangler, src_weights, src_func, direct_evaluation=False, timing_data=None, reorder_sources=True, reorder_potentials=True, **kwargs)[source]#

Top-level driver routine for volume potential calculation via fast multiple method.

This function, and the interface it utilizes, is adapted from boxtree/fmm.py

The fast multipole method is a two-pass algorithm:

1. During the fist (upward) pass, the multipole expansions for all boxes at all levels are formed from bottom up.

2. In the second (downward) pass, the local expansions for all boxes at all levels at formed from top down.

Parameters:
  • traversal – A boxtree traversal info object.

  • expansion_wrangler – An object implementing the expansion wrangler interface.

  • src_weights – Source ‘density/weights/charges’ time quad weights.. Passed unmodified to expansion_wrangler.

  • src_func – Source ‘density/weights/charges’ function. Passed unmodified to expansion_wrangler.

  • reorder_sources – Whether sources are in user order (if True, sources are reordered into tree order before conducting FMM).

  • reorder_potentials – Whether potentials should be in user order (if True, potentials are reordered into user order before return).

Returns the potentials computed by expansion_wrangler.

Each stage below runs inside a volumential.phase_profile.phase() block, so a caller that activates a volumential.phase_profile.PhaseProfile gets per-phase wall seconds for the solve. The blocks are inert (one truthiness check) when no profile is active, and a profiled solve synchronizes the command queue at every phase boundary, so profiled totals must not be quoted as unprofiled solve times.

volumential.volume_fmm.compute_barycentric_lagrange_params(q_order)[source]#

1D interpolation nodes and barycentric weights for a box of q_order.

The nodes are the q_order Gauss-Legendre points mapped from \([-1, 1]\) to the box-local \([0, 1]\), which is where the volume FMM places quadrature nodes inside a leaf; the weights are the barycentric Lagrange weights of those nodes. A single node needs no weight, so q_order == 1 returns a trivial one.

volumential.volume_fmm.interpolate_volume_potential(target_points, traversal, wrangler, potential, potential_in_tree_order=False, target_radii=None, **kwargs)[source]#

Interpolate the volume potential, only works for tensor-product quadrature formulae. target_points and potential should be an cl array.

Parameters:
  • wrangler – Used only for general info (nothing sumpy kernel specific). May also be None if the needed information is passed by kwargs.

  • potential_in_tree_order – Whether the potential is in tree order (as opposed to in user order).

  • leaves_near_ball_starts/leaves_near_ball_lists – Optional target-major lookup lists. If omitted, lookup lists are built from target points.