Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Python wrappers for particle FMMs

Project description

https://gitlab.tiker.net/inducer/pyfmmlib/badges/master/pipeline.svg https://badge.fury.io/py/pyfmmlib.png

pyfmmlib is a Python wrapper for fmmlib2d and fmmlib3d implementations of the fast multipole method for Laplace and Helmholtz potentials by Zydrunas Gimbutas and Leslie Greengard (and including code by many more people).

This wrapper is far from comprehensive. It just catches the things I ended up needing. Nonetheless, the FMMs and a fair bit of other useful stuff is accessible.

Installation

Binary wheels and source code are available from the Python package index. Thank you to Isuru Fernando for working on infrastructure to build those wheels.

To build this from source, you need

Run:

python setup.py install

as usual and cross your fingers.

Documentation

Not much, unfortunately. Here’s what I do to figure out how to use stuff:

>>> import pyfmmlib
>>> dir(pyfmmlib)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '_add_plot', ...]

Fish the desired function from this list (let's use 'legefder' as an
example) and run:

>>> print pyfmmlib.legefder.__doc__
legefder - Function signature:
  val,der = legefder(x,pexp,[n])
Required arguments:
  x : input float
  pexp : input rank-1 array('d') with bounds (n + 1)
Optional arguments:
  n := (len(pexp)-1) input int
Return objects:
  val : float
  der : float

This tells you how to call the function from Python. You can then use grep to fish out the right Fortran source:

$ grep -icl 'legefder' fmmlib*/*/*.f
fmmlib3d/src/legeexps.f

Then look at the docs there, and you’re in business. No idea what function name to look for? Just use the same grep procedure to look for keywords.

Crude, but effective. :)

Two more things:

  • Some functions are wrapped with a _vec suffix. This means they apply to whole vectors of arguments at once. They’re also parallel via OpenMP.

  • pyfmmlib.fmm_part and pyfmmlib.fmm_tria are (dimension-independent) wrappers that make the calling sequence for the FMMs just a wee bit less obnoxious. See examples/fmm.py for more.

    Here’s a rough idea how these are called:

    from pyfmmlib import fmm_part, HelmholtzKernel
    
    pot, grad = fmm_part("PG", iprec=2, kernel=HelmholtzKernel(5),
            sources=sources, mop_charge=1, target=targets)
    

    Unlike the rest of the library (which calls directly into Fortran), these routines expect (n,3)-shaped (that is, C-Order) arrays.

License

fmmlib{2,3}d are licensed under the 3-clause BSD license. (as of November 2017)

This wrapper is licensed under the MIT license, as below.

Copyright (C) 2013 Andreas Kloeckner

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyfmmlib, version 2019.1.5
Filename, size File type Python version Upload date Hashes
Filename, size pyfmmlib-2019.1.5-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (1.4 MB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp27-cp27m-manylinux1_i686.whl (851.4 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp27-cp27m-manylinux1_x86_64.whl (1.0 MB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp27-cp27mu-manylinux1_i686.whl (851.4 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp27-cp27mu-manylinux1_x86_64.whl (1.0 MB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (1.4 MB) File type Wheel Python version cp34 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp34-cp34m-manylinux1_i686.whl (855.2 kB) File type Wheel Python version cp34 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp34-cp34m-manylinux1_x86_64.whl (1.0 MB) File type Wheel Python version cp34 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp35-cp35m-manylinux1_i686.whl (854.7 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp35-cp35m-manylinux1_x86_64.whl (1.0 MB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (1.5 MB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp36-cp36m-manylinux1_i686.whl (851.2 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp36-cp36m-manylinux1_x86_64.whl (1.0 MB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (1.5 MB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp37-cp37m-manylinux1_i686.whl (851.4 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5-cp37-cp37m-manylinux1_x86_64.whl (1.0 MB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size pyfmmlib-2019.1.5.tar.gz (480.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page