Skip to main content

Python wrappers for particle FMMs

Project description

Gitlab Build Status Github Build Status Python Package Index Release Page Zenodo DOI for latest release

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.

For either binary or source install, run the following command:

pip install pyfmmlib

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.

Source Distribution

pyfmmlib-2024.1.1.tar.gz (6.1 MB view details)

Uploaded Source

Built Distributions

pyfmmlib-2024.1.1-cp312-cp312-musllinux_1_1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

pyfmmlib-2024.1.1-cp312-cp312-musllinux_1_1_i686.whl (1.4 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.1+ i686

pyfmmlib-2024.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pyfmmlib-2024.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (1.6 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

pyfmmlib-2024.1.1-cp311-cp311-musllinux_1_1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

pyfmmlib-2024.1.1-cp311-cp311-musllinux_1_1_i686.whl (1.4 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

pyfmmlib-2024.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pyfmmlib-2024.1.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (1.6 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

File details

Details for the file pyfmmlib-2024.1.1.tar.gz.

File metadata

  • Download URL: pyfmmlib-2024.1.1.tar.gz
  • Upload date:
  • Size: 6.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for pyfmmlib-2024.1.1.tar.gz
Algorithm Hash digest
SHA256 1c48575c133499b6ec0130d866694bccbda52c842f2fb9f9277b1ccfc19323ac
MD5 ec02987dfbd6d4e21a5e7f1fa7381b3c
BLAKE2b-256 25fa12a8175f2235a3ec0f3f71fd2ec152b5b098cd5def8ced64e7b6fea033ad

See more details on using hashes here.

File details

Details for the file pyfmmlib-2024.1.1-cp312-cp312-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pyfmmlib-2024.1.1-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 cd438ce70c2d29db4b8f9ef2e9d623bcb5ec4df9a14cffb331b4ced3efcacb5f
MD5 5782799ad194bcc69599ef044c5dbead
BLAKE2b-256 246c390bd746f94cde7295d9b6ff6443ab330c3cdab40d0bbe152f1a42737295

See more details on using hashes here.

File details

Details for the file pyfmmlib-2024.1.1-cp312-cp312-musllinux_1_1_i686.whl.

File metadata

File hashes

Hashes for pyfmmlib-2024.1.1-cp312-cp312-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 a62ff83467dd4938ee4bd850c2126d398aec491cc94b2bab0a0e7933b4873825
MD5 5e79c3f5c07c8c7388405890185c7fbe
BLAKE2b-256 8006bc8ef403c5036e5d6c10162b232ceefaf618d3dacbd36bdc3141dab0420c

See more details on using hashes here.

File details

Details for the file pyfmmlib-2024.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyfmmlib-2024.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 48c6fffa08dde37356de792a02465eb63171a42bed4ea8c0f7ca7a1b7a891e3a
MD5 c4cd5d8406bc5aae0b5c7cac5dd9c153
BLAKE2b-256 84b07fca8e3dda86d71a6926b18cdb2260b99d80f1ca6dcfbfea788af53ffaea

See more details on using hashes here.

File details

Details for the file pyfmmlib-2024.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pyfmmlib-2024.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 fc17efff6f2285e077c607fd72843812efcc5838ed8c6fef71c16cb7b2a3eaec
MD5 d1d70987fd2052c448f601046e3fa483
BLAKE2b-256 f1890ed89c3e10ebb6ca853c62cdc54b1831dfab8f987c54c16da619d58e828f

See more details on using hashes here.

File details

Details for the file pyfmmlib-2024.1.1-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pyfmmlib-2024.1.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 0e5942ee78ee7dba236a0b24f5d7b18d4ea105efef5992c18117e75455fa2228
MD5 fb5a2bfdee7fb0ccd617bdd014f2304a
BLAKE2b-256 e74d73fb6c27fceebea67971e23209a3988898ab17a0f063d9af73fb3893ca35

See more details on using hashes here.

File details

Details for the file pyfmmlib-2024.1.1-cp311-cp311-musllinux_1_1_i686.whl.

File metadata

File hashes

Hashes for pyfmmlib-2024.1.1-cp311-cp311-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 a9187b99c53f96263388eb9ff8952cd0b4a880ac90b1e6bb180fb64ca64096e8
MD5 aee425032fc27522692cd80abeb1a05e
BLAKE2b-256 2a3e86cc9b7fd4a0f8dda371715c28636cddb9b3205b829e8c6b7a586a97b25d

See more details on using hashes here.

File details

Details for the file pyfmmlib-2024.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyfmmlib-2024.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7fa7b91880f6cf3b32498c3e4d55e0578a0fa8d6e0f6d032a2c514dc0e52563d
MD5 d6578e27608ea95579a4de3a96ec55c6
BLAKE2b-256 0fa88f20240a5f28c8632e617c24df524d5847ca8afd5594de342d884e45f351

See more details on using hashes here.

File details

Details for the file pyfmmlib-2024.1.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pyfmmlib-2024.1.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 945320beb4fb5de12a3deb9d3d1fec10b7363e516903511b8594dad07849fac3
MD5 0aa3e2544c55a1fb3eef808b03349f23
BLAKE2b-256 027b692717d7c99ff71a261fce476fa17c3a218234ab0babade50a9d5cd6f107

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page