Aboria is a C++ library that supports the implementation of particle-based numerical methods. Here we define a particle-based method as consisting of three key properties:
Aboria attempts to provide a general purpose library that can be used to support the implementation of particle-based numerical methods. The idea is to give the user complete control to define of operators on the particle set, while implementing efficiently the difficult algorithmic aspects of particle-based methods, such as neighbourhood searches and fast summation algorithms. However, even at this level it is not a one-fits-all situation and Aboria is designed to allow users to choose specific algorithms that are best suited to the particular application. For example, calculating neighbourhood interactions for a uniform particle distribution is best done using a regular cell-list data structure, while for a highly non-uniform particle distribution a tree data structure like a kd-tree might be preferable . For neighbourhood interactions that are zero beyond a certain radius, a radial search is the best algorithm to obtain interacting particle pairs, while for interactions that can be approximated for well-separated clusters of particles, the fast multipole method is an efficient fast summation algorithm.
The diagram below shows the high-level design of Aboria, which consists of three separate and complimentary abstraction levels.
This implements a particle container class which holds the particle data (positions and other user-defined variables). This class is itself based on the Standard Template Library (STL) vector class (Level 0 in the figure above ), which serves as the lowest-level data container. The user can specify the dimension of the particle's position, as well as the variables defined at each particle (velocity, temperature etc.), and the Level 1 particle set container will combine multiple Level 0 vectors to form a single data structure.
This Level 1 particle set container generally (but not fully) follows the STL
specification, with its own iterators and traits. It supports operations to
add particles (i.e. the STL push_back
member function), remove particles (i.e. erase
),
and can return a single particle given an index $i$ (i.e. operator[]
). This index operation returns a lightweight
type containing references to the corresponding index in the set of zipped
Level 0 vectors. Individual variables can be obtained from this lightweight
type via get
functions provided
by Aboria.
Aboria Level 1 also includes multiple neighbour search classes, which can be used for fast neighbour searches throughout a hypercube domain with periodic or non-periodic boundaries. The particle set container interacts with a neighbour searching classes to embed the particles within the domain ensuring that the two data structures are kept in sync, while still allowing for updates to the particles positions throughout the domain. The current version of the code has four possible neighbour search classes:
This implements neighbourhood searching and fast summation algorithms useful for particle-based methods, using the particle set and neighbour search classes in Level 1. Currently this includes:
Note that all these algorithms can work with any neighbour search data structure, and in any number of dimensions.
The highest abstraction level in Aboria implements two higher level APIs, suitable for implementing particle-based methods:
*
,
+
or /
),
and/or a set of supplied functions (e.g. sqrt
,
pow
or norm
),
to express any non-linear operator over individual particles or particle
pairs.