You are on page 1of 358

Aboria 0.

Aboria 0.7
Martin Robinson
Copyright © 2015-2018 Martin Robinson

Table of Contents

Abstract
Introduction
Installation and Getting Started
Getting prerequisites
Compiling a program using Aboria
Compiling with Eigen
Compiling with VTK
Compiling with H2Lib
Compiling with OpenMP
Compiling with CUDA
Putting it all together
Particle Container
Creating Particles
Multidimensional Data Types
Working with particles within the container
Internal Data for Variables
Particle's value_type versus reference
Important differences from STL containers
Conversion to VTK formats
Neighbourhood Searching
Cell Lists
Fast Cell-list Neighbour Search
Kd-Trees
Hyper Oct-Tree
Using the spatial data structures
ID Searching
Parallelism in Aboria
OpenMP
CUDA
Evaluating and Solving Kernel Operators with Eigen
Creating Dense Operators
Creating Sparse Operators
Creating Chebyshev Operators
Creating Fast Multipole Method Operators
Creating Hierarchical Matrix Operators
Block Operators
Iterative Solvers
Symbolic Expressions
Setup
Constant Expressions
Univariate Expressions
Bivariate Expressions
Examples
Container/Iterator API
Symbolic API
Kernel Operator API
Benchmarks
Vector Addition

https://martinjrobins.github.io/Aboria/index.html[10/22/2018 7:32:21 AM]


Aboria 0.7

DAXPY
Dense non-linear operator
Neighbour search non-linear operator
API Overview
libaboria

Abstract
Aboria implements an expressive Domain Specifc Language (DSL) in C++ for specifying expressions over particles and their neighbours in
multidimensional space. The library is header-only and based on expression templates for effcient and natural expression of mathematical
expressions applied over the particles.

The particle data is contained in a C++ Standard Template Library (STL) compatible container. Each particle has a n-dimensional position
and user-defned data-package (for other variables such as velocity, density etc) and is optionally embedded within a hypercube spatial
domain (for neighbourhood searches) that can be periodic or not. Users can implement standard C++ and STL algorithms directly on the
particle data, or use the expression template API to naturally form non-linear operators over the particle set.

The motivation behind Aboria is to provide a useful library for implementing particle-based numerical algorithms, for example Molecular
Dynamics, Radial Basis Functions or Smoothed Particle Hydrodynamics.

Aboria is distributed under a BSD 3-Clause License, see LICENCE for more details. Aboria is supported by Maria Bruna's project
"Sustainable software for reactiondiffusion processes of interacting particles", funded by the John Fell Fund (grant BLD10370) and the St
John’s College Research Centre (grant 21138701).

Last revised: September 28, 2018 at 23:53:41 GMT

https://martinjrobins.github.io/Aboria/index.html[10/22/2018 7:32:21 AM]


Introduction

Introduction
Aboria is a C++ library that supports the implementation of particle-based numerical methods. Here we defne a particle-based method as
consisting of three key properties:

1. There exists a set of $N$ particles that have positions within an hypercube of $n$ dimensions. The boundaries of the hypercube can
optionally be periodic.
2. The numerical method in question can be described in terms of non-linear operators on the $N$ particle positions and/or variables
defned at these positions.
3. These operators are defned solely by the particle positions and variables (e.g. neighbourhood interactions), there are no pre-
defned connections or edges between the particles.

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 defne of operators on the particle set, while implementing effciently the diffcult algorithmic
aspects of particle-based methods, such as neighbourhood searches and fast summation algorithms. However, even at this level it is not a
one-fts-all situation and Aboria is designed to allow users to choose specifc 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 effcient fast summation algorithm.

Design
The diagram below shows the high-level design of Aboria, which consists of three separate and complimentary abstraction levels.

Aboria Level 1
This implements a particle container class which holds the particle data (positions and other user-defned variables). This class is itself
based on the Standard Template Library (STL) vector class (Level 0 in the fgure 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 defned 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.

https://martinjrobins.github.io/Aboria/aboria/introduction.html[10/22/2018 7:32:32 AM]


Introduction

This Level 1 particle set container generally (but not fully) follows the STL specifcation, 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:

1. Two types of cell lists, one supporting serial insertion and parallel queries, the other supporting parallel insertion and queries.
2. A kd-tree, useful for clustered particle distributions and for using Aboria's fast multipole capabilities
3. A hyper oct-tree

Aboria Level 2
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:

1. Neighbourhood searches using a $p$-norm distance measure, where $p$ can be any integer greater than 0, as well as $p
\rightarrow \infty$ (chebyshev distance)
2. Approximation of kernel operators using interpolation with chebyshev polynomials, the fast multipole method, or hierarchical H2
matrices.

Note that all these algorithms can work with any neighbour search data structure, and in any number of dimensions.

Aboria Level 3
The highest abstraction level in Aboria implements two higher level APIs, suitable for implementing particle-based methods:

1. kernel operators specifed by C++ lambda functions. These can be wrapped in Eigen matrix replacement classes, so they can be
treated as standard matrices, and used in iterative solvers.
2. a Domain Specifc Language (DSL) for specifying non-linear operators on the set of particles, using the Boost.Proto library. Users
can use standard C++ operators (e.g. *, + 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.

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/introduction.html[10/22/2018 7:32:32 AM]


Installation and Getting Started

Installation and Getting Started

Getting prerequisites
Compiling a program using Aboria
Compiling with Eigen
Compiling with VTK
Compiling with H2Lib
Compiling with OpenMP
Compiling with CUDA
Putting it all together

Getting prerequisites
This software is tested on Ubuntu 14.04LTS with the GCC compiler (version 5.4.1), and Clang compiler (version 3.8.0). See our Travis CI
page for more details.

You will need to install a C++ compiler with C++14 support, and the CMake build software prior to using Aboria, which you can do on a
Debian-based OS using

sudo apt-get install build-essential cmake

The only required dependency is the Boost library. Optional dependencies are The Visualization Toolkit , Eigen (version >= 3.3~beta1),
H2Lib, Trust and OpenMP, all of which add extra functionality. To install all these dependencies in a Debian-based OS you can type

sudo apt-get install libboost-dev libvtk5-dev libeigen3-dev libthrust-dev

Note
replace libvtk5-dev with libvtk6-dev if necessary

Note
If you wish to use H2Lib you will need to download and compile the source manually

Compiling a program using Aboria


Aboria is a header-only library, so at a minimum you will need to add the Aboria/src directory to your include path and include the
Aboria.h header, e.g.

#include <Aboria.h>

If you wish to use any of the optional dependencies you will need to install, include and/or link the required library as normal, and defne
one or more of the following compiler defnitions to "turn on" this functionality within Aboria

Table 1. Optional dependencies compiler defnitions

https://martinjrobins.github.io/Aboria/aboria/installation_and_getting_started.html[10/22/2018 7:32:43 AM]


Installation and Getting Started

Library Name Compiler defnition

VTK HAVE_VTK

Eigen HAVE_EIGEN

H2Lib HAVE_H2LIB

Thrust HAVE_THRUST

If you are familiar with compiling C++ projects, this might be all the information you need to incorporate Aboria into your own build system.
If you wish for more details, the following provides a step-by-step guide on compiling your frst Aboria program, using the popular CMake
build system.

First clone the Aboria GitHub repository like so

$ git clone https://github.com/martinjrobins/Aboria

Then copy and paste the code below into a C++ source fle named getting_started.cpp.

#include "Aboria.h"
using namespace Aboria;
int main() {
/*
* Create a 2d particle container type with one
* additional variable "velocity", represented
* by a 2d double vector
*/
ABORIA_VARIABLE(velocity, vdouble2, "velocity")
typedef Particles<std::tuple<velocity>, 2> container_t;
typedef typename container_t::position position;
/*
* create a particle set with size N
*/
const int N = 100;
container_t particles(N);
std::uniform_real_distribution<double> uni(0, 1);
std::default_random_engine gen;
for (int i = 0; i < N; ++i) {
/*
* set a random position, and initialise velocity
*/
get<position>(particles)[i] = vdouble2(uni(gen), uni(gen));
get<velocity>(particles)[i] = vdouble2(0, 0);
}
/*
* write particle container to a vtk
* unstructured grid fle
*/
vtkWriteGrid("aboria", 0, particles.get_grid(true));
}

Now copy and paste the CMake confg fle below into another fle called CMakeLists.txt. Note that this assumes that the Aboria
repository is in your current directory, which it will be if you just cloned the repo using the git command above.

cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
# Boost
fnd_package(Boost 1.50.0 REQUIRED serialization)
list(APPEND LIBRARIES ${Boost_LIBRARIES})
list(APPEND INCLUDES ${Boost_INCLUDE_DIRS})
# VTK
fnd_package(VTK REQUIRED)
if (VTK_FOUND)
add_defnitions(-DHAVE_VTK)
endif(VTK_FOUND)
list(APPEND LIBRARIES ${VTK_LIBRARIES})
list(APPEND INCLUDES ${VTK_INCLUDE_DIRS})
# Aboria
set(Aboria_LOG_LEVEL 1 CACHE STRING "Logging level (1 = least, 3 = most)")

https://martinjrobins.github.io/Aboria/aboria/installation_and_getting_started.html[10/22/2018 7:32:43 AM]


Installation and Getting Started

add_defnitions(-DABORIA_LOG_LEVEL=${Aboria_LOG_LEVEL})
list(APPEND INCLUDES Aboria/src)
list(APPEND INCLUDES Aboria/third-party)
include_directories(src ${INCLUDES})
set(SOURCE
getting_started.cpp
)
add_executable(getting_started ${SOURCE})
target_link_libraries(getting_started ${LIBRARIES})

If you wish to use The Visualisation Toolkit or Eigen with Aboria then you will need to defne the HAVE_VTK and HAVE_EIGEN compiler
defnitions, as done using the above CMakeLists.txt

Finally, confgure and compile getting_started.cpp, then run it like so

$ cmake .
$ make
$ ./getting_started

You now should have a fle aboria00000.vtu in your directory, which you can open and view using any application that supports the
VTK unstructured grid format (such as Paraview)

Compiling with Eigen


Aboria interfaces with the Eigen library to provide matrix-free linear operators, linear solvers and preconditioners. See
aboria.evaluating_and_solving_kernel_op for more details.

Assuming you are using CMake as per the instructions above, you can include Eigen in the build process by inserting the following into
your CMakeLists.txt

# optional if you already have a `FindEigen3.cmake` on your system


set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Aboria/cmake"
${CMAKE_MODULE_PATH})
# end optional
fnd_package(Eigen3 REQUIRED)
list(APPEND INCLUDES ${EIGEN3_INCLUDE_DIR})
add_defnitions(-DHAVE_EIGEN)

The frst line sets the CMAKE_MODULE_PATH to search in the Aboria cmake directory for additional .cmake fles. This is only necessary if
you don't already have a FindEigen3.cmake module or confg fle on your system and wish to use the one bundled with Aboria.

The most important line for using the Eigen functionality within Aboria is the add_defnitions instruction, which adds the HAVE_EIGEN
compiler defnition. This defnition is used to "turn on" all Eigen functionality within Aboria.

Compiling with VTK


Aboria uses The Visualisation Toolkit to allow it to write out or read in particle data as a vtkUnstructuredGrid. The example
CMakeLists.txt above shows how you can add VTK to the build process. The important lines are:

fnd_package(VTK REQUIRED)
add_defnitions(-DHAVE_VTK)
list(APPEND LIBRARIES ${VTK_LIBRARIES})
list(APPEND INCLUDES ${VTK_INCLUDE_DIRS})

Compiling with H2Lib


Aboria uses H2Lib for storing, evaluating and solving hierarchical matrices. You can use the bundled FindH2Lib.cmake to fnd H2Lib on
your system. Note that you will need to download and compile H2Lib frst, according to their instructions. You will also need to enable
OpenMP, see below for more details on how to do this.

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Aboria/cmake"
${CMAKE_MODULE_PATH})
set(H2Lib_ROOT $ENV{HOME}/git/H2Lib)
fnd_package(H2Lib REQUIRED)
list(APPEND LIBRARIES ${H2Lib_LIBRARIES})
list(APPEND INCLUDES ${H2Lib_INCLUDE_DIRS})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}

https://martinjrobins.github.io/Aboria/aboria/installation_and_getting_started.html[10/22/2018 7:32:43 AM]


Installation and Getting Started

${H2Lib_LINKER_FLAGS}") add_defnitions(-DHAVE_H2LIB)

Compiling with OpenMP


Aboria can be run using multiple cores using OpenMP. The majority of parallel regions in Aboria are implemented using the OpenMP
backend of Thrust, not raw OpenMP, so to get the best parallel performance Thrust should also be used.

To add OpenMP and Thrust to the build process, add the following to your CMakeLists.txt

# OpenMP
fnd_package(OpenMP REQUIRED)
add_defnitions(-DHAVE_OPENMP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# Thrust
fnd_package(Thrust REQUIRED)
add_defnitions(-DHAVE_THRUST)

Compiling with CUDA


The parallel STL-like algorithms provided with Thrust are used to provide the majority of parallism in Aboria. It is possible to use the native
CUDA backend of Thrust to run code on the GPU.

Caution
This mode is experimental, and has not been thoroughly tested. It is also quite slow, so any pull requests to fx this
are most welcome!

There are a few restrictions on the code that you can write while using the CUDA backend, and these are detailed in
aboria.parallelism_in_aboria.cuda (basically if you are already familiar with Thrust you should be comfortable using the CUDA backend for
Aboria). For now, just copy the following into a getting_started.cu fle

#include "Aboria.h"
using namespace Aboria;
ABORIA_VARIABLE(cu_velocity, vdouble2, "velocity")
int main() {
typedef Particles<std::tuple<cu_velocity>, 2, thrust::device_vector,
CellListOrdered>
cu_container_t;
typedef typename cu_container_t::position cu_position;
/*
* create a particle set with size N
*/
cu_container_t cu_particles(N);
/*
* set a random position
*/
thrust::tabulate(get<cu_position>(cu_particles).begin(),
get<cu_position>(cu_particles).end(),
[] __device__(const int i) {
thrust::default_random_engine gen;
thrust::uniform_real_distribution<foat> uni(0, 1);
gen.discard(i);
return vdouble2(uni(gen), uni(gen));
});
/*
* init velocity
*/
thrust::fll(get<cu_velocity>(cu_particles).begin(),
get<cu_velocity>(cu_particles).end(), vdouble2(0, 0));
/*
* write particle container to a vtk
* unstructured grid fle
*/
vtkWriteGrid("aboria", 0, particles.get_grid(true));
}

To enable the CUDA backend and compile the above source with the CUDA compiler nvcc, add the following to your CMakeLists.txt

fnd_package(CUDA REQUIRED)

https://martinjrobins.github.io/Aboria/aboria/installation_and_getting_started.html[10/22/2018 7:32:43 AM]


Installation and Getting Started

set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --expt-relaxed-constexpr


--expt-extended-lambda
-std=c++14")
set(SOURCE_CU
getting_started.cu
)
cuda_add_executable(getting_started_cu ${SOURCE_CU})
target_link_libraries(getting_started_cu ${LIBRARIES})

Putting it all together


For completness, here is a possible CMakeLists.txt fle combining all the options shown above

cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Aboria/cmake"
${CMAKE_MODULE_PATH})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
# Boost
fnd_package(Boost 1.50.0 REQUIRED serialization)
list(APPEND LIBRARIES ${Boost_LIBRARIES})
list(APPEND INCLUDES ${Boost_INCLUDE_DIRS})
# VTK
fnd_package(VTK REQUIRED)
if (VTK_FOUND)
add_defnitions(-DHAVE_VTK)
endif(VTK_FOUND)
list(APPEND LIBRARIES ${VTK_LIBRARIES})
list(APPEND INCLUDES ${VTK_INCLUDE_DIRS})
# H2Lib
set(H2Lib_ROOT $ENV{HOME}/git/H2Lib)
fnd_package(H2Lib REQUIRED)
list(APPEND LIBRARIES ${H2Lib_LIBRARIES})
list(APPEND INCLUDES ${H2Lib_INCLUDE_DIRS})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}
${H2Lib_LINKER_FLAGS}") add_defnitions(-DHAVE_H2LIB)
# OpenMP
fnd_package(OpenMP REQUIRED)
add_defnitions(-DHAVE_OPENMP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# CUDA
fnd_package(CUDA REQUIRED)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --expt-relaxed-constexpr
--expt-extended-lambda
-std=c++14")
# Thrust
fnd_package(Thrust REQUIRED)
add_defnitions(-DHAVE_THRUST)
# Aboria
set(Aboria_LOG_LEVEL 1 CACHE STRING "Logging level (1 = least, 3 = most)")
add_defnitions(-DABORIA_LOG_LEVEL=${Aboria_LOG_LEVEL})
list(APPEND INCLUDES Aboria/src)
list(APPEND INCLUDES Aboria/third-party)
include_directories(src ${INCLUDES})
set(SOURCE
getting_started.cpp
)
add_executable(getting_started ${SOURCE})
target_link_libraries(getting_started ${LIBRARIES})
set(SOURCE_CU
getting_started.cu
)
cuda_add_executable(getting_started_cu ${SOURCE_CU})
target_link_libraries(getting_started_cu ${LIBRARIES})

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/installation_and_getting_started.html[10/22/2018 7:32:43 AM]


Particle Container

Particle Container

Creating Particles
Multidimensional Data Types
Working with particles within the container
Internal Data for Variables
Particle's value_type versus reference
Important differences from STL containers
Conversion to VTK formats

Creating Particles
The main particles data-structure, or container, is called Aboria::Particles. It is templated using a tuple of variable types, explained
below. For example, the following creates a set of particles which each have (along with the standard variables such as position, id etc) a
data package consisting of one double variable type named scalar.

using namespace Aboria;


ABORIA_VARIABLE(scalar, double, "my scalar")
typedef Particles<std::tuple<scalar>> MyParticles;
MyParticles particles;

You can set the dimension of the container by using an optional unsigned integer template argument (defaults to 3). For example, if you
wanted a container of particles in 2D space, you would use

typedef Particles<std::tuple<scalar>, 2> MyParticles2;

If you wanted each particle to have a potential variable held as a double, as well as a velocity variable held as a Aboria::vdouble3
vector class, then you would write the following

ABORIA_VARIABLE(potential, double, "potential energy")


ABORIA_VARIABLE(velocity, vdouble3, "velocity")
typedef Particles<std::tuple<potential, velocity>> MyParticles3;

Note that there is a special case for boolean variables, which must be represented by an integer, rather than a boolean. This is due to the
STL specialisation of a boolean STL vector, which conficts with the internal design of Aboria. For example, here we can use an 8-bit
unsigned integer to stand in for the boolean fag variable.

ABORIA_VARIABLE(fag, uint8_t, "my fag variable")

You can give the MyParticles constructor a single int argument to initialise the container with n particles:

const int n = 100;


MyParticles particles2(n);

To create new particles simply use the value_type of the container type. For example, to create a new particle you could write

MyParticles::value_type p;

Each value_type is a tuple of values, of the types specifed by each variable. You can retrieve or set these value using the
Aboria::get function, which is templated on the variable type. For example, say you wanted to set the scalar variable for particle p:

https://martinjrobins.github.io/Aboria/aboria/particle_container.html[10/22/2018 7:32:54 AM]


Particle Container

get<scalar>(p) = 1.0;

You can print the value back out, again using the Aboria::get function

std::cout << "the scalar variable equals " << get<scalar>(p) << std::endl;

The value_type of the Particles container also has, a position, a unique id and a boolean fag indicating if this particle is alive or not.
The position type is dependent on the dimension, so the best way is to get the type from the container type, i.e.

typedef MyParticles::position position;


get<position>(p) = vdouble3(0, 0, 0);

Getting the id or alive fag from a value_type is much simpler

std::cout << "the particle id is " << get<id>(p) << std::endl;


std::cout << "the particle alive fag is " << get<alive>(p) << std::endl;

Once you are happy with your particle, you can add it to the container using the Aboria::Particles::push_back member function

particles.push_back(p);

Multidimensional Data Types


Aboria provides an internal vector type Aboria::Vector for types representing a vector of dimension d. Aboria::Vector is templated
on the type of each element and the number of dimensions:

Vector<double, 3> dim3vector;

There are a number of predefned double, int, and bool vector types, up to dimension 7, and typedefed by the pattern v<type><dim>.
E.g. Aboria::vdouble3, Aboria::vdouble6, Aboria::vint2, Aboria::vbool5...

Working with particles within the container


You can use the indexing operator Aboria::Particles::operator[] to simply loop through the container

for (size_t i = 0; i < particles.size(); i++) {


std::cout << "Accessing particle with id = " << get<id>(particles[i])
<< "\n";
}

Note that the index operator Aboria::Particles::operator[] returns a Aboria::Particles::reference, which is defned as a
tuple containing references to each of the variables. This is different from a reference to Aboria::Particles::value_type.

Or you can use the normal STL Aboria::Particles::begin() and Aboria::Particles::end() functions that return random
access iterators to the beginning and end of the container.

for (auto i = particles.begin(); i != particles.end(); i++) {


std::cout << "Accessing particle with id = " << get<id>(*i) << "\n";
}

Or

for (auto i : particles) {


std::cout << "Accessing particle with id = " << get<id>(i) << "\n";
}

Or you can use the STL algorithm for_each. If you are using a GCC compiler, you can turn on the parallel mode to enable this loop to be
run in parallel

https://martinjrobins.github.io/Aboria/aboria/particle_container.html[10/22/2018 7:32:54 AM]


Particle Container

std::for_each(particles.begin(), particles.end(), [](auto i) {


std::cout << "Accessing particle with id = " << get<id>(i) << "\n";
});

Internal Data for Variables


Each variable is held internally by a STL vector std::vector. If you wish to directly access this vector, then you can use the normal
Aboria::get functions to get it.

std::vector<size_t> &ids = get<id>(particles);


std::vector<double> &scalars = get<scalar>(particles);

Particle's value_type versus reference


When you index an individual particle using the bracket operator Aboria::Particles::operator[], it returns a getter_type,
which is essentially a tuple of references to the variables for that particle. This getter_type is typedef-ed to
Aboria::Particles::reference, and acts as the reference type for the container. Similarly, the value_type for the continer is also
a Aboria::getter_type, but instead holds a tuple of values instead of references.

Reading the above paragraph, you will note the fundamental difference from normal STL containers, in that value_type& is not the
same as reference. This can be relevant when writing functors for STL algorithms, where you will need to be sure if you need a
value_type& or a reference.

For example, the std::sort algorithm internally stores a value_type of an element which is used in the comparison, so the functor
needs to be equivalent to the following

bool cmp(const value_type& a, const value_type& b)

However, the std::transform algorithm can use a unaryop functor equivalent to

Ret fun(const reference a)

Which is more effcient than value_type&, since dereferencing the iterator will result in a reference.

Note
Fortunatelly, c++14 makes all this a lot easier, since you can just use the auto keyword and let the compiler
deduce the correct type!

Important differences from STL containers


The Aboria::Particles data structure acts fairly typically like a normal STL random-access container, with a few important differences.
It has methods like push_back, clear, size, erase. It provides subtypes like value_type, reference, const_reference,
iterator, const_iterator. All of the normal algorithms in the standard library should work with this container, if you fnd any that
don't please let us know and we will try to fx this.

The main differences between Aboria::Particles and normal STL containers are:

1. The difference between value_type& and reference mentioned described earlier.

2. Additional member functions are available to suit the specifc purpose of this container, for example the push_back function can take a
vector data-type for the particle position, and the get_query function for neighbour searching.

3. When using the neighbourhood searching capabilities of the container, the order of the particles in the particle container might change
due to internal sorting for neighbourhood searching effciency. So do not assume that the particle ordering is fxed. For example, the
push_back member function can reorder the particles if neighbourhood searching is turned on.

Conversion to VTK formats


It is possible to convert the Aboria::Particles data structure to a VTK unstructured grid class using the
Aboria::Particles::get_grid function. This function will write out each particle as a 3D point in the unstructured grid. By default all
the particle's variables are converted into VTK data arrays and added to the grid, except for those with names starting with the character

https://martinjrobins.github.io/Aboria/aboria/particle_container.html[10/22/2018 7:32:54 AM]


Particle Container

"_".

In order to write out the resultant grid to a fle using the VTK data format, Aboria provides a useful helper function
Aboria::vtkWriteGrid, which can write out the grid along with any constant felds (e.g. a timestamp) that you may need. For example,
the following code writes out the entire contents of the the particle set to the fle doc00001.vtu, along with a constant feld named "time"
containing the value 1.0.

vtkWriteGrid("doc", 0, particles.get_grid(true), {{"time", 1.0}});

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/particle_container.html[10/22/2018 7:32:54 AM]


Neighbourhood Searching

Neighbourhood Searching

Cell Lists
Fast Cell-list Neighbour Search
Kd-Trees
Hyper Oct-Tree

The Aboria::Particles container gives you neighbourhood searching functionality, using a variety of spatial data structures as
described below. All these data structure can be used in any number of dimensions, with arbitrary periodicity. Any neighbour search is
performed within a hypercube domain, with extents specifed by the user.

To start with, we will create a particle set in three dimensions (the default) containing a few randomly placed particles

const size_t N = 100;


ABORIA_VARIABLE(neighbours_count, int, "number of neighbours")
typedef Particles<std::tuple<neighbours_count>> particle_t;
typedef particle_t::position position;
particle_t particles(N);
std::default_random_engine gen;
std::uniform_real_distribution<double> uniform(-1, 1);
for (size_t i = 0; i < N; ++i) {
get<position>(particles)[i] =
vdouble3(uniform(gen), uniform(gen), uniform(gen));
}

Before you can use the neighbourhood searching, you need to initialise the domain using the
Aboria::Particles::init_neighbour_search function.

In this case, we will initialise a domain from $(-1,-1,-1)$ to $(1,1,1)$, which is periodic in all directions.

vdouble3 min = vdouble3::Constant(-1);


vdouble3 max = vdouble3::Constant(1);
vbool3 periodic = vbool3::Constant(true);
particles.init_neighbour_search(min, max, periodic);

Once this is done you can begin using the neighbourhood search queries using the Aboria::euclidean_search function. This returns
an forward-only iterator providing const access to a sequence of particles that lie within a certain distance of a given point. This iterator can
be compared with a boolean to let you know when you have reached that last particle.

For example, the following counts all the particles within a distance radius of the point $(0,0,0)$.

double radius = 0.2;


int count = 0;
for (auto i = euclidean_search(particles.get_query(), vdouble3::Constant(0),
radius);
i != false; ++i) {
count++;
}
std::cout << "There are " << count << " particles.\n";

Note that Aboria::euclidean_search uses the euclidean or 2-norm distance ($\sqrt{\sum_i^d x^2}$), but there are other functions for
other distance norms. Aboria::manhatten_search uses the 1-norm ($\sum_i^d |x|$), Aboria::chebyshev_search uses the inf-
norm ($\max_i^d |x|$), and you can use the generic Aboria::distance_search for the $p$-norm ($(\sum_i^d x^n)^{1/n}$), where $p$
is any integer greater than 0.

When dereferenced, the neighbourhood iterator returns a constant reference to the found particle object, with type
Aboria::Particles::const_reference or Aboria::search_iterator::reference. You can also use the function
Aboria::search_iterator::dx() to access a vector $\mathbf{dx}_{ij}$ pointing to the found point from the query point. I.e. if
$\mathbf{x}_i$ is the query point and $\mathbf{x}_j$ is the found point, then $\mathbf{dx}_{ij} = \mathbf{x}_j - \mathbf{x}_i$.

https://martinjrobins.github.io/Aboria/aboria/neighbourhood_searching.html[10/22/2018 7:33:05 AM]


Neighbourhood Searching

The dx vector is useful for periodic domains, the returned vector $\mathbf{dx}_{ij}$ takes periodic domains into account and returns the
$\mathbf{dx}_{ij}$ with the smallest length.

For example,

for (auto i = euclidean_search(particles.get_query(), vdouble3::Constant(0),


radius);
i != false; ++i) {
std::cout << "Found a particle with dx = " << i.dx()
<< " and id = " << get<id>(*i) << "\n";
}

Once you start to alter the positions of the particles, you will need to update the neighbourhood data structure that is used for the search.
This is done using the Aboria::Particles::update_positions function. For example, to move all the particles by a random value
and then update the data structure, you would use the following code:

for (auto &x : get<position>(particles)) {


x += vdouble3(uniform(gen), uniform(gen), uniform(gen));
}
particles.update_positions();

Note: if you did not call update_positions() after the loop, then subsequent neighbour searches would be incorrect

The function Aboria::Particles::update_positions can also take a pair of iterators corresponding to the range of particle
positions you wish to update. For example, if you wish to only move and update a single particle, you could write

get<position>(particles)[5] = vdouble3(0.1, 0, 0);


particles.update_positions(particles.begin() + 5, particles.begin() + 6);

Note that this code is valid only for the default Aboria::CellList neighbour data structure (see below), as this is (currently) the only
data structure that does not depend on the specifc ordering of the particles in the particles vector, and thus the only data structure that
can update a single particle independently to the others. The other data structures will generate a run-time error in this case.

You can also use update_positions to delete particles. Any particles with their alive fag set to false will be deleted by the
update_positions function. For example, if you wish to delete all the particles with an x coordinate less than 0 you could write:

for (auto p : particles) {


if (get<position>(p)[0] < 0) {
get<alive>(p) = false;
}
}
particles.update_positions();

If you wish to delete a single particle using the range version of update_positions, then the second iterator you pass to the function
must be the end() iterator of the particles vector. Recall that particles is a vector, and therefore deleting a particle at a given index
in the vector neccessarily moves all the particles after this index

get<alive>(particles)[5] = false;
particles.update_positions(particles.begin() + 5, particles.end());

Cell Lists
There are two cell list data structures within Aboria. Both divide the domain into a regular grid of hypercubes with side length set so that the
average number of particles within each box is close to a given value. Each particle in the container is assigned to the cell that contains its
position, and neighbourhood queries search within that cell and its neighbours within the given radius.

For example, the following diagram illustrates a cell list data structure in two dimensions, shown as a regular array of grey squares each
containing zero or more particles. The user wishes to fnd all the particles within a given euclidean distance around the red point. To
accomplish this query effciently, Aboria would then search all the red-shaded cells for particles that fall within the red circle.

https://martinjrobins.github.io/Aboria/aboria/neighbourhood_searching.html[10/22/2018 7:33:05 AM]


Neighbourhood Searching

The frst cell list data structure supports serial insertion of particles, and parallel queries. The relevant classes are Aboria::CellList
and Aboria::CellListQuery. This data structure can be selected on a per-particle-set basis, by setting the fourth template argument
for Aboria::Particles. I.e.

typedef Particles<std::tuple<>, 3, std::vector, CellList>


particle_bs_serial_t;
particle_bs_serial_t particle_bs_serial;

You will notice that we also need to specify the vector data structure that the particle container uses, which in this case is a std::vector.

The alternative is a cell-list data structure that supports parallel insertion of points, and parallel queries. This constantly re-orders the
particles in the particle container so that they are sorted into individual cells, so if particles are changing cells often this can be slower. But
theoretically (this hasn't been tested yet) this should speed up neighbourhood search queries as the particles that are local in memory are
also local in space. The relevant classes are Aboria::CellListOrdered and Aboria::CellListOrderedQuery, and you can use
this data structure like so:

typedef Particles<std::tuple<>, 3, std::vector, CellListOrdered>


particle_bs_parallel_t;
particle_bs_parallel_t particle_bs_parallel;

Fast Cell-list Neighbour Search


The two cell-list datastructures support an alternate neighbour search facility that can be faster than the typical Aboria search iterators
described above. The key assumption of this fast search is that the regular cells have a width greater than or equal to two times the search
radius, and that the same search (i.e. same radius) is to be performed for every single particle in the set. If we want to use the same search
radius radius as before, we can ensure this is true by setting the n_particles_in_leaf argument of the
Aboria::Particles::init_neighbour_search function to $n = N\frac{(radius)^D}{V}$, where $N$ is the total number of particles in
the set, $V$ is the volume of the domain, and $D$ is the number of spatial dimensions. That is,

const double required_n = N * std::pow(radius, 3) / std::pow(2.0, 3);


particles.init_neighbour_search(min, max, periodic, required_n);

Given this assumption, a fast neighbour search would be to simply look in all the possible pairs of neighbouring cells for possible
neighbouring particle pairs. To enable this, Aboria provides the Aboria::get_neighbouring_buckets function, which returns an
iterator that steps through all possible pairs of neighbouring buckets. The user can then iterate over each bucket pair, looping through all
the particle within in bucket using either the Aboria::CellListQuery::get_bucket_particles or
Aboria::CellListOrderedQuery::get_bucket_particles functions. For example, to count up the number of neighbours within a
distance of radius, you might write:

for (auto ij = get_neighbouring_buckets(particles.get_query()); ij != false;


++ij) {
auto tpl = *ij;
auto i = std::get<0>(tpl); // bucket i
auto j = std::get<1>(tpl); // bucket j
// position offset to apply to particles in i (for periodic boundaries)
auto poffset = std::get<2>(tpl);
for (auto pi = particles.get_query().get_bucket_particles(i); pi != false;
++pi) {
const Vector<double, 3> pi_position = get<position>(*pi) + poffset;
for (auto pj = particles.get_query().get_bucket_particles(j);
pj != false; ++pj) {
if ((pi_position - get<position>(*pj)).squaredNorm() < radius) {
// each ij bucket pair is counted once, so need to
// increment neighbour count for pi and pj
get<neighbours_count>(*pi)++;
get<neighbours_count>(*pj)++;
}
}
}

https://martinjrobins.github.io/Aboria/aboria/neighbourhood_searching.html[10/22/2018 7:33:05 AM]


Neighbourhood Searching

The above code considers particle pairs within neighbouring buckets, but not those within the same bucket. These pairs can be obtained
by simply looping through all the buckets in the cell-list, using the Aboria::CellListQuery::get_subtree or
Aboria::CellListOrderedQuery::get_subtree functions.

For example:

for (auto i = particles.get_query().get_subtree(); i != false; ++i) {


for (auto pi = particles.get_query().get_bucket_particles(*i);
pi != false; ++pi) {
get<neighbours_count>(*pi)++; // self is a neighbour
for (auto pj = pi + 1; pj != false; ++pj) {
if ((get<position>(*pi) - get<position>(*pj)).squaredNorm() <
radius) {
get<neighbours_count>(*pi)++;
get<neighbours_count>(*pj)++;
}
}
}
}

After the code given above, the variable neighbour_count for each particle will contain the number of neighbouring particles around that
particle. Note that this will only be correct if the width of each cell is greater than radius.

Kd-Trees
A kd-tree builds up a hierarchical tree of cells, with only the leaf cells actually containing particles. It is an effcient data structure to use if
you have a high number of dimensions or if your particles are clustered in certain regions of the domain, and so you wish to adapt the size
of your cells with the local particle density.

Each level of the tree divides the cells in the parent level along a certain dimension (the dimension is chosen based on the distribution of
particles within the cell). Any cells that contain a number of particles that is smaller than a given threshold (set in
Aboria::Particles::init_neighbour_search) are marked as leaf cells, and are not divided on subsequent levels.

There are two possible kd-trees in Aboria. The frst is a custom implementation, the second wraps the popular NanoFLANN library
https://github.com/jlblancoc/nanofann. However, Aboria's native neighbourhood queries are used instead of those provided with
NanoFLANN. The NanoFLANN kd-tree is fastest for running in serial (the construction and updates for this data structure are not done in
parallel), where-as the custom kd-tree is best if you are running in parallel, and is the only option if you are using a GPU.

The relevant classes within Aboria are Aboria::Kdtree and Aboria::KdtreeQuery for the custom implementation, and
Aboria::KdtreeNanofann and Aboria::KdtreeNanofannQuery for the NanoFLANN implementation. You can create a particle set
using a kd-tree by setting the Aboria::Particles template arguments accordingly.

typedef Particles<std::tuple<>, 3, std::vector, Kdtree> particle_kdtree_t;


particle_kdtree_t particle_kd_tree;

or

typedef Particles<std::tuple<>, 3, std::vector, KdtreeNanofann>


particle_kdtree_nanofann_t;
particle_kdtree_nanofann_t particle_kd_tree_nanofann;

Hyper Oct-Tree
A hyper oct-tree is a generalisation of an oct-tree (in 3 dimensions) to $N$ dimensions. Is also builds up a hierarchical tree of cells,
however in this case each level of the tree is split along all dimensions, so that each cell has $2^N$ children. Any cells that contain less
that the given number of particles (set in Aboria::Particles::init_neighbour_search) are marked as leaf cells. Empty cells are
included in the data structure, but are ignored by any queries.

For example, the diagram below shows the leaf cells of a hyper oct-tree in 2 dimensions (this is the same as a quad-tree). If the user
wishes to fnd all the particles within a given euclidean distance of the red particle, then Aboria will search through all the red-shaded cells
for matching particles.

https://martinjrobins.github.io/Aboria/aboria/neighbourhood_searching.html[10/22/2018 7:33:05 AM]


Neighbourhood Searching

The relevant classes within Aboria are Aboria::octtree and Aboria::HyperOctreeQuery. You can create a particle set using a
hyper oct-tree by setting the Aboria::Particles template arguments accordingly.

typedef Particles<std::tuple<>, 3, std::vector, HyperOctree>


particle_octtree_t;
particle_octtree_t particle_octtree;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/neighbourhood_searching.html[10/22/2018 7:33:05 AM]


Using the spatial data structures

Using the spatial data structures


The neighbour-searching functionality within Aboria uses the underlying spatial data structure (i.e. cell list, octtree, kdtree) to perform its
task. You can directly access this underlying data structure as well, in order for you to write your own spatial algorithms.

Aboria uses iterators to provide a generic way to interact with the spatial data structure, so that the code that you write is independent of
the particlular data structure that you use. An iterator is a generic C++ object that "iterates" through a 1D container. For example, the
classic iterator is the loop index i in the code below.

size_t N = 10;
std::vector<double> v(N);
for (size_t i = 0; i < N; ++i) {
v[i] = i;
}

The STL library abstracts away the particular type of i, and defnes a set of iterators for each container. For example, the std::vector
class has its own iterator, which you can use as follows.

size_t index = 0;
for (std::vector<double>::iterator i = v.begin(); i != v.end(); ++i) {
*i = index++;
}

Or in more compact notation

index = 0;
for (auto i = v.begin(); i != v.end(); ++i) {
*i = index++;
}

The iterators in Aboria are similar to STL iterators in that they can step through a given range of objects using the ++ operator, with some
slight differences that we will describe below.

Before we can start using the data structure iterators in Aboria, we need a particle set. Lets create a random set of points in 2D:

N = 100;
typedef Particles<std::tuple<>, 2> Particles_t;
typedef typename Particles_t::position position;
Particles_t particles(N);
std::uniform_real_distribution<double> uniform(0, 1);
for (size_t i = 0; i < N; ++i) {
auto &gen = get<generator>(particles)[i];
get<position>(particles)[i] = vdouble2(uniform(gen), uniform(gen));
}
particles.init_neighbour_search(vdouble2(0, 0), vdouble2(1, 1),
vdouble2(false, false));

In order to start interacting with the spatial data structures, we need to get its query object from the particle set. A query object is a
lightweight object that has all the information neccessary to access either the particle set itself or the underlying spatial data structures. It
was designed because the Aboria::Particles container and the neighbour search classes (e.g. Aboria::NeighbourQueryBase)
were unsuitable for copying to a gpu in order to perform calculations there, so a simpler class, the query class, was created with the
required functionality.

typedef Particles_t::query_type Query_t;


Query_t query = particles.get_query();

The base class for all the query objects is Aboria::NeighbourQueryBase, and all the query classes for the individual data structures
are derived from this. Now that we have query, we can create a Aboria::NeighbourQueryBase::child_iterator. This is the

https://martinjrobins.github.io/Aboria/aboria/using_the_spatial_data_structure.html[10/22/2018 7:33:16 AM]


Using the spatial data structures

lowest level data structure iterator, and allows you to iterate through a set of child nodes attached to a single parent node within a tree
structure.

Note
All the spatial data structures in Aboria are considered trees. For the HyperOctree and kdtree data structures, this
description is obvious, but the cell list is also treated as a tree, in this case a tree with one root node having N
children, where N is the total number of buckets in the cell list.

Note
Aboria tends to use the terms nodes and buckets fairly interchangably.

You can create a child_iterator by using the Aboria::NeighbourQueryBase::get_children function. This creates a child_iterator
that loops through the children of the root node of the tree. We will use this iterator to loop through all these children and print out the
spatial bounds of each node. In order to determine when we have reached the end of the children, we can compare the iterator to false.
This pattern is widely used in Aboria, rather than specifc end iterators as used in the STL.

for (auto i = query.get_children(); i != false; ++i) {


std::cout << query.get_bounds(i) << std::endl;
}

Above we use the Aboria::NeighbourQueryBase::get_bounds function to get the bounds of the child iterator. This returns a
Aboria::bbox class that contains the minimum and maximum spatial extents of the node pointed to by i.

Note that here we are using the default spatial data structure, a cell list provided by Aboria::CellList, so the "tree" here will only have
2 levels, and the loop above will loop through the second (i.e. non-root) level. We can also create a proper tree structure using the hyper
oct-tree data structure given by Aboria::HyperOctree, like so:

typedef Particles<std::tuple<>, 2, std::vector, HyperOctree>


ParticlesOcttree_t;
ParticlesOcttree_t particles_octtree(N);
for (size_t i = 0; i < N; ++i) {
auto &gen = get<generator>(particles_octtree)[i];
get<position>(particles_octtree)[i] =
vdouble2(uniform(gen), uniform(gen));
}
particles_octtree.init_neighbour_search(vdouble2(0, 0), vdouble2(1, 1),
vdouble2(false, false));
auto query_octtree = particles_octtree.get_query();

Now particles_octtree contains a full oct-tree, dividing the spatial domain into a hierarchical set of boxes that make up our tree data
structure. The simplest iteration we might want to do on the tree is a depth-frst iteration, which is easiest achieved by recursion. The
Aboria::NeighbourQueryBase::get_children function can be used to get the children of a
Aboria::NeighbourQueryBase::child_iterator, and using a C++ lambda function to provide the recursion we can implement a
depth-frst iteration like so

std::cout << "recursive depth-frst" << std::endl;


for (auto i = query_octtree.get_children(); i != false; ++i) {
std::function<void(decltype(i) &)> depth_frst;
depth_frst = [&](const auto &parent) {
std::cout << query_octtree.get_bounds(parent) << std::endl;
for (auto i = query_octtree.get_children(parent); i != false; ++i) {
depth_frst(i);
}
};
depth_frst(i);
}

This construction might be a bit clumsy to use in practice however, so Aboria provides a special depth-frst iterator
Aboria::NeighbourQueryBase::all_iterator to allow you to write a loop equivalent to the recursive depth-frst code given above.

The Aboria::NeighbourQueryBase::get_subtree function returns a Aboria::NeighbourQueryBase::all_iterator that


performs a depth-frst iteration over the tree. Note that you can also pass in a child_iterator to
Aboria::NeighbourQueryBase::get_subtree to iterate over the sub-tree below a particular node of the tree.

std::cout << "subtree depth-frst" << std::endl;


for (auto i = query_octtree.get_subtree(); i != false; ++i) {

https://martinjrobins.github.io/Aboria/aboria/using_the_spatial_data_structure.html[10/22/2018 7:33:16 AM]


Using the spatial data structures

std::cout << query_octtree.get_bounds(i.get_child_iterator())


<< std::endl;
}

You might also want to distinguish between leaf nodes (nodes with no children) and non-leaf nodes. You can do this with the
Aboria::NeighbourQueryBase::is_leaf_node function, which takes a reference to a node (rather than an iterator), and can be
used like so

std::cout << "subtree depth-frst showing leaf nodes" << std::endl;


for (auto i = query_octtree.get_subtree(); i != false; ++i) {
auto ci = i.get_child_iterator();
if (query_octtree.is_leaf_node(*ci)) {
std::cout << "leaf node with bounds = " << query_octtree.get_bounds(ci)
<< std::endl;
} else {
std::cout << "non-leaf node with bounds = "
<< query_octtree.get_bounds(ci) << std::endl;
}
}

Leaf nodes in the tree are the only nodes that contain particles. You can loop through all the particles in a given leaf node using the
Aboria::NeighbourQueryBase::get_bucket_particles function, which returns an iterator. Note for non-leaf nodes, the
Aboria::NeighbourQueryBase::get_bucket_particles will return an iterator that is immediatelly false, so this loop is safe even
for non-leaf nodes.

std::cout << "subtree depth-frst showing leaf nodes and particles"


<< std::endl;
for (auto i = query_octtree.get_subtree(); i != false; ++i) {
auto ci = i.get_child_iterator();
if (query_octtree.is_leaf_node(*ci)) {
std::cout << "leaf node with bounds = " << query_octtree.get_bounds(ci)
<< std::endl;
for (auto j = query_octtree.get_bucket_particles(*ci); j != false;
++j) {
std::cout << "\t has particle with position" << get<position>(*j)
<< std::endl;
}
} else {
std::cout << "non-leaf node with bounds = "
<< query_octtree.get_bounds(ci) << std::endl;
}
}

Aboria also provides functions to query leaf nodes, or buckets, within a certain distance of a point, and these are used internally for the
neighbour search functionality discussed in earlier sections. You can use the
Aboria::NeighbourQueryBase::get_buckets_near_point function, which returns a
Aboria::NeighbourQueryBase::query_iterator of all the buckets with a given distance of a point. This function also takes a
template argument P, which refers to the p-norm distance that it uses (i.e. P=2 is the standard euclidean distance).

Caution
The distance search provided by Aboria::NeighbourQueryBase::get_buckets_near_point does not
respect the periodicity of the domain, so if you did a search near a lhs edge of a periodic domain, it would not pick
up buckets on the neighbouring periodic rhs edge.

const int P = 2;
const vdouble2 search_point = vdouble2(0.5, 0.5);
const double search_radius = 0.1;
std::cout << "searching within " << search_point << " of point "
<< search_point << std::endl;
for (auto i = query_octtree.get_buckets_near_point<P>(search_point,
search_radius);
i != false; ++i) {
auto ci = i.get_child_iterator();
std::cout << "\t found bucket at " << query_octtree.get_bounds(ci)
<< std::endl;
for (auto j = query_octtree.get_bucket_particles(*ci); j != false; ++j) {
std::cout << "\t\t found particle at " << get<position>(*j)
<< std::endl;
}
}

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/using_the_spatial_data_structure.html[10/22/2018 7:33:16 AM]


ID Searching

ID Searching
As well as neighbourhood searching, Aboria has functionality to search by each particle's unique id. First, let's create a set of N particles
and randomly rearrange their position in the vector

const size_t N = 100;


typedef Particles<> particle_type;
particle_type particles(N);
std::default_random_engine g;
std::shuffe(particles.begin(), particles.end(), g);

This will create a set of particles that each have a unique id between 0 and N-1 (but their positions in the vector particles is
randomised). Now, we are going to turn on the id search capability for particles

particles.init_id_search();

Then we will try and fnd the particle with id equal to 2.

auto id_2 = particles.get_query().fnd(2);


assert(*get<id>(id_2) == 2);

Note that each fnd function (e.g. Aboria::CellListQuery::fnd) returns an iterator to the particle set. If we try and search for an id
which doesn't exist, then this iterator will point to the end of the particle vector

auto id_2N = particles.get_query().fnd(2 * N);


assert(id_2N == iterator_to_raw_pointer(particles.end()));

Finally, a note on performance: The id search is done by internally creating vectors of id and indicies ordered by id. Keeping these vectors
ordered at each call to Aboria::Particles::update_positions takes O(Nlog(N)). The call to fnd performs a binary search on the
ordered vectors, with takes O(log(N)) time.

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/id_searching.html[10/22/2018 7:33:29 AM]


Parallelism in Aboria

Parallelism in Aboria

OpenMP
CUDA

Aboria can use OpenMP or CUDA to utilise multiple cores or Nvidia GPUs that you might have. In general, Aboria uses the parallel
algorithms and vectors provided with Thrust to do this. From there, you can either use Thrust's OpenMP or CUDA backends to provide the
type of parallelism you wish. However, there are a few parts of Aboria that are OpenMP only (notably the entirety of the symbolic and
kernel APIs).

OpenMP
You don't have to do much to start using OpenMP for the high level symbolic or kernel interfaces, all that is required is that you install
OpenMP and Thrust and add the HAVE_THRUST compiler defnition (see aboria.installation_and_getting_started). For lower-level
programming you will need to add a few pragmas to your code, a few examples of which are discussed below.

First, let's create a set of N particles as usual

const size_t N = 100;


ABORIA_VARIABLE(neighbour_count, int, "neighbour_count");
typedef Particles<std::tuple<neighbour_count>, 2> particle_t;
typedef particle_t::position position;
particle_t particles(N);

Now we will loop through the particles and set their initial positions randomly. In order to use an OpenMP parallel for loop, we will stick to a
simple index-based loop for loop to iterate through the particles, like so

#pragma omp parallel for


for (size_t i = 0; i < particles.size(); ++i) {
std::uniform_real_distribution<double> uniform(0, 1);
auto gen = get<generator>(particles)[i];
get<position>(particles)[i] = vdouble2(uniform(gen), uniform(gen));
}

Now we can initialise the neighbourhood search data structure. Note that all creation and updates to the spatial data structures are run in
parallel.

Note
currently the only data structure that is created or updated in serial is Aboria::KdtreeNanofann. All the rest are
done in parallel using either OpenMP or CUDA

particles.init_neighbour_search(
vdouble2::Constant(0), vdouble2::Constant(1), vbool2::Constant(false));

We will use Aboria's range search to look for neighbouring pairs within a cutoff, and once again use OpenMPs parallel loop. All queries to
the spatial data structures are thread-safe and can be used in parallel.

const double radius = 0.1;


#pragma omp parallel for
for (size_t i = 0; i < particles.size(); ++i) {
for (auto j = euclidean_search(particles.get_query(),
get<position>(particles)[i], radius);
j != false; ++j) {

https://martinjrobins.github.io/Aboria/aboria/parallelism_in_aboria.html[10/22/2018 7:33:39 AM]


Parallelism in Aboria

++get<neighbour_count>(particles)[i];
}
}

In general, that is 90% of what you need to know, just add a couple of OpenMP pragmas to your loops and you are ready to go!

CUDA

Caution
CUDA support in Aboria is experimental, and is not tested regularly. We welcome feedback by any CUDA users if
anything doesn't work for you

Writing CUDA compatible code is slightly more involved. Aboria uses the Thrust library for CUDA parallism, and follows similar patterns (i.e.
STL-like).

Most importantly, we need to make sure that all the particle data is contained in vectors that are stored on the GPU. To do this we use a
thrust::device_vector as the base storage vector for our particles class

Note
we want to use the type thrust_neighbour_count within a device function, so we need to defne this type
outside any host functions (including main).

ABORIA_VARIABLE(thrust_neighbour_count, int, "thrust_neighbour_count");


int main() {
typedef Particles<std::tuple<thrust_neighbour_count>, 2,
thrust::device_vector, CellListOrdered>
thrust_particle_t;
thrust_particle_t thrust_particles(N);

Since all our data is on the device, we cannot use raw for loops to access this data without copying it back to the host, an expensive
operation. Instead, Thrust provides a wide variety of parallel algorithms to manipulate the data. Aboria's Aboria::zip_iterator is
compatible with the Thrust framework, so can be used in a similar fashion to Thrust's own zip_iterator (except, unlike Thrust's
zip_iterator, we can take advantage of Aboria's tagged reference and value_types).

We can use Thrust's tabulate algorithm to loop through the particles and set their initial positions randomly.

thrust::tabulate(get<position>(thrust_particles).begin(),
get<position>(thrust_particles).end(),
[] __device__(const int i) {
thrust::default_random_engine gen;
thrust::uniform_real_distribution<foat> uni(0, 1);
gen.discard(i);
return vdouble2(uni(gen), uni(gen));
});

Now we can initialise the neighbourhood search data structure. Note that we are using Aboria::CellListOrdered data structure,
which is similar to Aboria::CellList but instead relies on reordering the particles to arrange them into cells, which is more amenable to
parallelisation using a GPU.

thrust_particles.init_neighbour_search(
vdouble2::Constant(0), vdouble2::Constant(1), vbool2::Constant(false));

We can use any of Aboria's range searches within a Thrust algorithm. Below we will implement a range search around each particle,
counting all neighbours within range. Note that we need to copy all of the variables from the outer scope to the lambda function, since the
lambda will run on the device, and won't be able to access any host memory.

Note
The Aboria::NeighbourQueryBase class for each spatial data structure is designed to be copyable to the GPU,
but the Aboria::Particles class is not, so while the query variable is copyable to the device, the
thrust_particles variable is not.

https://martinjrobins.github.io/Aboria/aboria/parallelism_in_aboria.html[10/22/2018 7:33:39 AM]


Parallelism in Aboria

Note
The type of variable i in the lambda will be deduced as Aboria::Particles::raw_reference. This is different
to Aboria::Particles::reference when using thrust::device_vector, but acts in a similar fashion

thrust::for_each(
thrust_particles.begin(), thrust_particles.end(),
[radius, query = thrust_particles.get_query()] __device__(auto i) {
get<thrust_neighbour_count>(i) = 0;
for (auto j = euclidean_search(query, get<position>(i), radius);
j != false; ++j) {
++get<thrust_neighbour_count>(i);
}
});

While we have exclusively used thrust::for_each above, the iterators that Aboria provides for the Aboria::Particles container
should work with all of Thrust's algorithms. For example, you might wish to restructure the previous code as a transform:

thrust::transform(
thrust_particles.begin(), thrust_particles.end(),
get<thrust_neighbour_count>(thrust_particles).begin(),
[radius, query = thrust_particles.get_query()] __device__(auto i) {
int sum = 0;
for (auto j = euclidean_search(query, get<position>(i), radius);
j != false; ++j) {
++sum;
}
return sum;
});
}

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/parallelism_in_aboria.html[10/22/2018 7:33:39 AM]


Evaluating and Solving Kernel Operators with Eigen

Evaluating and Solving Kernel Operators with Eigen

Creating Dense Operators


Creating Sparse Operators
Creating Chebyshev Operators
Creating Fast Multipole Method Operators
Creating Hierarchical Matrix Operators
Block Operators
Iterative Solvers

Given that Aboria can describe non-linear operators, this naturally covers linear operators (i.e. matrices) as well. Consider the summation
operator given by the kernel function $K(x_i,x_j)$, over a set of $N$ particles

$$ a_i = \sum_j^N b_j K(x_i,x_j) \text{ for } i=1..N $$

This is a common enough operator that can be used in many areas. If $K(x_i,x_j) = 1/(x_j-x_i)$, then the operator might be calculating the
force on a set of charged particles via a Coulomb force. If $K(x_i,x_j) = \sqrt{(x_j-x_i)^2 + c^2}$, then the operator might be used for
function interpolation using the multiquadric basis function.

One way to evaluate this operator is to use a matrix to store the values of $K(x_i,x_j)$ for each particle pair, leading to a matrix
$\mathbf{K}$ with storage size $N^2$. Then the summation operator above is equivalent to the matrix-vector product

$$ \mathbf{a} = \mathbf{K} \mathbf{b}. $$

However, $\mathbf{K}$ could be too large to ft in memory, or the values of $x_i$ and $x_j$ might change too frequently for this to be
useful. Or you may wish to take advantage of the fact that $K(x_i,x_j)$ is a continuous function and use method such as Chebyshev
interpolation or Fast Multipole methods to effciently calculate the action of the operator on the vector $\mathbf{b}$. For any of these
reasons and many others, Aboria can help you out.

Aboria provides functionality to describe linear operators arising from the evaluation of kernel functions at a set of points (i.e. particles in
Aboria's terminology) in $N$ dimensional space. From now on we will refer to these types of operators as kernel operators. To provide
the concept and API of a matrix or linear operator, we will use the C++ linear algebra library Eigen. Aboria provides functionality to wrap
kernel operators as Aboria::MatrixReplacement, so that Eigen can treat them as normal dense or sparse matrices.

Using this wrapping, we can take advantage of Eigen to:

1. calculate the action of a kernel operator on a vector (i.e. a matrix-vector multiplication) # use Eigen's iterative solvers to solve a large
linear system of equations arising from a kernel operator.

Creating Dense Operators


The most general case involves a kernel operator $K$ that is non-zero for every possible particle pair. The kernel function can depend on
the particle positions and/or the variables assigned to each particle. For example, say we had a particle set with particle positions
$\mathbf{x}_i$ for $i=1..N$, and a single variable $a_i$. We wish to create a summation operator using the kernel function

$$ K(\mathbf{x}_i,a_i,\mathbf{x}_j,a_j) = \frac{a_i a_j}{||\mathbf{x}_j-\mathbf{x}_i|| + \epsilon} $$

were $||.||$ refers to the 2-norm, or magnitude of a vector.

First we need a particle set to apply the operator to. We will create a particle set containing $N=100$ particles with a single additional
variable $a$.

const size_t N = 100;


const double epsilon = 0.1;
ABORIA_VARIABLE(a, double, "a");
typedef Particles<std::tuple<a>> particle_type;

https://martinjrobins.github.io/Aboria/aboria/evaluating_and_solving_kernel_op.html[10/22/2018 7:33:50 AM]


Evaluating and Solving Kernel Operators with Eigen

typedef particle_type::position position;


particle_type particles(N);
std::default_random_engine gen;
std::uniform_real_distribution<double> uniform(0, 1);
for (size_t i = 0; i < N; ++i) {
get<position>(particles)[i] =
vdouble3(uniform(gen), uniform(gen), uniform(gen));
get<a>(particles)[i] = uniform(gen);
}

For convenience, we will also defne a constant reference type to refer to each particle in the container

typedef particle_type::const_reference const_particle_reference;

We then create a dense kernel operator using the Aboria::create_dense_operator function

auto K = create_dense_operator(
particles, particles,
[epsilon](const_particle_reference i, const_particle_reference j) {
const auto dx = get<position>(j) - get<position>(i);
return (get<a>(i) * get<a>(j)) / (dx.norm() + epsilon);
});

Note that Aboria::create_dense_operator takes three arguments. The frst two are particle containers which give the two particle
sets involved in the operator. The frst container holds the particles indexed by $i$ in the kernel function, and the second holds the
particles indexed by $j$. For a matrix representation, you might say that these refer to the rows and columns of the matrix.

The third argument to Aboria::create_dense_operator can be a function object, or C++ lambda expression. Basically any valid C++
object that can be called with two arguments, the frst of type const_particle_reference (i.e. a constant reference to a particle in the
set indexed by $i$), and the second of type const_particle_reference (i.e. a constant reference to a particle in the set indexed by
$j$). Note that in this case the particle sets indexed by $i$ and $j$ is the same particle set particles. However, in other cases you may
want $i$ and $j$ to index different particle sets, in which case the types for arguments 1 and 2 could be different.

In the code above, we are using a lambda expression as our function object, and create one that returns the particular kernel function
$K(\mathbf{x}_i,a_i,\mathbf{x}_j,a_j)$.

Once we have created the operator K, we can use it within Eigen as if it were a normal matrix. For example, to apply K to a vector b, we
could write the following

Eigen::VectorXd b = Eigen::VectorXd::LinSpaced(N, 0, 1.0);


Eigen::VectorXd c_1 = K * b;

This line of code calculates the following

$$ c_i = \sum_j^N b_j K(\mathbf{x}_i,a_i,\mathbf{x}_j,a_j) \text{ for } i=1..N $$

Note that rather then storing all the values of K that are needed for this summation, Aboria will instead evaluate these values as they are
needed. Therefore the memory requirements are only $\mathcal{O}(N)$, rather than $\mathcal{O}(N^2)$ for a traditional matrix. However,
this requires evaluating the kernel function for each pair of particles at a cost of $\mathcal{O}(N^2)$. If you wish to calculate this operation
approximately, then Aboria can perform the same operation using the Fast Multipole Method or Hierarchical Matrices, please see
subsequent sections for more details on how to do this.

Caution
the Aboria::MatrixReplacement operator K cannot be used, for example, in multiplications or additions with
other Eigen matrices. Thus far, it has only really been tested with matrix-vector multiplication and Eigen's iterative
solvers

If we wish to perform the same operator, but using a traditional matrix, we can use K's Aboria::MatrixReplacement::assemble
member function to fll in a normal Eigen matrix with the values of the kernel function $K(\mathbf{x}_i,a_i,\mathbf{x}_j,a_j)$. This might be
useful if you wish to perform the same operation repeatedly, or in one of Eigen's direct solvers.

Eigen::MatrixXd K_eigen(N, N);


K.assemble(K_eigen);
Eigen::VectorXd c_2 = K_eigen * b;

Creating Sparse Operators

https://martinjrobins.github.io/Aboria/aboria/evaluating_and_solving_kernel_op.html[10/22/2018 7:33:50 AM]


Evaluating and Solving Kernel Operators with Eigen

Is is common in particle-based methods that the kernel function $K$ be non-zero only for particle pairs separated by less than a certain
radius. In this case we have a summation operation like so

$$ c_i = \sum_j^N b_j K_s(\mathbf{x}_i,a_i,\mathbf{x}_j,a_j) \text{ for } i=1..N $$

where $K_s$ is a truncated version of $K$ that is only non-zero for $||\mathbf{dx}_{ij}||<r$, where $\mathbf{dx}_{ij}$ is the shortest vector
between particles $i$ and $j$. Note that for non-periodic systems, this will be $\mathbf{dx}_{ij}=\mathbf{x}_j-\mathbf{x}_i$.

$$ K_s(\mathbf{x}_i,a_i,\mathbf{x}_j,a_j) = \begin{cases} K(\mathbf{x}_i,a_i,\mathbf{x}_j,a_j), & \text{for } ||\mathbf{dx}_{ij}||<r \\0 &


\text{otherwise}. \end{cases} $$

Since the summation is only non-zero for $||\mathbf{dx}_{ij}||<r$, we wish to aim for better than $\mathcal{O}(N^2)$ time and combine the
sum with a spatial search of radius $r$.

Lets assume that we wish a similar kernel function as before

$$ K(\mathbf{x}_i,a_i,\mathbf{x}_j,a_j) = \frac{a_i a_j}{||\mathbf{dx}_{ij}|| + \epsilon} $$

We can create the operator K_s in Aboria like so (setting $r=0.1$ in this case)

const double r = 0.1;


auto K_s = create_sparse_operator(
particles, particles, r,
[epsilon](const vdouble3 &dx, const_particle_reference i,
const_particle_reference j) {
return (get<a>(i) * get<a>(j)) / (dx.norm() + epsilon);
});

Sparse operators support periodic domains, and therefore we now need the dx argument in the kernel function object. This is a distance
value that gives the shortest vector from particle i to particle j.

When applied to a vector, this operator will use the neighbour search of the particles container to perform a neighbour search for all
particle pairs where $||\mathbf{dx}_{ij}||<r$.

Before we can use this operator, we need to make sure that the neighbour search for particles is initialised. By default, the particle
container was created using three spatial dimensions, so we need to set up a domain from $(0,0,0)$ to $(1,1,1)$ which is not periodic in all
three directions.

vdouble3 min = vdouble3::Constant(0);


vdouble3 max = vdouble3::Constant(1);
vbool3 periodic = vbool3::Constant(false);
particles.init_neighbour_search(min, max, periodic);

Once this is done, we can then apply the operator to the vector b from before

Eigen::VectorXd c_3 = K_s * b;

Once again, we can write out K_s to a traditional matrix. This time, we will write out the values of K_s to a sparse matrix, so we can still
obtain an effcient operator

Eigen::SparseMatrix<double> K_s_eigen(N, N);


K_s.assemble(K_s_eigen);
Eigen::VectorXd c_4 = K_s_eigen * b;

Creating Chebyshev Operators


Lets assume that the kernel function of interest depends only on the particle positions

$$ c_i = \sum_j^N b_j K(\mathbf{x}_i,\mathbf{x}_j) \text{ for } i=1..N $$

and that we can approximate $K(\mathbf{x}_i,\mathbf{x}_j)$ using interpolation. That is, if $w_l(x)$ denotes a set of interpolating functions,
then

$$ K(\mathbf{x}_i,\mathbf{x}_j) \approx \sum_l \sum_m K(\mathbf{x}_l,\mathbf{x}_m) w_l(\mathbf{x}_i) w_m(\mathbf{x}_j) $$

Using this idea, we can use chebyshev interpolation to interpolate $K(\mathbf{x}_i,\mathbf{x}_j)$ at the chebyshev nodes, leading to an
operator that can be applied to a vector at a reduced cost. How reduced depends on the number of chebyshev nodes that are chosen. A
small number of nodes means that the error in the approximation grows, while a larger number of nodes means increased computational

https://martinjrobins.github.io/Aboria/aboria/evaluating_and_solving_kernel_op.html[10/22/2018 7:33:50 AM]


Evaluating and Solving Kernel Operators with Eigen

cost.

Note that this idea has been published in the following paper, which was used as a reference for Aboria's implementation:

Fong, William, and Eric Darve. "The black-box fast multipole method." Journal of Computational Physics 228.23 (2009): 8712-8725.

One restriction on the kernel function in this context is that it must be a smooth function of only position. With this in mind, we will defne the
following kernel function

$$ K(\mathbf{x}_i,\mathbf{x}_j) = \sqrt{||\mathbf{dx}_{ij}|| + \epsilon} $$

which is the multiquadric radial basis function.

A kernel operator using this function and chebyshev interpolation can be created in Aboria using the
Aboria::create_chebyshev_operator function

const unsigned int n = 10;


auto K_c = create_chebyshev_operator(
particles, particles, n,
[epsilon](const vdouble3 &i, const vdouble3 &j) {
return std::sqrt((j - i).norm() + epsilon);
});

where n sets the number of chebyshev nodes in each dimension. Here the function object given to
Aboria::create_chebyshev_operator must have two arguments representing the positions $\mathbf{x}_i$ and $\mathbf{x}_j$.

Caution
Once K_c is created, it assumes that the positions of the particles in particles do not change. If this is not true,
then you can use the function of the underlying kernel class Aboria::KernelChebyshev to update the positions.

Note
Aboria's neighbourhood searching does not need to be initialized in this case, as no neighbourhood queries are
used.

As before, this operator can be applied to an Eigen vector

Eigen::VectorXd c_5 = K_c * b;

Creating Fast Multipole Method Operators


One disadvantage of using chebyshev interpolation to construct an operator is that it is not valid if the kernel function is discontinuous. This
is violated by many kernels which contain singularities when $\mathbf{x}_i = \mathbf{x}_j$. Also, often large numbers of chebyshev nodes
are required, which does not reduce the computational cost suffciently while retaining accuracy.

Another powerful class of methods are based on the Fast Multipole Method, which has been also implemented in Aboria. These are valid
for kernel functions with singularities and which boasts $\mathcal{O}(N)$ complexity.

Once again, we will use chebyshev interpolation, but now will construct a tree data structure using one of Aboria's tree data structures (kd-
tree or oct-tree). When the kernel operator is applied to a vector, the fast multiplole algorithm will be invoked, which leads to traversals up
and down the tree, using chebyshev interpolation to compress the kernel function for clusters of particles that are well separated. The
interaction of particle clusters that are not well separated are calculated directly. The details of this are in the following article, which was
used as a reference for Aboria's implementation:

Fong, William, and Eric Darve. "The black-box fast multipole method." Journal of Computational Physics 228.23 (2009): 8712-8725.

A kernel operator using the fast multipole method can be created in Aboria using the Aboria::create_fmm_operator function

const unsigned int n2 = 4;


auto K_f = create_fmm_operator<n2>(
particles, particles,
[epsilon](const vdouble3 &i, const vdouble3 &j) {
return std::sqrt((j - i).norm() + epsilon);
},
[epsilon](const_particle_reference i, const_particle_reference j) {
return std::sqrt(
((get<position>(j) - get<position>(i)).norm() + epsilon));

https://martinjrobins.github.io/Aboria/aboria/evaluating_and_solving_kernel_op.html[10/22/2018 7:33:50 AM]


Evaluating and Solving Kernel Operators with Eigen

});

where n2 sets the number of chebyshev nodes in each dimension. Note that this is typically much less than what is required by the
chebyshev operator discussed in the previous section. Here we need to pass two function objects to Aboria::create_fmm_operator,
both of which represent the kernel applied in different situations. The frst takes two positions that are guarenteed to be not equal, and
which in FMM terminology are used to create the M2L (multipole to local) operators. The second function object takes two particle
references from the row and column particle sets, and is used to create the P2P (particle to particle) operator. Note that the position of i
and j, and/or the particles themselves, might be identical. Therefore this function object must handle any kernel singularities.

Note
the Aboria::create_fmm_operator function creates a kernel operator in which the fast multipole algorithm is
applied completely "on the fy". The fmm can be signifcantly speeded up for static particle positions by storing a
hierarchical matrix. Please see the next section for more details of how to do this in Aboria.

As before, this operator can be applied to an Eigen vector

Eigen::VectorXd c_6 = K_f * b;

Creating Hierarchical Matrix Operators


The fast multipole method (fmm) results in multiple tree traversals while applying linear operators to the multipole vectors. Rather than
calculating these linear operators during the algorithm, it is also possible to pre-calculate them and store them in a hierarchical H2 matrix.
The advantage of this is that applying the operator to a vector is much faster, the downside is that it assumes that the particle positions do
not change.

A kernel operator which does this can be created using the Aboria::create_h2_operator function

auto K_h = create_h2_operator(


particles, particles, n2,
[epsilon](const vdouble3 &i, const vdouble3 &j) {
return std::sqrt((j - i).norm() + epsilon);
},
[epsilon](const_particle_reference i, const_particle_reference j) {
return std::sqrt(
((get<position>(j) - get<position>(i)).norm() + epsilon));
});

As before, this operator can be applied to an Eigen vector

Eigen::VectorXd c_7 = K_h * b;

Block Operators
It is common that you would like to compose operators in a tiled or block format, and Aboria provides a functionality to do this using the
Aboria::create_block_operator.

Let us assume that we wish to compose the two operators K and K_s from before, and want to perform the following combined operator

$$ \begin{align} e_i &= \sum_j^N d_j K_s(\mathbf{x}_i,a_i,\mathbf{x}_j,a_j) \text{ for } i=1...N \\ e_{i+N} &= \sum_j^N d_{j+N}
K(\mathbf{x}_i,a_i,\mathbf{x}_j,a_j) \text{ for } i=1...N \end{align} $$

where $e_i$ and $d_j$ are elements of vectors $\mathbf{e}$ and $\mathbf{d}$ of size $2N$. Using matrix notation, and using $\mathbf{K}$
and $\mathbf{K}_s$ to represent the operators K and K_s, this is equivalent to

$$ \mathbf{e} = \begin{pmatrix} \mathbf{K}_s & 0 \\\ 0 & \mathbf{K} \end{pmatrix} \mathbf{d} $$

We frst need operators representing the zero matrices in the upper right and lower left corners of the block operator. We create these in
Aboria like so

auto Zero = create_zero_operator(particles, particles);

and then we can create the block operator Full like so

https://martinjrobins.github.io/Aboria/aboria/evaluating_and_solving_kernel_op.html[10/22/2018 7:33:50 AM]


Evaluating and Solving Kernel Operators with Eigen

auto Full = create_block_operator<2, 2>(K_s, Zero, Zero, K);

Finally we can create vectors e and d and apply the block operator

Eigen::VectorXd d(2 * N);


d.head(N) = Eigen::VectorXd::LinSpaced(N, 0, 1.0);
d.tail(N) = Eigen::VectorXd::LinSpaced(N, 0, 1.0);
Eigen::VectorXd e = Full * d;

Iterative Solvers
The Aboria::MatrixReplacement class can multiply other Eigen vectors, and can be used in Eigen's iterative solvers. Both
Eigen::IdentityPreconditioner and Eigen::DiagonalPreconditioner preconditioners are supported. Below is an example of
how to use Eigen's GMRES iterative solver to solve the equation

$$\mathbf{c} = \mathbf{K} \mathbf{h}$$

for input vector $\mathbf{h}$.

We can simply pass the dense operator K to Eigen's GMRES iterative solver like so

Eigen::GMRES<decltype(K), Eigen::DiagonalPreconditioner<double>>
gmres_matrix_free;
gmres_matrix_free.setMaxIterations(2 * N);
gmres_matrix_free.set_restart(2 * N + 1);
gmres_matrix_free.compute(K);
Eigen::VectorXd h_1 = gmres_matrix_free.solve(c_1);

This will solve the equation in a matrix-free fashion. Alternatively, we can use the normal matrix K_eigen that we assembled previously to
solve the equation

Eigen::GMRES<decltype(K_eigen), Eigen::DiagonalPreconditioner<double>>
gmres_matrix;
gmres_matrix.setMaxIterations(2 * N);
gmres_matrix.set_restart(2 * N + 1);
gmres_matrix.compute(K_eigen);
Eigen::VectorXd h_2 = gmres_matrix.solve(c_1);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/evaluating_and_solving_kernel_op.html[10/22/2018 7:33:50 AM]


Symbolic Expressions

Symbolic Expressions

Setup
Constant Expressions
Univariate Expressions
Bivariate Expressions

Setup
To start using symbolic expressions, you frst need to defne a set of symbols to represent your variables, as well as labels to represent
your particle set(s).

A symbol representing each particle's position is defned as

Symbol<position> p;

A symbol representing the variable alive is defned as

Symbol<alive> _alive;

A label representing the particle set particles with type MyParticles is defned as

Label<0, Particles_t> a(particles);


Label<1, Particles_t> b(particles);

The frst template argument is the id of the label, and the second is the type of the particle set label refers to. Note that the type of each
label must be unique, as this type is used to determine which particle you mean when using the label within expressions. You can use the
id template argument to ensure that each label type is unique.

Labels refer to a specifc particle set. For example, given a bivariate neighbour expression involving two particles from particles, the
label a defned above would refer to the frst particle, and b would refer to the second. Note that the result values of a bivariate expression
will form a matrix of values, with particle a corresponding to the row of the matrix, and particle b corresponding to the column.

Constant Expressions
Now we have defned our labels and symbols, we can create a simple expression to set the position of all particles to double3(0,0,1)

p[a] = vdouble3(0, 0, 1);

If we want to add 1 to every particle position, we can use an increment expression

p[a] += 1;

A special case involves the alive variable fag. If we use our _alive symbol to set all the alive fag's to false like so

_alive[a] = false;

Then after the expression is complete Aboria will call the delete_particles member function to delete all the particles with

https://martinjrobins.github.io/Aboria/aboria/symbolic_expressions.html[10/22/2018 7:34:01 AM]


Symbolic Expressions

get<alive>(particle) == false (i.e. all of them). After this expression the particle container will be empty.

Univariate Expressions
Single-particle dependent expressions can easily be built by using a single label on the RHS of the expression. For example we can also
add a constant value 1 to each particle position like so

p[a] = p[a] + 1;

Or we can use a fag variable fag, along with its symbol f, so defne two sets of particles within the same container and only change the
particle position if get<fag>(particle) == true. Recall that we can't use boolean fags so we can instead use a uint8_t datatype.
For example

ABORIA_VARIABLE(fag,uint8_t,"my fag");
// create particle container and set fags and positions here

Symbol<fag> f;
p[a] = if_else(f[a], p[a] + 1, p[a]);

We can even selectively delete particle using our f and _alive symbols.

_alive[a] = if_else(f[a], true, false);

Bivariate Expressions
So far we have used constant or univariate expressions on the RHS of an assignment operator. This makes sense because we can only
assign an expression to a single particle if that expression depends on a constant or that particle's variables. However, we might also want
our expression to depend on the other particles in the container, or another container. In this case we wish to use a bivariate expression.
For example, the following equation defned a sum over all other particles (with label b), using the function w, which depends on the
separation of particle a and b.

$$ p_a = \sum_b w(p_b-p_a) $$

Normally for a bivariate expression we wish to accumulate the contribution from other particles in order to arrive at a result. This is most
often done with a summation. In Aboria, we can defne an accumulator object, which takes a single template argument which is the
function or functor to accumulate with. For example, the following defnes a summation accumulator using std::plus

Accumulate<std::plus<vdouble3>> sum;

Once we have this summation accumulator, we can write an expression similar


to the equation above like so, using $w(p_b) = (p_b - p_a)$.Note that the
frst argument to `sum` is set to `true`, indicating the summation is over

all* particles in label b.

p[a] = sum(b, p[b] - p[a]);

We might also want to sum the inverse distance between particle pairs, like so

p[a] = sum(b, 1.0 / (p[b] - p[a]));

Unfortunately if a and b refer to the same particle container this will result a divide-by-zero at runtime, when a and b are labels for the
same particle. Therefore we can restrict the evaluation of the sum by setting the second argument to ensure that the id of particles a and
b are non-identical. Recall that id is a built-in variable that contains a unique id for each particle in the container.

Symbol<id> _id;
p[a] = sum(b, if_else(_id[a] != _id[b], 1.0, 0.0) / (p[b] - p[a]));

https://martinjrobins.github.io/Aboria/aboria/symbolic_expressions.html[10/22/2018 7:34:01 AM]


Symbolic Expressions

So the frst argument to sum is the label to sum over, the second is the conditional expression that must evaluate to true to be included in
the summation, and the third is an expression that provides the value to be included in the summation.

There is a special case for the conditional expression, when you want to sum over all particles within a certain radius. This can be
expressed using the Aboria::AccumulateWithinDistance summation

AccumulateWithinDistance<std::plus<vdouble3>> sum_within_two(2);
auto dx = create_dx(a, b);
p[a] = sum_within_two(b, dx / pow(norm(dx), 2));

where dx is a Dx symbol representing the shortest vector from b to a. Note that this might be different from p[a]-p[b] for periodic
domains. The symbolic function [functionref Aboria::norm norm] returns the 2-norm, or magnitude, of the vector dx, and the symbolic
function [functionref Aboria::pow pow] returns the frst argument to the power of the second (in much the same way as std::pow, but lazily
evaluated).

In this case Aboria will perform a summation over neighbours closer than a radius of 2, and will use the neighbourhood searching facility
described in aboria.neighbourhood_searching to fnd these neighbouring particles. Note that you need to call
Aboria::Particles::init_neighbour_search before any bivariate expressions using neighbourhood searching.

As another, more complete example, we can use the

neighbourhood-searching expressions to count the number of particles within a distance of 2 of each individual particle, storing the result in
a variable called count.

ABORIA_VARIABLE(count, int, "number of surrounding particles")


typedef Particles<std::tuple<count>> MyParticles;
typedef MyParticles::position position_t;
// add some particles
MyParticles particles2(N);
std::uniform_real_distribution<double> uni(0, 1);
for (size_t i = 0; i < N; ++i) {
auto &gen = get<generator>(particles2)[i];
get<position_t>(particles2)[i] = vdouble3(uni(gen), uni(gen), uni(gen));
}
// initialise neighbour searching
particles2.init_neighbour_search(
vdouble3::Constant(0), vdouble3::Constant(1), vbool3::Constant(false));
// defne symbols and labels, and sum
Symbol<count> c;
Label<0, MyParticles> i(particles2);
Label<1, MyParticles> j(particles2);
AccumulateWithinDistance<std::plus<int>> neighbour_sum(2);
auto dx_ij = create_dx(i, j);
// count neighbouring particles within a distance of 2
c[i] = neighbour_sum(j, 1);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/symbolic_expressions.html[10/22/2018 7:34:01 AM]


Examples

Examples

Container/Iterator API
Symbolic API
Kernel Operator API

Container/Iterator API

Molecular Dynamics (Linear Spring) (MD)


1955 FPUT Experiment

Molecular Dynamics (Linear Spring) (MD)


Simple Molecular Dynamics of $N$ particles interacting via a linear spring potential.

This example creates $N$ particles within a two-dimensional square domain, with periodic boundary conditions.

There is a linear spring force $\mathbf{f}_{ij}$ between particles $i$ and $j$ with a rest separation of $r$ (constant for all particles), and a
cutoff at $r$. That is, if $\mathbf{r}_i$ is the position of particle $i$ and $\mathbf{dx}_{ij}=\mathbf{r}_j-\mathbf{r}_j$, then

$$ \mathbf{f}_{ij} = \begin{cases} \frac{r-|\mathbf{dx}_{ij}|}{|\mathbf{dx}_{ij}|}\mathbf{dx}_{ij}, & \text{for } |\mathbf{dx}_{ij}|<r \\ 0 &


\text{otherwise}. \end{cases} $$

We wish to use a leap frog integrator to evolve positions $\mathbf{r}_i$ using velocities $\mathbf{v}_i$ and accelerations $\mathbf{a}_i =
\sum_j \mathbf{f}_{ij}$. This gives the following update equations for each timestep $n$

\begin{align*} \mathbf{v}^{n+1}_i &= \mathbf{v}^n_i + \frac{dt}{m_i} \sum_j \mathbf{f}^n_{ij} \\ \mathbf{r}^{n+1}_i &= \mathbf{r}^n_i + dt,
\mathbf{v}^{n+1}_i. \end{align*}

We implement this in Aboria using the code given below. Firstly we create the particle set data structure and add particles, ensuring that
we have an initial condition where all the spring forces are $\mathbf{f}_{ij}=0$. Then we start the timestep loop, using our update equations
given above.

#include <boost/math/constants/constants.hpp>
#include <math.h>
#include <random>
#include "Aboria.h"
using namespace Aboria;
int main() {
const double PI = boost::math::constants::pi<double>();
// Create a 2d particle container with one additional variable
// "velocity", represented by a 2d double vector
ABORIA_VARIABLE(velocity, vdouble2, "velocity")
typedef Particles<std::tuple<velocity>,2> container_type;
typedef typename container_type::position position;
container_type particles;
// set parameters for the MD simulation
const int timesteps = 3000;
const int nout = 200;
const int timesteps_per_out = timesteps / nout;
const double L = 31.0 / 1000.0;
const int N = 30;
const double diameter = 0.0022;
const double k = 1.0e01;

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

const double dens = 1160.0;


const double mass = PI * std::pow(0.5 * diameter, 2) * dens;
const double reduced_mass = 0.5 * mass;
const double dt = (1.0 / 50.0) * PI / std::sqrt(k / reduced_mass);
const double v0 = L / (timesteps * dt);
// initiate neighbour search on a periodic 2d domain of side length L
// set average number of particles per cell to 1
particles.init_neighbour_search(vdouble2(0, 0), vdouble2(L, L),
vbool2(true, true));
// create N particles, ensuring that they do not overlap, according
// to the set diameter. set the initial velocity in a random direction
std::uniform_real_distribution<double> uni(0, 1);
for (int i = 0; i < N; ++i) {
bool free_position = false;
// create new particle
typename container_type::value_type p;
// set a random direction, and initialise velocity
const double theta = uni(generator) * 2 * PI;
get<velocity>(p) = v0 * vdouble2(cos(theta), sin(theta));
// randomly choose positions within the domain until one is
// found with no other particles within a range equal to diameter
while (free_position == false) {
get<position>(p) = vdouble2(uni(generator) * L, uni(generator) * L);
free_position = true;
// loop over all neighbouring particles within a euclidean distance
// of size "diameter"
for (auto j = euclidean_search(particles.get_query(), get<position>(p),
diameter);
j != false; ++j) {
free_position = false;
break;
}
}
particles.push_back(p);
}
// perform MD timestepping
for (int io = 0; io < nout; ++io) {
// on every i/o step write particle container to a vtk
// unstructured grid fle
std::cout << "." << std::fush;
#ifdef HAVE_VTK
vtkWriteGrid("particles", io, particles.get_grid(true));
#endif
for (int t = 0; t < timesteps_per_out; t++) {
// loop through particles and calculate velocity update
for (auto i : particles) {
auto sum = vdouble2::Constant(0);
// use a range search with radius `diameter` to
// accelerate velocity update
for (auto j = euclidean_search(particles.get_query(),
get<position>(i), diameter);
j != false; ++j) {
const double r = j.dx().norm();
if (r != 0) {
sum += -k * (diameter / r - 1.0) * j.dx();
}
}
get<velocity>(i) += dt * sum / mass;
}
// now loop through particles and use velocity
// to update the particle positions
for (auto i : particles) {
get<position>(i) += dt * get<velocity>(i);
}
// since we have changed the particle positions, we need
// to update the spatial data structures
particles.update_positions();
}
}
std::cout << std::endl;
}

1955 FPUT Experiment


The frst-ever numerical experiment was performed in 1955 by Fermi, Pasta, Ulam, and Tsingou. They simulated a lattice of particles, with
nearest neighbour particles connected by springs. The motion of the particles over time is chaotic and quasi-periodic.

This experiment was the frst to demonstrate the importance of computer simulation in the analysis of non-linear systems, and
demonstrates the paradox that many apparently chaotic systems exhibit periodic behaviour.

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

We reproduce this experiment using Aboria below. Of course, being a 1D lattice code, Aboria is overkill for this type of simulation, but given
that the frst numerical experiment was a particle simulation I had to include it in the examples.

The equations of motion for each particle in terms of its displacement from a rest confguration are

$$ \frac{d^2 u_j}{dt^2} = \frac{c^2}{h^2} (u_{j+1}+u_{j-1}-2u_{j}) + \alpha [(u_{j+1}-u_{j})^2 - (u_{j}-u_{j-1})^2] $$

If we calculate the energy in the lowest mode

$$ E_1 = 0.5(\dot{A_1}^2 + w_1^2 A_1^2) $$

where $w_1^2 = 4 \sin^2(\pi/2N)$, and $A_1 = \sqrt{2/(N+1)}\sum_{n=1}^N u_n \sin(n\pi/(N+1))$ and set up an initial condition with all the
energy in this lowest mode, then we see that while the energy initially diffuses away to the higher modes, after a long enough time the
energy returns to the lowest modes until the system is in its original state.

If you compile the code below with Cairo enabled, then it will output svg fles showing the image below. The circles are the particles,
coloured red by their displacement $u$, and the line shows the amount of energy in the lowest mode versus time.

#include "Aboria.h"
#include <random>
using namespace Aboria;
#include <boost/math/constants/constants.hpp>
int main() {
const double PI = boost::math::constants::pi<double>();
// setup types
ABORIA_VARIABLE(velocity, vdouble1, "velocity")
ABORIA_VARIABLE(acceleration, vdouble1, "acceleration")
ABORIA_VARIABLE(acceleration0, vdouble1, "old acceleration")
typedef Particles<std::tuple<velocity, acceleration, acceleration0>, 1>
particles_t;
typedef particles_t::position position;
// simulation parameters
const double c = 1.0;
const double alpha = 0.25;
const double h = 1.0;
const double scale = std::pow(c, 2) / std::pow(h, 2);
const int N = 32;
const double w1 = 2.0 * std::sin(PI / (2.0 * N));
const double Tf = 160 * 2 * PI / w1;
const long timesteps = 1000000;
const int nout = 1000;
const int timesteps_per_out = timesteps / nout;
const double dt = static_cast<double>(Tf) / timesteps;
// create particles
particles_t particles(N);
// set intial variables, position here is simply a displacement
// for each particle away from its resting position
for (size_t i = 0; i < N; ++i) {
get<position>(particles)[i][0] = std::sin((i + 1) * PI / (N + 1));
get<acceleration>(particles)[i][0] = 0;
get<velocity>(particles)[i][0] = 0;
}
// time loop
std::vector<double> energy(nout, 0);
for (size_t out = 0; out < nout; ++out) {
for (size_t t = 0; t < timesteps_per_out; ++t) {
// advance position: x1 = x0 + dt*v + 0.5*dt^2*a
for (size_t i = 0; i < N; ++i) {
get<position>(particles)[i] +=
dt * get<velocity>(particles)[i] +
0.5 * std::pow(dt, 2) * get<acceleration>(particles)[i];
}
// calculate acceleration: a1 = f(x1)
for (size_t i = 0; i < N; ++i) {
// get displacements, taking into account boundary conditions
// of x0 = xN = 0
const double &x = get<position>(particles)[i][0];
const double xp1 =

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

i != N - 1 ? get<position>(particles)[i + 1][0] : 0;
const double xm1 = i != 0 ? get<position>(particles)[i - 1][0] : 0;
get<acceleration0>(particles)[i] = get<acceleration>(particles)[i];
get<acceleration>(particles)[i][0] =
scale * (xp1 + xm1 - 2 * x) +
alpha * (std::pow(xp1 - x, 2) - std::pow(x - xm1, 2));
}
// advance velocity: v1 = v0 + 0.5*dt*(a0 + a1)
for (size_t i = 0; i < N; ++i) {
get<velocity>(particles)[i] += 0.5 * dt *
(get<acceleration0>(particles)[i] +
get<acceleration>(particles)[i]);
}
}
// calculate energy in the lowest mode
// (w1*A1)^2 = potential energy
// (Adot1)^2 = kinetic energy
double A1 = 0;
double Adot1 = 0;
for (size_t i = 0; i < N; ++i) {
const double &u = get<position>(particles)[i][0];
const double &v = get<velocity>(particles)[i][0];
A1 += std::sqrt(2.0 / (N + 1)) * u * std::sin((i + 1) * PI / (N + 1));
Adot1 +=
std::sqrt(2.0 / (N + 1)) * v * std::sin((i + 1) * PI / (N + 1));
}
energy[out] = 0.5 * (std::pow(Adot1, 2) + std::pow(w1 * A1, 2));
// visualise system if compiled with cairo
#ifdef HAVE_CAIRO
// create surface
const int image_size = 512;
const double ratio = 1.0 / 5.0;
cairo_surface_t *surface = cairo_svg_surface_create(
("fput" + std::to_string(out) + ".svg").c_str(), image_size,
image_size * ratio);
cairo_svg_surface_restrict_to_version(surface, CAIRO_SVG_VERSION_1_2);
cairo_t *cr = cairo_create(surface);
// set source
cairo_scale(cr, image_size, image_size);
cairo_set_source_rgba(cr, 0, 0, 0, 1.0);
const double lw = 0.01;
cairo_set_line_width(cr, lw);
// draw particles
for (size_t i = 0; i < N; ++i) {
const double &u = get<position>(particles)[i][0];
const double pos = 0.1 * u + (i + 1) * dx;
cairo_set_source_rgba(cr, std::abs(u), 0, 0, 1.0);
cairo_arc(cr, pos, 0.5 * ratio, lw, 0, 2 * PI);
cairo_fll(cr);
}
// draw energy
cairo_set_source_rgba(cr, 1, 0, 0, 0.8);
cairo_move_to(cr, 0, energy[0] * ratio);
for (size_t i = 1; i < out; ++i) {
cairo_line_to(cr, static_cast<double>(i) / nout,
(1.0 - 10 * energy[i]) * ratio);
}
cairo_stroke(cr);
// clean up
cairo_destroy(cr);
cairo_surface_destroy(surface);
#endif // HAVE_CAIRO
}
}

Symbolic API

Molecular Dynamics (Linear Spring) (MD)


Brownian Dynamics (BD)
Discrete Element Model (DEM)
Smoothed Particle Hydrodynamics (SPH)

Molecular Dynamics (Linear Spring) (MD)


Simple Molecular Dynamics of $N$ particles interacting via a linear spring potential.

This example creates $N$ particles within a two-dimensional square domain, with periodic boundary conditions.

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

There is a linear spring force $\mathbf{f}_{ij}$ between particles $i$ and $j$ with a rest separation of $r$ (constant for all particles), and a
cutoff at $r$. That is, if $\mathbf{r}_i$ is the position of particle $i$ and $\mathbf{dx}_{ij}=\mathbf{r}_j-\mathbf{r}_j$, then

$$ \mathbf{f}_{ij} = \begin{cases} \frac{r-|\mathbf{dx}_{ij}|}{|\mathbf{dx}_{ij}|}\mathbf{dx}_{ij}, & \text{for } |\mathbf{dx}_{ij}|<r \\ 0 &


\text{otherwise}. \end{cases} $$

We wish to use a leap frog integrator to evolve positions $\mathbf{r}_i$ using velocities $\mathbf{v}_i$ and accelerations $\mathbf{a}_i =
\sum_j \mathbf{f}_{ij}$. This gives the following update equations for each timestep $n$

\begin{align*} \mathbf{v}^{n+1}_i &= \mathbf{v}^n_i + \frac{dt}{m_i} \sum_j \mathbf{f}^n_{ij} \\ \mathbf{r}^{n+1}_i &= \mathbf{r}^n_i + dt,
\mathbf{v}^{n+1}_i. \end{align*}

We implement this in Aboria using the code given below. Firstly we create the particle set data structure and add particles, ensuring that
we have an initial condition where all the spring forces are $\mathbf{f}_{ij}=0$. Then we start the timestep loop, using our update equations
given above.

#include <boost/math/constants/constants.hpp>
#include <math.h>
#include <random>
#include "Aboria.h"
using namespace Aboria;
int main() {
const double PI = boost::math::constants::pi<double>();
// Create a 2d particle container with one additional variable
// "velocity", represented by a 2d double vector
ABORIA_VARIABLE(velocity, vdouble2, "velocity")
typedef Particles<std::tuple<velocity>,2> container_type;
typedef typename container_type::position position;
// set parameters for the MD simulation
const int timesteps = 3000;
const int nout = 200;
const int timesteps_per_out = timesteps / nout;
const double L = 31.0 / 1000.0;
const int N = 30;
const double diameter = 0.0022;
const double k = 1.0e01;
const double dens = 1160.0;
const double mass = PI * std::pow(0.5 * diameter, 2) * dens;
const double reduced_mass = 0.5 * mass;
const double dt = (1.0 / 50.0) * PI / std::sqrt(k / reduced_mass);
// create N particles
container_type particles(N);
// create symbols and labels in order to use the expression API
Symbol<position> p;
Symbol<velocity> v;
Symbol<id> id_;
Uniform uniform;
VectorSymbolic<double, 2> vector;
Label<0, container_type> a(particles);
Label<1, container_type> b(particles);
// dx is a symbol representing the difference in positions of
// particle a and b.
auto dx = create_dx(a, b);
// sum is a symbolic function that sums a sequence of 2d vectors
AccumulateWithinDistance<std::plus<vdouble2>> sum(diameter);
// initialise particles to a uniform distribution
p[a] = L * vector(uniform[a], uniform[a]);
// zero initial velocity
v[a] = vector(0, 0);
// initiate neighbour search on a periodic 2d domain of side length
// L set average number of particles per cell to 1
particles.init_neighbour_search(vdouble2(0, 0), vdouble2(L, L),
vbool2(true, true));
// perform MD timestepping
for (int io = 0; io < nout; ++io) {
// on every i/o step write particle container to a vtk
// unstructured grid fle
std::cout << "." << std::fush;
#ifdef HAVE_VTK
vtkWriteGrid("particles", io, particles.get_grid(true));
#endif
for (int i = 0; i < timesteps_per_out; i++) {
// leap frog integrator
v[a] += dt *
// spring force between particles
sum(b, if_else(id_[a] != id_[b],

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

-k * (diameter / norm(dx) - 1.0), 0.0) *


dx) /
mass;
// update positions
p[a] += dt * v[a];
}
}
std::cout << std::endl;
}

Brownian Dynamics (BD)


This example creates two particle sets, the frst representing a set of point particles undergoing brownian motion, the second representing
a set of spheres with a given radius, different for each sphere.

The point particles diffuse around the three-dimensional, periodic domain, and refect off the spheres whenever they encounter them.

Let indicies $i$ and $j$ refer to a pair of point particles, and $a$ and $b$ refer to a pair of spheres. Let $\mathbf{p}_i$ be the position of
particle $i$, and let $\mathbf{dx}_{ij}$ refer to the shortest difference between the positions of particles $i$ and $j$. Let $r_b$ be the radius
of sphere $b$. Then the update equations used to evolve the system are given by

$$ \mathbf{p}_i = \mathbf{p}_i + \sqrt{2\, D\, dt}\, \mathbf{N} + \sum_b \begin{cases} -2\left(\frac{r_b}{||\mathbf{dx}_{ib}||} - 1\right)
\mathbf{dx}_{ib}, & \text{for } ||\mathbf{dx}_{ib}||<r_b \0 & \text{otherwise}. \end{cases} $$

where $D$ is the diffusion constant, $dt$ is the timestep and $\mathbf{N}$ is a three-dimensional vector containing random samples from a
normal distribution

#include "Aboria.h"
#include <random>
using namespace Aboria;
int main() {
ABORIA_VARIABLE(radius, double, "radius")
typedef Particles<std::tuple<radius>,3,std::vector> spheres_type;
typedef Particles<std::tuple<>,3,std::vector> points_type;
typedef position_d<3> position;
spheres_type spheres;
const double L = 10.0;
const double D = 1.0;
const double dt = 0.01;
const double timesteps = 500;
spheres.push_back(vdouble3(0, 0, 0));
get<radius>(spheres[0]) = 1.0;
spheres.push_back(vdouble3(5, 0, 0));
get<radius>(spheres[1]) = 2.0;
spheres.push_back(vdouble3(0, -5, 0));
get<radius>(spheres[2]) = 1.5;
spheres.push_back(vdouble3(0, 0, 5));
get<radius>(spheres[3]) = 1.0;
points_type points;
std::uniform_real_distribution<double> uni(-L + L / 5, L - L / 5);
std::default_random_engine generator;
for (int i = 0; i < 1000; ++i) {
points.push_back(
vdouble3(uni(generator), uni(generator), uni(generator)));
}
points.init_neighbour_search(vdouble3(-L, -L, -L), vdouble3(L, L, L),
vbool3(true, true, true));
spheres.init_neighbour_search(vdouble3(-L, -L, -L), vdouble3(L, L, L),
vbool3(false, false, false));
Symbol<position> p;
Symbol<radius> r;
Symbol<alive> alive_;
Label<0, spheres_type> a(spheres);
Label<1, spheres_type> b(spheres);
Label<0, points_type> i(points);
Label<1, points_type> j(points);
auto dx = create_dx(i, b);
Normal N;
VectorSymbolic<double, 3> vector;
AccumulateWithinDistance<std::bit_or<bool>> any(4);
AccumulateWithinDistance<std::plus<vdouble3>> sum(4);
int count_before = 0;
for (auto point : points) {
if ((get<position>(point) - get<position>(spheres[0])).norm() <
get<radius>(spheres[0])) {
count_before++;
}
}

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

/*
* Kill any points within spheres
*/
alive_[i] = !any(b, if_else(norm(dx) < r[b], true, false));
int count_after = 0;
for (auto point : points) {
if ((get<position>(point) - get<position>(spheres[0])).norm() <
get<radius>(spheres[0])) {
count_after++;
}
}
std::cout << " found " << count_before << " before and " << count_after
<< " after" << std::endl;
/*
* Diffusion step for points and refect off spheres
*/
for (int ts = 1; ts < timesteps; ++ts) {
if (ts % 10 == 0) {
#ifdef HAVE_VTK
vtkWriteGrid("bd", ts / 10, points.get_grid(true));
#endif
std::cout << "." << std::fush;
}
p[i] += std::sqrt(2 * D * dt) * vector(N[i], N[i], N[i]);
p[i] += sum(b, if_else(norm(dx) < r[b] && norm(dx) != 0,
-2 * (r[b] / norm(dx) - 1), 0) *
dx);
}
std::cout << std::endl;
}

Discrete Element Model (DEM)


An Discrete Element Model example, simulating a polydisperse set of spherical particles falling onto an surface.

We wish to describe a set of particles in 3D cuboid, which is periodic in the Cartesian $x$, and $y$ directions. There is a linear spring force
$\mathbf{f}_{ij}$ plus dissipation term between particles $i$ and $j$ with a rest separation at $s_i + s_j$ and a cutoff at $s_i + s_j$. That is,
if $\mathbf{r}_i$ is the position of particle $i$ and $\mathbf{dx}_{ij}=\mathbf{r}_j-\mathbf{r}_j$, then

$$ \mathbf{f}_{ij} = \begin{cases} \frac{s_i+s_j-|\mathbf{dx}_{ij}|}{|\mathbf{dx}_{ij}|}\mathbf{dx}_{ij} + \gamma(\mathbf{v}_j-\mathbf{v}_i), &


\text{for } |\mathbf{dx}_{ij}|<s_i+s_j \\ 0 & \text{otherwise}. \end{cases} $$

We wish to use a leap frog integrator to evolve positions $\mathbf{r}_i$ using velocities $\mathbf{v}_i$ and accelerations $\mathbf{a}_i =
\frac{1}{m_i} \sum_j \mathbf{f}_{ij} - \mathbf{g}$. This gives the following update equations for each timestep $n$

\begin{align*} \mathbf{v}^{n+1}_i &= \mathbf{v}^n_i + \frac{dt}{m_i} \sum_j \mathbf{f}^n_{ij} \\ \mathbf{r}^{n+1}_i &= \mathbf{r}^n_i + dt,
\mathbf{v}^{n+1}_i. \end{align*}

This fgure above shows the simulation domain. As well as periodic in $x$, and $y$, we wish to add a soft surface at $z=0$ that also
interacts with the particles using the same linear spring force. The domain is left open at $z=h$. We wish to initialise $N$ particles within
this domain, and ensure that they are non-interacting at $t=0$.

#include <random>
#include "Aboria.h"

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

using namespace Aboria;


#include <boost/math/constants/constants.hpp>
int main() {
const double PI = boost::math::constants::pi<double>();
/*
* create variable types
*/
ABORIA_VARIABLE(radius, double, "radius")
ABORIA_VARIABLE(mass, double, "mass")
ABORIA_VARIABLE(velocity, vdouble3, "velocity")
ABORIA_VARIABLE(acceleration, vdouble3, "acceleration")
/*
* create particle container
*/
typedef Particles<std::tuple<radius, velocity, acceleration, mass>>
dem_type;
typedef position_d<3> position;
dem_type dem;
/*
* simulation parameters
*/
const int timesteps = 3000;
const int nout = 200;
const int timesteps_per_out = timesteps / nout;
const double L = 31.0 / 1000.0;
const int N = 30;
/*
* dem parameters
*/
const double dem_diameter = 0.0022;
const double dem_gamma = 0.0004;
const double dem_k = 1.0e01;
const double dem_dens = 1160.0;
const double dem_mass_min =
(1.0 / 6.0) * PI * std::pow(0.5 * dem_diameter, 3) * dem_dens;
const double dem_mass_max =
(1.0 / 6.0) * PI * std::pow(dem_diameter, 3) * dem_dens;
const double dem_min_reduced_mass =
dem_mass_min * dem_mass_max / (dem_mass_min + dem_mass_max);
const double dt = (1.0 / 50.0) * PI /
sqrt(dem_k / dem_min_reduced_mass -
std::pow(0.5 * dem_gamma / dem_min_reduced_mass, 2));
/*
* initialise neighbour search with 3d cuboid domain,
* periodic in x and y, set cell size so that there is
* an average of 2 particles within each cell
*/
dem.init_neighbour_search(vdouble3(0, 0, -dem_diameter),
vdouble3(L / 3, L / 3, L + dem_diameter),
vbool3(true, true, false), 2);
/*
* create N random, non-overlaping particles with
* random radius between 0.5*dem_diameter and dem_diameter
*/
std::uniform_real_distribution<double> uni(0, 1);
std::default_random_engine generator;
for (int i = 0; i < N; ++i) {
bool free_position = false;
dem_type::value_type p;
get<radius>(p) = 0.25 * (uni(generator) + 1) * dem_diameter;
while (free_position == false) {
get<position>(p) =
vdouble3(uni(generator) * L / 3, uni(generator) * L / 3,
uni(generator) * (L - dem_diameter) + dem_diameter / 2);
free_position = true;
/*
* loop over all neighbouring particles within "dem_diameter" distance
*/
for (auto j = euclidean_search(dem.get_query(), get<position>(p),
dem_diameter);
j != false; ++j) {
if (j.dx().norm() < get<radius>(*j) + get<radius>(p)) {
free_position = false;
break;
}
}
}
dem.push_back(p);
}
/*
* create symbols and labels in order to use the expression API
*/
Symbol<position> p;
Symbol<radius> r;
Symbol<mass> m;
Symbol<velocity> v;
Symbol<acceleration> dvdt;
Symbol<id> id_;
Label<0, dem type> a(dem);

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

Label<1, dem_type> b(dem);


/*
* dx is a symbol representing the difference in positions of
* particle a and b.
*/
auto dx = create_dx(a, b);
/*
* sum is a symbolic function that sums a sequence of 3d vectors
* over neighbouring particles within "dem_diameter"
*/
AccumulateWithinDistance<std::plus<vdouble3>> sum(dem_diameter);
/*
* vector creates a new double vector of dimension 3
*/
VectorSymbolic<double, 3> vector;
/*
* perform MD timestepping
*/
v[a] = vdouble3::Zero();
m[a] = (1.0 / 6.0) * PI * 8 * r[a] * r[a] * r[a] * dem_dens;
for (int io = 0; io < nout; ++io) {
std::cout << "." << std::fush;
#ifdef HAVE_VTK
vtkWriteGrid("dem", io, dem.get_grid(true), {{"time", io / 2.0}});
#endif
for (int i = 0; i < timesteps_per_out; i++) {
p[a] += v[a] * dt;
dvdt[a] =
( // spring force between dem particles
sum(b, if_else(norm(dx) < r[a] + r[b] && id_[a] != id_[b],
-dem_k * ((r[a] + r[b]) / norm(dx) - 1) * dx +
dem_gamma * (v[b] - v[a]),
vdouble3::Zero()))
// spring force between particles and bottom wall
+ if_else(r[a] - p[a][2] > 0, dem_k * (r[a] - p[a][2]), 0.0) *
vdouble3(0, 0, 1)
// gravity force
+ vdouble3(0, 0, -9.81) * m[a]
) /
m[a];
v[a] += dvdt[a] * dt;
}
}
std::cout << std::endl;
}

Smoothed Particle Hydrodynamics (SPH)


An Smoothed Particle Hydrodynamics example, simulating a 2D water column over a no-slip boundary. The x and y directions are
periodic.

Simulation of a water column in hydrostatic equilibrium. SPH discretises the Navier-Stokes equations using radial interpolation kernels
defned over a given particle set. See the following papers for more details than can be described here:

M. Robinson, J. J. Monaghan, Direct numerical simulation of decaying two-dimensional turbulence in a no-slip square box using smoothed
par- ticle hydrodynamics, International Journal for Numerical Methods in Fluids 70 (1) (2012) 37–55

M. Robinson, M. Ramaioli, S. Luding, Fluid-particle fow simulations us- ing two-way-coupled mesoscale SPH-DEM and validation,
International Journal of Multiphase Flow 59 (2014) 121–134.

SPH is based on the idea of kernel interpolation. A fuid variable $A(\mathbf{r})$ (such as velocity or density) is interpolated using a kernel
$W$, which depends on the smoothing length variable $h$.

\begin{equation}\label{Eq:integralInterpolant} A(\mathbf{r}) = \int A(\mathbf{r'})W(\mathbf{r}-\mathbf{r'},h)d\mathbf{r'}. \end{equation}

where $m_b$ and $\rho_b$ are the mass and density of particle $b$.

Here we have used the ffth-order Wendland kernel for $W$, which has the form

\begin{eqnarray} W(q) = \frac{\beta}{h^d} \begin{cases} (2-q)^4(1+2q) & \text{for } 0 \leq q \le 2, \ 0 & \text{for } q > 2. \end{cases}
\end{eqnarray}

where $q = ||\mathbf{r}-\mathbf{r'}||/h$.

The rate of change of density, or continuity equation, is given by

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

\begin{equation} \label{Eq:changeInDensity} \frac{D\rho_a}{Dt} = \frac{1}{\Omega_a}\sum_b m_b \mathbf{v}_{ab} \cdot


abla_a W_{ab}, \end{equation}

where $\mathbf{v}_{ab}=\mathbf{v}_a-\mathbf{v}_b$. The correction term $\Omega_a$ due to variable $h$ is given by

\begin{equation} \Omega_a = 1 - \frac{\partial h_a}{\partial \rho_a} \sum_b m_b \frac{\partial W_{ab}(h_a)}{\partial h_a}. \end{equation}

The equation of state used is the standard quasi-compressible form

\begin{equation} P = B \left ( \left ( \frac{\rho}{\rho_0} \right )^\gamma - 1 \right ), \end{equation}

where $\gamma = 7$ is a typical value and $\rho_0$ is a reference density that is normally set to the density of the fuid.

The SPH momentum equation is given as below. Viscosity is included by adding a viscous term $\Pi$

\begin{equation}\label{Eq:sphJustPressureForce} \frac{d\mathbf{v}_a}{dt} = -\sum_b m_b \left [ \left ( \frac{P_a}{\Omega_a \rho_a^2} +


\Pi_{ab} \right )
abla_a W_{ab}(h_a) + \left ( \frac{P_b}{\Omega_b \rho_b^2} + \Pi_{ab} \right )
abla_a W_{ab}(h_b) \right ], \end{equation}

The SPH literature contains many different forms for $\Pi$. We have used the term

\begin{equation}\label{Eq:monaghansViscousTerm} \Pi_{ab} = - \alpha \frac{v_{sig} (\mathbf{v}_{ab} \cdot \mathbf{r}_{ab} )}{2


\overline{\rho}_{ab} |\mathbf{r}_{ab}|}, \end{equation}

where $v_{sig} = 2(c_s + |\mathbf{v}_{ab} \cdot \mathbf{r}_{ab}| / |\mathbf{r}_{ab}| )$ is a signal velocity that represents the speed at which
information propagates between the particles.

The particle's position and velocity were integrated using the Leapfrog second order method, which is also reversible in time in the
absence of viscosity. To preserve the reversibility of the simulation, $d\rho/dt$ was calculated using the particle's position and velocity at
the end of the timestep, rather than the middle as is commonly done. The full integration scheme is given by

\begin{align} \mathbf{r}^{\frac{1}{2}} &= \mathbf{r}^{0} + \frac{\delta t}{2} \mathbf{v}^{0}, \\ \mathbf{v}^{\frac{1}{2}} &= \mathbf{v}^{0} +
\frac{\delta t}{2} F(\mathbf{r}^{-\frac{1}{2}},\mathbf{v}^{-\frac{1}{2}},\rho^{-\frac{1}{2}}), \\ \rho^{\frac{1}{2}} &= \rho^{0} + \frac{\delta t}{2}
D(\mathbf{r}^0,\mathbf{v}^0), \label{Eq:timestepDensity1} \\ \mathbf{v}^{1} &= \mathbf{v}^{0} + \delta t
F(\mathbf{r}^{\frac{1}{2}},\mathbf{v}^{\frac{1}{2}},\rho^{\frac{1}{2}}), \\ \mathbf{r}^{1} &= \mathbf{r}^{\frac{1}{2}} + \frac{\delta t}{2}
\mathbf{v}^{1}, \\ \rho^{1} &= \rho^{\frac{1}{2}} + \frac{\delta t}{2} D(\mathbf{r}^1,\mathbf{v}^1), \label{Eq:timestepDensity2} \end{align}

where $\mathbf{r}^0$, $\mathbf{r}^{1/2}$ and $\mathbf{r}^1$ is $\mathbf{r}$ at the start, mid-point and end of the timestep respectively. The
functions $F$ and $D$ are respectivly the momentum and continuity equations given above. The timestep $\delta t$ is bounded by the
standard Courant condition

\begin{equation} \delta t_1 \le \min_a \left ( 0.8 \frac{h_a}{v_{sig}} \right ), \end{equation}

where the minimum is taken over all the particles.

#include "Aboria.h"
using namespace Aboria;
#include <boost/math/constants/constants.hpp>
const double PI = boost::math::constants::pi<double>();
const double WCON_WENDLAND = 21.0 / (256.0 * PI);
const unsigned int NDIM = 3;
/*
* Note that we are using standard C++ function objects to implement
* the kernel W and its gradient F. We can wrap these as lazy Aboria
* functions that can be used within the symbolic Level 3 API.
*/
struct F_fun {
typedef double result_type;
double operator()(const double r, const double h) const {
if (r == 0)
return 0;
const double q = r / h;
if (q <= 2.0) {
return (1 / std::pow(h, NDIM + 2)) * WCON_WENDLAND *
(-4 * std::pow(2 - q, 3) * (1 + 2 * q) + 2 * std::pow(2 - q, 4)) /
q;
} else {
return 0.0;
}
}
};
struct W_fun {
typedef double result_type;
double operator()(const double r, const double h) const {
const double q = r / h;

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

if (q <= 2.0) {
return (1 / std::pow(h, NDIM)) * WCON_WENDLAND * std::pow(2.0 - q, 4) *
(1.0 + 2.0 * q);
} else {
return 0.0;
}
}
};
ABORIA_BINARY_FUNCTION(F, F_fun, SymbolicDomain);
ABORIA_BINARY_FUNCTION(W, W_fun, SymbolicDomain);
int main() {
ABORIA_VARIABLE(kernel_radius, double, "kernel radius");
ABORIA_VARIABLE(velocity, vdouble3, "velocity");
ABORIA_VARIABLE(velocity_tmp, vdouble3, "temp velocity");
ABORIA_VARIABLE(varh_omega, double, "varh omega");
ABORIA_VARIABLE(density, double, "density");
ABORIA_VARIABLE(total_force, vdouble3, "total force");
ABORIA_VARIABLE(is_fxed, uint8_t, "fxed boundary");
ABORIA_VARIABLE(pressure_div_density2, double, "pressure div density2");
typedef Particles<
std::tuple<kernel_radius, velocity, velocity_tmp, varh_omega,
density, total_force, is_fxed,
pressure_div_density2>, 3>
sph_type;
typedef position_d<3> position;
sph_type sph;
Symbol<position> p;
Symbol<id> id_;
Symbol<velocity> v;
Symbol<velocity_tmp> v0;
Symbol<density> rho;
Symbol<total_force> dvdt;
Symbol<is_fxed> fxed;
Symbol<varh_omega> omega;
Symbol<kernel_radius> h;
Symbol<pressure_div_density2> pdr2;
Label<0, sph_type> a(sph);
Label<1, sph_type> b(sph);
const int timesteps = 200;
const int nout = 10;
const int timesteps_per_out = timesteps / nout;
const double L = 31.0 / 1000.0;
const int nx = 5;
/*
* sph parameters
*/
const double hfac = 1.5;
const double visc = 8.9e-07;
const double refd = 1000.0;
const double dens = 1000.0;
const double gamma = 7;
const double VMAX = 2.0 * sqrt(2 * 9.81 * L);
const double CSFAC = 10.0;
const double spsound = CSFAC * VMAX;
const double prb = std::pow(refd / dens, gamma - 1.0) *
std::pow(spsound, 2) * refd / gamma;
const double psep = L / nx;
double dt = std::min(0.25 * hfac * psep / spsound,
0.125 * std::pow(hfac * psep, 2) / visc);
const double mass = dens * std::pow(psep, NDIM);
std::cout << "h = " << hfac * psep << " vmax = " << VMAX << std::endl;
const double time_damping = dt * 500;
double t = 0;
const vdouble3 low(0, 0, -3.0 * psep);
const vdouble3 high(L, L, L);
const vbool3 periodic(true, true, false);
for (int i = 0; i < nx; i++) {
for (int j = 0; j < nx; j++) {
for (int k = 0; k < nx + 3; k++) {
typename sph_type::value_type p;
get<position>(p) = low + vdouble3((i + 0.5) * psep, (j + 0.5) * psep,
(k + 0.5) * psep);
get<kernel_radius>(p) = hfac * psep;
get<velocity>(p) = vdouble3(0, 0, 0);
get<velocity_tmp>(p) = vdouble3(0, 0, 0);
get<varh_omega>(p) = 1.0;
get<density>(p) = dens;
get<total_force>(p) = vdouble3(0, 0, 0);
get<is_fxed>(p) = get<position>(p)[2] < 0;
sph.push_back(p);
}
}
}
std::cout << "starting...." << std::endl;
sph.init_neighbour_search(low, high, periodic);

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

auto dx = create_dx(a, b);


AccumulateWithinDistance<std::plus<vdouble3>> sum_vect(2 * hfac * psep);
AccumulateWithinDistance<std::plus<double>> sum(2 * hfac * psep);
Accumulate<Aboria::max<double>> max;
max.set_init(0);
Accumulate<Aboria::min<double>> min;
min.set_init(L);
VectorSymbolic<double, 3> vector;
for (int i = 0; i < nout; ++i) {
#ifdef HAVE_VTK
vtkWriteGrid("sph", i, sph.get_grid(true));
#endif
for (int k = 0; k < timesteps_per_out; ++k) {
/*
* 0 -> 1/2 step
*/
v[a] += if_else(fxed[a] == false, dt / 2, 0) * dvdt[a];
if (t < time_damping)
v[a] *= 0.98;
p[a] += dt / 2 * v[a];
/*
* Calculate omega
*/
omega[a] =
1.0 - (mass / (rho[a] * NDIM)) *
sum(b, if_else(norm(dx) < 2 * h[a],
pow(norm(dx), 2) * F(norm(dx), h[a]) +
NDIM * W(norm(dx), h[a]),
0));
/*
* 1/2 -> 1 step
*/
/*
* calculate change in density and kernel radius
*/
rho[a] += dt * (mass / omega[a]) *
sum(b, if_else(norm(dx) < 2 * h[a],
dot(v[b] - v[a], dx * F(norm(dx), h[a])), 0));
h[a] = pow(mass / rho[a], 1.0 / NDIM);
/*
* reset neighbour search for new kernel radius
*/
const double maxh = eval(max(a, h[a]));
const double minh = eval(min(a, h[a]));
sum_vect.set_max_distance(2 * maxh);
sum.set_max_distance(2 * maxh);
/*
* advance velocity, position and calculate pdr2
*/
v0[a] = v[a];
v[a] += if_else(fxed[a] == false, dt / 2.0, 0.0) * dvdt[a];
pdr2[a] = prb * (pow(rho[a] / refd, gamma) - 1.0) / pow(rho[a], 2);
p[a] += dt / 2 * v0[a];
/*
* acceleration due to gravity
*/
dvdt[a] = vdouble3(0, 0, -9.81);
/*
* acceleration on SPH calculation
*/
dvdt[a] +=
mass *
sum_vect(b,
if_else(norm(dx) < 2 * h[a],
// pressure force
((1.0 / omega[a]) * pdr2[a] * F(norm(dx), h[a]) +
(1.0 / omega[b]) * pdr2[b] * F(norm(dx), h[b])) *
dx
// viscous force
+ (v[a] - v[b]) * visc * (rho[a] + rho[b]) /
(rho[a] * rho[b]) * F(norm(dx), h[a])
,
vector(0, 0, 0)));
/*
* 1/2 -> 1 step for velocity
*/
v[a] = if_else(fxed[a] == false, v0[a] + dt / 2 * dvdt[a],
vector(0, 0, 0));
t += dt;
/*
* sph timestep condition
*/
dt = std::min(0.25 * minh / spsound, 0.125 * std::pow(minh, 2) / visc);
}

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

std::cout << "iteration " << i << std::endl;


}
}

Kernel Operator API

Radial Basis Function (RBF) Interpolation


Kansa Method for PDEs

Radial Basis Function (RBF) Interpolation


Here we interpolate a function $f(x,y)$ over the two-dimensional unit cube from $(0,0)$ to $(1,1)$, using the multiquadric Radial Basis
Function (RBF).

The function to be interpolated is

\begin{equation} f(x,y) = \exp(-9(x-\frac{1}{2})^2 - 9(y-\frac{1}{4})^2), \end{equation}

and the multiquadric RBF $K(r)$ is given by

\begin{equation} K(r) = \sqrt{r^2 + c^2}. \end{equation}

We create a set of basis functions around a set of $N$ particles with positions $\mathbf{x}_i$. In this case the radial coordinate around
each point is $r = ||\mathbf{x}_i - \mathbf{x}||$. The function $f$ is approximated using the sum of these basis functions, with the addition of
a constant factor $\beta$

\begin{equation} \overline{f}(\mathbf{x}) = \beta + \sum_i \alpha_j K(||\mathbf{x}_i-\mathbf{x}||). \end{equation}

We exactly interpolate the function at $\mathbf{x}_i$ (i.e. set $\overline{f}(\mathbf{x}_i)=f(\mathbf{x}_i)$), leading to

\begin{equation} f(\mathbf{x}_i) = \beta + \sum_j \alpha_j K(||\mathbf{x}_j-\mathbf{x}_i||). \end{equation}

Note that the sum $j$ is over the same particle set.

We also need one additional constraint to fnd $\beta$

\begin{equation} 0 = \sum_j \alpha_j. \end{equation}

We rewrite the two previous equations as a linear algebra expression

\begin{equation} \mathbf{\Phi} = \begin{bmatrix} \mathbf{G}&\mathbf{P} \\ \mathbf{P}^T & \mathbf{0} \end{bmatrix} \begin{bmatrix}


\mathbf{\alpha} \\ \mathbf{\beta} \end{bmatrix} = \mathbf{W} \mathbf{\gamma}, \end{equation}

where $\mathbf{\Phi} = [f(\mathbf{x}_1),f(\mathbf{x}_2),...,f(\mathbf{x}_N),0]$, $\mathbf{G}$ is an $N \times N$ matrix with elements $G_{ij}


= K(||\mathbf{x}_j-\mathbf{x}_i||)$ and $\mathbf{P}$ is a $N \times 1$ vector of ones.

The basis function coeffcients $\mathbf{\gamma}$ are found by solving this equation. To do this, we use the iterative solvers found in the
Eigen package and Aboria's ability to wrap C++ function objects as Eigen matricies.

#include "Aboria.h"
#include <random>
using namespace Aboria;
int main() {
auto funct = [](const double x, const double y) {
return std::exp(-9 * std::pow(x - 0.5, 2) - 9 * std::pow(y - 0.25, 2));
// return x;
};
ABORIA_VARIABLE(alpha, double, "alpha value")
ABORIA_VARIABLE(interpolated, double, "interpolated value")
ABORIA_VARIABLE(constant2, double, "c2 value")
typedef Particles<std::tuple<alpha, constant2, interpolated>, 2,
std::vector, SearchMethod>
ParticlesType;
typedef position_d<2> position;
typedef typename ParticlesType::const_reference const_particle_reference;
typedef Eigen::Matrix<double, Eigen::Dynamic, 1> vector_type;
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> matrix_type;
ParticlesType knots;
ParticlesType augment;

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

ParticlesType test;
const double c = 0.5;
const int N = 1000;
const int max_iter = 100;
const int restart = 101;
typename ParticlesType::value_type p;
std::default_random_engine generator;
std::uniform_real_distribution<double> distribution(0.0, 1.0);
for (int i = 0; i < N; ++i) {
get<position>(p) =
vdouble2(distribution(generator), distribution(generator));
get<constant2>(p) = std::pow(c, 2);
knots.push_back(p);
get<position>(p) =
vdouble2(distribution(generator), distribution(generator));
get<constant2>(p) = std::pow(c, 2);
test.push_back(p);
}
// knots.init_neighbour_search(min,max,periodic);
augment.push_back(p);
auto kernel = [](const_particle_reference a, const_particle_reference b) {
return std::sqrt((get<position>(b) - get<position>(a)).squaredNorm() +
get<constant2>(b));
};
auto one = [](const_particle_reference a, const_particle_reference b) {
return 1.0;
};
auto G = create_dense_operator(knots, knots, kernel);
auto P = create_dense_operator(knots, augment, one);
auto Pt = create_dense_operator(augment, knots, one);
auto Zero = create_zero_operator(augment, augment);
auto W = create_block_operator<2, 2>(G, P, Pt, Zero);
auto G_test = create_dense_operator(test, knots, kernel);
auto W_test = create_block_operator<2, 2>(G_test, P, Pt, Zero);
vector_type phi(N + 1), gamma(N + 1);
for (size_t i = 0; i < knots.size(); ++i) {
const double x = get<position>(knots[i])[0];
const double y = get<position>(knots[i])[1];
phi[i] = funct(x, y);
}
phi[knots.size()] = 0;
matrix_type W_matrix(N + 1, N + 1);
W.assemble(W_matrix);
gamma = W_matrix.ldlt().solve(phi);
Eigen::GMRES<matrix_type> gmres;
gmres.setMaxIterations(max_iter);
gmres.set_restart(restart);
gmres.compute(W_matrix);
gamma = gmres.solve(phi);
std::cout << "GMRES: #iterations: " << gmres.iterations()
<< ", estimated error: " << gmres.error() << std::endl;
phi = W * gamma;
double rms_error = 0;
double scale = 0;
for (size_t i = 0; i < knots.size(); ++i) {
const double x = get<position>(knots[i])[0];
const double y = get<position>(knots[i])[1];
const double truth = funct(x, y);
const double eval_value = phi[i];
rms_error += std::pow(eval_value - truth, 2);
scale += std::pow(truth, 2);
// TS_ASSERT_DELTA(eval_value,truth,2e-3);
}
std::cout << "rms_error for global support, at centers = "
<< std::sqrt(rms_error / scale) << std::endl;
TS_ASSERT_LESS_THAN(std::sqrt(rms_error / scale), 1e-6);
phi = W_test * gamma;
rms_error = 0;
scale = 0;
for (size_t i = 0; i < test.size(); ++i) {
const double x = get<position>(test[i])[0];
const double y = get<position>(test[i])[1];
const double truth = funct(x, y);
const double eval_value = phi[i];
rms_error += std::pow(eval_value - truth, 2);
scale += std::pow(truth, 2);
// TS_ASSERT_DELTA(eval_value,truth,2e-3);
}
std::cout << "rms_error for global support, away from centers = "

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

<< std::sqrt(rms_error / scale) << std::endl;


TS_ASSERT_LESS_THAN(std::sqrt(rms_error / scale), 1e-5);
}

Kansa Method for PDEs

#include "Aboria.h"
using namespace Aboria;
int main() {
auto funct = [](const double x, const double y) {
return std::cos(4*x+4*y);
};
auto laplace_funct = [](const double x, const double y) {
return -32*std::cos(4*x+4*y);
};
ABORIA_VARIABLE(boundary,uint8_t,"is boundary knot")
ABORIA_VARIABLE(interpolated,double,"interpolated value")
ABORIA_VARIABLE(constant2,double,"c2 value")
ABORIA_VARIABLE(alpha,double,"alpha value")
typedef Particles<std::tuple<alpha,boundary,constant2,interpolated>,2> ParticlesType;
typedef position_d<2> position;
typedef typename ParticlesType::const_reference const_particle_reference;
typedef Eigen::Map<Eigen::Matrix<double,Eigen::Dynamic,1>> map_type;
typedef Eigen::Matrix<double,Eigen::Dynamic,1> vector_type;
ParticlesType knots,augment;
const double c = 0.5;
const int max_iter = 100;
const int restart = 100;
const int nx = 7;
constexpr int N = (nx+1)*(nx+1);
const double delta = 1.0/nx;
typename ParticlesType::value_type p;
for (int i=0; i<=nx; ++i) {
for (int j=0; j<=nx; ++j) {
get<position>(p) = vdouble2(i*delta,j*delta);
if ((i==0)||(i==nx)||(j==0)||(j==nx)) {
get<boundary>(p) = true;
} else {
get<boundary>(p) = false;
}
get<constant2>(p) = std::pow(c,2);
knots.push_back(p);
}
}
augment.push_back(p);
auto kernel = [](
const_particle_reference a,
const_particle_reference b) {
const vdouble2 dx = get<position>(b) - get<position>(a);
return std::exp(-dx.squaredNorm()/get<constant2>(b));
};
auto laplace_kernel = [](
const_particle_reference a,
const_particle_reference b) {
const vdouble2 dx = get<position>(b) - get<position>(a);
return 4.0*(dx.squaredNorm()-get<constant2>(b))*
std::exp(-dx.squaredNorm()/get<constant2>(b))/
(get<constant2>(b)*get<constant2>(b));
};
auto G = create_dense_operator(knots,knots,
[kernel,laplace_kernel](
const_particle_reference a,
const_particle_reference b) {
if (get<boundary>(a)) {
return kernel(a,b);
} else {
return laplace_kernel(a,b);
}
});
auto P = create_dense_operator(knots,augment,
[](
const_particle_reference a,
const_particle_reference b) {
if (get<boundary>(a)) {
return 1.0;
} else {
return 0.0;
}
});
auto Pt = create_dense_operator(augment,knots,

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Examples

[](
const_particle_reference a,
const_particle_reference b) {
if (get<boundary>(b)) {
return 1.0;
} else {
return 0.0;
}
});
auto Zero = create_zero_operator(augment,augment);
auto W = create_block_operator<2,2>(G, P,
Pt,Zero);

vector_type phi(N+1), gamma(N+1);


for (int i=0; i<N; ++i) {
const double x = get<position>(knots[i])[0];
const double y = get<position>(knots[i])[1];
if (get<boundary>(knots[i])) {
phi[i] = funct(x,y);
} else {
phi[i] = laplace_funct(x,y);
}
}
phi[N] = 0;
std::cout << std::endl;
Eigen::GMRES<decltype(W), Eigen::DiagonalPreconditioner<double>> gmres;
gmres.set_restart(restart);
gmres.setMaxIterations(max_iter);
gmres.compute(W);
gamma = gmres.solve(phi);
std::cout << "GMRES: #iterations: " << gmres.iterations() << ", estimated error: " <<
gmres.error() << std::endl;
phi = W*gamma;
for (int i=0; i<N; ++i) {
const double x = get<position>(knots[i])[0];
const double y = get<position>(knots[i])[1];
if (get<boundary>(knots[i])) {
TS_ASSERT_DELTA(phi[i],funct(x,y),2e-3);
} else {
TS_ASSERT_DELTA(phi[i],laplace_funct(x,y),2e-3);
}
}
TS_ASSERT_DELTA(phi[N],0,2e-3);

map_type alpha_wrap(get<alpha>(knots).data(),N);
map_type interp_wrap(get<interpolated>(knots).data(),N);
alpha_wrap = gamma.segment<N>(0);
vector_type beta = vector_type::Constant(N,gamma[N]);
auto K = create_dense_operator(knots,knots,kernel);
interp_wrap = K*alpha_wrap + beta;
double rms_error = 0;
double scale = 0;
for (int i=0; i<N; ++i) {
const double x = get<position>(knots[i])[0];
const double y = get<position>(knots[i])[1];
const double truth = funct(x,y);
const double eval_value = get<interpolated>(knots[i]);
rms_error += std::pow(eval_value-truth,2);
scale += std::pow(truth,2);
TS_ASSERT_DELTA(eval_value,truth,1e-2);
}
std::cout << "rms_error for global support, at centers =
"<<std::sqrt(rms_error/scale)<<std::endl;
TS_ASSERT_LESS_THAN(std::sqrt(rms_error/scale),1e-3);
}

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/examples.html[10/22/2018 7:34:14 AM]


Benchmarks

Benchmarks

Vector Addition
DAXPY
Dense non-linear operator
Neighbour search non-linear operator

Vector Addition
Here we aim to compute a simple vector addition operation

$$ a_i = b_i + c_i \text{ for } i = 0...N. $$

A particle set containing the variables $a$, $b$ and $c$ can be defned in Aboria like so

ABORIA_VARIABLE(a_var,double,"a")
ABORIA_VARIABLE(b_var,double,"b")
ABORIA_VARIABLE(c_var,double,"c")
typedef Particles<std::tuple<a_var,b_var,c_var>,3> nodes_type;
nodes_type nodes(N);

The vector addition operation can then be calculated using the Level 3 layer like so

Symbol<a_var> a;
Symbol<b_var> b;
Symbol<c_var> c;
Label<0,nodes_type> i(nodes);
a[i] = b[i] + c[i];

We compare this with Level 1 Aboria using the get functions and looping through the container

for (size_t i=0; i<N; i++) {


get<a_var>(nodes)[i] = get<b_var>(nodes)[i] + get<c_var>(nodes)[i];
}

We also compare against a plain std::vector implementation like so

std::vector<double> a(N),b(N),c(N);
for (size_t i=0; i<N; i++) {
a[i] = b[i] + c[i];
}

Finally we compare against an Eigen implementation:

typedef Eigen::Matrix<double,Eigen::Dynamic,1> vector_type;


vector_type a(N),b(N),c(N);
a = b + c;

We can measure the time taken by the last line in the code segment above for varying $N$, and compare the four different
implementations

The resultant benchmarks are shown in the Figure below, where it can be seen that the four approaches are very similar in speed,
confrming that [Aboria][] can achieve zero-cost abstraction, at least in this simple case. More complicated cases are explored below.

https://martinjrobins.github.io/Aboria/aboria/benchmarks.html[10/22/2018 7:34:28 AM]


Benchmarks

DAXPY
This benchmark is for the BLAS DAXPY operation, given by

$$ a_i = a_i + 0.1*b_i \text{ for } i = 0...N. $$

This is implemented in Aboria using

a[i] += 0.1*b[i];

We compare against a Level 1 implementation like so

for (size_t i=0; i<N; i++) {


get<a_var>(nodes)[i] += 0.1*get<b_var>(nodes)[i];
}

and a std::vector implementation like so

std::vector<double> a(N),b(N);
for (size_t i=0; i<N; i++) {
a[i] += 0.1*b[i];
}

and an Eigen implementation

typedef Eigen::Matrix<double,Eigen::Dynamic,1> vector_type;


vector_type a(N),b(N);
a += 0.1*b;

The comarison benchmarks for varying $N$ are shown below

https://martinjrobins.github.io/Aboria/aboria/benchmarks.html[10/22/2018 7:34:28 AM]


Benchmarks

Dense non-linear operator


Here we move onto a dense, $N^2$ operation, given by the non-linear operator

$$ a_i = a_i + \sum_j^N a_j \sqrt{\mathbf{dx}_{ij} \cdot \mathbf{dx}_{ij} + b_j^2} \text{ for } i = 0...N. $$

where $\mathbf{dx}_{ij}$ is the shortest vector from particle $i$ to $i$. This is implemented in Level 3 Aboria like so

Label<1,nodes_type> j(nodes);
auto dx = create_dx(i,j);
Accumulate<std::plus<double> > sum;
a[i] += sum(j,true,a[j]*sqrt(dot(dx,dx)+b[j]*b[j]));

This is compared against a std::vector implementation. Note that this operator involves aliasing, in that the update variable $a$
appears within the sum, so we need to accumulate the update to a temporary buffer before we assign to $a_i$.

The implementation is shown below (note the openMP parallel loops are turned off for the plot below)

std::vector<double> x(N), y(N), b(N), a(N), a_buffer(N);


#pragma omp parallel for
for (size_t i = 0; i < N; ++i) {
a_buffer[i] = a[i];
for (size_t j = 0; j < N; ++j) {
const double dx_x = x[j]-x[i];
const double dx_y = y[j]-x[i];
a_buffer[i] += a[j]*std::sqrt(dx_x*dx_x+dx_y*dx_y+b[j]*b[j]);
}
}
#pragma omp parallel for
for (size_t i = 0; i < N; ++i) {
a[i] = a_buffer[i];
}

The benchmarks are shown below.

https://martinjrobins.github.io/Aboria/aboria/benchmarks.html[10/22/2018 7:34:28 AM]


Benchmarks

Neighbour search non-linear operator


Finally we implement a non-linear operator involving a neighbour search, common in particle-based methods. This is given by

$$ a_i = \sum_j^N \begin{cases} \frac{r-|\mathbf{dx}_{ij}|}{|\mathbf{dx}_{ij}|}\mathbf{dx}_{ij} , & \text{for } |\mathbf{dx}_{ij}|<r \\ 0 &


\text{otherwise}, \end{cases} \text{ for } i = 0...N. $$

where $r$ is a given constant.

a[i] = sum(j,norm(dx)<r,(r-norm(dx))/norm(dx)*dx);

The benchmarks are shown below.

https://martinjrobins.github.io/Aboria/aboria/benchmarks.html[10/22/2018 7:34:28 AM]


Benchmarks

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/benchmarks.html[10/22/2018 7:34:28 AM]


API Overview

API Overview

libaboria

Header: <Aboria.h>

Utility
Vector - a $n$-dimensional vector of a given type

Level 1 - Data structures

Table 2. Creating a particle set

Class Name Description

Aboria::Particles The main particle set container, implemented as a zipped set of vectors

Objects of this class are normally never created. Instead, this class is used as a "tag" type, and is
Aboria::Variable
used to name variables that are added to the particle set

This is a pre-processor macro that creates a Aboria::Variable class, use this rather than
ABORIA_VARIABLE
using Aboria::Variable directly

Table 3. Getting particles and variables

Class Name Description

This is used to refer to an individual particle in a Aboria::Particles. It implements a


tuple of values or references, or pointers, that are or point to the variables of that particle.
Aboria::getter_type
When you use the Aboria::Particles::operator[] operator, you get a
Aboria::getter_type that contains references to that particle's variables

This function is used to "get" a variable from a Aboria::getter_type. It it used in a


Aboria::get similar fashion to the std::get function, but takes a Aboria::Variable type as the
template argument instead of an int

This class is an iterator for the Aboria::Particles class. It points to a single particle
Aboria::zip_iterator within the particle set. Dereferencing it gives you a Aboria::getter_type that contains
references to the particle's variables

Table 4. Neighbourhood Search Data Structures

Class Name Description

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

This spatial data structure implements a cell list. That is, it divides the space into a
Aboria::CellList regular grid of cells, or buckets, that contain particles. This is the default spatial
data structure used within Aboria::Particles

This is similar to CellList, but uses the ordering of the particles in


Aboria::Particles to implement the cell list data structure. This makes it more
Aboria::CellListOrdered
suitable for parallel computation, but not suitable for particles that change their
positions rapidly

Aboria::Kdtree This implements a kdtree spatial data structure.

This implements a kdtree spatial data structure. Note that this wraps the
Aboria::KdtreeNanofann Nanofann library <https://github.com/jlblancoc/nanofann> for tree construction,
but Aboria routines are used for all queries.

Aboria::HyperOctree This implements a hyper oct-tree data structure

Aboria::Particles::get_query returns a query object that can be used to


Aboria::CellListQuery query the spatial data structure for that particle set. This is the query object for the
serial cell lists data structure

Aboria::CellListOrderedQuery This is the query object for the Aboria::CellListOrdered data structure

Aboria::KdtreeQuery This is the query object for the kd-tree data structure

Aboria::KdtreeNanofannQuery This is the query object for the kd-tree data structure

Aboria::HyperOctreeQuery This is the query object for the hyper oct-tree data structure

Table 5. Internal Traits for Level 0 vector

To use a STL compatible vector to construct a Aboria::Particles, a


Aboria::Traits<std::vector>
specialisation of Aboria::Traits must exist

Level 2 - Algorithms

Table 6. Neighbourhood Searching

Class Name Description

performs a distance search around a given point, using a given p-norm for the distance
Aboria::distance_search
measure

Aboria::euclidean_search performs a distance search around a given point, using euclidean distance

Aboria::manhatten_search performs a distance search around a given point, using manhatten distance

Aboria::chebyshev_search performs a distance search around a given point, using chebyshev distance

Table 7. Kernel Approximations

Class Name Description

Class used to perform a fast multipole method. Takes a set of


Aboria::FastMultipoleMethod
expansions that are used to approximate the kernel function

Aboria::make fmm Helper class that returns a Aboria::FastMultipoleMethod

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

Returns a set of expansions for the black box fast multipole method.
Aboria::make_black_box_expansion
Uses chebyshev interpolation to approximate a kernel function

Same as Aboria::FastMultipoleMethod, but stores the action


Aboria::H2LibMatrix of the kernel operator as a hierarchical H2 matrix using H2Lib, for
repeated applications

Aboria::make_h2lib_matrix Helper class that returns a Aboria::H2LibMatrix

Returns a set of expansions for the black box fast multipole method,
Aboria::make_h2lib_black_box_expansion
designed to be used in conjunction with Aboria::H2LibMatrix

Level 3 - Kernel Operators

Table 8. Eigen Wrapping

Class Name Description

This is a matrix replacement class that can be used within the Eigen linear algebra
library. It follows the layout given in the Eigen documentation for matrix-free operators.
Aboria::MatrixReplacement
Note that this "matrix" can only be used in a matrix-vector multiply with a standard
Eigen vector, or in Eigen's iterative solvers

Table 9. Creating Eigen Kernel Operators

Class Name Description

Creates an instance of Aboria::MatrixReplacement. It takes a


Aboria::create_dense_operator
standard C++ function object or lambda expression

Creates an instance of Aboria::MatrixReplacement that implements a


Aboria::create_sparse_operator sparse matrix, where the elements are assumed zero for particle pairs that
are separated by more than a given distance.

Creates an instance of Aboria::MatrixReplacement that implements a


Aboria::create_zero_operator
zero matrix

Creates an instance of Aboria::MatrixReplacement. When multiplied


Aboria::create_chebyshev_operator by a vector, the result is approximated using Chebyshev interpolation. This
operator assumes that the row and column particle sets do not change

Creates an instance of Aboria::MatrixReplacement. When multiplied


Aboria::create_fmm_operator by a vector, the result is approximated using the black-box fast multipole
method

Creates an instance of Aboria::MatrixReplacement that wraps a H2


hierarchical matrix. When multiplied by a vector, the result is approximated
Aboria::create_h2_operator using the black-box fast multipole method. Unlike
Aboria::create_fmm_operator, this operator assumes that the row
and column particle sets do not change

Takes one or more Aboria::MatrixReplacement instances and forms


Aboria::create_block_operator
a $N \times M$ block operator

Level 3 - Symbolic particle-based DSL

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

Table 10. Creating expression terminals

Class Name Description

An object of this class is a symbolic reference to a particle's variable. It is similar to


Aboria::Symbol Aboria::Variable, but unlike Aboria::Variable, objects can be created with type
Aboria::Symbol, and then participate in symbolic expressions

An object of this class is a symbolic reference to a particle set, and can participate in symbolic
Aboria::Label
expressions

A function that creates a symbolic reference to the shortest difference between two particle's
Aboria::create_dx
positions. It takes two ::Label objects as its arguments

An object of this class is a symbolic reference to a accumulation (e.g. a summation) over a


Aboria::Accumulate
particle set

Table 11. Symbolic functions

Class Name Description

Aboria::norm A lazy function that calculates the 2-norm of a vector

Aboria::inf_norm A lazy function that calculates the inf-norm of a vector

Aboria::dot A lazy function that calculates the dot product of two vectors

Aboria::exp A lazy function that calculates the result of std::exp on a scalar

Aboria::pow A lazy function that calculates the result of std::pow on a scalar

Aboria::abs A lazy function that calculates the result of std::abs on a scalar

Aboria::log A lazy function that calculates the result of std::log on a scalar

Aboria::erf A lazy function that calculates the result of std::erf on a scalar

Aboria::sign A lazy function that calculates the result of std::sign on a scalar

libaboria

Header </home/travis/build/martinjrobins/Aboria/src/CellList.h>
Header </home/travis/build/martinjrobins/Aboria/src/CellListOrdered.h>
Header </home/travis/build/martinjrobins/Aboria/src/Chebyshev.h>
Header </home/travis/build/martinjrobins/Aboria/src/Evaluate.h>
Header </home/travis/build/martinjrobins/Aboria/src/FastMultipoleMethod.h>
Header </home/travis/build/martinjrobins/Aboria/src/Functions.h>
Header </home/travis/build/martinjrobins/Aboria/src/Get.h>
Header </home/travis/build/martinjrobins/Aboria/src/H2Lib.h>
Header </home/travis/build/martinjrobins/Aboria/src/Kdtree.h>
Header </home/travis/build/martinjrobins/Aboria/src/Kernels.h>
Header </home/travis/build/martinjrobins/Aboria/src/Log.h>
Header </home/travis/build/martinjrobins/Aboria/src/NanoFlannAdaptor.h>
Header </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
Header </home/travis/build/martinjrobins/Aboria/src/OctTree.h>
Header </home/travis/build/martinjrobins/Aboria/src/Operators.h>
Header </home/travis/build/martinjrobins/Aboria/src/Particles.h>
Header </home/travis/build/martinjrobins/Aboria/src/Search.h>
Header </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

Header </home/travis/build/martinjrobins/Aboria/src/Traits.h>
Header </home/travis/build/martinjrobins/Aboria/src/Utils.h>
Header </home/travis/build/martinjrobins/Aboria/src/Variable.h>
Header </home/travis/build/martinjrobins/Aboria/src/Vector.h>

Header </home/travis/build/martinjrobins/Aboria/src/CellList.h>

namespace Aboria {
template<typename Traits> struct CellListQuery;
template<typename Traits> class CellList;
}

Header </home/travis/build/martinjrobins/Aboria/src/CellListOrdered.h>

namespace Aboria {
template<typename Traits> struct CellListOrdered_params;
template<typename Traits> struct CellListOrderedQuery;
template<typename Traits> class CellListOrdered;
}

Header </home/travis/build/martinjrobins/Aboria/src/Chebyshev.h>

namespace Aboria {
template<unsigned int D, typename InputIterator, typename OutputIterator,
typename PositionIterator, typename Kernel>
void chebyshev_interpolation(InputIterator input_iterator_begin,
InputIterator input_iterator_end,
OutputIterator output_iterator_begin,
OutputIterator output_iterator_end,
PositionIterator source_positions_begin,
PositionIterator target_positions_begin,
Kernel kernel, unsigned int n);
}

Header </home/travis/build/martinjrobins/Aboria/src/Evaluate.h>

namespace Aboria {
template<typename VariableType, typename Functor, typename ExprRHS,
typename LabelType>
void evaluate_nonlinear(ExprRHS const &, LabelType &);
}

Header </home/travis/build/martinjrobins/Aboria/src/FastMultipoleMethod.h>

namespace Aboria {
template<typename Expansions, typename Kernel, typename RowParticles,
typename ColParticles>
class FastMultipoleMethod;
template<unsigned int D, unsigned int N, typename Function,
typename KernelHelper = detail::position_kernel_helper<D, Function>,
typename Block = typename KernelHelper::Block>
unspecifed make_black_box_expansion(const Function & function);
template<typename Expansions, typename Kernel, typename RowParticles,
typename ColParticles>
FastMultipoleMethod< Expansions, Kernel, RowParticles, ColParticles >
make_fmm(const RowParticles & row_particles,
const ColParticles & col_particles,
const Expansions & expansions, const Kernel & kernel);
}

Header </home/travis/build/martinjrobins/Aboria/src/Functions.h>

ABORIA_UNARY_FUNCTION(function_name, function_to_wrap, domain)


ABORIA_BINARY_FUNCTION(function_name, function_to_wrap, domain)
ABORIA_TERNARY_FUNCTION(function_name, function_to_wrap, domain)

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

ABORIA_TAGGED_FUNCTION(name, tag)

namespace Aboria {
struct norm_fun;
struct inf_norm_fun;
struct dot_fun;
struct exp_fun;
struct sqrt_fun;
struct sign_fun;
struct erf_fun;
struct erfc_fun;
struct log_fun;
struct abs_fun;
struct pow_fun;
template<typename T> struct refect_fun;
template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, norm_fun, Expr const &
>::type const
norm(Expr const &);
template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, inf_norm_fun, Expr const &
>::type const
inf_norm(Expr const &);
template<typename Expr1, typename Expr2>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, dot_fun, Expr1 const &, Expr2
const & >::type const
dot(Expr1 const &, Expr2 const &);
template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, exp_fun, Expr const & >::type
const
exp(Expr const &);
template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, sqrt_fun, Expr const &
>::type const
sqrt(Expr const &);
template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, sign_fun, Expr const &
>::type const
sign(Expr const &);
template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, erf_fun, Expr const & >::type
const
erf(Expr const &);
template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, erfc_fun, Expr const &
>::type const
erfc(Expr const &);
template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, log_fun, Expr const & >::type
const
log(Expr const &);
template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, abs_fun, Expr const & >::type
const
abs(Expr const &);
template<typename Expr1, typename Expr2>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, pow_fun, Expr1 const &, Expr2
const & >::type const
pow(Expr1 const &, Expr2 const &);
ABORIA_TERNARY_FUNCTION(refect_, refect_fun< Expr3 >, SymbolicDomain);
}

Header </home/travis/build/martinjrobins/Aboria/src/Get.h>

namespace Aboria {
template<typename Tuple, typename MplVector> struct getter_type;
template<typename iterator_tuple_type, typename mpl_vector_type>
class zip_iterator;
template<typename TupleType, typename MplVector> struct zip_pointer;
template<typename MplVector, typename... Types>
struct getter_type<std::tuple< Types...>, MplVector>;
template<typename MplVector, typename TT1, typename TT2, typename TT3,
typename TT4, typename TT5, typename TT6, typename TT7,
typename TT8, typename TT9>
struct getter_type<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector>;
template<typename MplVector, typename... Types>
struct zip_pointer<std::tuple< Types *...>, MplVector>;
template<typename MplVector, typename TT1, typename TT2, typename TT3,
typename TT4, typename TT5, typename TT6, typename TT7,
typename TT8, typename TT9>
struct zip_pointer<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector>;
template<typename mpl_vector_type, typename... Types>
class zip_iterator<std::tuple< Types...>, mpl_vector_type>;
template<typename mpl_vector_type, typename... Types>
class zip_iterator<thrust::tuple< Types...>, mpl_vector_type>;
template<typename tuple_type, typename tuple_type2,
typename mpl_vector_type>

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

unspecifed swap(getter_type< tuple_type, mpl_vector_type > x,


getter_type< tuple_type2, mpl_vector_type > & y);
template<typename tuple_type, typename tuple_type2,
typename mpl_vector_type>
unspecifed swap(getter_type< tuple_type, mpl_vector_type > & x,
getter_type< tuple_type2, mpl_vector_type > y);
template<typename tuple_type, typename mpl_vector_type>
void swap(getter_type< tuple_type, mpl_vector_type > x,
getter_type< tuple_type, mpl_vector_type > y);
template<typename Iterator> auto iterator_to_raw_pointer(const Iterator &);
template<typename T, typename ValueType>
ValueType::template return_type< T >::type const & get(const ValueType &);
template<typename T, typename ValueType>
ValueType::template return_type< T >::type & get(ValueType &);
template<typename T, typename ValueType>
ValueType::template return_type< T >::type & get(ValueType &&);
template<unsigned int N, typename ValueType>
unspecifed get_by_index(const ValueType &);
template<unsigned int N, typename ValueType>
unspecifed get_by_index(ValueType &);
template<unsigned int N, typename ValueType>
unspecifed get_by_index(ValueType &&);
}

Header </home/travis/build/martinjrobins/Aboria/src/H2Lib.h>

namespace Aboria {
class H2Lib_LR_Decomposition;
class H2LibCholeskyDecomposition;
class HLib_LR_Decomposition;
class HLibCholeskyDecomposition;
class H2LibMatrix;
class HLibMatrix;
template<unsigned int D, typename Function,
typename KernelHelper = detail::position_kernel_helper<D, Function>,
typename Block = typename KernelHelper::Block>
unspecifed make_h2lib_black_box_expansion(size_t order,
const Function & function);
template<typename Expansions, typename Kernel, typename RowParticlesType,
typename ColParticlesType>
HLibMatrix make_h2lib_h_matrix(const RowParticlesType & row_particles,
const ColParticlesType & col_particles,
const Expansions & expansions,
const Kernel & kernel);
template<typename Expansions, typename Kernel, typename RowParticlesType,
typename ColParticlesType>
H2LibMatrix make_h2lib_matrix(const RowParticlesType & row_particles,
const ColParticlesType & col_particles,
const Expansions & expansions,
const Kernel & kernel, const double eta);
}

Header </home/travis/build/martinjrobins/Aboria/src/Kdtree.h>

namespace Aboria {
template<typename Traits> struct KdtreeQuery;
template<typename Traits> class Kdtree;
template<typename Query> class KdtreeChildIterator;
}

Header </home/travis/build/martinjrobins/Aboria/src/Kernels.h>

namespace Aboria {
template<typename RowElements, typename ColElements, typename F>
class KernelBase;
template<typename RowElements, typename ColElements, typename F>
class KernelDense;
template<typename RowElements, typename ColElements, typename F>
class KernelMatrix;
template<typename RowElements, typename ColElements, typename PositionF,
size_t QuadratureOrder = 8,
typename F = detail::position_kernel<RowElements, ColElements, PositionF> >
class KernelChebyshev;
template<typename RowElements, typename ColElements, typename PositionF,
typename F>
class KernelH2;
template<typename RowElements, typename ColElements, typename PositionF,
typename F, unsigned int N>
class KernelFMM;
template<typename RowElements, typename ColElements, typename FRadius,
typename FWithDx,
typename F = detail::sparse_kernel<RowElements, ColElements, FRadius, FWithDx> >
class KernelSparse;

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

template<typename RowElements, typename ColElements, typename F,


typename RadiusFunction = detail::constant_radius<RowElements> >
class KernelSparseConst;
template<typename RowElements, typename ColElements,
typename F = detail::zero_kernel<RowElements, ColElements> >
class KernelZero;
}

Header </home/travis/build/martinjrobins/Aboria/src/Log.h>

ASSERT(condition, message)
ASSERT_CUDA(condition)
CHECK(condition, message)
CHECK_CUDA(condition, message)
ERROR(message)
ERROR_CUDA(message)
ABORIA_LOG_LEVEL
LOG(level, message)
LOG_CUDA(level, message)
LOG_CUDA1(level, message, variable)
LOG_CUDA2(level, message, variable1, variable2)
LOG_BOLD(level, message)

Header </home/travis/build/martinjrobins/Aboria/src/NanoFlannAdaptor.h>

namespace Aboria {
template<typename Traits> class KdtreeNanofann;
template<typename Traits> struct KdtreeNanofannQuery;
template<typename Traits> class nanofann_child_iterator;
}

Header </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>

namespace Aboria {
template<typename IteratorType> struct iterator_range;
template<typename Derived, typename Traits, typename QueryType>
class neighbour_search_base;
template<typename Traits> struct NeighbourQueryBase;
template<typename Traits> class ranges_iterator;
template<typename Traits> class linked_list_iterator;
template<typename Traits, typename Iterator> class index_vector_iterator;
template<typename Query> class depth_frst_iterator;
template<typename Query, int LNormNumber> class tree_query_iterator;
template<unsigned int D> class lattice_iterator;
template<typename Query, int LNormNumber>
class lattice_iterator_within_distance;
template<typename IteratorType>
iterator_range< IteratorType >
make_iterator_range(IteratorType &&, IteratorType &&);
}

Header </home/travis/build/martinjrobins/Aboria/src/OctTree.h>

namespace Aboria {
template<typename Traits> struct HyperOctreeQuery;
template<typename Traits> class HyperOctree;
template<unsigned int D> class octree_child_iterator;
}

Header </home/travis/build/martinjrobins/Aboria/src/Operators.h>

namespace Aboria {
template<unsigned int NI, unsigned int NJ, typename Blocks>
class MatrixReplacement;
template<typename RowParticles, typename ColParticles, typename F,
typename Kernel = KernelDense<RowParticles, ColParticles, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create dense operator(const RowParticles &, const ColParticles &,

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

const F &);
template<typename RowParticles, typename ColParticles, typename F,
typename Kernel = KernelMatrix<RowParticles, ColParticles, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_matrix_operator(const RowParticles &,
const ColParticles &, const F &);
template<typename RowParticles, typename ColParticles, typename F,
typename Kernel = KernelChebyshev<RowParticles, ColParticles, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_chebyshev_operator(const RowParticles &,
const ColParticles &,
const unsigned int, const F &);
template<unsigned int N, typename RowParticles, typename ColParticles,
typename PositionF, typename F,
typename Kernel = KernelFMM<RowParticles, ColParticles, PositionF, F, N>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_fmm_operator(const RowParticles &, const ColParticles &,
const PositionF &, const F &);
template<typename RowParticles, typename ColParticles, typename PositionF,
typename F,
typename Kernel = KernelH2<RowParticles, ColParticles, PositionF, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_h2_operator(const RowParticles &, const ColParticles &,
const int, const PositionF &, const F &,
const double = 1.0);
template<typename RowParticles, typename ColParticles, typename FRadius,
typename F,
typename Kernel = KernelSparse<RowParticles, ColParticles, FRadius, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>>,
typename = typename std::enable_if<!std::is_arithmetic<FRadius>::value>::type>
Operator create_sparse_operator(const RowParticles &,
const ColParticles &, const FRadius &,
const F &);
template<typename RowParticles, typename ColParticles, typename F,
typename Kernel = KernelSparseConst<RowParticles, ColParticles, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_sparse_operator(const RowParticles &,
const ColParticles &, const double,
const F &);
template<typename RowParticles, typename ColParticles,
typename Kernel = KernelZero<RowParticles, ColParticles>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_zero_operator(const RowParticles &, const ColParticles &);
template<unsigned int NI, unsigned int NJ, typename... T>
MatrixReplacement< NI, NJ, std::tuple< typename std::tuple_element< 0, T >::type...> >
create_block_operator(const MatrixReplacement< 1, 1, T > &...);
}

Header </home/travis/build/martinjrobins/Aboria/src/Particles.h>

namespace Aboria {
template<typename VAR, unsigned int DomainD,
template< typename, typename > class VECTOR,
template< typename > class SearchMethod, typename TRAITS_USER>
class Particles;
}

Header </home/travis/build/martinjrobins/Aboria/src/Search.h>

namespace Aboria {
template<typename Query, int LNormNumber> class search_iterator;
template<typename Query> class bucket_pair_iterator;
template<int LNormNumber, typename Query,
typename SearchIterator = search_iterator<Query, LNormNumber> >
SearchIterator
distance_search(const Query &, const typename Query::double_d &,
const double);
template<typename Query,
typename SearchIterator = search_iterator<Query, -1> >
SearchIterator
chebyshev_search(const Query &, const typename Query::double_d &,
const double);
template<typename Query,
typename SearchIterator = search_iterator<Query, 1> >
SearchIterator
manhatten_search(const Query &, const typename Query::double_d &,
const double);
template<typename Query,
typename SearchIterator = search_iterator<Query, 2> >
SearchIterator
euclidean_search(const Query &, const typename Query::double_d &,
const double);
template<typename Query, typename Iterator = bucket_pair_iterator<Query> >
Iterator get_neighbouring_buckets(const Query &);
}

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

Header </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

namespace Aboria {
template<typename T> struct Symbol;
template<unsigned int I, typename P> struct Label;
template<typename L1, typename L2> struct Dx;
struct Normal;
struct Uniform;
template<typename T, unsigned int N> struct VectorSymbolic;
template<typename T> struct Accumulate;
template<typename T, int LNormNumber = 2,
typename Terminal = typename detail::accumulate_within_distance< T,
mpl::int_<LNormNumber>> >
struct AccumulateWithinDistance;
template<typename T> struct min;
template<typename T> struct max;
template<typename Expr> unspecifed deep_copy(Expr const &);
template<typename Expr> unspecifed eval(Expr &);
template<typename Expr> unspecifed eval(Expr &, unspecifed);
template<typename Expr, typename ParticleReference>
unspecifed eval(Expr &, const ParticleReference &);
template<typename Expr, typename AnyRef>
unspecifed eval(Expr &, const AnyRef &);
template<typename Expr>
unspecifed eval(Expr &, unspecifed, unspecifed, unspecifed);
template<typename Expr, typename AnyRef>
unspecifed eval(Expr &, unspecifed, unspecifed, const AnyRef &);
template<typename Expr, typename AnyRef>
unspecifed eval(Expr &, unspecifed, const AnyRef &, unspecifed);
template<typename Expr, typename AnyDx, typename AnyRef1, typename AnyRef2>
unspecifed eval(Expr &, const AnyDx &, const AnyRef1 &, const AnyRef2 &);
template<typename Expr> unspecifed is_trivially_zero(Expr &);
// returns false for non constant expressions (might be not zero)
template<typename Expr> unspecifed is_trivially_zero(Expr & expr);
// returns true if the expression always evaluates to false
template<typename IfExpr> unspecifed is_trivially_false(IfExpr & expr);
// returns false for non constant expressions (might be not false)
template<typename IfExpr> unspecifed is_trivially_false(IfExpr & expr);
// returns true if the expression always evaluates to true
template<typename IfExpr> unspecifed is_trivially_true(IfExpr & expr);
// returns false for non constant expressions (might be not true)
template<typename IfExpr> unspecifed is_trivially_true(IfExpr & expr);
template<unsigned int I, typename P> Label< I, P > create_label(P & p);
template<typename L1, typename L2> Dx< L1, L2 > create_dx(L1 &, L2 &);
}

Header </home/travis/build/martinjrobins/Aboria/src/Traits.h>

namespace Aboria {
struct default_traits;
template<template< typename, typename > class VECTOR> struct Traits;
template<> struct Traits<std::vector>;
template<> struct Traits<thrust::device_vector>;
template<> struct Traits<thrust::host_vector>;
template<typename ARG, unsigned int DomainD, unsigned int SelfD,
typename TRAITS>
struct TraitsCommon;
template<typename traits, unsigned int DomainD, unsigned int SelfD,
typename... TYPES>
struct TraitsCommon<std::tuple< TYPES...>, DomainD, SelfD, traits>;
}

Header </home/travis/build/martinjrobins/Aboria/src/Utils.h>

namespace Aboria {
template<typename T = void>
void vtkWriteGrid(const char *, int,
vtkSmartPointer< vtkUnstructuredGrid >,
const std::map< std::string, double > & = {});
template<typename PTYPE, typename GTYPE, typename RNDGTYPE>
void create_n_particles_with_rejection_sampling(const unsigned int n,
PTYPE & particles,
const GTYPE & generator_fun,
const Vector< double, 3 > & low,
const Vector< double, 3 > & high,
RNDGTYPE & generator);
template<typename T>
void radial_distribution_function(const T & particles, const double min,

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

const double max, const int n,


std::vector< double > & out);
}

Header </home/travis/build/martinjrobins/Aboria/src/Variable.h>

ABORIA_VARIABLE(NAME, DATA_TYPE, NAME_STRING)


ABORIA_VARIABLE_VECTOR(NAME, DATA_TYPE, NAME_STRING)

namespace Aboria {
template<typename T, typename NAME> struct Variable;
}

Header </home/travis/build/martinjrobins/Aboria/src/Vector.h>

UNARY_OPERATOR(the_op)
OPERATOR(the_op)
COMPARISON(the_op)
COMPOUND_ASSIGN(the_op)
UFUNC(the_op)

namespace Aboria {
template<typename T, unsigned int N> class Vector;
template<typename T> struct is_vector;
template<typename T, unsigned int N> struct is_vector<Vector< T, N >>;
template<typename T> struct is_eigen_vector;
template<typename T, int N>
struct is_eigen_vector<Eigen::Matrix< T, N, 1 >>;
template<typename T, typename Enable = void> struct scalar;
template<typename T>
struct scalar<T, typename std::enable_if< std::is_arithmetic< T >::value >::type>;
template<typename T>
struct scalar<T, typename std::enable_if< is_vector< T >::value >::type>;
template<typename T, typename Enable = void> struct dim;
template<typename T>
struct dim<T, typename std::enable_if< std::is_arithmetic< T >::value >::type>;
template<typename T>
struct dim<T, typename std::enable_if< is_vector< T >::value >::type>;
typedef Vector< double, 1 > vdouble1;
typedef Vector< double, 2 > vdouble2;
typedef Vector< double, 3 > vdouble3;
typedef Vector< double, 4 > vdouble4;
typedef Vector< double, 5 > vdouble5;
typedef Vector< double, 6 > vdouble6;
typedef Vector< double, 7 > vdouble7;
typedef Vector< int, 1 > vint1;
typedef Vector< int, 2 > vint2;
typedef Vector< int, 3 > vint3;
typedef Vector< int, 4 > vint4;
typedef Vector< int, 5 > vint5;
typedef Vector< int, 6 > vint6;
typedef Vector< int, 7 > vint7;
typedef Vector< bool, 1 > vbool1;
typedef Vector< bool, 2 > vbool2;
typedef Vector< bool, 3 > vbool3;
typedef Vector< bool, 4 > vbool4;
typedef Vector< bool, 5 > vbool5;
typedef Vector< bool, 6 > vbool6;
typedef Vector< bool, 7 > vbool7;
// returns arg.pow(exponent)
template<typename T, unsigned int N, typename EXP_T>
Vector< T, N > pow(Vector< T, N > arg, EXP_T exponent);
// unary - operator for Vector class
template<typename T, unsigned int N>
Vector< double, N > operator-(const Vector< T, N > & arg1);
// binary + operator for Vector class
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T1>::value>::type>
Vector< double, N >
operator+(const T1 & arg1, const Vector< T2, N > & arg2);

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

template<typename T1, typename T2, unsigned int N,


typename = typename std::enable_if<std::is_arithmetic<T2>::value>::type>
Vector< double, N >
operator+(const Vector< T1, N > & arg1, const T2 & arg2);
template<typename T1, typename T2, unsigned int N>
Vector< double, N >
operator+(const Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator+(const Vector< int, N > & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator+(const int & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator+(const Vector< int, N > & arg1, const int & arg2);
// binary - operator for Vector class
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T1>::value>::type>
Vector< double, N >
operator-(const T1 & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T2>::value>::type>
Vector< double, N >
operator-(const Vector< T1, N > & arg1, const T2 & arg2);
template<typename T1, typename T2, unsigned int N>
Vector< double, N >
operator-(const Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator-(const Vector< int, N > & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator-(const int & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator-(const Vector< int, N > & arg1, const int & arg2);
// binary / operator for Vector class
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T1>::value>::type>
Vector< double, N >
operator/(const T1 & arg1, const Vector< T2, N > & arg2);
template<typename T1 , typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T2>::value>::type>
Vector< double, N >
operator/(const Vector< T1, N > & arg1, const T2 & arg2);
template<typename T1, typename T2, unsigned int N>
Vector< double, N >
operator/(const Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator/(const Vector< int, N > & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator/(const int & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator/(const Vector< int, N > & arg1, const int & arg2);
// binary * operator for Vector class
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T1>::value>::type>
Vector< double, N >
operator*(const T1 & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T2>::value>::type>
Vector< double, N >
operator*(const Vector< T1, N > & arg1, const T2 & arg2);
template<typename T1, typename T2, unsigned int N>
Vector< double, N >
operator*(const Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator*(const Vector< int, N > & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator*(const int & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N >
operator*(const Vector< int, N > & arg1, const int & arg2);
template<typename T, int N, unsigned int M>
Vector< T, N >
operator*(const Eigen::Matrix< T, N, int(M)> matrix,
const Vector< T, M > & arg);
// binary > comparison operator for Vector class
template<typename T1, typename T2, unsigned int N>
Vector< bool, N >
operator>(const Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T2>::value>::type>
Vector< bool, N > operator>(const Vector< T1, N > & arg1, const T2 & arg2);
// binary < comparison operator for Vector class
template<typename T1, typename T2, unsigned int N>
Vector< bool, N >

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

operator<(const Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T2>::value>::type>
Vector< bool, N > operator<(const Vector< T1, N > & arg1, const T2 & arg2);
// binary <= comparison operator for Vector class
template<typename T1, typename T2, unsigned int N>
Vector< bool, N >
operator<=(const Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T2>::value>::type>
Vector< bool, N >
operator<=(const Vector< T1, N > & arg1, const T2 & arg2);
// binary >= comparison operator for Vector class
template<typename T1, typename T2, unsigned int N>
Vector< bool, N >
operator>=(const Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T2>::value>::type>
Vector< bool, N >
operator>=(const Vector< T1, N > & arg1, const T2 & arg2);
// binary == comparison operator for Vector class
template<typename T1, typename T2, unsigned int N>
Vector< bool, N >
operator==(const Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T2>::value>::type>
Vector< bool, N >
operator==(const Vector< T1, N > & arg1, const T2 & arg2);
// binary != comparison operator for Vector class
template<typename T1, typename T2, unsigned int N>
Vector< bool, N >
operator!=(const Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N,
typename = typename std::enable_if<std::is_arithmetic<T2>::value>::type>
Vector< bool, N >
operator!=(const Vector< T1, N > & arg1, const T2 & arg2);
// compound assign += comparison operator for Vector class
template<typename T1, typename T2, unsigned int N>
Vector< double, N > &
operator+=(Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N>
Vector< double, N > & operator+=(Vector< T1, N > & arg1, const T2 & arg2);
template<int , int , unsigned int N>
Vector< int, N > &
operator+=(Vector< int, N > & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N > & operator+=(Vector< int, N > & arg1, const int & arg2);
// compound assign -= comparison operator for Vector class
template<typename T1, typename T2, unsigned int N>
Vector< double, N > &
operator-=(Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N>
Vector< double, N > & operator-=(Vector< T1, N > & arg1, const T2 & arg2);
template<int , int , unsigned int N>
Vector< int, N > &
operator-=(Vector< int, N > & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N > & operator-=(Vector< int, N > & arg1, const int & arg2);
// compound assign *= comparison operator for Vector class
template<typename T1, typename T2, unsigned int N>
Vector< double, N > &
operator*=(Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N>
Vector< double, N > & operator*=(Vector< T1, N > & arg1, const T2 & arg2);
template<int , int , unsigned int N>
Vector< int, N > &
operator*=(Vector< int, N > & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N > & operator*=(Vector< int, N > & arg1, const int & arg2);
// compound assign /= comparison operator for Vector class
template<typename T1, typename T2, unsigned int N>
Vector< double, N > &
operator/=(Vector< T1, N > & arg1, const Vector< T2, N > & arg2);
template<typename T1, typename T2, unsigned int N>
Vector< double, N > & operator/=(Vector< T1, N > & arg1, const T2 & arg2);
template<int , int , unsigned int N>
Vector< int, N > &
operator/=(Vector< int, N > & arg1, const Vector< int, N > & arg2);
template<int , int , unsigned int N>
Vector< int, N > & operator/=(Vector< int, N > & arg1, const int & arg2);
template<typename T, int I> double norm(const Vector< T, I > &);
// return arg1.squaredNorm()
template<typename T, int I> double squaredNorm(const Vector< T, I > & arg1);
template<typename T1, typename T2, int I>
double dot(const Vector< T1, I > &, const Vector< T2, I > &);
// cross-product function for 3D vectors
template<typename T>
Vector< T, 3 >

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


API Overview

cross(const Vector< T, 3 > & arg1, const Vector< T, 3 > & arg2);
// returns the input Vector x (for Eigen)
template<typename T, unsigned int N>
const Vector< T, N > & conj(const Vector< T, N > & x);
// returns the input Vector x (for Eigen)
template<typename T, unsigned int N>
const Vector< T, N > & real(const Vector< T, N > & x);
// returns imaginary component of Vector class (i.e. 0, for Eigen)
template<typename T, unsigned int N>
const Vector< T, N > imag(const Vector< T, N > & x);
template<typename T, unsigned int N>
const Vector< T, N > abs(const Vector< T, N > &);
// element-wise e_i*e_i function for Vector class
template<typename T, unsigned int N>
const Vector< T, N > abs2(const Vector< T, N > & x);
// stream output operator for Vector class
template<typename T, unsigned int N>
std::ostream & operator<<(std::ostream & out, const Vector< T, N > & v);
// stream input operator for Vector class
template<typename T, unsigned int N>
std::istream & operator>>(std::istream & out, Vector< T, N > & v);
}namespace boost {
namespace serialization {
template<typename Archive, typename S, int Rows_, int Cols_, int Ops_,
int MaxRows_, int MaxCols_>
void serialize(Archive & ar,
Eigen::Matrix< S, Rows_, Cols_, Ops_, MaxRows_, MaxCols_ > & matrix,
const unsigned int version);
template<typename Archive, typename S, int Dim_, int Mode_, int Options_>
void serialize(Archive & ar,
Eigen::Transform< S, Dim_, Mode_, Options_ > & transform,
const unsigned int version);
}
}

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/aboria/api_overview.html[10/22/2018 7:34:41 AM]


Class template Particles

Class template Particles


Aboria::Particles — A STL-compatable container of particles in 3D space.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Particles.h>
template<typename VAR, unsigned int DomainD,
template< typename, typename > class VECTOR,
template< typename > class SearchMethod, typename TRAITS_USER>
class Particles {
public:
// types
typedef Particles< VAR, DomainD, VECTOR, SearchMethod, TRAITS_USER > particles_type; // This
type.
typedef TraitsCommon< VAR, DomainD, 1, TRAITS_USER > traits_type;
typedef traits_type::value_type value_type; // a
tuple type containing value_types for each Variable
typedef traits_type::reference reference; // a
tuple type containing references to value_types for each Variable
typedef traits_type::const_reference const_reference; // a
tuple type containing const_references to value_types for each Variable
typedef traits_type::raw_pointer raw_pointer; // a
tuple type containing raw references to value_types for each Variable
typedef traits_type::raw_reference raw_reference;
typedef traits_type::raw_const_reference raw_const_reference; // a
tuple type containing raw references to value_types for each Variable
typedef traits_type::data_type data_type; // type
used to hold data (a tuple of vectors)
typedef traits_type::size_type size_type; // type
used to hold and return size information
typedef traits_type::size_type difference_type;
typedef traits_type::iterator iterator;
typedef traits_type::const_iterator const_iterator;
typedef SearchMethod< traits_type > search_type; // the
neighbourhood data structure that the particles will be embedded into
typedef search_type::query_type query_type; // the
query class that is associated with search_type
typedef traits_type::mpl_type_vector mpl_type_vector;
typedef unspecifed elem_by_type;
typedef unspecifed return_type;
typedef Vector< double, dimension > double_d; // a
type to store a vector of doubles with given dimension
typedef Vector< double, dimension > int_d; // a
type to store a vector of doubles with given dimension
typedef Vector< bool, dimension > bool_d; // a
type to store a vector of bool with given dimension
typedef traits_type::position position; // the
tag type for the default position variable
// construct/copy/destruct
Particles();
Particles(const size_t);
Particles(const particles_type &);
Particles(iterator, iterator);
// public member functions
void resize(size_type);
void push_back(const value_type &, bool = true);
void print_data_structure() const;
void set_seed(const uint32_t);
void push_back(const double_d &);
void push_back(const particles_type &);
void pop_back(bool = true);
reference operator[](std::size_t);
const_reference operator[](std::size_t) const;
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
const_iterator cbegin() const;
const_iterator cend() const;
void clear();
iterator erase(iterator, const bool = true);
iterator erase(iterator, iterator, const bool = true);
iterator insert(iterator, const value type &);

https://martinjrobins.github.io/Aboria/Aboria/Particles.html[10/22/2018 7:34:56 AM]


Class template Particles

void insert(iterator, size_type, const value_type &);


template<typename InputIterator>
iterator insert(iterator, InputIterator, InputIterator);
size_t size() const;
void init_neighbour_search(const double_d &, const double_d &,
const bool_d &, const double = 10.0);
void init_id_search();
const query_type & get_query() const;
double_d correct_dx_for_periodicity(const double_d &) const;
double get_max_bucket_size() const;
const double_d & get_min() const;
const double_d & get_max() const;
const bool_d & get_periodic() const;
bool is_ordered() const;
void update_positions(iterator, iterator);
void update_positions();
const data_type::tuple_type & get_tuple() const;
data_type::tuple_type & get_tuple();
template<typename Archive> void serialize(Archive &, const unsigned int);
vtkSmartPointer< vtkUnstructuredGrid > get_grid(bool = false);
void copy_to_vtk_grid(vtkUnstructuredGrid *);
void copy_from_vtk_grid(vtkUnstructuredGrid *);
// friend functions
friend std::ostream & operator<<(std::ostream &, const Particles &);
friend std::istream & operator>>(std::istream &, Particles &);
// private member functions
void reorder(iterator, iterator,
const typename vector_int::const_iterator &,
const typename vector_int::const_iterator &);
template<typename InputIterator>
iterator insert_dispatch(iterator, InputIterator, InputIterator,
std::false_type);
template<typename InputIterator>
iterator insert_dispatch(iterator, InputIterator, InputIterator,
std::true_type);
// public data members
static const unsigned int dimension; // the number of spatial dimensions
};

Description
Each particle has a 3D position and user-defned data-package (for other variables such as velocity, density etc) and is optionally
embedded within a cuboidal spatial domain (for neighbourhood searches) that can be periodic or not. Each particle also has its own
random number generator that is seeded via its own unique id.

For example, the following creates a set of particles which each have (along with the standard variables such as position, id etc) a data
package consisting of one double variable type named scalar.

using namespace Aboria;


ABORIA_VARIABLE(scalar,double,"my scalar")
typedef Particles<std::tuple<scalar>> MyParticles;
MyParticles particles();

See Also:

ABORIA_VARIABLE

Particles public types


1. typedef TraitsCommon< VAR, DomainD, 1, TRAITS_USER > traits_type;

The traits type used to build up the Particle container. Contains Level 0 vector class and dimension information

2. typedef traits_type::raw_reference raw_reference;

a tuple type containing raw references to value_types for each Variable note that this is only different from reference when using a
thrust::device_vector level 0 vector

3. typedef traits_type::size_type difference_type;

type used to hold and return the difference of iterator, or distance between

4. typedef traits_type::iterator iterator;

https://martinjrobins.github.io/Aboria/Aboria/Particles.html[10/22/2018 7:34:56 AM]


Class template Particles

non-const iterator type

See Also:

zip_iterator

5. typedef traits_type::const_iterator const_iterator;

const iterator type

See Also:

zip_iterator

6. typedef traits_type::mpl_type_vector mpl_type_vector;

a boost mpl vector type containing a vector of Variable attached to the particles (includes position, id and alive fag as well as all
user-supplied variables)

Particles public construct/copy/destruct


1. Particles();

Contructs an empty container with no searching or id tracking enabled.

2. Particles(const size_t size);

Constructs a container with size particles. Searching or id tracking is disabled

3. Particles(const particles_type & other);

copy-constructor. performs deep copying of all particles from other to *this

4. Particles(iterator frst, iterator last);

range-based copy-constructor. performs deep copying of all particles from frst to last

Particles public member functions


1. void resize(size_type n);

Resize the continer to n particles.

Note that if new particles are created, they are NOT added to the neighbour search structure, and might be outside the domain

Parameters:
n the new size of the container

2. void push_back(const value_type & val, bool update_neighbour_search = true);

push the particle val to the back of the container (if it is within the searchable domain)

See Also:

update_positions()

Parameters:
update_neighbour_search the default is to update the neighbour search set this to false to
not update
val the value_type to add

https://martinjrobins.github.io/Aboria/Aboria/Particles.html[10/22/2018 7:34:56 AM]


Class template Particles

3. void print_data_structure() const;

Print to stdout the current state of the internal neighbourhood data structure. Used for debugging purposes

4. void set_seed(const uint32_t value);

set the base seed of the container. Note that the random number generator for each particle is set to value plus the particle's id

5. void push_back(const double_d & pos);

push a new particle with position position to the back of the container. All other variables for the new particle are left at the
defaults

6. void push_back(const particles_type & particles);

push the particles in particles to the back of the container

7. void pop_back(bool update_neighbour_search = true);

pop (delete) the particle at the end of the container

Parameters:
update_neighbour_search by default update the neighbour data structure. Set this to false to
turn off the update

8. reference operator[](std::size_t idx);

returns a reference to the particle at position idx

9. const_reference operator[](std::size_t idx) const;

returns a const_reference to the particle at position idx

10. iterator begin();

returns an iterator to the beginning of the container

11. iterator end();

returns an iterator to the end of the container

12. const_iterator begin() const;

returns an iterator to the beginning of the container

13. const_iterator end() const;

returns an iterator to the end of the container

14. const_iterator cbegin() const;

returns a const_iterator to the beginning of the container

15. const_iterator cend() const;

returns an iterator to the end of the container

16. void clear();

sets container to empty and deletes all particles

17. iterator erase(iterator i, const bool update_neighbour_search = true);

erase the particle pointed to by the iterator i.

See Also:

https://martinjrobins.github.io/Aboria/Aboria/Particles.html[10/22/2018 7:34:56 AM]


Class template Particles

update_positions

Parameters:
i erase particle pointed to by i. This simply sets the id variable of
that particle to false and (if
update_neighbour_search==true) calls ::update_positions
update_neighbour_search by default this function will update the neighbour search data
structure. Set this to false to turn off update

18. iterator erase(iterator frst, iterator last,


const bool update_neighbour_search = true);

erase the particles between the iterators frst and last

See Also:

erase(iterator)

Parameters:
update_neighbour_search By default this updates the neighbourhood data structure. Set to
false to turn off this update

19. iterator insert(iterator position, const value_type & val);

insert a particle val into the container at position

Note that this will copy across the id, generator and alive variables from val, which might confict with particles already in the
container (e.g. the new container might have identical ids or generators, which are generally assumed to be unique).

20. void insert(iterator position, size_type n, const value_type & val);

insert a n copies of the particle val into the container at position

Note that this will copy across the id, generator and alive variables from val, which might confict with particles already in the
container (e.g. the new container might have identical ids or generators, which are generally assumed to be unique).

21. template<typename InputIterator>


iterator insert(iterator position, InputIterator frst, InputIterator last);

insert a range of particles pointed to by frst and last at position

Note that this will copy across the id, generator and alive variables from the range, which might confict with particles already
in the container (e.g. the new container might have identical ids or generators, which are generally assumed to be unique).

22. size_t size() const;

return the total number of particles in the container

23. void init_neighbour_search(const double_d & low, const double_d & high,
const bool_d & periodic,
const double n_particles_in_leaf = 10.0);

initialise the neighbourhood searching for the particle container. The neighbourhood searching is performed over a cuboidal domain
from low to high.

Parameters:
high the highest point in the search domain
low the lowest point in the search domain
n_particles_in_leaf By default the neighbourhood data structure will have either an
average (cell-list) or a maximum of this number of particles within each
bucket. Set this argument to change this number
periodic a boolean 3d vector indicating whether each dimension is periodic
(true) or not (false)

https://martinjrobins.github.io/Aboria/Aboria/Particles.html[10/22/2018 7:34:56 AM]


Class template Particles

24. void init_id_search();

Initialise the "search by id" functionality. This will switch on the creation and updating of an internal data structure to enable search
by id.

See Also:

::init_neighbour_search()

25. const query_type & get_query() const;

Returns the query_type object that can be used for neighbourhood queries. This object is designed to be as lightweight as possible
so that it can by copied (for example to the GPU)

26. double_d correct_dx_for_periodicity(const double_d & uncorrected_dx) const;

takes an vector uncorrected_dx that might come from the difference between two particle positions, and returns the shortest
possible dx, according to the periodicity of the domain

27. double get_max_bucket_size() const;

return the length scale of the neighbourhood search

See Also:

init_neighbour_search()

28. const double_d & get_min() const;

return the lower extent of the neighbourhood search

See Also:

init_neighbour_search()

29. const double_d & get_max() const;

return the upper extent of the neighbourhood search

See Also:

init_neighbour_search()

30. const bool_d & get_periodic() const;

return the periodicty of the neighbourhood search

See Also:

init_neighbour_search()

31. bool is_ordered() const;

A neighbourhood search data structure can be ordered (i.e. the order of the particles in the container is important) or not.

32. void update_positions(iterator update_begin, iterator update_end);

Update the neighbourhood search data for particles between update_begin and update_end (not including update_end).

This function must be called after altering the particle positions (e.g. with set<position>(particle,new_position)) in order
for accurate neighbourhood searching. This function will also delete any particles that have their alive fags set to false. If any
particles within the range have alive==false, then the update_end iterator must be the same as that returned by end()

33. void update_positions();

Update the neighbourhood search data for all particles in the container

This function must be called after altering the particle positions (e.g. with set<position>(particle,new_position)) in order
for accurate neighbourhood searching. This function will also delete any particles that have their alive fags set to false.

https://martinjrobins.github.io/Aboria/Aboria/Particles.html[10/22/2018 7:34:56 AM]


Class template Particles

34. const data_type::tuple_type & get_tuple() const;

35. data_type::tuple_type & get_tuple();

36. template<typename Archive>


void serialize(Archive & ar, const unsigned int version);

Boost serialization support.

37. vtkSmartPointer< vtkUnstructuredGrid > get_grid(bool refresh = false);

get a vtk unstructured grid version of the particle container This grid is cached internally. The frst time this function is called the grid
is created and updated with the particle data. If the particle data is updated subsequently you need to set refresh=true for the
grid to be updated

38. void copy_to_vtk_grid(vtkUnstructuredGrid * grid);

copy the particle data to a VTK unstructured grid

39. void copy_from_vtk_grid(vtkUnstructuredGrid * grid);

update the particle data according to a supplied VTK unstructured grid it is assumed that grid has been generated from
copy_to_vtk_grid() or get_grid()

See Also:

get_grid()

copy_to_vtk_grid()

Particles friend functions


1. friend std::ostream &
operator<<(std::ostream & stream, const Particles & particles);

stream output for particle data

2. friend std::istream & operator>>(std::istream & stream, Particles & particles);

stream input for particle data

Particles private member functions


1. void reorder(iterator update_begin, iterator update_end,
const typename vector_int::const_iterator & order_start,
const typename vector_int::const_iterator & order_end);

Used by update_particles(). The parameters update_begin and update_end are the same as given to update_particles(). This
function reorders particles within this range according to the order_start and order_end range, using a gather.

2. template<typename InputIterator>
iterator insert_dispatch(iterator position, InputIterator frst,
InputIterator last, std::false_type);

3. template<typename InputIterator>
iterator insert_dispatch(iterator position, InputIterator frst,
InputIterator last, std::true_type);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Particles.html[10/22/2018 7:34:56 AM]


Class template Particles

https://martinjrobins.github.io/Aboria/Aboria/Particles.html[10/22/2018 7:34:56 AM]


Function template get

Function template get


Aboria::get — get the value of a variable from a const getter_type, zip_iterator, zip_pointer, or Particles

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>

template<typename T, typename ValueType>


ValueType::template return_type< T >::type const &
get(const ValueType & arg);

Description
get a variable from a particle arg

See Also:

ABORIA_VARIABLE

Parameters:
arg the particle
the object with type ValueType

Template Parameters:
T the variable type to get,
ValueType the getter_type, zip_iterator, zip_pointer, or Particles

Returns: a const reference to a T::value_type holding the variable data


Returns: CUDA_HOST_DEVICE typename ValueType::template return_type<T> ::type const&

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/get_idp46631327509760.html[10/22/2018 7:35:07 AM]


Class template Vector

Class template Vector


Aboria::Vector — An N-dimensional vector class.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T, unsigned int N>
class Vector {
public:
// types
typedef T value_type;
// construct/copy/destruct
Vector();
Vector(T, T);
Vector(T, T, T);
Vector(T, T, T, T);
Vector(const Vector< T, N > &);
template<typename Derived> Vector(const Eigen::DenseBase< Derived > &);
template<typename T2> Vector(const Vector< T2, N > &);
template<typename T2> Vector& operator=(Vector< T2, N > &);
template<typename T2> Vector& operator=(T2 *);
template<typename Derived>
Vector& operator=(const Eigen::DenseBase< Derived > &);
// public member functions
const T & operator[](unsigned int) const;
T & operator[](unsigned int);
template<typename T2> double inner_product(const Vector< T2, N > &) const;
template<typename T2> Vector< T2, N > cast();
template<typename T2> double dot(const Vector< T2, N > &) const;
double squaredNorm() const;
double norm() const;
double inf_norm() const;
template<typename EXP_T> Vector< T, N > pow(const EXP_T);
void normalize();
bool all() const;
bool any() const;
T minCoeff() const;
T maxCoeff() const;
T prod() const;
T * data();
template<typename Archive> void serialize(Archive &, const unsigned int);
// public static functions
static Vector Zero();
static Vector Constant(const T &);
// public data members
static const int size;
};

Description
Normal C++ operators ('*','/','<' etc.) operate on this vector class in an element-wise fashion.

Vector public construct/copy/destruct


1. Vector();

Constructs an vector and allocates memory.

2. Vector(T arg1, T arg2);

https://martinjrobins.github.io/Aboria/Aboria/Vector.html[10/22/2018 7:35:18 AM]


Class template Vector

Constructs an vector with initial values.

Parameters:
arg1 All the elements of the vector are set to this value Constructs an vector with initial values.
The frst element is set to this value
arg2 The second element is set to this value

3. Vector(T arg1, T arg2, T arg3);

Constructs an vector with initial values.

Parameters:
arg1 The frst element is set to this value
arg2 The second element is set to this value
arg3 The third element is set to this value

4. Vector(T arg1, T arg2, T arg3, T arg4);

Constructs an vector with initial values.

Parameters:
arg1 The frst element is set to this value
arg2 The second element is set to this value
arg3 The third element is set to this value
arg4 The fourth element is set to this value

5. Vector(const Vector< T, N > & arg);

6. template<typename Derived> Vector(const Eigen::DenseBase< Derived > & arg);

Eigen copy constructor

Assigns an eigen vector object (arg) to this vector.

7. template<typename T2> Vector(const Vector< T2, N > & arg);

Vector copy-constructor

Parameters:
arg constructs a vector as a copy of this arguement

8. template<typename T2> Vector& operator=(Vector< T2, N > & arg);

Vector assignment

Assigns a vector with different type T2 but same length N to this vector

Parameters:
arg Assigns the frst N values from arg to this vector.

9. template<typename T2> Vector& operator=(T2 * arg);

Other Vector assignment

Assigns a vector-like object (arg) to this vector.

Parameters:
arg Vector-like object (with index operator)

https://martinjrobins.github.io/Aboria/Aboria/Vector.html[10/22/2018 7:35:18 AM]


Class template Vector

10. template<typename Derived>


Vector& operator=(const Eigen::DenseBase< Derived > & arg);

Eigen Vector assignment

Assigns an eigen vector object (arg) to this vector.

Vector public member functions


1. const T & operator[](unsigned int n) const;

const Index operator

Returns a const reference to the n-th element of the vector

Parameters:
n the element number to index

2. T & operator[](unsigned int n);

Index operator

Returns a reference to the n-th element of the vector

Parameters:
n the element number to index

3. template<typename T2> double inner_product(const Vector< T2, N > & arg) const;

inner product

Returns: the inner product (dot product) of this vector with arg

4. template<typename T2> Vector< T2, N > cast();

change vector type

Returns: A new vector with each element static_cast to T2

5. template<typename T2> double dot(const Vector< T2, N > & arg) const;

inner product

See Also:

inner_product

Returns: The inner product (dot product) of this vector with arg

6. double squaredNorm() const;

squared norm

Returns: the squared 2-norm of the vector $ v_i^2$

7. double norm() const;

2-norm

https://martinjrobins.github.io/Aboria/Aboria/Vector.html[10/22/2018 7:35:18 AM]


Class template Vector

Returns: the 2-norm of the vector ${ v_i^2}$

8. double inf_norm() const;

inf-norm

Returns: the infnity norm of the vector $ |v_i|$

9. template<typename EXP_T> Vector< T, N > pow(const EXP_T exponent);

10. void normalize();

normalise vector so that its length (2-norm) equals one.

See Also:

norm

11. bool all() const;

collapse boolean vector using & operator

Returns: the accumulated & of all the vectors elements, i.e. v_1 & v_2 & v3 & ...

12. bool any() const;

collapse boolean vector using | operator

Returns: the accumulated | of all the vectors elements, i.e. v_1 | v_2 | v3 | ...

13. T minCoeff() const;

fnd the minimum element of the vector

Returns: the minimum element of the vector

14. T maxCoeff() const;

fnd the maximum element of the vector

Returns: the maximum element of the vector

15. T prod() const;

returns the product of every element in the vector

16. T * data();

returns the raw memory array containing the data for the vector

17. template<typename Archive>


void serialize(Archive & ar, const unsigned int version);

Vector public static functions


1. static Vector Zero();

Zero Vector

Returns a zero vector

2. static Vector Constant(const T & c);

Vector

https://martinjrobins.github.io/Aboria/Aboria/Vector.html[10/22/2018 7:35:18 AM]


Class template Vector

Constant

Returns a constant vector

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Vector.html[10/22/2018 7:35:18 AM]


Struct template getter_type

Struct template getter_type


Aboria::getter_type — Generic type that can be used by get<variable>()

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>
template<typename Tuple, typename MplVector>
struct getter_type {
};

Description

Template Parameters
1. typename Tuple

a std::tuple or thrust::tuple of values

2. typename MplVector

a boost::mpl typelist of variable types

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/getter_type.html[10/22/2018 7:35:29 AM]


Function template vtkWriteGrid

Function template vtkWriteGrid


Aboria::vtkWriteGrid

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Utils.h>

template<typename T = void>
void vtkWriteGrid(const char * name, int timestep,
vtkSmartPointer< vtkUnstructuredGrid > grid,
const std::map< std::string, double > & felds = {});

Description
Write a vtk unstructured grid to a flename of the form: printf("name%05d",timestep). User can optionally provide felds, which is a set of
key/value pairs (e.g. "time"->0.1) written as additional felds to the fle

Parameters:
felds a std::map of additional felds to write
grid the grid to write to the fle
name the base flename
timestep the index in the flename

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/vtkWriteGrid.html[10/22/2018 7:35:39 AM]


Function template euclidean_search

Function template euclidean_search


Aboria::euclidean_search — returns a search_iterator that iterates over all the particles within a given distance around a point

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Search.h>

template<typename Query, typename SearchIterator = search_iterator<Query, 2> >


SearchIterator
euclidean_search(const Query & query,
const typename Query::double_d & centre,
const double max_distance);

Description
Uses the euclidean distance https://en.wikipedia.org/wiki/Euclidean_distance

Parameters:
centre the central point of the search
max_distance the maximum distance to search around centre
query the query object

Template Parameters:
Query the query object type

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/euclidean_search.html[10/22/2018 7:35:49 AM]


Function template manhatten_search

Function template manhatten_search


Aboria::manhatten_search — returns a search_iterator that iterates over all the particles within a given distance around a point

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Search.h>

template<typename Query, typename SearchIterator = search_iterator<Query, 1> >


SearchIterator
manhatten_search(const Query & query,
const typename Query::double_d & centre,
const double max_distance);

Description
Uses the manhatten distance https://en.wikipedia.org/wiki/Taxicab_geometry

Parameters:
centre the central point of the search
max_distance the maximum distance to search around centre
query the query object

Template Parameters:
Query the query object type

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/manhatten_search.html[10/22/2018 7:35:59 AM]


Function template chebyshev_search

Function template chebyshev_search


Aboria::chebyshev_search — returns a search_iterator that iterates over all the particles within a given distance around a point

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Search.h>

template<typename Query,
typename SearchIterator = search_iterator<Query, -1> >
SearchIterator
chebyshev_search(const Query & query,
const typename Query::double_d & centre,
const double max_distance);

Description
Uses the chebyshev distance https://en.wikipedia.org/wiki/Chebyshev_distance

Parameters:
centre the central point of the search
max_distance the maximum distance to search around centre
query the query object

Template Parameters:
Query the query object type

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/chebyshev_search.html[10/22/2018 7:36:10 AM]


Function template distance_search

Function template distance_search


Aboria::distance_search — returns a search_iterator that iterates over all the particles within a given distance around a point

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Search.h>

template<int LNormNumber, typename Query,


typename SearchIterator = search_iterator<Query, LNormNumber> >
SearchIterator
distance_search(const Query & query,
const typename Query::double_d & centre,
const double max_distance);

Description
Parameters:
centre the central point of the search
max_distance the maximum distance to search around centre
query the query object

Template Parameters:
Query the query object type

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/distance_search.html[10/22/2018 7:36:20 AM]


Class template search_iterator

Class template search_iterator


Aboria::search_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Search.h>
template<typename Query, int LNormNumber>
class search_iterator {
public:
// types
typedef p_pointer pointer;
typedef std::forward_iterator_tag iterator_category;
typedef p_reference reference;
typedef p_value_type value_type;
typedef std::ptrdiff_t difference_type;
// construct/copy/destruct
search_iterator();
search_iterator(const Query &, const double_d &, const double);
// public static functions
static periodic_iterator_type get_periodic_range(const bool_d);
// public member functions
const double_d & dx() const;
reference operator*() const;
reference operator->();
search_iterator & operator++();
search_iterator operator++(int);
size_t operator-(search_iterator) const;
size_t distance_to_end() const;
bool operator==(const search_iterator &);
bool operator!=(const search_iterator &);
bool operator==(const bool) const;
bool operator!=(const bool) const;
// private member functions
bool equal(search_iterator const &) const;
bool equal(const bool) const;
bool get_valid_bucket();
bool get_valid_candidate();
bool go_to_next_candidate();
bool check_candidate();
void increment();
reference dereference() const;
};

Description
A const iterator to a set of neighbouring points. This iterator implements a STL forward iterator type

search_iterator public construct/copy/destruct


1. search_iterator();

constructs an invalid iterator that can be used as an end() iterator

2. search_iterator(const Query & query, const double_d & r,


const double max_distance);

should generally use this constructor to make a search iterator. Returns an iterator that will search around the given point, and

https://martinjrobins.github.io/Aboria/Aboria/search_iterator.html[10/22/2018 7:36:31 AM]


Class template search_iterator

iterate through all the particles it fnds within the given maximum distance

Parameters:
max_distance the maximum distance to search
query a query object for a spatial data structure
r the central point to search around

search_iterator public static functions


1. static periodic_iterator_type get_periodic_range(const bool_d is_periodic);

returns iterator for periodic lattice, given the periodicity of the domain

search_iterator public member functions


1. const double_d & dx() const;

returns the distance $r_b-r_a$ between the current candidate position $r_b$ an the central search point $r_a$

2. reference operator*() const;

dereference the iterator, returns a reference to the current candidate particle

3. reference operator->();

dereference the iterator, returns a reference to the current candidate particle

4. search_iterator & operator++();

increment the iterator, i.e. move to the next candidate particle

5. search_iterator operator++(int);

post increment the iterator, i.e. move to the next candidate particle and return the original iterator

6. size_t operator-(search_iterator start) const;

returns the distance between start and this

7. size_t distance_to_end() const;

returns how many candidate particle to go until the iterator becomes invalid

8. bool operator==(const search_iterator & rhs);

returns true if rhs is the same as this

9. bool operator!=(const search_iterator & rhs);

returns true if rhs is not the same as this

10. bool operator==(const bool rhs) const;

the search iterator can be converted to true if it is pointing to a valid candidate point, false otherwise

11. bool operator!=(const bool rhs) const;

the search iterator can be converted to true if it is pointing to a valid candidate point, false otherwise

https://martinjrobins.github.io/Aboria/Aboria/search_iterator.html[10/22/2018 7:36:31 AM]


Class template search_iterator

search_iterator private member functions


1. bool equal(search_iterator const & other) const;

if both iterators are valid, and pointing to the same particle, then they are equal

2. bool equal(const bool other) const;

if this->m_valid is true then the iterator is equal to true

3. bool get_valid_bucket();

to be called after incrementing m_current_bucket. If m_current bucket is no longer valid, then move to the next periodic lattice. If not
more periodic lattices to search through, then the iterator becomes invalid

4. bool get_valid_candidate();

to be called after incrementing m_current_particle. If m_current_particle is invalid, then move to the next bucket

5. bool go_to_next_candidate();

increments m_current_particle and deals with any invalid iterators

6. bool check_candidate();

checks that the current particle in m_current_particle is within the search distance

7. void increment();

main increment function, iterates internal iterators until a candidate particle is found (i.e. one within the search distance)

8. reference dereference() const;

dereference the iterator, returns a reference to the current candidate particle

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/search_iterator.html[10/22/2018 7:36:31 AM]


Class template CellList

Class template CellList


Aboria::CellList — A cell list spatial data structure that is paired with a CellListQuery query type.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellList.h>
template<typename Traits>
class CellList : public Aboria::neighbour_search_base< CellList< Traits >, Traits, CellListQuery<
Traits > >
{
public:
// member classes/structs/unions
// function object to copy a range of particles to another index range
struct copy_points_in_bucket_lambda {
// construct/copy/destruct
copy_points_in_bucket_lambda(size_t, size_t, size_t, int *, int *);
// public member functions
void operator()(const int);
// public data members
int * m_linked_list;
int * m_buckets;
size_t start_index_deleted;
size_t start_index_copied;
size_t end_index_copied;
};
// function object to delete a range of particles within the buckets
struct delete_points_in_bucket_lambda {
// construct/copy/destruct
delete_points_in_bucket_lambda(int, int, int *, int *);
// public member functions
void operator()(const int);
// public data members
int * m_linked_list;
int * m_buckets;
int start_index_deleted;
int end_index_deleted;
};
// thread-safe function object to insert a list of non-consecutive particles
// into the data structure
struct insert_points_lambda_non_sequential {
// types
typedef Traits::double_d double_d;
typedef unspecifed ptobl_type;
// construct/copy/destruct
insert_points_lambda_non_sequential(double_d *, int *, const ptobl_type &,
int *, int *, int *, int);
// public member functions
void operator()(const int);
// public data members
double_d * m_positions;
int * m_alive_indices;
ptobl_type m_point_to_bucket_index;
int * m_buckets;
int * m_dirty_buckets;
int * m_linked_list;
int start;
};
// non-threadsafe function object to insert a non-consecutive list of
// particles into the data structure
struct insert points lambda non sequential serial {

https://martinjrobins.github.io/Aboria/Aboria/CellList.html[10/22/2018 7:36:42 AM]


Class template CellList

// types
typedef Traits::double_d double_d;
typedef unspecifed ptobl_type;
// construct/copy/destruct
insert_points_lambda_non_sequential_serial(double_d *, int *,
const ptobl_type &, int *,
int *, int *, int *, int);
// public member functions
void operator()(const int);
// public data members
double_d * m_positions;
int * m_alive_indices;
ptobl_type m_point_to_bucket_index;
int * m_buckets;
int * m_dirty_buckets;
int * m_linked_list;
int * m_linked_list_reverse;
int start;
};
// thread-safe function object to insert a list of consecutive particles
// into the data structure
struct insert_points_lambda_sequential {
// types
typedef Traits::double_d double_d;
typedef unspecifed ptobl_type;
// construct/copy/destruct
insert_points_lambda_sequential(double_d *, const ptobl_type &, int *,
int *, int *, int);
// public member functions
void operator()(const int);
// public data members
double_d * m_positions;
ptobl_type m_point_to_bucket_index;
int * m_buckets;
int * m_dirty_buckets;
int * m_linked_list;
int start;
};
// non-threadsafe insert a consecutive vector of particles into the data
// structure
struct insert_points_lambda_sequential_serial {
// types
typedef Traits::double_d double_d;
typedef unspecifed ptobl_type;
// construct/copy/destruct
insert_points_lambda_sequential_serial(double_d *, const ptobl_type &,
int *, int *, int *, int *, int);
// public member functions
void operator()(const int);
// public data members
double_d * m_positions;
ptobl_type m_point_to_bucket_index;
int * m_buckets;
int * m_dirty_buckets;
int * m_linked_list;
int * m_linked_list_reverse;
int start;
};
// construct/copy/destruct
CellList();
// public member functions
void print_data_structure() const;
// public static functions
static constexpr bool ordered();
// private member functions
bool set_domain_impl();
void check_data_structure();
void update_iterator_impl();
void update_positions_impl(iterator, iterator, const int, const bool = true);
void insert_points(typename vector_int::iterator,
typename vector_int::iterator, const int);
void insert_points(const int, const int);
const CellListQuery< Traits > & get_query_impl() const;
CellListQuery< Traits > & get_query_impl();
};

Description

https://martinjrobins.github.io/Aboria/Aboria/CellList.html[10/22/2018 7:36:42 AM]


Class template CellList

This class implements neighbourhood searching using a bucket search, or cell list algorithm. The domain is frst divided up into a regular
grid of constant size "buckets".

After the buckets are created, a set of 3D points can be assigned to their respective buckets. After this, neighbourhood queries around a
given point can be performed be looking at all the points in the same bucket or surrounding buckets of the given point.

CellList public construct/copy/destruct


1. CellList();

constructs the default base structure

CellList public member functions


1. void print_data_structure() const;

Print the data structure to stdout.

CellList public static functions


1. static constexpr bool ordered();

This structure is not ordered. That is, the order of the particles is not important to the search algorithm. Instead, the indicies of the
particles are kept in a linked list.

CellList private member functions


1. bool set_domain_impl();

set the domain, called from base class

Returns: true if this function wishes to trigger a reconstruction of the data structure (i.e. resize the buckets and re-insert
all the particles to the linked list) set

2. void check_data_structure();

check that the data structure is internally consistent

3. void update_iterator_impl();

called by base class, does nothing for this data structure

4. void update_positions_impl(iterator update_begin, iterator update_end,


const int num_new_particles_added,
const bool call_set_domain = true);

called by base class, deals with an updated particle range.

Needs to handle: dead particles (only if update_end == m_particles_end), particles with different positions, and new particles

Parameters:
call_set_domain set to true (the default) if set_domain_impl() needs to be called
num_new_particles_added number of new particles to be added
update_begin iterator to the beginning of the update range
update_end iterator to the end of the update range

https://martinjrobins.github.io/Aboria/Aboria/CellList.html[10/22/2018 7:36:42 AM]


Class template CellList

5. void insert_points(typename vector_int::iterator start_adding,


typename vector_int::iterator stop_adding,
const int start);

insert non-consecutive points into data structure

Parameters:
start the index of the particle set to start adding (the start of the update range)
start_adding iterator to the start of the list of indices to be inserted
stop_adding iterator to the end of the list of indices to be inserted

6. void insert_points(const int start, const int n);

7. const CellListQuery< Traits > & get_query_impl() const;

returns the query object via the base class

8. CellListQuery< Traits > & get_query_impl();

returns the query object via the base class

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellList.html[10/22/2018 7:36:42 AM]


Struct template CellListQuery

Struct template CellListQuery


Aboria::CellListQuery — This is a query object for the CellList spatial data structure.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellList.h>
template<typename Traits>
struct CellListQuery : public Aboria::NeighbourQueryBase< Traits > {
// types
typedef Traits traits_type;
typedef Traits::raw_pointer raw_pointer;
typedef Traits::double_d double_d;
typedef Traits::bool_d bool_d;
typedef Traits::int_d int_d;
typedef Traits::unsigned_int_d unsigned_int_d;
typedef Traits::reference particle_reference;
typedef Traits::const_reference particle_const_reference;
typedef lattice_iterator_within_distance< CellListQuery, LNormNumber > query_iterator;
typedef lattice_iterator< dimension > all_iterator;
typedef lattice_iterator< dimension > child_iterator;
typedef query_iterator< 2 >::reference reference;
typedef query_iterator< 2 >::pointer pointer;
typedef query_iterator< 2 >::value_type value_type;
typedef linked_list_iterator< Traits > particle_iterator;
typedef bbox< dimension > box_type;
// construct/copy/destruct
CellListQuery();
// public member functions
raw_pointer fnd(const size_t) const;
child_iterator get_children() const;
child_iterator get_children(const child_iterator &) const;
size_t num_children() const;
const box_type get_bounds(const child_iterator &) const;
const box_type & get_bounds() const;
const bool_d & get_periodic() const;
particle_iterator get_bucket_particles(const reference) const;
bbox< dimension > get_bucket_bbox(const reference) const;
child_iterator get_bucket(const double_d &) const;
size_t get_bucket_index(const reference) const;
template<int LNormNumber = -1>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double) const;
template<int LNormNumber = -1>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double_d &) const;
const int_d & get_end_bucket() const;
all_iterator get_subtree(const child_iterator &) const;
all_iterator get_subtree() const;
size_t number_of_buckets() const;
size_t number_of_particles() const;
const raw_pointer & get_particles_begin() const;
raw_pointer & get_particles_begin();
unsigned number_of_levels() const;
// public static functions
static bool is_leaf_node(const value_type &);
static bool is_tree();
static size_t num_children(const child_iterator &);
// public data members
static const unsigned int dimension;
bool_d m_periodic; // periodicity of domain
double_d m_bucket_side_length; // bucket length in each dimension
int_d m_end_bucket; // index of last bucket
bbox< dimension > m_bounds; // domain min/max bounds
unspecifed m_point_to_bucket_index; // function object to calculate a bucket index from a
position
raw_pointer m_particles_begin; // pointer to the beginning of the particle set
raw_pointer m_particles_end; // pointer to the end of the particle set
int * m_buckets_begin; // pointer to the beginning of the buckets
int * m_linked_list_begin; // pointer to the beginning of the linked list
size_t * m_id_map_key; // pointer to the fnd-by-id map key
size t * m id map value; // pointer to the fnd-by-id map value

https://martinjrobins.github.io/Aboria/Aboria/CellListQuery.html[10/22/2018 7:36:53 AM]


Struct template CellListQuery

};

Description
This object is designed to be used within algorithms or gpu kernels, and can be obtained from a Particles type using the
Particles::get_query() function

auto query = particles.get_query();


std::for_each(particles.begin(), particles.end(), [&] (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Note that if you wish to run this on a gpu using Trust, you need to copy the query object to the kernel, and mark the lambda function as a
device function

auto query = particles.get_query();


thrust::for_each(particles.begin(), particles.end(),
[=] __host__ __device__ (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Template Parameters
1. typename Traits

the TraitsCommon type

CellListQuery public construct/copy/destruct


1. CellListQuery();

constructor checks that we are not using std::vector and cuda at the same time

CellListQuery public member functions


1. raw_pointer fnd(const size_t id) const;

implement fnd-by-id

performs a binary search for the id in the map

Parameters:
id the id of the particle to fnd

Returns: pointer to the particle found, or a pointer to the end of the particle set if not found

2. child_iterator get_children() const;

gets all the children of the root node.

for CellList this is all the buckets (fat tree with one root node, all the rest leafs)

Returns: a child_iterator that iterates through all the buckets in the data structure

https://martinjrobins.github.io/Aboria/Aboria/CellListQuery.html[10/22/2018 7:36:53 AM]


Struct template CellListQuery

3. child_iterator get_children(const child_iterator & ci) const;

returns all the children of the given child_iterator

Parameters:
ci this fuction returns all the children of ci

Returns: same as get_children()

4. size_t num_children() const;

returns the number of children of the root node

5. const box_type get_bounds(const child_iterator & ci) const;

returns the min/max bounds of the given child_iterator ci

Returns: a containing the bounds

6. const box_type & get_bounds() const;

returns the min/max bounds of the given child_iterator ci

Returns: a containing the bounds

7. const bool_d & get_periodic() const;

returns the periodicity of the domain

8. particle_iterator get_bucket_particles(const reference bucket) const;

returns a particle_iterator range to all the particles within the given bucket

Parameters:
bucket a reference to the bucket in question

9. bbox< dimension > get_bucket_bbox(const reference bucket) const;

get min/max bounds of given bucket bucket

10. child_iterator get_bucket(const double_d & position) const;

given a position, returns a bucket and a min/max bounds

Parameters:
position (input)

11. size_t get_bucket_index(const reference bucket) const;

returns a bucket index/id given a bucket reference

12. template<int LNormNumber = -1>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position, const double max_distance) const;

returns all the bucket within a distance of a point

This function can use multiple p-norm distance types by setting LNormNumber, and uses a isotropic distance value given by
max_distance. Note that only buckets within the domain are returned, and periodicity is not taken into account

See Also:

https://martinjrobins.github.io/Aboria/Aboria/CellListQuery.html[10/22/2018 7:36:53 AM]


Struct template CellListQuery

lattice_iterator_within_distance

Parameters:
max_distance the maximum distance of the buckets to be returned
position the position to search around

Returns: an iterator_range containing all the buckets found

13. template<int LNormNumber = -1>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position,
const double_d & max_distance) const;

returns all the bucket within a distance of a point

This function can use multiple p-norm distance types by setting LNormNumber, and uses a isotropic distance value given by
max_distance. Note that only buckets within the domain are returned, and periodicity is not taken into account

See Also:

lattice_iterator_within_distance

Parameters:
max_distance the maximum distance of the buckets to be returned
position the position to search around

Returns: an iterator_range containing all the buckets found

14. const int_d & get_end_bucket() const;

get index of the last bucket in the cell list

15. all_iterator get_subtree(const child_iterator & ci) const;

return an all_iterator to the entire tree under the given child_iterator ci

Parameters:
ci the child_iterator to search under

16. all_iterator get_subtree() const;

return an all_iterator to the entire tree data structure

Can use this range to loop through all the buckets in the data structure, wether it is a tree or not

17. size_t number_of_buckets() const;

return the total number of buckets in the data structure

18. size_t number_of_particles() const;

return the total number of particles in the data structure

19. const raw_pointer & get_particles_begin() const;

get a pointer to the beginning of the particle container

can use this and number_of_particles() to loop through all the particles

20. raw_pointer & get_particles_begin();

get a pointer to the beginning of the particle container

can use this and number_of_particles() to loop through all the particles

https://martinjrobins.github.io/Aboria/Aboria/CellListQuery.html[10/22/2018 7:36:53 AM]


Struct template CellListQuery

21. unsigned number_of_levels() const;

returns the number of levels in the tree

CellListQuery public static functions


1. static bool is_leaf_node(const value_type & bucket);

given a reference to a bucket, checks if that bucket is a leaf (i.e. does not have any children)

CellList implements a "fat" tree, so all buckets are leafs

Parameters:
bucket the bucket to check

Returns: true if is a bucket


false if is not a bucket

2. static bool is_tree();

CellList is not a proper tree structure, so will return false always

Returns: true if this data structure is a tree (e.g. kdtree, HyperOctree)


false if this data structure is not a tree (e.g. cell list)

3. static size_t num_children(const child_iterator & ci);

returns the number of children of a given child iterator ci

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellListQuery.html[10/22/2018 7:36:53 AM]


Class template CellListOrdered

Class template CellListOrdered


Aboria::CellListOrdered — A cell list spatial data structure that is paired with a CellListOrderedQuery query type.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellListOrdered.h>
template<typename Traits>
class CellListOrdered : public Aboria::neighbour_search_base< CellListOrdered< Traits >, Traits,
CellListOrderedQuery< Traits > >
{
public:
// construct/copy/destruct
CellListOrdered();
// public member functions
void print_data_structure() const;
// public static functions
static constexpr bool ordered();
// private member functions
bool set_domain_impl();
void update_iterator_impl();
void update_positions_impl(iterator, iterator, const int, const bool = true);
const CellListOrderedQuery< Traits > & get_query_impl() const;
CellListOrderedQuery< Traits > & get_query_impl();
};

Description
This class implements neighbourhood searching using a cell list. That is, the domain is divided up into a regular grid of constant size
"buckets", and particles are assigned to their containing bucket.

The main difference between this class and CellList is that the particle set is reordered according to which cell each particle belongs to.
This correlates memory locality with spatial locality, and improves cache access if you are often looping over neighbouring particles. It also
mean that particles within a given bucket are sequential in memory.

CellListOrdered public construct/copy/destruct


1. CellListOrdered();

CellListOrdered public member functions


1. void print_data_structure() const;

CellListOrdered public static functions


1. static constexpr bool ordered();

https://martinjrobins.github.io/Aboria/Aboria/CellListOrdered.html[10/22/2018 7:37:04 AM]


Class template CellListOrdered

CellListOrdered private member functions


1. bool set_domain_impl();

2. void update_iterator_impl();

3. void update_positions_impl(iterator update_begin, iterator update_end,


const int new_n,
const bool call_set_domain = true);

4. const CellListOrderedQuery< Traits > & get_query_impl() const;

5. CellListOrderedQuery< Traits > & get_query_impl();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellListOrdered.html[10/22/2018 7:37:04 AM]


Struct template CellListOrderedQuery

Struct template CellListOrderedQuery


Aboria::CellListOrderedQuery — This is a query object for the CellListOrdered spatial data structure.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellListOrdered.h>
template<typename Traits>
struct CellListOrderedQuery : public Aboria::NeighbourQueryBase< Traits > {
// types
typedef Traits traits_type;
typedef Traits::raw_pointer raw_pointer;
typedef Traits::double_d double_d;
typedef Traits::bool_d bool_d;
typedef Traits::int_d int_d;
typedef Traits::unsigned_int_d unsigned_int_d;
typedef lattice_iterator_within_distance< CellListOrderedQuery, LNormNumber > query_iterator;
typedef lattice_iterator< dimension > all_iterator;
typedef lattice_iterator< dimension > child_iterator;
typedef query_iterator< 2 >::reference reference;
typedef query_iterator< 2 >::pointer pointer;
typedef query_iterator< 2 >::value_type value_type;
typedef ranges_iterator< Traits > particle_iterator;
typedef bbox< dimension > box_type;
// construct/copy/destruct
CellListOrderedQuery();
// public member functions
raw_pointer fnd(const size_t) const;
child_iterator get_children() const;
child_iterator get_children(const child_iterator &) const;
size_t num_children() const;
const box_type get_bounds(const child_iterator &) const;
const box_type & get_bounds() const;
const bool_d & get_periodic() const;
particle_iterator get_bucket_particles(const reference) const;
bbox< dimension > get_bucket_bbox(const reference) const;
child_iterator get_bucket(const double_d &) const;
size_t get_bucket_index(const reference) const;
template<int LNormNumber = -1>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double) const;
template<int LNormNumber = -1>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double_d &) const;
const int_d & get_end_bucket() const;
all_iterator get_subtree(const child_iterator &) const;
all_iterator get_subtree() const;
size_t number_of_buckets() const;
size_t number_of_particles() const;
const raw_pointer & get_particles_begin() const;
raw_pointer & get_particles_begin();
unsigned number_of_levels() const;
// public static functions
static bool is_leaf_node(const value_type &);
static bool is_tree();
static size_t num_children(const child_iterator &);
// public data members
static const unsigned int dimension;
raw_pointer m_particles_begin; // pointer to the beginning of the particle set
raw_pointer m_particles_end; // pointer to the end of the particle set
bool_d m_periodic; // periodicity of the domain
double_d m_bucket_side_length; // dimensions of each bucket
int_d m_end_bucket; // index of the last bucket in the cell list
bbox< dimension > m_bounds; // min/max bounds of the domain
unspecifed m_point_to_bucket_index; // function object to transform a point to a bucket index
unsigned int * m_bucket_begin; // pointer to the beginning of the buckets
unsigned int * m_bucket_end; // pointer to the end of the buckets
unsigned int m_nbuckets; // the number of buckets
size_t * m_id_map_key; // a pointer to the "key" values of the fnd-by-id map
size_t * m_id_map_value; // a pointer to the "value" values of the fnd-by-id map
};

https://martinjrobins.github.io/Aboria/Aboria/CellListOrderedQuery.html[10/22/2018 7:37:15 AM]


Struct template CellListOrderedQuery

Description
This object is designed to be used within algorithms or gpu kernels, and can be obtained from a Particles type using the
Particles::get_query() function

auto query = particles.get_query();


std::for_each(particles.begin(), particles.end(), [&] (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Note that if you wish to run this on a gpu using Trust, you need to copy the query object to the kernel, and mark the lambda function as a
device function

auto query = particles.get_query();


thrust::for_each(particles.begin(), particles.end(),
[=] __host__ __device__ (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Template Parameters
1. typename Traits

the TraitsCommon type

CellListOrderedQuery public construct/copy/destruct


1. CellListOrderedQuery();

CellListOrderedQuery public member functions


1. raw_pointer fnd(const size_t id) const;

implement fnd-by-id

performs a binary search for the id in the map

Parameters:
id the id of the particle to fnd

Returns: pointer to the particle found, or a pointer to the end of the particle set if not found

2. child_iterator get_children() const;

gets all the children of the root node.

Returns: a child_iterator that iterates through all the buckets in the data structure

3. child_iterator get_children(const child_iterator & ci) const;

returns all the children of the given child_iterator

https://martinjrobins.github.io/Aboria/Aboria/CellListOrderedQuery.html[10/22/2018 7:37:15 AM]


Struct template CellListOrderedQuery

Parameters:
ci this fuction returns all the children of ci

Returns: same as get_children()

4. size_t num_children() const;

returns the number of children of the root node

5. const box_type get_bounds(const child_iterator & ci) const;

returns the min/max bounds of the given child_iterator ci

Returns: a containing the bounds

6. const box_type & get_bounds() const;

returns the min/max bounds of the given child_iterator ci

Returns: a containing the bounds

7. const bool_d & get_periodic() const;

returns the periodicity of the domain

8. particle_iterator get_bucket_particles(const reference bucket) const;

returns a particle_iterator range to all the particles within the given bucket

Parameters:
bucket a reference to the bucket in question

9. bbox< dimension > get_bucket_bbox(const reference bucket) const;

get min/max bounds of given bucket bucket

10. child_iterator get_bucket(const double_d & position) const;

given a position, returns a bucket and a min/max bounds

Parameters:
position (input)

11. size_t get_bucket_index(const reference bucket) const;

returns a bucket index/id given a bucket reference

12. template<int LNormNumber = -1>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position, const double max_distance) const;

returns all the bucket within a distance of a point

This function can use multiple p-norm distance types by setting LNormNumber, and uses a isotropic distance value given by
max_distance. Note that only buckets within the domain are returned, and periodicity is not taken into account

Parameters:
max_distance the maximum distance of the buckets to be returned
position the position to search around

Returns: an iterator_range containing all the buckets found

https://martinjrobins.github.io/Aboria/Aboria/CellListOrderedQuery.html[10/22/2018 7:37:15 AM]


Struct template CellListOrderedQuery

13. template<int LNormNumber = -1>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position,
const double_d & max_distance) const;

returns all the bucket within a distance of a point

This function can use multiple p-norm distance types by setting LNormNumber, and uses a isotropic distance value given by
max_distance. Note that only buckets within the domain are returned, and periodicity is not taken into account

Parameters:
max_distance the maximum distance of the buckets to be returned
position the position to search around

Returns: an iterator_range containing all the buckets found

14. const int_d & get_end_bucket() const;

get index of the last bucket in the cell list

15. all_iterator get_subtree(const child_iterator & ci) const;

return an all_iterator to the entire tree under the given child_iterator ci

Parameters:
ci the child_iterator to search under

16. all_iterator get_subtree() const;

return an all_iterator to the entire tree data structure

Can use this range to loop through all the buckets in the data structure, wether it is a tree or not

17. size_t number_of_buckets() const;

return the total number of buckets in the data structure

18. size_t number_of_particles() const;

return the total number of particles in the data structure

19. const raw_pointer & get_particles_begin() const;

get a pointer to the beginning of the particle container

can use this and number_of_particles() to loop through all the particles

20. raw_pointer & get_particles_begin();

get a pointer to the beginning of the particle container

can use this and number_of_particles() to loop through all the particles

21. unsigned number_of_levels() const;

returns the number of levels in the tree

always 2 for CellListOrdered

CellListOrderedQuery public static functions


1. static bool is_leaf_node(const value_type & bucket);

https://martinjrobins.github.io/Aboria/Aboria/CellListOrderedQuery.html[10/22/2018 7:37:15 AM]


Struct template CellListOrderedQuery

given a reference to a bucket, checks if that bucket is a leaf (i.e. does not have any children)

always true for CellListOrdered

Parameters:
bucket the bucket to check

Returns: true if is a bucket


false if is not a bucket

2. static bool is_tree();

always false for CellListOrdered

Returns: true if this data structure is a tree (e.g. kdtree, HyperOctree)


false if this data structure is not a tree (e.g. cell list)

3. static size_t num_children(const child_iterator & ci);

returns the number of children of a given child iterator ci

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellListOrderedQuery.html[10/22/2018 7:37:15 AM]


Function template get_neighbouring_buckets

Function template get_neighbouring_buckets


Aboria::get_neighbouring_buckets — returns a bucket_pair_iterator that iterates through all the neighbouring buckets (i.e. buckets that are
touching) within a domain. Note that this will only work for cell list spatial data structures

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Search.h>

template<typename Query, typename Iterator = bucket_pair_iterator<Query> >


Iterator get_neighbouring_buckets(const Query & query);

Description
Parameters:
query the query object

Template Parameters:
Query query object type (must be CellListQuery or CellListOrderedQuery)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/get_neighbouring_buckets.html[10/22/2018 7:37:25 AM]


Class template Kdtree

Class template Kdtree


Aboria::Kdtree — KdTree.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kdtree.h>
template<typename Traits>
class Kdtree : public Aboria::neighbour_search_base< Kdtree< Traits >, Traits, KdtreeQuery< Traits
> >
{
public:
// construct/copy/destruct
Kdtree();
// public member functions
void print_data_structure() const;
// public static functions
static constexpr bool ordered();
// private member functions
void set_domain_impl();
void update_iterator_impl();
void print_tree() const;
void print_level(int, int) const;
void update_positions_impl(iterator, iterator, const int, const bool = true);
const KdtreeQuery< Traits > & get_query_impl() const;
KdtreeQuery< Traits > & get_query_impl();
void build_tree();
};

Description

Kdtree public construct/copy/destruct


1. Kdtree();

Kdtree public member functions


1. void print_data_structure() const;

Kdtree public static functions


1. static constexpr bool ordered();

Kdtree private member functions


1. void set_domain_impl();

https://martinjrobins.github.io/Aboria/Aboria/Kdtree.html[10/22/2018 7:37:36 AM]


Class template Kdtree

2. void update_iterator_impl();

3. void print_tree() const;

4. void print_level(int index, int level_size) const;

5. void update_positions_impl(iterator update_begin, iterator update_end,


const int new_n,
const bool call_set_domain = true);

6. const KdtreeQuery< Traits > & get_query_impl() const;

7. KdtreeQuery< Traits > & get_query_impl();

8. void build_tree();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Kdtree.html[10/22/2018 7:37:36 AM]


Struct template KdtreeQuery

Struct template KdtreeQuery


Aboria::KdtreeQuery — This is a query object for the Kdtree spatial data structure.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kdtree.h>
template<typename Traits>
struct KdtreeQuery {
// types
typedef Traits traits_type;
typedef Traits::raw_pointer raw_pointer;
typedef Traits::double_d double_d;
typedef Traits::bool_d bool_d;
typedef Traits::int_d int_d;
typedef Traits::unsigned_int_d unsigned_int_d;
typedef tree_query_iterator< KdtreeQuery, LNormNumber > query_iterator;
typedef depth_frst_iterator< KdtreeQuery > all_iterator;
typedef KdtreeChildIterator< KdtreeQuery > child_iterator;
typedef child_iterator::value_type value_type;
typedef child_iterator::reference reference;
typedef child_iterator::pointer pointer;
typedef ranges_iterator< Traits > particle_iterator;
typedef bbox< dimension > box_type;
// public member functions
const box_type & get_bounds() const;
const bool_d & get_periodic() const;
raw_pointer fnd(const size_t) const;
bool is_leaf_node(reference) const;
child_iterator get_children() const;
child_iterator get_children(const child_iterator &) const;
size_t num_children() const;
size_t num_children(const child_iterator &) const;
const box_type get_bounds(const child_iterator &) const;
particle_iterator get_bucket_particles(reference) const;
void go_to(const double_d &, child_iterator &) const;
child_iterator get_bucket(const double_d &) const;
size_t get_parent_index(const child_iterator &) const;
const box_type & get_parent_bounds(const child_iterator &) const;
size_t get_bucket_index(reference) const;
size_t number_of_buckets() const;
template<int LNormNumber>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double) const;
template<int LNormNumber>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double_d &) const;
all_iterator get_subtree(const child_iterator &) const;
all_iterator get_subtree() const;
size_t number_of_particles() const;
raw_pointer get_particles_begin() const;
unsigned number_of_levels() const;
// private member functions
int get_parent_index(reference) const;
int get_child_index(reference) const;
// public static functions
static bool is_tree();
// public data members
static const unsigned int dimension;
static const unsigned int m_max_tree_depth;
bool_d m_periodic;
bbox< dimension > m_bounds;
raw_pointer m_particles_begin;
raw_pointer m_particles_end;
size_t m_number_of_buckets;
size_t m_number_of_levels;
int * m_nodes_child;
int * m_nodes_split_dim;
double * m_nodes_split_pos;
size_t * m_id_map_key;
size_t * m_id_map_value;
};

https://martinjrobins.github.io/Aboria/Aboria/KdtreeQuery.html[10/22/2018 7:37:46 AM]


Struct template KdtreeQuery

Description
This object is designed to be used within algorithms or gpu kernels, and can be obtained from a Particles type using the
Particles::get_query() function

auto query = particles.get_query();


std::for_each(particles.begin(), particles.end(), [&] (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Note that if you wish to run this on a gpu using Trust, you need to copy the query object to the kernel, and mark the lambda function as a
device function

auto query = particles.get_query();


thrust::for_each(particles.begin(), particles.end(),
[=] __host__ __device__ (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Template Parameters
1. typename Traits

the TraitsCommon type

KdtreeQuery public member functions


1. const box_type & get_bounds() const;

2. const bool_d & get_periodic() const;

3. raw_pointer fnd(const size_t id) const;

4. bool is_leaf_node(reference bucket) const;

5. child_iterator get_children() const;

6. child_iterator get_children(const child_iterator & ci) const;

7. size_t num_children() const;

returns the number of children of the root node

8. size_t num_children(const child_iterator & ci) const;

9. const box_type get_bounds(const child_iterator & ci) const;

10. particle_iterator get_bucket_particles(reference bucket) const;

11. void go_to(const double_d & position, child_iterator & ci) const;

12. child_iterator get_bucket(const double_d & position) const;

13. size_t get_parent_index(const child_iterator & ci) const;

https://martinjrobins.github.io/Aboria/Aboria/KdtreeQuery.html[10/22/2018 7:37:46 AM]


Struct template KdtreeQuery

14. const box_type & get_parent_bounds(const child_iterator & ci) const;

15. size_t get_bucket_index(reference bucket) const;

16. size_t number_of_buckets() const;

17. template<int LNormNumber>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position, const double max_distance) const;

18. template<int LNormNumber>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position,
const double_d & max_distance) const;

19. all_iterator get_subtree(const child_iterator & ci) const;

20. all_iterator get_subtree() const;

21. size_t number_of_particles() const;

22. raw_pointer get_particles_begin() const;

23. unsigned number_of_levels() const;

KdtreeQuery private member functions


1. int get_parent_index(reference b) const;

2. int get_child_index(reference b) const;

KdtreeQuery public static functions


1. static bool is_tree();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KdtreeQuery.html[10/22/2018 7:37:46 AM]


Class template KdtreeNanoflann

Class template KdtreeNanofann


Aboria::KdtreeNanofann — Implements neighbourhood searching using a bucket search algorithm, dividing the domain into constant size
"buckets".

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NanoFlannAdaptor.h>
template<typename Traits>
class KdtreeNanofann : public Aboria::neighbour_search_base< KdtreeNanofann< Traits >, Traits,
KdtreeNanofannQuery< Traits > >
{
public:
// construct/copy/destruct
KdtreeNanofann();
// public member functions
size_t kdtree_get_point_count() const;
double kdtree_distance(const double *, const size_t, size_t) const;
double kdtree_get_pt(const size_t, int) const;
template<typename BBOX> bool kdtree_get_bbox(BBOX &) const;
void print_data_structure() const;
// public static functions
static constexpr bool ordered();
// private member functions
void set_domain_impl();
void end_list_of_copies_impl();
void update_iterator_impl();
void print_tree(const node_type *) const;
void print_level(std::vector< const node_type * > &) const;
void update_positions_impl(iterator, iterator, const int, const bool = true);
const KdtreeNanofannQuery< Traits > & get_query_impl() const;
KdtreeNanofannQuery< Traits > & get_query_impl();
};

Description
This class implements neighbourhood searching using a bucket search algorithm. The domain is frst divided up into a regular grid of
constant size "buckets", either by using the class constructor to initialise the domain extents, bucket size etc., or by using the reset()
member function to reset these parameters.

After the buckets are created, a set of 3D points can be assigned to their respective buckets using the embed_points() member function.
After this, neighbourhood queries around a given point can be performed using fnd_broadphase_neighbours(), which returns a const
iterator to all the points in the same bucket or surrounding buckets of the given point.

KdtreeNanofann public construct/copy/destruct


1. KdtreeNanofann();

KdtreeNanofann public member functions


1. size_t kdtree_get_point_count() const;

2. double kdtree_distance(const double * p1, const size_t idx_p2, size_t) const;

https://martinjrobins.github.io/Aboria/Aboria/KdtreeNanoflann.html[10/22/2018 7:37:57 AM]


Class template KdtreeNanoflann

3. double kdtree_get_pt(const size_t idx, int dim) const;

4. template<typename BBOX> bool kdtree_get_bbox(BBOX & bb) const;

5. void print_data_structure() const;

KdtreeNanofann public static functions


1. static constexpr bool ordered();

KdtreeNanofann private member functions


1. void set_domain_impl();

2. void end_list_of_copies_impl();

3. void update_iterator_impl();

4. void print_tree(const node_type * nodes) const;

5. void print_level(std::vector< const node_type * > & nodes) const;

6. void update_positions_impl(iterator update_begin, iterator update_end,


const int new_n,
const bool call_set_domain = true);

7. const KdtreeNanofannQuery< Traits > & get_query_impl() const;

8. KdtreeNanofannQuery< Traits > & get_query_impl();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KdtreeNanoflann.html[10/22/2018 7:37:57 AM]


Struct template KdtreeNanoflannQuery

Struct template KdtreeNanofannQuery


Aboria::KdtreeNanofannQuery — This is a query object for the KdtreeNanofann spatial data structure.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NanoFlannAdaptor.h>
template<typename Traits>
struct KdtreeNanofannQuery {
// types
typedef unspecifed kd_tree_type;
typedef kd_tree_type::Node value_type;
typedef const value_type & reference;
typedef const value_type * pointer;
typedef Traits traits_type;
typedef Traits::raw_pointer raw_pointer;
typedef Traits::double_d double_d;
typedef Traits::bool_d bool_d;
typedef Traits::int_d int_d;
typedef Traits::unsigned_int_d unsigned_int_d;
typedef tree_query_iterator< KdtreeNanofannQuery, LNormNumber > query_iterator;
typedef value_type * root_iterator;
typedef depth_frst_iterator< KdtreeNanofannQuery > all_iterator;
typedef nanofann_child_iterator< Traits > child_iterator;
typedef ranges_iterator< Traits > particle_iterator;
typedef bbox< dimension > box_type;
// public member functions
const box_type & get_bounds() const;
const bool_d & get_periodic() const;
raw_pointer fnd(const size_t) const;
child_iterator get_children() const;
child_iterator get_children(reference, const box_type &) const;
size_t num_children() const;
size_t num_children(const child_iterator &) const;
particle_iterator get_bucket_particles(reference) const;
child_iterator get_bucket(const double_d &) const;
size_t get_bucket_index(reference) const;
size_t number_of_buckets() const;
template<int LNormNumber>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double) const;
template<int LNormNumber>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double_d &) const;
iterator_range< root_iterator > get_root_buckets() const;
all_iterator get_subtree(const child_iterator &) const;
all_iterator get_subtree() const;
size_t number_of_particles() const;
raw_pointer get_particles_begin() const;
unsigned number_of_levels() const;
// public static functions
static bool is_leaf_node(reference);
static bool is_tree();
static size_t get_dimension_index(reference);
static double get_cut_low(reference);
static double get_cut_high(reference);
static pointer get_child1(pointer);
static pointer get_child2(pointer);
static child_iterator get_children(const child_iterator &);
static const box_type get_bounds(const child_iterator &);
// public data members
static const unsigned int dimension;
static const unsigned int m_max_tree_depth;
bool_d m_periodic;
bbox< dimension > m_bounds;
raw_pointer m_particles_begin;
raw_pointer m_particles_end;
size_t m_number_of_buckets;
size_t m_number_of_levels;
value_type * m_root;
value_type m_dummy_root;
size_t * m_id_map_key;
size t * m id map value;

https://martinjrobins.github.io/Aboria/Aboria/KdtreeNanoflannQuery.html[10/22/2018 7:38:08 AM]


Struct template KdtreeNanoflannQuery

};

Description
This object is designed to be used within algorithms or gpu kernels, and can be obtained from a Particles type using the
Particles::get_query() function

auto query = particles.get_query();


std::for_each(particles.begin(), particles.end(), [&] (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Note that if you wish to run this on a gpu using Trust, you need to copy the query object to the kernel, and mark the lambda function as a
device function

auto query = particles.get_query();


thrust::for_each(particles.begin(), particles.end(),
[=] __host__ __device__ (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Template Parameters
1. typename Traits

the TraitsCommon type

KdtreeNanofannQuery public member functions


1. const box_type & get_bounds() const;

2. const bool_d & get_periodic() const;

3. raw_pointer fnd(const size_t id) const;

4. child_iterator get_children() const;

5. child_iterator get_children(reference bucket, const box_type & bounds) const;

6. size_t num_children() const;

returns the number of children of the root node

7. size_t num_children(const child_iterator & ci) const;

8. particle_iterator get_bucket_particles(reference bucket) const;

9. child_iterator get_bucket(const double_d & position) const;

10. size_t get_bucket_index(reference bucket) const;

11. size_t number_of_buckets() const;

12. template<int LNormNumber>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position, const double max_distance) const;

https://martinjrobins.github.io/Aboria/Aboria/KdtreeNanoflannQuery.html[10/22/2018 7:38:08 AM]


Struct template KdtreeNanoflannQuery

13. template<int LNormNumber>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position,
const double_d & max_distance) const;

14. iterator_range< root_iterator > get_root_buckets() const;

15. all_iterator get_subtree(const child_iterator & ci) const;

16. all_iterator get_subtree() const;

17. size_t number_of_particles() const;

18. raw_pointer get_particles_begin() const;

19. unsigned number_of_levels() const;

KdtreeNanofannQuery public static functions


1. static bool is_leaf_node(reference bucket);

2. static bool is_tree();

3. static size_t get_dimension_index(reference bucket);

4. static double get_cut_low(reference bucket);

5. static double get_cut_high(reference bucket);

6. static pointer get_child1(pointer bucket);

7. static pointer get_child2(pointer bucket);

8. static child_iterator get_children(const child_iterator & ci);

9. static const box_type get_bounds(const child_iterator & ci);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KdtreeNanoflannQuery.html[10/22/2018 7:38:08 AM]


Struct template HyperOctreeQuery

Struct template HyperOctreeQuery


Aboria::HyperOctreeQuery — This is a query object for the HyperOctree spatial data structure.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/OctTree.h>
template<typename Traits>
struct HyperOctreeQuery {
// types
typedef Traits traits_type;
typedef Traits::raw_pointer raw_pointer;
typedef Traits::double_d double_d;
typedef Traits::bool_d bool_d;
typedef Traits::int_d int_d;
typedef Traits::unsigned_int_d unsigned_int_d;
typedef tree_query_iterator< HyperOctreeQuery, LNormNumber > query_iterator;
typedef depth_frst_iterator< HyperOctreeQuery > root_iterator;
typedef depth_frst_iterator< HyperOctreeQuery > all_iterator;
typedef octree_child_iterator< dimension > child_iterator;
typedef child_iterator::reference reference;
typedef child_iterator::pointer pointer;
typedef child_iterator::value_type value_type;
typedef bbox< dimension > box_type;
typedef ranges_iterator< Traits > particle_iterator;
// public member functions
raw_pointer fnd(const size_t) const;
const box_type & get_bounds() const;
const bool_d & get_periodic() const;
child_iterator get_children() const;
child_iterator get_children(reference, const box_type &) const;
child_iterator get_children(const child_iterator &) const;
particle_iterator get_bucket_particles(reference) const;
child_iterator get_bucket(const double_d &) const;
size_t get_bucket_index(reference) const;
size_t number_of_buckets() const;
template<int LNormNumber>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double) const;
template<int LNormNumber>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double_d &) const;
iterator_range< root_iterator > get_root_buckets() const;
all_iterator get_subtree(const child_iterator &) const;
all_iterator get_subtree() const;
size_t number_of_particles() const;
unsigned number_of_levels() const;
const raw_pointer & get_particles_begin() const;
raw_pointer & get_particles_begin();
// public static functions
static bool is_leaf_node(reference);
static bool is_tree();
static size_t num_children();
static size_t num_children(const child_iterator &);
static box_type get_bounds(const child_iterator &);
// public data members
static const unsigned int dimension;
static const unsigned int m_max_tree_depth;
bool_d m_periodic;
box_type m_bounds;
raw_pointer m_particles_begin;
raw_pointer m_particles_end;
size_t m_number_of_nodes;
unsigned m_number_of_levels;
vint2 * m_leaves_begin;
int * m_nodes_begin;
size_t * m_id_map_key;
size_t * m_id_map_value;
};

https://martinjrobins.github.io/Aboria/Aboria/HyperOctreeQuery.html[10/22/2018 7:38:18 AM]


Struct template HyperOctreeQuery

Description
This object is designed to be used within algorithms or gpu kernels, and can be obtained from a Particles type using the
Particles::get_query() function

auto query = particles.get_query();


std::for_each(particles.begin(), particles.end(), [&] (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Note that if you wish to run this on a gpu using Trust, you need to copy the query object to the kernel, and mark the lambda function as a
device function

auto query = particles.get_query();


thrust::for_each(particles.begin(), particles.end(),
[=] __host__ __device__ (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Template Parameters
1. typename Traits

the TraitsCommon type

HyperOctreeQuery public member functions


1. raw_pointer fnd(const size_t id) const;

2. const box_type & get_bounds() const;

3. const bool_d & get_periodic() const;

4. child_iterator get_children() const;

5. child_iterator get_children(reference bucket, const box_type & bounds) const;

6. child_iterator get_children(const child_iterator & ci) const;

7. particle_iterator get_bucket_particles(reference bucket) const;

8. child_iterator get_bucket(const double_d & position) const;

9. size_t get_bucket_index(reference bucket) const;

10. size_t number_of_buckets() const;

11. template<int LNormNumber>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position, const double max_distance) const;

12. template<int LNormNumber>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position,
const double_d & max_distance) const;

13. iterator_range< root_iterator > get_root_buckets() const;

https://martinjrobins.github.io/Aboria/Aboria/HyperOctreeQuery.html[10/22/2018 7:38:18 AM]


Struct template HyperOctreeQuery

14. all_iterator get_subtree(const child_iterator & ci) const;

15. all_iterator get_subtree() const;

16. size_t number_of_particles() const;

17. unsigned number_of_levels() const;

18. const raw_pointer & get_particles_begin() const;

19. raw_pointer & get_particles_begin();

HyperOctreeQuery public static functions


1. static bool is_leaf_node(reference bucket);

2. static bool is_tree();

3. static size_t num_children();

returns the number of children of the root node

4. static size_t num_children(const child_iterator & ci);

5. static box_type get_bounds(const child_iterator & ci);

returns the min/max bounds of the given child_iterator ci

Returns: a containing the bounds

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/HyperOctreeQuery.html[10/22/2018 7:38:18 AM]


Struct template NeighbourQueryBase

Struct template NeighbourQueryBase


Aboria::NeighbourQueryBase — a lightweight query object that should be used for read-only access to the spatial data structures

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
template<typename Traits>
struct NeighbourQueryBase {
// types
typedef Traits::raw_pointer raw_pointer;
typedef Traits::double_d double_d;
typedef Traits::bool_d bool_d;
typedef Traits::int_d int_d;
typedef Traits::unsigned_int_d unsigned_int_d;
typedef Traits::reference particle_reference;
typedef Traits::const_reference particle_const_reference;
typedef bbox< dimension > box_type;
typedef query_iterator< 2 >::reference reference; // A reference to a bucket in
the tree.
typedef query_iterator< 2 >::pointer pointer; // A pointer to a bucket in the
tree.
typedef query_iterator< 2 >::value_type value_type; // A value_type for a bucket in
the tree.
// member classes/structs/unions
// An iterator that steps through all the buckets in the tree (depth-frst)
struct all_iterator {
};
// An iterator that steps through the children of a single bucket in the
// tree.
struct child_iterator {
};
// An iterator that steps through the particles within a given bucket.
struct particle_iterator {
};
template<int LNormNumber>
struct query_iterator {
};
// public member functions
raw_pointer fnd(const size_t) const;
bool is_leaf_node(const value_type &);
bool is_tree();
child_iterator get_children() const;
child_iterator get_children(const child_iterator &) const;
size_t num_children() const;
size_t num_children(const child_iterator &) const;
const box_type get_bounds(const child_iterator &) const;
const box_type & get_bounds() const;
const bool_d & get_periodic() const;
particle_iterator get_bucket_particles(const reference);
bbox< dimension > get_bucket_bbox(const reference) const;
void get_bucket(const double_d &, pointer &, box_type &) const;
size_t get_bucket_index(const reference) const;
template<int LNormNumber = -1>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double) const;
template<int LNormNumber = -1>
query_iterator< LNormNumber >
get_buckets_near_point(const double_d &, const double_d &) const;
const int_d & get_end_bucket() const;
all_iterator get_subtree(const child_iterator &) const;
all_iterator get_subtree() const;
size_t number_of_buckets() const;
size_t number_of_particles() const;
const raw_pointer & get_particles_begin() const;
raw_pointer & get_particles_begin();
unsigned number_of_levels() const;

https://martinjrobins.github.io/Aboria/Aboria/NeighbourQueryBase.html[10/22/2018 7:38:29 AM]


Struct template NeighbourQueryBase

// public data members


static const unsigned int dimension;
};

Description
This object is designed to be used within algorithms or gpu kernels, and can be obtained from a Particles type using the
Particles::get_query() function

auto query = particles.get_query();


std::for_each(particles.begin(), particles.end(), [&] (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Note that if you wish to run this on a gpu using Trust, you need to copy the query object to the kernel, and mark the lambda function as a
device function

auto query = particles.get_query();


thrust::for_each(particles.begin(), particles.end(),
[=] __host__ __device__ (auto i) {
int count = 0;
for (auto j = euclidean_search(query, get<position>(i), diameter);
j != false; ++j) {
++count;
}
});

Template Parameters
1. typename Traits

the TraitsCommon type

NeighbourQueryBase public member functions


1. raw_pointer fnd(const size_t id) const;

implement fnd-by-id

performs a binary search for the id in the map

Parameters:
id the id of the particle to fnd

Returns: pointer to the particle found, or a pointer to the end of the particle set if not found

2. bool is_leaf_node(const value_type & bucket);

given a reference to a bucket, checks if that bucket is a leaf (i.e. does not have any children)

Parameters:
bucket the bucket to check

Returns: true if is a bucket


false if is not a bucket

3. bool is_tree();

Returns: true if this data structure is a tree (e.g. kdtree, HyperOctree)

https://martinjrobins.github.io/Aboria/Aboria/NeighbourQueryBase.html[10/22/2018 7:38:29 AM]


Struct template NeighbourQueryBase

false if this data structure is not a tree (e.g. cell list)

4. child_iterator get_children() const;

gets all the children of the root node.

Returns: a child_iterator that iterates through all the buckets in the data structure

5. child_iterator get_children(const child_iterator & ci) const;

returns all the children of the given child_iterator

Parameters:
ci this fuction returns all the children of ci

Returns: same as get_children()

6. size_t num_children() const;

returns the number of children of the root node

7. size_t num_children(const child_iterator & ci) const;

returns the number of children of a given child iterator ci

8. const box_type get_bounds(const child_iterator & ci) const;

returns the min/max bounds of the given child_iteratorci

Returns: a containing the bounds

9. const box_type & get_bounds() const;

returns entire domain min/max bounds

10. const bool_d & get_periodic() const;

returns the periodicity of the domain

11. particle_iterator get_bucket_particles(const reference bucket);

returns a particle_iterator range to all the particles within the given bucket

Parameters:
bucket a reference to the bucket in question

12. bbox< dimension > get_bucket_bbox(const reference bucket) const;

get min/max bounds of given bucket bucket

13. void get_bucket(const double_d & position, pointer & bucket,


box_type & bounds) const;

given a position, returns a bucket and a min/max bounds

Parameters:
bounds (output)
bucket (output)
position (input)

14. size_t get_bucket_index(const reference bucket) const;

https://martinjrobins.github.io/Aboria/Aboria/NeighbourQueryBase.html[10/22/2018 7:38:29 AM]


Struct template NeighbourQueryBase

returns a bucket index/id given a bucket reference

15. template<int LNormNumber = -1>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position, const double max_distance) const;

returns all the bucket within a distance of a point

This function can use multiple p-norm distance types by setting LNormNumber, and uses a isotropic distance value given by
max_distance. Note that only buckets within the domain are returned, and periodicity is not taken into account

Parameters:
max_distance the maximum distance of the buckets to be returned
position the position to search around

Returns: an iterator_range containing all the buckets found

16. template<int LNormNumber = -1>


query_iterator< LNormNumber >
get_buckets_near_point(const double_d & position,
const double_d & max_distance) const;

returns all the bucket within an anisotropic distance of a point

This function can use multiple p-norm distance types by setting LNormNumber, and uses a anisotropic distance value given by
max_distance. Note that only buckets within the domain are returned, and periodicity is not taken into account

Parameters:
max_distance the maximum distance of the buckets to be returned
position the position to search around

Returns: an iterator_range containing all the buckets found

17. const int_d & get_end_bucket() const;

get index of the last bucket in the cell list

18. all_iterator get_subtree(const child_iterator & ci) const;

return an all_iterator to the entire tree under the given child_iteratorci

Parameters:
ci the child_iterator to search under

19. all_iterator get_subtree() const;

return an all_iterator to the entire tree data structure

Can use this range to loop through all the buckets in the data structure, wether it is a tree or not

20. size_t number_of_buckets() const;

return the total number of buckets in the data structure

21. size_t number_of_particles() const;

return the total number of particles in the data structure

22. const raw_pointer & get_particles_begin() const;

get a pointer to the beginning of the particle container

https://martinjrobins.github.io/Aboria/Aboria/NeighbourQueryBase.html[10/22/2018 7:38:29 AM]


Struct template NeighbourQueryBase

can use this and number_of_particles() to loop through all the particles

23. raw_pointer & get_particles_begin();

get a pointer to the beginning of the particle container

can use this and number_of_particles() to loop through all the particles

24. unsigned number_of_levels() const;

returns the number of levels in the tree

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/NeighbourQueryBase.html[10/22/2018 7:38:29 AM]


Struct child_iterator

Struct child_iterator
Aboria::NeighbourQueryBase::child_iterator — An iterator that steps through the children of a single bucket in the tree.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>

// An iterator that steps through the children of a single bucket in the tree.
struct child_iterator {
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/NeighbourQueryBase/child_iterator.html[10/22/2018 7:38:40 AM]


Class template HyperOctree

Class template HyperOctree


Aboria::HyperOctree — A hyper octree spatial data structure that is paired with a HyperOctreeQuery query type.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/OctTree.h>
template<typename Traits>
class HyperOctree : public Aboria::neighbour_search_base< HyperOctree< Traits >, Traits,
HyperOctreeQuery< Traits > >
{
public:
// member classes/structs/unions
struct child_index_to_tag_mask {
// types
typedef vector_int::const_pointer ptr_type;
// construct/copy/destruct
child_index_to_tag_mask(int, int, ptr_type);
// public member functions
int operator()(int) const;
// public data members
const int level;
const int max_level;
ptr_type m_nodes;
static const unsigned mask;
};
struct classify_node {
// construct/copy/destruct
classify_node(int, int);
// public member functions
template<typename tuple_type> int operator()(const tuple_type &) const;
// public data members
const int threshold;
const int last_level;
};
struct classify_point {
// construct/copy/destruct
classify_point(const bbox< dimension > &, int);
// public member functions
int operator()(const double_d &);
// public data members
bbox< dimension > box;
int max_level;
};
struct make_leaf {
// types
typedef vint2 result_type;
// public member functions
template<typename tuple_type>
result_type operator()(const tuple_type &) const;
};
struct write_nodes {
// construct/copy/destruct
write_nodes(int, int);
// public member functions
template<typename tuple_type> int operator()(const tuple_type &) const;
// public data members
int num_nodes;
int num_leaves;
};
// construct/copy/destruct

https://martinjrobins.github.io/Aboria/Aboria/HyperOctree.html[10/22/2018 7:38:50 AM]


Class template HyperOctree

HyperOctree();
// public member functions
void build_tree();
void print_data_structure() const;
// public static functions
static constexpr bool ordered();
// private member functions
void set_domain_impl();
void update_iterator_impl();
void update_positions_impl(iterator, iterator, const int, const bool = true);
const HyperOctreeQuery< Traits > & get_query_impl() const;
HyperOctreeQuery< Traits > & get_query_impl();
};

Description
An hyper octree is the general n-dimensional analog of an octree (aside: a normal octree is only defned for three dimensions). This data
structure is a tree, where each level of the tree splits each bucket along the middle of each dimension. Each new bucket formed by this split
becomes a child bucket for that bucket. Once the number of particles within a box falls below a threshold value (default: 10) then it is a leaf
of the tree with no children

For example, consider a certain level of the tree in two dimensions which has 3 buckets, one a leaf with 9 particles, the other two non-leafs
with 44 and 11 particles respectivly. The threshold value is set at 10. <heading>~~~ </heading>

| | | | leaf | |

9 44

   

|---------------<mdash></mdash>+-----------------<mdash></mdash>|

11  

   

   

   

<hruler></hruler>

The next level of the tree might look like this:

<hruler></hruler> | | 12 | 9 | | | | leaf | | +------<mdash></mdash>+-------<mdash></mdash>| | | 11 | 12 | | | | | |-----<mdash></mdash>+-----


-<mdash></mdash>|------<mdash></mdash>+-------<mdash></mdash>| | 1 | 8 | | | leaf | leaf | | |-----<mdash></mdash>+-----
-<mdash></mdash>| | | 0 | 2 | | <heading>| leaf | leaf | | </heading>

~~~

Template Parameters
1. typename Traits

an instatiation of TraitsCommon

HyperOctree public construct/copy/destruct

https://martinjrobins.github.io/Aboria/Aboria/HyperOctree.html[10/22/2018 7:38:50 AM]


Class template HyperOctree

1. HyperOctree();

HyperOctree public member functions


1. void build_tree();

2. void print_data_structure() const;

HyperOctree public static functions


1. static constexpr bool ordered();

HyperOctree private member functions


1. void set_domain_impl();

2. void update_iterator_impl();

3. void update_positions_impl(iterator update_begin, iterator update_end,


const int new_n,
const bool call_set_domain = true);

4. const HyperOctreeQuery< Traits > & get_query_impl() const;

5. HyperOctreeQuery< Traits > & get_query_impl();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/HyperOctree.html[10/22/2018 7:38:50 AM]


Struct all_iterator

Struct all_iterator
Aboria::NeighbourQueryBase::all_iterator — An iterator that steps through all the buckets in the tree (depth-frst)

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>

// An iterator that steps through all the buckets in the tree (depth-frst)
struct all_iterator {
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/NeighbourQueryBase/all_iterator.html[10/22/2018 7:39:01 AM]


Struct template query_iterator

Struct template query_iterator


Aboria::NeighbourQueryBase::query_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>

template<int LNormNumber>
struct query_iterator {
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/NeighbourQueryBase/query_iterator.html[10/22/2018 7:39:11 AM]


Class template zip_iterator

Class template zip_iterator


Aboria::zip_iterator — Generic iterator that zips multiple iterators together.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>
template<typename iterator_tuple_type, typename mpl_vector_type>
class zip_iterator {
};

Description

Template Parameters
1. typename iterator_tuple_type

std::tuple or thrust::tuple of individual iterators

2. typename mpl_vector_type

a boost::mpl typelist of variable types

Specializations
Class template zip_iterator<std::tuple< Types...>, mpl_vector_type>

Class template zip_iterator<thrust::tuple< Types...>, mpl_vector_type>

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/zip_iterator.html[10/22/2018 7:39:21 AM]


Class template MatrixReplacement

Class template MatrixReplacement


Aboria::MatrixReplacement — A matrix-replacement class for use with Eigen.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Operators.h>
template<unsigned int NI, unsigned int NJ, typename Blocks>
class MatrixReplacement :
public Eigen::EigenBase< MatrixReplacement< NI, NJ, Blocks > >
{
public:
// types
typedef frst_block_type::Scalar Scalar;
typedef Scalar RealScalar;
typedef size_t Index;
typedef int StorageIndex;
typedef unspecifed InnerIterator;
enum @0 { ColsAtCompileTime = = Eigen::Dynamic,
RowsAtCompileTime = = Eigen::Dynamic,
MaxColsAtCompileTime = = Eigen::Dynamic,
MaxRowsAtCompileTime = = Eigen::Dynamic, IsRowMajor = = false };
// construct/copy/destruct
MatrixReplacement(const Blocks &);
MatrixReplacement(Blocks &&);
// public member functions
Index rows() const;
Index cols() const;
Index innerSize() const;
Index outerSize() const;
void resize(Index, Index);
Scalar coeff(const Index, const Index) const;
template<typename Rhs>
Eigen::Product< MatrixReplacement, Rhs, Eigen::AliasFreeProduct >
operator*(const Eigen::MatrixBase< Rhs > &) const;
template<unsigned int I, unsigned int J>
const std::tuple_element< I *NJ+J, Blocks >::type & get_kernel() const;
const std::tuple_element< 0, Blocks >::type & get_frst_kernel() const;
template<unsigned int I, unsigned int J>
std::tuple_element< I *NJ+J, Blocks >::type & get_kernel();
std::tuple_element< 0, Blocks >::type & get_frst_kernel();
template<typename Derived>
void assemble(Eigen::DenseBase< Derived > &) const;
template<int _Options, typename _StorageIndex>
void assemble(Eigen::SparseMatrix< Scalar, _Options, _StorageIndex > &);
template<std::size_t... I> Index rows_impl(unspecifed) const;
template<std::size_t... J> Index cols_impl(unspecifed) const;
template<int I> Index start_col() const;
template<int I> Index size_col() const;
template<int I> Index start_row() const;
template<int I> Index size_row() const;
template<typename block_type>
Scalar coeff_impl_block(const Index, const Index, const block_type &) const;
template<std::size_t... I>
Scalar coeff_impl(const Index, const Index, unspecifed) const;
template<typename Block>
void assemble_block_impl(const size_t, const size_t,
std::vector< Eigen::Triplet< Scalar >> &,
const Block &) const;
template<typename Block, typename Derived>
void assemble_block_impl(const Eigen::MatrixBase< Derived > &,
const Block &) const;
template<std::size_t... I>
void assemble_impl(std::vector< Eigen::Triplet< Scalar >> &, unspecifed) const;
template<typename Derived, std::size_t... I>
void assemble_impl(Eigen::DenseBase< Derived > &, unspecifed) const;
// public data members
Blocks m_blocks;
};

https://martinjrobins.github.io/Aboria/Aboria/MatrixReplacement.html[10/22/2018 7:39:31 AM]


Class template MatrixReplacement

Description
This provides a class that acts like a sparse matrix within Eigen, at least for matrix-vector multiplication and the iterative solvers (it has not
been tested with anything else and will not work, for example, in matrix-matrix addition or multiplication).

It is templated on a set of NI x NJ blocks, each containing a kernel defned in Kernels.h . This kernel performs the actual operator

See Also:

Aboria::create_dense_operator() create_sparse_operator() create_zero_operator() create_chebyshev_operator()

Template Parameters
1. unsigned int NI

the number of kernel block rows in the operator

2. unsigned int NJ

the number of kernel block columns in the operator

3. typename Blocks

a 3-tuple of (particle_type_row, particle_type_col,kernel_type), where particle_type_row is the type of the row


particle set, particle_type_col is the type of the column particle set, and kernel_type is the type of kernel used by the block

MatrixReplacement public construct/copy/destruct


1. MatrixReplacement(const Blocks & blocks);

2. MatrixReplacement(Blocks && blocks);

MatrixReplacement public member functions


1. Index rows() const;

2. Index cols() const;

3. Index innerSize() const;

4. Index outerSize() const;

5. void resize(Index a_rows, Index a_cols);

6. Scalar coeff(const Index i, const Index j) const;

7. template<typename Rhs>
Eigen::Product< MatrixReplacement, Rhs, Eigen::AliasFreeProduct >
operator*(const Eigen::MatrixBase< Rhs > & x) const;

8. template<unsigned int I, unsigned int J>


const std::tuple_element< I *NJ+J, Blocks >::type & get_kernel() const;

9. const std::tuple_element< 0, Blocks >::type & get_frst_kernel() const;

10. template<unsigned int I, unsigned int J>


std::tuple_element< I *NJ+J, Blocks >::type & get_kernel();

11. std::tuple_element< 0, Blocks >::type & get_frst_kernel();

template<typename Derived>

https://martinjrobins.github.io/Aboria/Aboria/MatrixReplacement.html[10/22/2018 7:39:31 AM]


Class template MatrixReplacement

12.
void assemble(Eigen::DenseBase< Derived > & matrix) const;

13. template<int _Options, typename _StorageIndex>


void assemble(Eigen::SparseMatrix< Scalar, _Options, _StorageIndex > & matrix);

14. template<std::size_t... I> Index rows_impl(unspecifed) const;

15. template<std::size_t... J> Index cols_impl(unspecifed) const;

16. template<int I> Index start_col() const;

17. template<int I> Index size_col() const;

18. template<int I> Index start_row() const;

19. template<int I> Index size_row() const;

20. template<typename block_type>


Scalar coeff_impl_block(const Index i, const Index j,
const block_type & block) const;

21. template<std::size_t... I>


Scalar coeff_impl(const Index i, const Index j, unspecifed) const;

22. template<typename Block>


void assemble_block_impl(const size_t startI, const size_t startJ,
std::vector< Eigen::Triplet< Scalar >> & triplets,
const Block & block) const;

23. template<typename Block, typename Derived>


void assemble_block_impl(const Eigen::MatrixBase< Derived > & matrix,
const Block & block) const;

24. template<std::size_t... I>


void assemble_impl(std::vector< Eigen::Triplet< Scalar >> & triplets,
unspecifed) const;

25. template<typename Derived, std::size_t... I>


void assemble_impl(Eigen::DenseBase< Derived > & matrix, unspecifed) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/MatrixReplacement.html[10/22/2018 7:39:31 AM]


Function template create_dense_operator

Function template create_dense_operator


Aboria::create_dense_operator — creates a dense matrix-free linear operator for use with Eigen

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Operators.h>

template<typename RowParticles, typename ColParticles, typename F,


typename Kernel = KernelDense<RowParticles, ColParticles, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_dense_operator(const RowParticles & row_particles,
const ColParticles & col_particles,
const F & function);

Description
This function returns a MatrixReplacement object that acts like a dense linear operator (i.e. matrix) in Eigen.

Parameters:
col_particles The columns of the linear operator index this frst particle set
function A function object that returns the value of the operator for a given particle
pair
row_particles The rows of the linear operator index this frst particle set

Template
Parameters: ColParticles The type of the column particle set
F The type of the function object
RowParticles The type of the row particle set

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/create_dense_operator.html[10/22/2018 7:39:42 AM]


Function template create_chebyshev_operator

Function template create_chebyshev_operator


Aboria::create_chebyshev_operator — creates a matrix-free linear operator using chebyshev interpolation for use with Eigen

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Operators.h>

template<typename RowParticles, typename ColParticles, typename F,


typename Kernel = KernelChebyshev<RowParticles, ColParticles, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_chebyshev_operator(const RowParticles & row_particles,
const ColParticles & col_particles,
const unsigned int n,
const F & function);

Description
This function returns a MatrixReplacement object that acts like a dense linear operator (i.e. matrix) in Eigen. It uses chebyshev
interpolation to speed up its application to a vector.

Parameters:
col_particles The columns of the linear operator index this frst particle set
function A function object that returns the value of the operator for a given particle
pair
n The number of chebyshev nodes in each dimension to use
row_particles The rows of the linear operator index this frst particle set

Template
Parameters: ColParticles The type of the column particle set
F The type of the function object
RowParticles The type of the row particle set

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/create_chebyshev_operator.html[10/22/2018 7:39:52 AM]


Class template KernelChebyshev

Class template KernelChebyshev


Aboria::KernelChebyshev

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kernels.h>
template<typename RowElements, typename ColElements, typename PositionF,
size_t QuadratureOrder = 8,
typename F = detail::position_kernel<RowElements, ColElements, PositionF> >
class KernelChebyshev :
public Aboria::KernelDense< RowElements, ColElements, F >
{
public:
// types
typedef base_type::Scalar Scalar;
typedef base_type::Block Block;
// construct/copy/destruct
KernelChebyshev(const RowElements &, const ColElements &,
const unsigned int, const PositionF &);
// public member functions
void set_n(const unsigned int);
void update_row_positions();
void update_kernel_matrix();
void update_col_positions();
template<typename DerivedLHS, typename DerivedRHS>
void evaluate(Eigen::DenseBase< DerivedLHS > &,
const Eigen::DenseBase< DerivedRHS > &) const;
// public data members
static const size_t BlockRows;
static const size_t BlockCols;
};

Description

KernelChebyshev public construct/copy/destruct


1. KernelChebyshev(const RowElements & row_elements,
const ColElements & col_elements, const unsigned int n,
const PositionF & function);

KernelChebyshev public member functions


1. void set_n(const unsigned int n);

2. void update_row_positions();

3. void update_kernel_matrix();

4. void update_col_positions();

5. template<typename DerivedLHS, typename DerivedRHS>


void evaluate(Eigen::DenseBase< DerivedLHS > & lhs,

https://martinjrobins.github.io/Aboria/Aboria/KernelChebyshev.html[10/22/2018 7:40:02 AM]


Class template KernelChebyshev

const Eigen::DenseBase< DerivedRHS > & rhs) const;

Evaluates a matrix-free linear operator given by expr if_expr, and particle sets a and b on a vector rhs and accumulates the
result in vector lhs

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KernelChebyshev.html[10/22/2018 7:40:02 AM]


Function template create_fmm_operator

Function template create_fmm_operator


Aboria::create_fmm_operator — creates a matrix-free linear operator using the Black-Box Fast Multipole Method (FMM)

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Operators.h>

template<unsigned int N, typename RowParticles, typename ColParticles,


typename PositionF, typename F,
typename Kernel = KernelFMM<RowParticles, ColParticles, PositionF, F, N>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_fmm_operator(const RowParticles & row_particles,
const ColParticles & col_particles,
const PositionF & position_function,
const F & function);

Description
This function returns a MatrixReplacement object that acts like a dense linear operator (i.e. matrix) in Eigen. It uses FMM speed up its
application to a vector. For repeated uses it is better to use create_h2_operator

Parameters:
col_particles The columns of the linear operator index this frst particle set
function A function object that returns the value of the operator for a given particle
pair (used for close particle pairs)
position_function A function object that returns the value of the operator for a given position
pair (used for well-separated position pairs)
row_particles The rows of the linear operator index this frst particle set

Template
Parameters: ColParticles The type of the column particle set
F The type of the function object
N The number of chebyshev nodes in each dimension to use
RowParticles The type of the row particle set

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/create_fmm_operator.html[10/22/2018 7:40:13 AM]


Function template create_h2_operator

Function template create_h2_operator


Aboria::create_h2_operator — creates a matrix-free linear operator using the Black-Box Fast Multipole Method (FMM) to internally create a
H2 hierarchical matrix

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Operators.h>

template<typename RowParticles, typename ColParticles, typename PositionF,


typename F,
typename Kernel = KernelH2<RowParticles, ColParticles, PositionF, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_h2_operator(const RowParticles & row_particles,
const ColParticles & col_particles,
const int order,
const PositionF & position_function,
const F & function, const double eta = 1.0);

Description
This function returns a MatrixReplacement object that acts like a dense linear operator (i.e. matrix) in Eigen. It internally creates a H2
hierarchical matrix to speed up repeated applications of the operator

Parameters:
col_particles The columns of the linear operator index this frst particle set
function A function object that returns the value of the operator for a given particle
pair (used for close particle pairs)
order Chebyshev order of the approximation within each cluster
position_function A function object that returns the value of the operator for a given position
pair (used for well-separated position pairs)
row_particles The rows of the linear operator index this frst particle set

Template
Parameters: ColParticles The type of the column particle set
F The type of the function object
RowParticles The type of the row particle set

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/create_h2_operator.html[10/22/2018 7:40:23 AM]


Function template create_block_operator

Function template create_block_operator


Aboria::create_block_operator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Operators.h>

template<unsigned int NI, unsigned int NJ, typename... T>


MatrixReplacement< NI, NJ, std::tuple< typename std::tuple_element< 0, T >::type...> >
create_block_operator(const MatrixReplacement< 1, 1, T > &... operators);

Description
creates a matrix-free linear block operator for use with Eigen

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/create_block_operator.html[10/22/2018 7:40:33 AM]


Struct template Dx

Struct template Dx
Aboria::Dx

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>
template<typename L1, typename L2>
struct Dx {
// types
typedef unspecifed data_type;
typedef proto::terminal< data_type >::type expr_type;
// construct/copy/destruct
explicit Dx(L1 &, L2 &);
};

Description
a symbolic class used to refer to the difference between neighbouring particles position vectors. Note that for periodic domains this might
be different than get<position)(a)-get<position>(b), and in this case always gives the shortest position difference

Dx public construct/copy/destruct
1. explicit Dx(L1 & la, L2 & lb);

constructor

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Dx.html[10/22/2018 7:40:43 AM]


Struct template Variable

Struct template Variable


Aboria::Variable — variables are attached to particles and have a name and container type

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Variable.h>
template<typename T, typename NAME>
struct Variable {
// types
typedef T value_type;
// public data members
const char * name;
};

Description
Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Variable.html[10/22/2018 7:40:53 AM]


Macro ABORIA_VARIABLE

Macro ABORIA_VARIABLE
ABORIA_VARIABLE — a macro to conveniently defne variable types

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Variable.h>
ABORIA_VARIABLE(NAME, DATA_TYPE, NAME_STRING)

Description
Parameters:
DATA_TYPE the type used to contain the data of the variable, e.g. int, double
NAME the name of the generated type
NAME_STRING a string used to name or describe the variable, e.g. "scalar", "velocity"

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ABORIA_VARIABLE.html[10/22/2018 7:41:03 AM]


Struct template Traits

Struct template Traits


Aboria::Traits

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>
template<template< typename, typename > class VECTOR>
struct Traits {
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits.html[10/22/2018 7:41:14 AM]


Class template FastMultipoleMethod

Class template FastMultipoleMethod


Aboria::FastMultipoleMethod

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/FastMultipoleMethod.h>
template<typename Expansions, typename Kernel, typename RowParticles,
typename ColParticles>
class FastMultipoleMethod {
public:
// construct/copy/destruct
FastMultipoleMethod(const RowParticles &, const ColParticles &,
const Expansions &, const Kernel &);
// public member functions
template<typename VectorTypeTarget, typename VectorTypeSource>
void matrix_vector_multiply(VectorTypeTarget &, const VectorTypeSource &) const;
// private member functions
template<typename VectorType>
m_expansion_type &
calculate_dive_P2M_and_M2M(const col_child_iterator &, const VectorType &,
const int) const;
template<typename VectorTypeTarget, typename VectorTypeSource>
void calculate_dive_M2L_and_L2L(VectorTypeTarget &,
const col_child_iterator_vector_type &,
const l_expansion_type &,
const box_type &,
const row_child_iterator &,
const VectorTypeSource &, const int) const;
};

Description

FastMultipoleMethod public construct/copy/destruct


1. FastMultipoleMethod(const RowParticles & row_particles,
const ColParticles & col_particles,
const Expansions & expansions, const Kernel & kernel);

FastMultipoleMethod public member functions


1. template<typename VectorTypeTarget, typename VectorTypeSource>
void matrix_vector_multiply(VectorTypeTarget & target_vector,
const VectorTypeSource & source_vector) const;

FastMultipoleMethod private member functions


1. template<typename VectorType>
m_expansion_type &
calculate_dive_P2M_and_M2M(const col_child_iterator & ci,

https://martinjrobins.github.io/Aboria/Aboria/FastMultipoleMethod.html[10/22/2018 7:41:24 AM]


Class template FastMultipoleMethod

const VectorType & source_vector,


const int num_tasks) const;

2. template<typename VectorTypeTarget, typename VectorTypeSource>


void calculate_dive_M2L_and_L2L(VectorTypeTarget & target_vector,
const col_child_iterator_vector_type &
connected_buckets_parent,
const l_expansion_type & g_parent,
const box_type & box_parent,
const row_child_iterator & ci,
const VectorTypeSource & source_vector,
const int num_tasks) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/FastMultipoleMethod.html[10/22/2018 7:41:24 AM]


Class H2LibMatrix

Class H2LibMatrix
Aboria::H2LibMatrix

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/H2Lib.h>

class H2LibMatrix {
public:
// construct/copy/destruct
template<typename RowParticles, typename ColParticles, typename Expansions,
typename Kernel>
H2LibMatrix(const RowParticles &, const ColParticles &,
const Expansions &, const Kernel &, const double);
// public member functions
void compress(const double);
ph2matrix get_ph2matrix() const;
pblock get_pblock() const;
H2Lib_LR_Decomposition lr(const double) const;
H2LibCholeskyDecomposition chol(const double) const;
template<typename T1, typename T2>
void matrix_vector_multiply(std::vector< T1 > &, const double, const bool,
const std::vector< T2 > &) const;
template<typename T1, typename T2>
void matrix_vector_multiply(Eigen::DenseBase< T1 > &, const double,
const bool, const Eigen::DenseBase< T2 > &) const;
// private member functions
template<typename Particles>
pcluster set_root_idx(uint *, const Particles &, const size_t);
template<typename ChildIterator, typename Particles>
pcluster set_idx(const ChildIterator, uint *, const Particles &,
const size_t);
};

Description

H2LibMatrix public construct/copy/destruct


1. template<typename RowParticles, typename ColParticles, typename Expansions,
typename Kernel>
H2LibMatrix(const RowParticles & row_particles,
const ColParticles & col_particles,
const Expansions & expansions, const Kernel & kernel,
const double eta);

H2LibMatrix public member functions


1. void compress(const double tol);

2. ph2matrix get_ph2matrix() const;

3. pblock get_pblock() const;

https://martinjrobins.github.io/Aboria/Aboria/H2LibMatrix.html[10/22/2018 7:41:34 AM]


Class H2LibMatrix

4. H2Lib_LR_Decomposition lr(const double tol) const;

5. H2LibCholeskyDecomposition chol(const double tol) const;

6. template<typename T1, typename T2>


void matrix_vector_multiply(std::vector< T1 > & target_vector,
const double alpha, const bool h2trans,
const std::vector< T2 > & source_vector) const;

7. template<typename T1, typename T2>


void matrix_vector_multiply(Eigen::DenseBase< T1 > & target_vector,
const double alpha, const bool h2trans,
const Eigen::DenseBase< T2 > & source_vector) const;

H2LibMatrix private member functions


1. template<typename Particles>
pcluster set_root_idx(uint * idx, const Particles & particles,
const size_t block_size);

2. template<typename ChildIterator, typename Particles>


pcluster set_idx(const ChildIterator ci, uint * idx,
const Particles & particles, const size_t block_size);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/H2LibMatrix.html[10/22/2018 7:41:34 AM]


Function template create_sparse_operator

Function template create_sparse_operator


Aboria::create_sparse_operator — creates a sparse matrix-free linear operator for use with Eigen

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Operators.h>

template<typename RowParticles, typename ColParticles, typename FRadius,


typename F,
typename Kernel = KernelSparse<RowParticles, ColParticles, FRadius, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>>,
typename = typename std::enable_if<!std::is_arithmetic<FRadius>::value>::type>
Operator create_sparse_operator(const RowParticles & row_particles,
const ColParticles & col_particles,
const FRadius & radius_function,
const F & function);

Description
This function returns a MatrixReplacement object that acts like a sparse linear operator (i.e. matrix) in Eigen, in that only particle pairs
(i.e. a row/column pair) with a separation less that a given value are considered to be non-zero

Parameters:
col_particles The columns of the linear operator index this frst particle set
function A function object that returns the value of the operator for a given particle pair
radius_function A function object that takes a const_reference to a particle and returns a double
value. It is assumed that function returns a zero value for all particle pairs with a
separation greater than this value
row_particles The rows of the linear operator index this frst particle set

Template
Parameters: ColParticles The type of the column particle set
F The type of the function object
RowParticles The type of the row particle set

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/create_s_idp46631328975712.html[10/22/2018 7:41:45 AM]


Function template create_zero_operator

Function template create_zero_operator


Aboria::create_zero_operator — creates a zero matrix-free linear operator for use with Eigen

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Operators.h>

template<typename RowParticles, typename ColParticles,


typename Kernel = KernelZero<RowParticles, ColParticles>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_zero_operator(const RowParticles & row_particles,
const ColParticles & col_particles);

Description
This function returns a MatrixReplacement object that acts like a $n m$ zero matrix. That is the application of this linear operator to a
vector will always return a zero vector.

Parameters:
col_particles The columns of the linear operator index this frst particle set
row_particles The rows of the linear operator index this frst particle set

Template Parameters:
ColParticles The type of the column particle set
RowParticles The type of the row particle set

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/create_zero_operator.html[10/22/2018 7:41:55 AM]


Struct template Symbol

Struct template Symbol


Aboria::Symbol

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>
template<typename T>
struct Symbol {
// types
typedef unspecifed expr_type; // type of the (terminal) expression used to express Symbol
typedef T variable_type; // the underlying Variable type
typedef T::value_type value_type; // value_type of the underlying Variable type
typedef unspecifed data_type;
// construct/copy/destruct
explicit Symbol();
};

Description
defne a symbol from a Variable type T. This symbol can then be used in expressions

Symbol public types


1. typedef unspecifed data_type;

type of internal data class used to store Symbol information (e.g. buffering)

Symbol public construct/copy/destruct


1. explicit Symbol();

constructor

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Symbol.html[10/22/2018 7:42:05 AM]


Struct template Label

Struct template Label


Aboria::Label

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>
template<unsigned int I, typename P>
struct Label {
// types
typedef unspecifed expr_type; // type of the (terminal) expression used to express Label
typedef unspecifed data_type; // type of internal data class used to store Label information
// construct/copy/destruct
explicit Label(P &);
// public member functions
template<typename Variable> void resize_buffer(const size_t);
};

Description
defne a label with a given depth I that referres to a particle container with type P

Label public construct/copy/destruct


1. explicit Label(P & p);

constructor

Label public member functions


1. template<typename Variable> void resize_buffer(const size_t n);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Label.html[10/22/2018 7:42:15 AM]


Function template create_dx

Function template create_dx


Aboria::create_dx

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename L1, typename L2> Dx< L1, L2 > create_dx(L1 & la, L2 & lb);

Description
helper function to create a Dx class that refers to the shortest distance between two particles given by labels la and lb

See Also:

Dx

Label

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/create_dx.html[10/22/2018 7:42:26 AM]


Struct template Accumulate

Struct template Accumulate


Aboria::Accumulate

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>
template<typename T>
struct Accumulate {
// types
typedef unspecifed expr_type;
typedef unspecifed data_type;
// construct/copy/destruct
explicit Accumulate();
template<typename T2> explicit Accumulate(const T2 &);
// public member functions
void set_init(const typename data_type::init_type &);
};

Description
an accumulation expression, for example a sum or product over neighbouring particles

Accumulate public construct/copy/destruct


1. explicit Accumulate();

empty constructor, makes an instantiation of the functor class T

2. template<typename T2> explicit Accumulate(const T2 & arg);

constructor that passes a single argument to the functor class T

Accumulate public member functions


1. void set_init(const typename data_type::init_type & arg);

a function used to set the initial value of the accumulation

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Accumulate.html[10/22/2018 7:42:36 AM]


Function template norm

Function template norm


Aboria::norm

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, norm_fun, Expr const & >::type
const
norm(Expr const & arg);

Description
a symbolic norm function for Vect3d

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/norm_idp46631327066400.html[10/22/2018 7:42:47 AM]


Function template inf_norm

Function template inf_norm


Aboria::inf_norm

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, inf_norm_fun, Expr const &
>::type const
inf_norm(Expr const & arg);

Description
a symbolic norm function for Vect3d

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/inf_norm.html[10/22/2018 7:42:57 AM]


Function template dot

Function template dot


Aboria::dot

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr1, typename Expr2>


proto::result_of::make_expr< proto::tag::function, SymbolicDomain, dot_fun, Expr1 const &, Expr2
const & >::type const
dot(Expr1 const & arg1, Expr2 const & arg2);

Description
a symbolic dot-product function for Vect3d

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/dot_idp46631327072736.html[10/22/2018 7:43:07 AM]


Function template exp

Function template exp


Aboria::exp

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, exp_fun, Expr const & >::type
const
exp(Expr const & arg);

Description
a symbolic exponential function for scalars

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/exp.html[10/22/2018 7:43:17 AM]


Function template pow

Function template pow


Aboria::pow

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr1, typename Expr2>


proto::result_of::make_expr< proto::tag::function, SymbolicDomain, pow_fun, Expr1 const &, Expr2
const & >::type const
pow(Expr1 const & arg1, Expr2 const & arg2);

Description
a symbolic power function for that takes two arguements arg1 and arg2 and returns arg1 to the power of arg2

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/pow_idp46631327099424.html[10/22/2018 7:43:27 AM]


Function template abs

Function template abs


Aboria::abs

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, abs_fun, Expr const & >::type
const
abs(Expr const & arg);

Description
a symbolic absolute value function for scalars

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/abs_idp46631327096240.html[10/22/2018 7:43:38 AM]


Function template log

Function template log


Aboria::log

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, log_fun, Expr const & >::type
const
log(Expr const & arg);

Description
a symbolic log function for scalars

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/log_idp46631327093072.html[10/22/2018 7:43:48 AM]


Function template erf

Function template erf


Aboria::erf

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, erf_fun, Expr const & >::type
const
erf(Expr const & arg);

Description
a symbolic error function for scalars

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/erf.html[10/22/2018 7:43:58 AM]


Function template sign

Function template sign


Aboria::sign

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, sign_fun, Expr const & >::type
const
sign(Expr const & arg);

Description
a symbolic sign function for scalars

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/sign.html[10/22/2018 7:44:09 AM]


Struct template CellListOrdered_params

Struct template CellListOrdered_params


Aboria::CellListOrdered_params

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellListOrdered.h>
template<typename Traits>
struct CellListOrdered_params {
// types
typedef Traits::double_d double_d;
// construct/copy/destruct
CellListOrdered_params();
CellListOrdered_params(const double_d &);
// public data members
double_d side_length;
};

Description

CellListOrdered_params public construct/copy/destruct


1. CellListOrdered_params();

2. CellListOrdered_params(const double_d & side_length);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellListOrdered_params.html[10/22/2018 7:44:20 AM]


Function template evaluate_nonlinear

Function template evaluate_nonlinear


Aboria::evaluate_nonlinear

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Evaluate.h>

template<typename VariableType, typename Functor, typename ExprRHS,


typename LabelType>
void evaluate_nonlinear(ExprRHS const & expr, LabelType & label);

Description
Evaluates a non-linear operator expr over a set of particles given by label label and stores the result, using the functor Functor, in
variable with type VariableType

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/evaluate_nonlinear.html[10/22/2018 7:44:32 AM]


Macro ABORIA_UNARY_FUNCTION

Macro ABORIA_UNARY_FUNCTION
ABORIA_UNARY_FUNCTION

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>
ABORIA_UNARY_FUNCTION(function_name, function_to_wrap, domain)

Description
a macro to generate a symbolic function taking a single argument using a given functor

Parameters:
domain the domain of the symbolic function (normally SymbolicDomain)
function_name the name of the symbolic function to generate
function_to_wrap a functor that defnes a typedef result_type with the returned type, and a
operator() that takes a single argument and returns result_type

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ABORIA_UNARY_FUNCTION.html[10/22/2018 7:44:43 AM]


Macro ABORIA_BINARY_FUNCTION

Macro ABORIA_BINARY_FUNCTION
ABORIA_BINARY_FUNCTION

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>
ABORIA_BINARY_FUNCTION(function_name, function_to_wrap, domain)

Description
a macro to generate a symbolic function taking two arguments using a given functor

Parameters:
domain the domain of the symbolic function (normally SymbolicDomain)
function_name the name of the symbolic function to generate
function_to_wrap a functor that defnes a typedef result_type with the returned type, and a
operator() that takes two arguments and returns result_type

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ABORIA_BINARY_FUNCTION.html[10/22/2018 7:44:53 AM]


Macro ABORIA_TERNARY_FUNCTION

Macro ABORIA_TERNARY_FUNCTION
ABORIA_TERNARY_FUNCTION

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>
ABORIA_TERNARY_FUNCTION(function_name, function_to_wrap, domain)

Description
a macro to generate a symbolic function taking three arguments using a given functor

Parameters:
domain the domain of the symbolic function (normally SymbolicDomain)
function_name the name of the symbolic function to generate
function_to_wrap a functor that defnes a typedef result_type with the returned type, and a
operator() that takes three arguments and returns result_type

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ABORIA_TERNARY_FUNCTION_idp46631327116144.html[10/22/2018 7:45:03 AM]


Macro ABORIA_TAGGED_FUNCTION

Macro ABORIA_TAGGED_FUNCTION
ABORIA_TAGGED_FUNCTION

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>
ABORIA_TAGGED_FUNCTION(name, tag)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ABORIA_TAGGED_FUNCTION.html[10/22/2018 7:45:14 AM]


Struct norm_fun

Struct norm_fun
Aboria::norm_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct norm_fun {
// types
typedef double result_type;
// public member functions
template<typename T, unsigned int N>
result_type operator()(const Vector< T, N > &) const;
};

Description

norm_fun public member functions


1. template<typename T, unsigned int N>
result_type operator()(const Vector< T, N > & vector) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/norm_fun.html[10/22/2018 7:45:24 AM]


Struct inf_norm_fun

Struct inf_norm_fun
Aboria::inf_norm_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct inf_norm_fun {
// types
typedef double result_type;
// public member functions
template<typename T, unsigned int N>
result_type operator()(const Vector< T, N > &) const;
};

Description

inf_norm_fun public member functions


1. template<typename T, unsigned int N>
result_type operator()(const Vector< T, N > & vector) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/inf_norm_fun.html[10/22/2018 7:45:34 AM]


Struct dot_fun

Struct dot_fun
Aboria::dot_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct dot_fun {
// types
typedef double result_type;
// public member functions
template<typename T, unsigned int N>
result_type operator()(const Vector< T, N > &, const Vector< T, N > &) const;
};

Description

dot_fun public member functions


1. template<typename T, unsigned int N>
result_type operator()(const Vector< T, N > & vector1,
const Vector< T, N > & vector2) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/dot_fun.html[10/22/2018 7:45:45 AM]


Struct exp_fun

Struct exp_fun
Aboria::exp_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct exp_fun {
// types
typedef double result_type;
// public member functions
result_type operator()(const double &) const;
};

Description

exp_fun public member functions


1. result_type operator()(const double & arg) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/exp_fun.html[10/22/2018 7:45:55 AM]


Struct sqrt_fun

Struct sqrt_fun
Aboria::sqrt_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct sqrt_fun {
// types
typedef double result_type;
// public member functions
result_type operator()(const double &) const;
};

Description

sqrt_fun public member functions


1. result_type operator()(const double & arg) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/sqrt_fun.html[10/22/2018 7:46:05 AM]


Struct sign_fun

Struct sign_fun
Aboria::sign_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct sign_fun {
// types
typedef double result_type;
// public member functions
result_type operator()(const double &) const;
};

Description

sign_fun public member functions


1. result_type operator()(const double & arg) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/sign_fun.html[10/22/2018 7:46:15 AM]


Struct erf_fun

Struct erf_fun
Aboria::erf_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct erf_fun {
// types
typedef double result_type;
// public member functions
result_type operator()(const double &) const;
};

Description

erf_fun public member functions


1. result_type operator()(const double & arg) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/erf_fun.html[10/22/2018 7:46:25 AM]


Struct erfc_fun

Struct erfc_fun
Aboria::erfc_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct erfc_fun {
// types
typedef double result_type;
// public member functions
result_type operator()(const double &) const;
};

Description

erfc_fun public member functions


1. result_type operator()(const double & arg) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/erfc_fun.html[10/22/2018 7:46:36 AM]


Struct log_fun

Struct log_fun
Aboria::log_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct log_fun {
// types
typedef double result_type;
// public member functions
result_type operator()(const double &) const;
};

Description

log_fun public member functions


1. result_type operator()(const double & arg) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/log_fun.html[10/22/2018 7:46:46 AM]


Struct abs_fun

Struct abs_fun
Aboria::abs_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct abs_fun {
// types
typedef double result_type;
// public member functions
result_type operator()(const double &) const;
};

Description

abs_fun public member functions


1. result_type operator()(const double & arg) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/abs_fun.html[10/22/2018 7:46:56 AM]


Struct pow_fun

Struct pow_fun
Aboria::pow_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

struct pow_fun {
// types
typedef double result_type;
// public member functions
double operator()(const double, const double) const;
double operator()(const double, const int) const;
};

Description

pow_fun public member functions


1. double operator()(const double d, const double exp) const;

2. double operator()(const double d, const int exp) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/pow_fun.html[10/22/2018 7:47:06 AM]


Struct template reflect_fun

Struct template refect_fun


Aboria::refect_fun

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>
template<typename T>
struct refect_fun {
// types
typedef Vector< double, 3 > Vect3d;
typedef Vect3d result_type;
// public member functions
result_type operator()(const Vect3d &, const Vect3d &, const T) const;
};

Description

refect_fun public member functions


1. result_type operator()(const Vect3d & from, const Vect3d & to,
const T geometry) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/reflect_fun.html[10/22/2018 7:47:17 AM]


Function template sqrt

Function template sqrt


Aboria::sqrt

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, sqrt_fun, Expr const & >::type
const
sqrt(Expr const & arg);

Description
a symbolic square root function for scalars

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/sqrt.html[10/22/2018 7:47:27 AM]


Function template erfc

Function template erfc


Aboria::erfc

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Functions.h>

template<typename Expr>
proto::result_of::make_expr< proto::tag::function, SymbolicDomain, erfc_fun, Expr const & >::type
const
erfc(Expr const & arg);

Description
a symbolic complimentary error function for scalars

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/erfc.html[10/22/2018 7:47:37 AM]


Struct template zip_pointer

Struct template zip_pointer


Aboria::zip_pointer — Generic pointer that zips multiple pointers together.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>
template<typename TupleType, typename MplVector>
struct zip_pointer {
};

Description

Template Parameters
1. typename TupleType

std::tuple or thrust::tuple of individual iterators

2. typename MplVector

a boost::mpl typelist

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/zip_pointer.html[10/22/2018 7:47:47 AM]


Struct template getter_type<std::tuple< Types...>, MplVector>

Struct template getter_type<std::tuple< Types...>, MplVector>


Aboria::getter_type<std::tuple< Types...>, MplVector> — specialisation of getter_type for std::tuple

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>
template<typename MplVector, typename... Types>
struct getter_type<std::tuple< Types...>, MplVector> {
// types
typedef std::tuple< Types...> tuple_type;
typedef MplVector mpl_vector_type;
typedef unspecifed tuple_reference;
typedef unspecifed elem_by_type;
typedef unspecifed return_type;
// construct/copy/destruct
getter_type();
explicit getter_type(const tuple_type &);
getter_type(const getter_type &);
getter_type(getter_type &&);
template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(const getter_type< tuple_reference, mpl_vector_type > &);
template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(getter_type< tuple_reference, mpl_vector_type > &&);
template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_type>::value) && (!std::is_same<T, tuple_reference>::value)>::type>
getter_type(const getter_type< T, mpl_vector_type > &);
template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_type>::value) && (!std::is_same<T, tuple_reference>::value)>::type>
getter_type(getter_type< T, mpl_vector_type > &&);
template<typename T1, typename T2, typename... T3>
getter_type(T1 &&, T2 &&, T3 &&...);
getter_type& operator=(const getter_type &);
getter_type& operator=(getter_type &&);
template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type&
operator=(const getter_type< tuple_reference, mpl_vector_type > &);
template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type& operator=(getter_type< tuple_reference, mpl_vector_type > &&);
template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_reference>::value) && (!std::is_same<T, tuple_type>::value)>::type>
getter_type& operator=(const getter_type< T, mpl_vector_type > &);
template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_reference>::value) && (!std::is_same<T, tuple_type>::value)>::type>
getter_type& operator=(getter_type< T, mpl_vector_type > &&);
// public member functions
template<typename T> int throw_away(const T &);
template<typename Tuple, std::size_t... I>
void copy_impl(const Tuple &, unspecifed);
template<typename T1, typename T2>
bool operator==(const getter_type< T1, T2 > &);
void swap(getter_type &);
template<typename tuple_type2, std::size_t... I>
void swap_via_tie(tuple_type2 &, unspecifed);
const tuple_type & get_tuple() const;
tuple_type & get_tuple();
// public data members
tuple_type data;
};

https://martinjrobins.github.io/Aboria/Aboria/getter_t_idp46631327135424.html[10/22/2018 7:47:58 AM]


Struct template getter_type<std::tuple< Types...>, MplVector>

Description
This needs to be all host only code, use thrust::tuple specialisation for device code

: api is not good, consider doing an iterator_facade type thing

getter_type public construct/copy/destruct


1. getter_type();

2. explicit getter_type(const tuple_type & data);

3. getter_type(const getter_type & other);

4. getter_type(getter_type && other);

5. template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(const getter_type< tuple_reference, mpl_vector_type > & other);

6. template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(getter_type< tuple_reference, mpl_vector_type > && other);

7. template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_type>::value) && (!std::is_same<T,
tuple_reference>::value)>::type>
getter_type(const getter_type< T, mpl_vector_type > & other);

8. template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_type>::value) && (!std::is_same<T,
tuple_reference>::value)>::type>
getter_type(getter_type< T, mpl_vector_type > && other);

9. template<typename T1, typename T2, typename... T3>


getter_type(T1 && arg1, T2 && arg2, T3 &&... args);

10. getter_type& operator=(const getter_type & other);

11. getter_type& operator=(getter_type && other);

12. template<typename T = tuple_reference,


typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type&
operator=(const getter_type< tuple_reference, mpl_vector_type > & other);

13. template<typename T = tuple_reference,


typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type&
operator=(getter_type< tuple_reference, mpl_vector_type > && other);

14. template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_reference>::value) && (!std::is_same<T,
tuple_type>::value)>::type>

https://martinjrobins.github.io/Aboria/Aboria/getter_t_idp46631327135424.html[10/22/2018 7:47:58 AM]


Struct template getter_type<std::tuple< Types...>, MplVector>

getter_type& operator=(const getter_type< T, mpl_vector_type > & other);

15. template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_reference>::value) && (!std::is_same<T,
tuple_type>::value)>::type>
getter_type& operator=(getter_type< T, mpl_vector_type > && other);

getter_type public member functions


1. template<typename T> int throw_away(const T & in);

2. template<typename Tuple, std::size_t... I>


void copy_impl(const Tuple & other_data, unspecifed);

3. template<typename T1, typename T2>


bool operator==(const getter_type< T1, T2 > & other);

4. void swap(getter_type & other);

5. template<typename tuple_type2, std::size_t... I>


void swap_via_tie(tuple_type2 & tuple, unspecifed);

6. const tuple_type & get_tuple() const;

7. tuple_type & get_tuple();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/getter_t_idp46631327135424.html[10/22/2018 7:47:58 AM]


Struct template getter_type<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector>

Struct template getter_type<thrust::tuple< TT1, TT2, TT3, TT4,


TT5, TT6, TT7, TT8, TT9 >, MplVector>
Aboria::getter_type<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector> — specialisation of getter_type for
thrust::tuple

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>
template<typename MplVector, typename TT1, typename TT2, typename TT3,
typename TT4, typename TT5, typename TT6, typename TT7, typename TT8,
typename TT9>
struct getter_type<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector> {
// types
typedef thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 > tuple_type;
typedef MplVector mpl_vector_type;
typedef unspecifed tuple_reference;
typedef unspecifed tuple_device_reference;
typedef unspecifed index_type;
typedef unspecifed elem_by_type;
typedef unspecifed return_type;
// construct/copy/destruct
getter_type();
explicit getter_type(const tuple_type &);
getter_type(const getter_type &);
template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(const getter_type< tuple_reference, mpl_vector_type > &);
template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(getter_type< tuple_reference, mpl_vector_type > &&);
template<typename T = tuple_device_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(const getter_type< tuple_device_reference, mpl_vector_type > &);
template<typename T = tuple_device_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(getter_type< tuple_device_reference, mpl_vector_type > &&);
template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_type>::value) && (!std::is_same<T, tuple_reference>::value)>::type>
getter_type(const getter_type< T, mpl_vector_type > &);
template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_type>::value) && (!std::is_same<T, tuple_reference>::value)>::type>
getter_type(getter_type< T, mpl_vector_type > &&);
template<typename T1, typename T2, typename... T3>
getter_type(T1 &&, T2 &&, T3 &&...);
getter_type& operator=(const getter_type &);
getter_type& operator=(getter_type &&);
template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type&
operator=(const getter_type< tuple_reference, mpl_vector_type > &);
template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type& operator=(getter_type< tuple_reference, mpl_vector_type > &&);
template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_reference>::value) && (!std::is_same<T, tuple_type>::value)>::type>
getter_type& operator=(const getter_type< T, mpl_vector_type > &);
template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_reference>::value) && (!std::is_same<T, tuple_type>::value)>::type>
getter_type& operator=(getter_type< T, mpl_vector_type > &&);
template<typename T, typename Tag>
getter_type&

https://martinjrobins.github.io/Aboria/Aboria/getter_t_idp46631327201264.html[10/22/2018 7:48:10 AM]


Struct template getter_type<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector>

operator=(const thrust::reference< getter_type< T, mpl_vector_type >, thrust::pointer<


getter_type< T, mpl_vector_type >, Tag >> &);
// public member functions
template<typename T> int throw_away(const T &);
template<typename Tuple, std::size_t... I>
void copy_impl(const Tuple &, unspecifed);
template<typename T1, typename T2>
bool operator==(const getter_type< T1, T2 > &);
void swap(getter_type &);
template<typename tuple_type2, std::size_t... I>
void swap_via_tie(tuple_type2 &, unspecifed);
const tuple_type & get_tuple() const;
tuple_type & get_tuple();
// public data members
tuple_type data;
};

Description
Use device code only in this specialisation : api is not good, consider doing an iterator_facade type thing

getter_type public construct/copy/destruct


1. getter_type();

2. explicit getter_type(const tuple_type & data);

3. getter_type(const getter_type & other);

4. template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(const getter_type< tuple_reference, mpl_vector_type > & other);

5. template<typename T = tuple_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(getter_type< tuple_reference, mpl_vector_type > && other);

6. template<typename T = tuple_device_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(const getter_type< tuple_device_reference, mpl_vector_type > & other);

7. template<typename T = tuple_device_reference,
typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type(getter_type< tuple_device_reference, mpl_vector_type > && other);

8. template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_type>::value) && (!std::is_same<T,
tuple_reference>::value)>::type>
getter_type(const getter_type< T, mpl_vector_type > & other);

9. template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_type>::value) && (!std::is_same<T,
tuple_reference>::value)>::type>
getter_type(getter_type< T, mpl_vector_type > && other);

10. template<typename T1, typename T2, typename... T3>


getter_type(T1 && arg1, T2 && arg2, T3 &&... args);

11. getter_type& operator=(const getter_type & other);

https://martinjrobins.github.io/Aboria/Aboria/getter_t_idp46631327201264.html[10/22/2018 7:48:10 AM]


Struct template getter_type<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector>

12. getter_type& operator=(getter_type && other);

13. template<typename T = tuple_reference,


typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type&
operator=(const getter_type< tuple_reference, mpl_vector_type > & other);

14. template<typename T = tuple_reference,


typename = typename std::enable_if< !std::is_same<T,
tuple_type>::value>::type>
getter_type&
operator=(getter_type< tuple_reference, mpl_vector_type > && other);

15. template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_reference>::value) && (!std::is_same<T,
tuple_type>::value)>::type>
getter_type& operator=(const getter_type< T, mpl_vector_type > & other);

16. template<typename T,
typename = typename std::enable_if< (!std::is_same<T,
tuple_reference>::value) && (!std::is_same<T,
tuple_type>::value)>::type>
getter_type& operator=(getter_type< T, mpl_vector_type > && other);

17. template<typename T, typename Tag>


getter_type&
operator=(const thrust::reference< getter_type< T, mpl_vector_type >, thrust::pointer<
getter_type< T, mpl_vector_type >, Tag >> & other);

getter_type public member functions


1. template<typename T> int throw_away(const T & in);

2. template<typename Tuple, std::size_t... I>


void copy_impl(const Tuple & other_data, unspecifed);

3. template<typename T1, typename T2>


bool operator==(const getter_type< T1, T2 > & other);

4. void swap(getter_type & other);

5. template<typename tuple_type2, std::size_t... I>


void swap_via_tie(tuple_type2 & tuple, unspecifed);

6. const tuple_type & get_tuple() const;

7. tuple_type & get_tuple();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/getter_t_idp46631327201264.html[10/22/2018 7:48:10 AM]


Struct template zip_pointer<std::tuple< Types *...>, MplVector>

Struct template zip_pointer<std::tuple< Types *...>, MplVector>


Aboria::zip_pointer<std::tuple< Types *...>, MplVector> — specialisation of zip_pointer for std::tuple

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>
template<typename MplVector, typename... Types>
struct zip_pointer<std::tuple< Types *...>, MplVector> {
// types
typedef std::tuple< Types *...> tuple_type;
typedef MplVector mpl_vector_type;
typedef unspecifed elem_by_type;
typedef unspecifed return_type;
typedef unspecifed reference;
typedef unspecifed difference_type;
typedef unspecifed index_type;
// construct/copy/destruct
zip_pointer();
explicit zip_pointer(const tuple_type &);
zip_pointer(const zip_pointer &);
zip_pointer(zip_pointer &&);
template<typename tuple_type2,
typename = typename std::enable_if< std::is_convertible<tuple_type2,
tuple_type>::value>::type>
zip_pointer(const zip_pointer< tuple_type2, mpl_vector_type > &);
template<typename tuple_type2,
typename = typename std::enable_if< std::is_convertible<tuple_type2,
tuple_type>::value>::type>
zip_pointer(const zip_pointer< tuple_type2, mpl_vector_type > &&);
template<typename T1, typename T2, typename... T3>
zip_pointer(T1 &&, T2 &&, T3 &&...);
zip_pointer& operator=(const zip_pointer &);
zip_pointer& operator=(zip_pointer &&);
template<typename T1, typename T2>
zip_pointer& operator=(const zip_pointer< T1, T2 > &);
template<typename T1, typename T2>
zip_pointer& operator=(zip_pointer< T1, T2 > &&);
// public member functions
void swap(zip_pointer &);
const tuple_type & get_tuple() const;
tuple_type & get_tuple();
bool operator==(const zip_pointer &) const;
zip_pointer & operator++();
zip_pointer operator++(int);
zip_pointer operator+(const difference_type &) const;
zip_pointer operator-(const difference_type &) const;
zip_pointer & operator+=(const difference_type &);
difference_type operator-(const zip_pointer &) const;
bool operator<(const zip_pointer &) const;
bool operator<=(const zip_pointer &) const;
bool operator>(const zip_pointer &) const;
bool operator>=(const zip_pointer &) const;
zip_pointer & operator--();
zip_pointer operator--(int);
reference operator*() const;
void increment();
void decrement();
bool equal(zip_pointer const &) const;
reference dereference() const;
difference_type distance_to(zip_pointer const &) const;
void advance(difference_type);
// public data members
tuple_type data;
};

Description

https://martinjrobins.github.io/Aboria/Aboria/zip_poin_idp46631327283424.html[10/22/2018 7:48:21 AM]


Struct template zip_pointer<std::tuple< Types *...>, MplVector>

Use host only code in this specialisation

zip_pointer public construct/copy/destruct


1. zip_pointer();

2. explicit zip_pointer(const tuple_type & data);

3. zip_pointer(const zip_pointer & other);

4. zip_pointer(zip_pointer && other);

5. template<typename tuple_type2,
typename = typename std::enable_if< std::is_convertible<tuple_type2,
tuple_type>::value>::type>
zip_pointer(const zip_pointer< tuple_type2, mpl_vector_type > & other);

6. template<typename tuple_type2,
typename = typename std::enable_if< std::is_convertible<tuple_type2,
tuple_type>::value>::type>
zip_pointer(const zip_pointer< tuple_type2, mpl_vector_type > && other);

7. template<typename T1, typename T2, typename... T3>


zip_pointer(T1 && arg1, T2 && arg2, T3 &&... args);

8. zip_pointer& operator=(const zip_pointer & other);

9. zip_pointer& operator=(zip_pointer && other);

10. template<typename T1, typename T2>


zip_pointer& operator=(const zip_pointer< T1, T2 > & other);

11. template<typename T1, typename T2>


zip_pointer& operator=(zip_pointer< T1, T2 > && other);

zip_pointer public member functions


1. void swap(zip_pointer & other);

2. const tuple_type & get_tuple() const;

3. tuple_type & get_tuple();

4. bool operator==(const zip_pointer & other) const;

5. zip_pointer & operator++();

6. zip_pointer operator++(int);

7. zip_pointer operator+(const difference_type & n) const;

8. zip_pointer operator-(const difference_type & n) const;

9. zip_pointer & operator+=(const difference_type & n);

10. difference_type operator-(const zip_pointer & other) const;

11. bool operator<(const zip_pointer & other) const;

12. bool operator<=(const zip_pointer & other) const;

13. bool operator>(const zip_pointer & other) const;

https://martinjrobins.github.io/Aboria/Aboria/zip_poin_idp46631327283424.html[10/22/2018 7:48:21 AM]


Struct template zip_pointer<std::tuple< Types *...>, MplVector>

14. bool operator>=(const zip_pointer & other) const;

15. zip_pointer & operator--();

16. zip_pointer operator--(int);

17. reference operator*() const;

18. void increment();

19. void decrement();

20. bool equal(zip_pointer const & other) const;

21. reference dereference() const;

22. difference_type distance_to(zip_pointer const & other) const;

23. void advance(difference_type n);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/zip_poin_idp46631327283424.html[10/22/2018 7:48:21 AM]


Struct template zip_pointer<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector>

Struct template zip_pointer<thrust::tuple< TT1, TT2, TT3, TT4,


TT5, TT6, TT7, TT8, TT9 >, MplVector>
Aboria::zip_pointer<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector> — specialisation of zip_pointer for
thrust::tuple

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>
template<typename MplVector, typename TT1, typename TT2, typename TT3,
typename TT4, typename TT5, typename TT6, typename TT7, typename TT8,
typename TT9>
struct zip_pointer<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector> {
// types
typedef thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 > tuple_type;
typedef MplVector mpl_vector_type;
typedef unspecifed elem_by_type;
typedef unspecifed return_type;
typedef unspecifed reference;
typedef unspecifed difference_type;
typedef unspecifed index_type;
// construct/copy/destruct
zip_pointer();
explicit zip_pointer(const tuple_type &);
zip_pointer(const zip_pointer &);
zip_pointer(zip_pointer &&);
template<typename tuple_type2,
typename = typename std::enable_if< std::is_convertible<tuple_type2,
tuple_type>::value>::type>
zip_pointer(const zip_pointer< tuple_type2, mpl_vector_type > &);
template<typename tuple_type2,
typename = typename std::enable_if< std::is_convertible<tuple_type2,
tuple_type>::value>::type>
zip_pointer(const zip_pointer< tuple_type2, mpl_vector_type > &&);
template<typename T1, typename T2, typename... T3>
zip_pointer(T1 &&, T2 &&, T3 &&...);
zip_pointer& operator=(const zip_pointer &);
zip_pointer& operator=(zip_pointer &&);
template<typename T1, typename T2>
zip_pointer& operator=(const zip_pointer< T1, T2 > &);
template<typename T1, typename T2>
zip_pointer& operator=(zip_pointer< T1, T2 > &&);
// public member functions
void swap(zip_pointer &);
const tuple_type & get_tuple() const;
tuple_type & get_tuple();
bool operator==(const zip_pointer &) const;
zip_pointer & operator++();
zip_pointer operator++(int);
zip_pointer operator+(const difference_type &) const;
zip_pointer & operator+=(const difference_type &);
zip_pointer operator-(const difference_type &) const;
difference_type operator-(const zip_pointer &) const;
zip_pointer & operator--();
zip_pointer operator--(int);
bool operator<(const zip_pointer &) const;
bool operator<=(const zip_pointer &) const;
bool operator>(const zip_pointer &) const;
bool operator>=(const zip_pointer &) const;
reference operator*() const;
void increment();
void decrement();
bool equal(zip_pointer const &) const;
reference dereference() const;
difference_type distance_to(zip_pointer const &) const;
void advance(difference_type);
// public data members
tuple_type data;
};

https://martinjrobins.github.io/Aboria/Aboria/zip_poin_idp46631327354784.html[10/22/2018 7:48:31 AM]


Struct template zip_pointer<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector>

Description
Use device only code in this specialisation

zip_pointer public construct/copy/destruct


1. zip_pointer();

2. explicit zip_pointer(const tuple_type & data);

3. zip_pointer(const zip_pointer & other);

4. zip_pointer(zip_pointer && other);

5. template<typename tuple_type2,
typename = typename std::enable_if< std::is_convertible<tuple_type2,
tuple_type>::value>::type>
zip_pointer(const zip_pointer< tuple_type2, mpl_vector_type > & other);

6. template<typename tuple_type2,
typename = typename std::enable_if< std::is_convertible<tuple_type2,
tuple_type>::value>::type>
zip_pointer(const zip_pointer< tuple_type2, mpl_vector_type > && other);

7. template<typename T1, typename T2, typename... T3>


zip_pointer(T1 && arg1, T2 && arg2, T3 &&... args);

8. zip_pointer& operator=(const zip_pointer & other);

9. zip_pointer& operator=(zip_pointer && other);

10. template<typename T1, typename T2>


zip_pointer& operator=(const zip_pointer< T1, T2 > & other);

11. template<typename T1, typename T2>


zip_pointer& operator=(zip_pointer< T1, T2 > && other);

zip_pointer public member functions


1. void swap(zip_pointer & other);

2. const tuple_type & get_tuple() const;

3. tuple_type & get_tuple();

4. bool operator==(const zip_pointer & other) const;

5. zip_pointer & operator++();

6. zip_pointer operator++(int);

7. zip_pointer operator+(const difference_type & n) const;

8. zip_pointer & operator+=(const difference_type & n);

9. zip_pointer operator-(const difference_type & n) const;

10. difference_type operator-(const zip_pointer & other) const;

11. zip_pointer & operator--();

https://martinjrobins.github.io/Aboria/Aboria/zip_poin_idp46631327354784.html[10/22/2018 7:48:31 AM]


Struct template zip_pointer<thrust::tuple< TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9 >, MplVector>

12. zip_pointer operator--(int);

13. bool operator<(const zip_pointer & other) const;

14. bool operator<=(const zip_pointer & other) const;

15. bool operator>(const zip_pointer & other) const;

16. bool operator>=(const zip_pointer & other) const;

17. reference operator*() const;

18. void increment();

19. void decrement();

20. bool equal(zip_pointer const & other) const;

21. reference dereference() const;

22. difference_type distance_to(zip_pointer const & other) const;

23. void advance(difference_type n);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/zip_poin_idp46631327354784.html[10/22/2018 7:48:31 AM]


Class template zip_iterator<std::tuple< Types...>, mpl_vector_type>

Class template zip_iterator<std::tuple< Types...>,


mpl_vector_type>
Aboria::zip_iterator<std::tuple< Types...>, mpl_vector_type> — specialisation of zip_iterator for std::tuple

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>
template<typename mpl_vector_type, typename... Types>
class zip_iterator<std::tuple< Types...>, mpl_vector_type> {
public:
// types
typedef iterator_tuple_type tuple_type;
typedef unspecifed value_type;
typedef unspecifed reference;
typedef unspecifed difference_type;
typedef unspecifed iterator_category;
typedef unspecifed pointer;
typedef unspecifed getter_raw_pointer;
typedef unspecifed getter_raw_reference;
typedef unspecifed elem_by_type;
// member classes/structs/unions
template<typename T>
struct return_type {
// types
typedef unspecifed type;
// public data members
static const size_t N;
};
// construct/copy/destruct
zip_iterator();
explicit zip_iterator(iterator_tuple_type);
template<typename... T> explicit zip_iterator(T...);
// public member functions
const iterator_tuple_type & get_tuple() const;
iterator_tuple_type & get_tuple();
// private member functions
void increment();
void decrement();
bool equal(zip_iterator const &) const;
reference dereference() const;
difference_type distance_to(zip_iterator const &) const;
void advance(difference_type);
};

Description
Use host only code in this specialisation

zip_iterator public construct/copy/destruct


1. zip_iterator();

2. explicit zip_iterator(iterator_tuple_type iter);

3. template<typename... T> explicit zip_iterator(T... args);

https://martinjrobins.github.io/Aboria/Aboria/zip_iter_idp46631327432688.html[10/22/2018 7:48:44 AM]


Class template zip_iterator<std::tuple< Types...>, mpl_vector_type>

zip_iterator public member functions


1. const iterator_tuple_type & get_tuple() const;

2. iterator_tuple_type & get_tuple();

zip_iterator private member functions


1. void increment();

2. void decrement();

3. bool equal(zip_iterator const & other) const;

4. reference dereference() const;

5. difference_type distance_to(zip_iterator const & other) const;

6. void advance(difference_type n);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/zip_iter_idp46631327432688.html[10/22/2018 7:48:44 AM]


Class template zip_iterator<thrust::tuple< Types...>, mpl_vector_type>

Class template zip_iterator<thrust::tuple< Types...>,


mpl_vector_type>
Aboria::zip_iterator<thrust::tuple< Types...>, mpl_vector_type> — specialisation of zip_iterator for thrust::tuple

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>
template<typename mpl_vector_type, typename... Types>
class zip_iterator<thrust::tuple< Types...>, mpl_vector_type> {
public:
// types
typedef iterator_tuple_type tuple_type;
typedef unspecifed value_type;
typedef unspecifed reference;
typedef unspecifed difference_type;
typedef unspecifed iterator_category;
typedef unspecifed pointer;
typedef unspecifed getter_raw_pointer;
typedef unspecifed getter_raw_reference;
typedef unspecifed elem_by_type;
// member classes/structs/unions
template<typename T>
struct return_type {
// types
typedef unspecifed type;
// public data members
static const size_t N;
};
// construct/copy/destruct
zip_iterator();
explicit zip_iterator(iterator_tuple_type);
template<typename... T> explicit zip_iterator(T...);
// public member functions
const iterator_tuple_type & get_tuple() const;
iterator_tuple_type & get_tuple();
// private member functions
void increment();
void decrement();
bool equal(zip_iterator const &) const;
reference dereference() const;
difference_type distance_to(zip_iterator const &) const;
void advance(difference_type);
};

Description
Use device only code in this specialisation

zip_iterator public construct/copy/destruct


1. zip_iterator();

2. explicit zip_iterator(iterator_tuple_type iter);

3. template<typename... T> explicit zip_iterator(T... args);

https://martinjrobins.github.io/Aboria/Aboria/zip_iter_idp46631327462224.html[10/22/2018 7:48:55 AM]


Class template zip_iterator<thrust::tuple< Types...>, mpl_vector_type>

zip_iterator public member functions


1. const iterator_tuple_type & get_tuple() const;

2. iterator_tuple_type & get_tuple();

zip_iterator private member functions


1. void increment();

2. void decrement();

3. bool equal(zip_iterator const & other) const;

4. reference dereference() const;

5. difference_type distance_to(zip_iterator const & other) const;

6. void advance(difference_type n);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/zip_iter_idp46631327462224.html[10/22/2018 7:48:55 AM]


Function template iterator_to_raw_pointer

Function template iterator_to_raw_pointer


Aboria::iterator_to_raw_pointer — convert an generic iterator to a raw_pointer

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>

template<typename Iterator> auto iterator_to_raw_pointer(const Iterator & arg);

Description
Parameters:
arg the actual iterator object to be converted

Template Parameters:
Iterator the iterator type to be converted. Can be a normal STL iterator or a

Returns: decltype(detail::iterator_to_raw_pointer(arg,typename detail::is_zip_iterator<Iterator>::type()))

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/iterator_to_raw_pointer.html[10/22/2018 7:49:06 AM]


Function template get

Function template get


Aboria::get — get the value of a variable from a getter_type, zip_iterator, zip_pointer, or Particles

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>

template<typename T, typename ValueType>


ValueType::template return_type< T >::type & get(ValueType & arg);

Description
See Also:

ABORIA_VARIABLE

Parameters:
arg the object with type ValueType

Template Parameters:
T the variable type to get,
ValueType the getter_type, zip_iterator, zip_pointer, or Particles

Returns: CUDA_HOST_DEVICE typename ValueType::template return_type<T> ::type const&

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/get_idp46631327523312.html[10/22/2018 7:49:18 AM]


Function template get

Function template get


Aboria::get — get the value of a variable from a rvalue getter_type, zip_iterator, zip_pointer, or Particles

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>

template<typename T, typename ValueType>


ValueType::template return_type< T >::type & get(ValueType && arg);

Description
See Also:

ABORIA_VARIABLE

Parameters:
arg the object with type ValueType

Template Parameters:
T the variable type to get,
ValueType the getter_type, zip_iterator, zip_pointer, or Particles

Returns: CUDA_HOST_DEVICE typename ValueType::template return_type<T> ::type const&

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/get_idp46631327535504.html[10/22/2018 7:49:28 AM]


Function template get_by_index

Function template get_by_index


Aboria::get_by_index — get the value of an indexed variable from a const getter_type, zip_iterator, zip_pointer, or Particles

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>

template<unsigned int N, typename ValueType>


unspecifed get_by_index(const ValueType & arg);

Description
Parameters:
arg the object with type ValueType

Template
Parameters: N the index of the variable to get. The order of variables is set to
(position,id,alive,generator,user_variable1,user_variable2,...)
ValueType the getter_type, zip_iterator, zip_pointer, or Particles

Returns: CUDA_HOST_DEVICE const typename detail::getter_helper<typename ValueType::tuple_type> ::template


return_type<N> ::type&

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/get_by_i_idp46631327547712.html[10/22/2018 7:49:38 AM]


Function template get_by_index

Function template get_by_index


Aboria::get_by_index — get the value of an indexed variable from a lvalue getter_type, zip_iterator, zip_pointer, or Particles

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>

template<unsigned int N, typename ValueType>


unspecifed get_by_index(ValueType & arg);

Description
Parameters:
arg the object with type ValueType

Template
Parameters: N the index of the variable to get. The order of variables is set to
(position,id,alive,generator,user_variable1,user_variable2,...)
ValueType the getter_type, zip_iterator, zip_pointer, or Particles

Returns: CUDA_HOST_DEVICE const typename detail::getter_helper<typename ValueType::tuple_type> ::template


return_type<N> ::type&

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/get_by_i_idp46631327559312.html[10/22/2018 7:49:48 AM]


Function template get_by_index

Function template get_by_index


Aboria::get_by_index — get the value of an indexed variable from a rvalue getter_type, zip_iterator, zip_pointer, or Particles

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>

template<unsigned int N, typename ValueType>


unspecifed get_by_index(ValueType && arg);

Description
Parameters:
arg the object with type ValueType

Template
Parameters: N the index of the variable to get. The order of variables is set to
(position,id,alive,generator,user_variable1,user_variable2,...)
ValueType the getter_type, zip_iterator, zip_pointer, or Particles

Returns: CUDA_HOST_DEVICE const typename detail::getter_helper<typename ValueType::tuple_type> ::template


return_type<N> ::type&

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/get_by_i_idp46631327570912.html[10/22/2018 7:49:59 AM]


Class H2Lib_LR_Decomposition

Class H2Lib_LR_Decomposition
Aboria::H2Lib_LR_Decomposition

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/H2Lib.h>

class H2Lib_LR_Decomposition {
public:
// construct/copy/destruct
H2Lib_LR_Decomposition(const ph2matrix, const pblock, const double);
// public member functions
template<typename T1, typename T2>
void solve(const std::vector< T1 > &, std::vector< T2 > &);
};

Description

H2Lib_LR_Decomposition public construct/copy/destruct


1. H2Lib_LR_Decomposition(const ph2matrix h2mat, const pblock broot,
const double tol);

H2Lib_LR_Decomposition public member functions


1. template<typename T1, typename T2>
void solve(const std::vector< T1 > & source, std::vector< T2 > & dest);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/H2Lib_LR_Decomposition.html[10/22/2018 7:50:09 AM]


Class H2LibCholeskyDecomposition

Class H2LibCholeskyDecomposition
Aboria::H2LibCholeskyDecomposition

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/H2Lib.h>

class H2LibCholeskyDecomposition {
public:
// construct/copy/destruct
H2LibCholeskyDecomposition(const ph2matrix, const pblock, const double);
// public member functions
template<typename DerivedRHS>
void solve(const Eigen::DenseBase< DerivedRHS > &,
Eigen::Matrix< double, Eigen::Dynamic, 1 > &);
template<typename T1, typename T2>
void solve(const std::vector< T1 > &, std::vector< T2 > &);
double determinant() const;
double log_determinant() const;
// private member functions
double log_determinant_sum(ph2matrix) const;
};

Description

H2LibCholeskyDecomposition public construct/copy/destruct


1. H2LibCholeskyDecomposition(const ph2matrix h2mat, const pblock broot,
const double tol);

H2LibCholeskyDecomposition public member functions


1. template<typename DerivedRHS>
void solve(const Eigen::DenseBase< DerivedRHS > & source,
Eigen::Matrix< double, Eigen::Dynamic, 1 > & dest);

2. template<typename T1, typename T2>


void solve(const std::vector< T1 > & source, std::vector< T2 > & dest);

3. double determinant() const;

returns the determinant of the H2 matrix that was used to make this decomposition

Returns: double
NaN if negative eigenvalues found (i.e. H2 matrix not positive defnite)

4. double log_determinant() const;

returns the log determinant of the H2 matrix that was used to make this decomposition.

https://martinjrobins.github.io/Aboria/Aboria/H2LibCholeskyDecomposition.html[10/22/2018 7:50:19 AM]


Class H2LibCholeskyDecomposition

Returns: double
NaN if negative eigenvalues found (i.e. H2 matrix not positive defnite)
-HUGE_VAL if zero eigenvalues found

H2LibCholeskyDecomposition private member functions


1. double log_determinant_sum(ph2matrix h2) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/H2LibCholeskyDecomposition.html[10/22/2018 7:50:19 AM]


Class HLib_LR_Decomposition

Class HLib_LR_Decomposition
Aboria::HLib_LR_Decomposition

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/H2Lib.h>

class HLib_LR_Decomposition {
public:
// construct/copy/destruct
HLib_LR_Decomposition(const phmatrix, const double);
~HLib_LR_Decomposition();
// public member functions
template<typename T1, typename T2>
void solve(const std::vector< T1 > &, std::vector< T2 > &);
};

Description

HLib_LR_Decomposition public construct/copy/destruct


1. HLib_LR_Decomposition(const phmatrix hmat, const double tol);

2. ~HLib_LR_Decomposition();

HLib_LR_Decomposition public member functions


1. template<typename T1, typename T2>
void solve(const std::vector< T1 > & source, std::vector< T2 > & dest);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/HLib_LR_Decomposition.html[10/22/2018 7:50:29 AM]


Class HLibCholeskyDecomposition

Class HLibCholeskyDecomposition
Aboria::HLibCholeskyDecomposition

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/H2Lib.h>

class HLibCholeskyDecomposition {
public:
// construct/copy/destruct
HLibCholeskyDecomposition(const phmatrix, const double);
~HLibCholeskyDecomposition();
// public member functions
template<typename DerivedRHS>
void solve(const Eigen::DenseBase< DerivedRHS > &,
Eigen::Matrix< double, Eigen::Dynamic, 1 > &);
template<typename T>
void solve(const std::vector< T > &, std::vector< double > &);
};

Description

HLibCholeskyDecomposition public construct/copy/destruct


1. HLibCholeskyDecomposition(const phmatrix hmat, const double tol);

2. ~HLibCholeskyDecomposition();

HLibCholeskyDecomposition public member functions


1. template<typename DerivedRHS>
void solve(const Eigen::DenseBase< DerivedRHS > & source,
Eigen::Matrix< double, Eigen::Dynamic, 1 > & dest);

2. template<typename T>
void solve(const std::vector< T > & source, std::vector< double > & dest);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/HLibCholeskyDecomposition.html[10/22/2018 7:50:40 AM]


Class HLibMatrix

Class HLibMatrix
Aboria::HLibMatrix

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/H2Lib.h>

class HLibMatrix {
public:
// construct/copy/destruct
template<typename RowParticles, typename ColParticles, typename Expansions,
typename Kernel>
HLibMatrix(const RowParticles &, const ColParticles &, const Expansions &,
const Kernel &);
// private static functions
template<typename RowParticles, typename ColParticles, typename Expansions,
typename Kernel>
static void assemble_block_hmatrix(pcblock, uint, uint, uint, uint,
void *);
static void truncate_block_hmatrix(pcblock, uint, uint, uint, uint, void *);
// public member functions
void compress(const double);
phmatrix get_phmatrix() const;
HLib_LR_Decomposition lr(const double) const;
HLibCholeskyDecomposition chol(const double) const;
template<typename T1, typename T2>
void matrix_vector_multiply(std::vector< T1 > &, const double, const bool,
const std::vector< T2 > &) const;
// private member functions
template<typename Particles>
pcluster set_root_idx(uint *, const Particles &, const size_t);
template<typename ChildIterator, typename Particles>
pcluster set_idx(const ChildIterator, uint *, const Particles &,
const size_t);
};

Description

HLibMatrix public construct/copy/destruct


1. template<typename RowParticles, typename ColParticles, typename Expansions,
typename Kernel>
HLibMatrix(const RowParticles & row_particles,
const ColParticles & col_particles,
const Expansions & expansions, const Kernel & kernel);

HLibMatrix private static functions


1. template<typename RowParticles, typename ColParticles, typename Expansions,
typename Kernel>
static void assemble_block_hmatrix(pcblock b, uint bname, uint rname,
uint cname, uint pardepth, void * data);

https://martinjrobins.github.io/Aboria/Aboria/HLibMatrix.html[10/22/2018 7:50:50 AM]


Class HLibMatrix

2. static void truncate_block_hmatrix(pcblock b, uint bname, uint rname,


uint cname, uint pardepth, void * data);

HLibMatrix public member functions


1. void compress(const double tol);

2. phmatrix get_phmatrix() const;

3. HLib_LR_Decomposition lr(const double tol) const;

4. HLibCholeskyDecomposition chol(const double tol) const;

5. template<typename T1, typename T2>


void matrix_vector_multiply(std::vector< T1 > & target_vector,
const double alpha, const bool h2trans,
const std::vector< T2 > & source_vector) const;

HLibMatrix private member functions


1. template<typename Particles>
pcluster set_root_idx(uint * idx, const Particles & particles,
const size_t block_size);

2. template<typename ChildIterator, typename Particles>


pcluster set_idx(const ChildIterator ci, uint * idx,
const Particles & particles, const size_t block_size);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/HLibMatrix.html[10/22/2018 7:50:50 AM]


Class template KdtreeChildIterator

Class template KdtreeChildIterator


Aboria::KdtreeChildIterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kdtree.h>
template<typename Query>
class KdtreeChildIterator {
public:
// types
typedef const value_type * pointer;
typedef std::forward_iterator_tag iterator_category;
typedef const value_type & reference;
typedef std::ptrdiff_t difference_type;
// member classes/structs/unions
struct value_type {
// public data members
int high;
const int * parent;
box_type bounds;
};
// construct/copy/destruct
KdtreeChildIterator();
KdtreeChildIterator(const int *, const box_type &);
// public member functions
bool is_high() const;
int get_child_number() const;
reference operator*() const;
reference operator->() const;
KdtreeChildIterator & operator++();
KdtreeChildIterator operator++(int);
bool operator==(const KdtreeChildIterator &) const;
bool operator!=(const KdtreeChildIterator &) const;
bool operator==(const bool) const;
bool operator!=(const bool) const;
// private member functions
bool equal(KdtreeChildIterator const &) const;
bool equal(const bool) const;
reference dereference() const;
void increment();
// public data members
value_type m_data;
};

Description

KdtreeChildIterator public construct/copy/destruct


1. KdtreeChildIterator();

2. KdtreeChildIterator(const int * parent, const box_type & bounds);

KdtreeChildIterator public member functions

https://martinjrobins.github.io/Aboria/Aboria/KdtreeChildIterator.html[10/22/2018 7:51:01 AM]


Class template KdtreeChildIterator

1. bool is_high() const;

2. int get_child_number() const;

3. reference operator*() const;

4. reference operator->() const;

5. KdtreeChildIterator & operator++();

6. KdtreeChildIterator operator++(int);

7. bool operator==(const KdtreeChildIterator & rhs) const;

8. bool operator!=(const KdtreeChildIterator & rhs) const;

9. bool operator==(const bool rhs) const;

10. bool operator!=(const bool rhs) const;

KdtreeChildIterator private member functions


1. bool equal(KdtreeChildIterator const & other) const;

2. bool equal(const bool other) const;

3. reference dereference() const;

4. void increment();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KdtreeChildIterator.html[10/22/2018 7:51:01 AM]


Class template KernelBase

Class template KernelBase


Aboria::KernelBase

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kernels.h>
template<typename RowElements, typename ColElements, typename F>
class KernelBase {
public:
// types
typedef kernel_helper::Block Block;
typedef kernel_helper::Scalar Scalar;
typedef kernel_helper::BlockRHSVector BlockRHSVector;
typedef kernel_helper::BlockLHSVector BlockLHSVector;
typedef RowElements row_elements_type;
typedef ColElements col_elements_type;
typedef F function_type;
typedef size_t Index;
enum @1 { ColsAtCompileTime = = -1, RowsAtCompileTime = = -1 };
// construct/copy/destruct
KernelBase(const RowElements &, const ColElements &, const F &);
// public member functions
RowElements & get_row_elements();
const RowElements & get_row_elements() const;
ColElements & get_col_elements();
const function_type & get_kernel_function() const;
const ColElements & get_col_elements() const;
size_t rows() const;
size_t cols() const;
Scalar coeff(const size_t, const size_t) const;
template<typename MatrixType> void assemble(const MatrixType &) const;
template<typename Triplet>
void assemble(std::vector< Triplet > &, const size_t = 0,
const size_t = 0) const;
template<typename VectorLHS, typename VectorRHS>
void evaluate(VectorLHS &, const VectorRHS &) const;
// public data members
static const size_t BlockRows;
static const size_t BlockCols;
};

Description

KernelBase public construct/copy/destruct


1. KernelBase(const RowElements & row_elements, const ColElements & col_elements,
const F & function);

KernelBase public member functions


1. RowElements & get_row_elements();

2. const RowElements & get_row_elements() const;

https://martinjrobins.github.io/Aboria/Aboria/KernelBase.html[10/22/2018 7:51:12 AM]


Class template KernelBase

3. ColElements & get_col_elements();

4. const function_type & get_kernel_function() const;

5. const ColElements & get_col_elements() const;

6. size_t rows() const;

7. size_t cols() const;

8. Scalar coeff(const size_t i, const size_t j) const;

9. template<typename MatrixType> void assemble(const MatrixType & matrix) const;

10. template<typename Triplet>


void assemble(std::vector< Triplet > & triplets, const size_t startI = 0,
const size_t startJ = 0) const;

11. template<typename VectorLHS, typename VectorRHS>


void evaluate(VectorLHS & lhs, const VectorRHS & rhs) const;

Evaluates a matrix-free linear operator given by expr if_expr, and particle sets a and b on a vector rhs and accumulates the
result in vector lhs

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KernelBase.html[10/22/2018 7:51:12 AM]


Class template KernelDense

Class template KernelDense


Aboria::KernelDense

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kernels.h>
template<typename RowElements, typename ColElements, typename F>
class KernelDense : public Aboria::KernelBase< RowElements, ColElements, F > {
public:
// types
typedef base_type::Block Block;
typedef base_type::BlockLHSVector BlockLHSVector;
typedef base_type::Scalar Scalar;
// construct/copy/destruct
KernelDense(const RowElements &, const ColElements &, const F &);
// public member functions
template<typename Derived>
void assemble(const Eigen::DenseBase< Derived > &) const;
template<typename Triplet>
void assemble(std::vector< Triplet > &, const size_t = 0,
const size_t = 0) const;
template<typename DerivedLHS, typename DerivedRHS>
void evaluate(Eigen::DenseBase< DerivedLHS > &,
const Eigen::DenseBase< DerivedRHS > &) const;
template<typename LHSType, typename RHSType>
void evaluate(std::vector< LHSType > &, const std::vector< RHSType > &) const;
// public data members
static const size_t BlockRows;
static const size_t BlockCols;
};

Description

KernelDense public construct/copy/destruct


1. KernelDense(const RowElements & row_elements,
const ColElements & col_elements, const F & function);

KernelDense public member functions


1. template<typename Derived>
void assemble(const Eigen::DenseBase< Derived > & matrix) const;

2. template<typename Triplet>
void assemble(std::vector< Triplet > & triplets, const size_t startI = 0,
const size_t startJ = 0) const;

3. template<typename DerivedLHS, typename DerivedRHS>


void evaluate(Eigen::DenseBase< DerivedLHS > & lhs,
const Eigen::DenseBase< DerivedRHS > & rhs) const;

Evaluates a matrix-free linear operator given by expr if expr, and particle sets a and b on a vector rhs and accumulates the

https://martinjrobins.github.io/Aboria/Aboria/KernelDense.html[10/22/2018 7:51:23 AM]


Class template KernelDense

result in vector lhs

4. template<typename LHSType, typename RHSType>


void evaluate(std::vector< LHSType > & lhs,
const std::vector< RHSType > & rhs) const;

Evaluates a matrix-free linear operator given by expr if_expr, and particle sets a and b on a vector rhs and accumulates the
result in vector lhs

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KernelDense.html[10/22/2018 7:51:23 AM]


Class template KernelMatrix

Class template KernelMatrix


Aboria::KernelMatrix

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kernels.h>
template<typename RowElements, typename ColElements, typename F>
class KernelMatrix : public Aboria::KernelBase< RowElements, ColElements, F > {
public:
// types
typedef base_type::Scalar Scalar;
typedef base_type::Block Block;
// construct/copy/destruct
KernelMatrix(const RowElements &, const ColElements &, const F &);
// public member functions
void assemble_matrix();
Scalar coeff(const size_t, const size_t) const;
template<typename MatrixType> void assemble(const MatrixType &) const;
template<typename LHSType, typename RHSType>
void evaluate(std::vector< LHSType > &, const std::vector< RHSType > &) const;
template<typename DerivedLHS, typename DerivedRHS>
void evaluate(Eigen::DenseBase< DerivedLHS > &,
const Eigen::DenseBase< DerivedRHS > &) const;
// public data members
static const size_t BlockRows;
static const size_t BlockCols;
};

Description

KernelMatrix public construct/copy/destruct


1. KernelMatrix(const RowElements & row_elements,
const ColElements & col_elements, const F & function);

KernelMatrix public member functions


1. void assemble_matrix();

2. Scalar coeff(const size_t i, const size_t j) const;

3. template<typename MatrixType> void assemble(const MatrixType & matrix) const;

4. template<typename LHSType, typename RHSType>


void evaluate(std::vector< LHSType > & lhs,
const std::vector< RHSType > & rhs) const;

Evaluates a matrix-free linear operator given by expr if_expr, and particle sets a and b on a vector rhs and accumulates the
result in vector lhs

5. template<typename DerivedLHS, typename DerivedRHS>

https://martinjrobins.github.io/Aboria/Aboria/KernelMatrix.html[10/22/2018 7:51:33 AM]


Class template KernelMatrix

void evaluate(Eigen::DenseBase< DerivedLHS > & lhs,


const Eigen::DenseBase< DerivedRHS > & rhs) const;

Evaluates a matrix-free linear operator given by expr if_expr, and particle sets a and b on a vector rhs and accumulates the
result in vector lhs

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KernelMatrix.html[10/22/2018 7:51:33 AM]


Class template KernelH2

Class template KernelH2


Aboria::KernelH2

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kernels.h>
template<typename RowElements, typename ColElements, typename PositionF,
typename F>
class KernelH2 : public Aboria::KernelDense< RowElements, ColElements, F > {
public:
// types
typedef base_type::Block Block;
typedef base_type::Scalar Scalar;
// construct/copy/destruct
KernelH2(const RowElements &, const ColElements &, const int,
const PositionF &, const F &, const double);
// public member functions
const h2_matrix_type & get_h2_matrix() const;
const PositionF & get_position_function() const;
void compress(const double);
template<typename VectorLHS, typename VectorRHS>
void evaluate(VectorLHS &, const VectorRHS &) const;
// public data members
static const size_t BlockRows;
static const size_t BlockCols;
};

Description

KernelH2 public construct/copy/destruct


1. KernelH2(const RowElements & row_elements, const ColElements & col_elements,
const int order, const PositionF & position_function,
const F & function, const double eta);

KernelH2 public member functions


1. const h2_matrix_type & get_h2_matrix() const;

2. const PositionF & get_position_function() const;

3. void compress(const double tol);

4. template<typename VectorLHS, typename VectorRHS>


void evaluate(VectorLHS & lhs, const VectorRHS & rhs) const;

Evaluates a h2 matrix linear operator given by expr if_expr, and particle sets a and b on a vector rhs and accumulates the result
in vector lhs

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KernelH2.html[10/22/2018 7:51:43 AM]


Class template KernelH2

https://martinjrobins.github.io/Aboria/Aboria/KernelH2.html[10/22/2018 7:51:43 AM]


Class template KernelFMM

Class template KernelFMM


Aboria::KernelFMM

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kernels.h>
template<typename RowElements, typename ColElements, typename PositionF,
typename F, unsigned int N>
class KernelFMM : public Aboria::KernelDense< RowElements, ColElements, F > {
public:
// types
typedef base_type::Block Block;
typedef base_type::Scalar Scalar;
// construct/copy/destruct
KernelFMM(const RowElements &, const ColElements &, const PositionF &,
const F &);
// public member functions
template<typename VectorLHS, typename VectorRHS>
void evaluate(VectorLHS &, const VectorRHS &) const;
// public data members
static const size_t BlockRows;
static const size_t BlockCols;
};

Description

KernelFMM public construct/copy/destruct


1. KernelFMM(const RowElements & row_elements, const ColElements & col_elements,
const PositionF & position_function, const F & function);

KernelFMM public member functions


1. template<typename VectorLHS, typename VectorRHS>
void evaluate(VectorLHS & lhs, const VectorRHS & rhs) const;

Evaluates a matrix-free linear operator given by expr if_expr, and particle sets a and b on a vector rhs and accumulates the
result in vector lhs

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KernelFMM.html[10/22/2018 7:51:54 AM]


Class template KernelSparse

Class template KernelSparse


Aboria::KernelSparse

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kernels.h>
template<typename RowElements, typename ColElements, typename FRadius,
typename FWithDx,
typename F = detail::sparse_kernel<RowElements, ColElements, FRadius, FWithDx> >
class KernelSparse : public Aboria::KernelBase< RowElements, ColElements, F > {
public:
// types
typedef base_type::Block Block;
typedef base_type::Scalar Scalar;
// construct/copy/destruct
KernelSparse(const RowElements &, const ColElements &, const FRadius &,
const FWithDx &);
// public member functions
template<typename MatrixType> void assemble(const MatrixType &) const;
template<typename Triplet>
void assemble(std::vector< Triplet > &, const size_t = 0,
const size_t = 0) const;
template<typename LHSType, typename RHSType>
void evaluate(std::vector< LHSType > &, const std::vector< RHSType > &) const;
template<typename DerivedLHS, typename DerivedRHS>
void evaluate(Eigen::DenseBase< DerivedLHS > &,
const Eigen::DenseBase< DerivedRHS > &) const;
// public data members
static const size_t BlockRows;
static const size_t BlockCols;
};

Description

KernelSparse public construct/copy/destruct


1. KernelSparse(const RowElements & row_elements,
const ColElements & col_elements,
const FRadius & radius_function,
const FWithDx & withdx_function);

KernelSparse public member functions


1. template<typename MatrixType> void assemble(const MatrixType & matrix) const;

2. template<typename Triplet>
void assemble(std::vector< Triplet > & triplets, const size_t startI = 0,
const size_t startJ = 0) const;

3. template<typename LHSType, typename RHSType>


void evaluate(std::vector< LHSType > & lhs,
const std::vector< RHSType > & rhs) const;

https://martinjrobins.github.io/Aboria/Aboria/KernelSparse.html[10/22/2018 7:52:06 AM]


Class template KernelSparse

Evaluates a matrix-free linear operator given by expr if_expr, and particle sets a and b on a vector rhs and accumulates the
result in vector lhs

4. template<typename DerivedLHS, typename DerivedRHS>


void evaluate(Eigen::DenseBase< DerivedLHS > & lhs,
const Eigen::DenseBase< DerivedRHS > & rhs) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KernelSparse.html[10/22/2018 7:52:06 AM]


Class template KernelSparseConst

Class template KernelSparseConst


Aboria::KernelSparseConst

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kernels.h>
template<typename RowElements, typename ColElements, typename F,
typename RadiusFunction = detail::constant_radius<RowElements> >
class KernelSparseConst :
public Aboria::KernelSparse< RowElements, ColElements, RadiusFunction, F >
{
public:
// types
typedef base_type::Block Block;
typedef base_type::Scalar Scalar;
// construct/copy/destruct
KernelSparseConst(const RowElements &, const ColElements &, const double,
const F &);
// public data members
static const size_t BlockRows;
static const size_t BlockCols;
};

Description

KernelSparseConst public construct/copy/destruct


1. KernelSparseConst(const RowElements & row_elements,
const ColElements & col_elements, const double radius,
const F & function);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KernelSparseConst.html[10/22/2018 7:52:16 AM]


Class template KernelZero

Class template KernelZero


Aboria::KernelZero

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kernels.h>
template<typename RowElements, typename ColElements,
typename F = detail::zero_kernel<RowElements, ColElements> >
class KernelZero : public Aboria::KernelBase< RowElements, ColElements, F > {
public:
// types
typedef base_type::Block Block;
typedef base_type::Scalar Scalar;
// construct/copy/destruct
KernelZero(const RowElements &, const ColElements &);
// public member functions
template<typename MatrixType> void assemble(const MatrixType &) const;
template<typename Triplet>
void assemble(std::vector< Triplet > &, const size_t = 0,
const size_t = 0) const;
template<typename VectorLHS, typename VectorRHS>
void evaluate(VectorLHS &, const VectorRHS &) const;
};

Description

KernelZero public construct/copy/destruct


1. KernelZero(const RowElements & row_elements, const ColElements & col_elements);

KernelZero public member functions


1. template<typename MatrixType> void assemble(const MatrixType & matrix) const;

2. template<typename Triplet>
void assemble(std::vector< Triplet > & triplets, const size_t startI = 0,
const size_t startJ = 0) const;

3. template<typename VectorLHS, typename VectorRHS>


void evaluate(VectorLHS & lhs, const VectorRHS & rhs) const;

Evaluates a matrix-free linear operator given by expr if_expr, and particle sets a and b on a vector rhs and accumulates the
result in vector lhs

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KernelZero.html[10/22/2018 7:52:27 AM]


Macro ASSERT

Macro ASSERT
ASSERT

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
ASSERT(condition, message)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ASSERT.html[10/22/2018 7:52:38 AM]


Macro ASSERT_CUDA

Macro ASSERT_CUDA
ASSERT_CUDA

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
ASSERT_CUDA(condition)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ASSERT_CUDA.html[10/22/2018 7:52:48 AM]


Macro CHECK

Macro CHECK
CHECK

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
CHECK(condition, message)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/CHECK.html[10/22/2018 7:52:58 AM]


Macro CHECK_CUDA

Macro CHECK_CUDA
CHECK_CUDA

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
CHECK_CUDA(condition, message)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/CHECK_CUDA.html[10/22/2018 7:53:08 AM]


Macro ERROR

Macro ERROR
ERROR

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
ERROR(message)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ERROR.html[10/22/2018 7:53:18 AM]


Macro ERROR_CUDA

Macro ERROR_CUDA
ERROR_CUDA

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
ERROR_CUDA(message)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ERROR_CUDA.html[10/22/2018 7:53:29 AM]


Macro ABORIA_LOG_LEVEL

Macro ABORIA_LOG_LEVEL
ABORIA_LOG_LEVEL

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
ABORIA_LOG_LEVEL

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ABORIA_LOG_LEVEL.html[10/22/2018 7:53:39 AM]


Macro LOG

Macro LOG
LOG

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
LOG(level, message)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/LOG_idp46631328057024.html[10/22/2018 7:53:49 AM]


Macro LOG_CUDA

Macro LOG_CUDA
LOG_CUDA

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
LOG_CUDA(level, message)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/LOG_CUDA.html[10/22/2018 7:53:59 AM]


Macro LOG_CUDA1

Macro LOG_CUDA1
LOG_CUDA1

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
LOG_CUDA1(level, message, variable)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/LOG_CUDA1.html[10/22/2018 7:54:10 AM]


Macro LOG_CUDA2

Macro LOG_CUDA2
LOG_CUDA2

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
LOG_CUDA2(level, message, variable1, variable2)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/LOG_CUDA2.html[10/22/2018 7:54:20 AM]


Macro LOG_BOLD

Macro LOG_BOLD
LOG_BOLD

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Log.h>
LOG_BOLD(level, message)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/LOG_BOLD.html[10/22/2018 7:54:30 AM]


Class template nanoflann_child_iterator

Class template nanofann_child_iterator


Aboria::nanofann_child_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NanoFlannAdaptor.h>
template<typename Traits>
class nanofann_child_iterator {
public:
// types
typedef const kd_tree_type::Node * pointer;
typedef std::forward_iterator_tag iterator_category;
typedef const kd_tree_type::Node value_type;
typedef const kd_tree_type::Node & reference;
typedef std::ptrdiff_t difference_type;
// construct/copy/destruct
nanofann_child_iterator();
nanofann_child_iterator(pointer, const box_type &);
// public member functions
void go_to(const double_d &);
int get_child_number() const;
bool is_high() const;
box_type get_bounds() const;
reference operator*() const;
reference operator->() const;
nanofann_child_iterator & operator++();
nanofann_child_iterator operator++(int);
bool operator==(const nanofann_child_iterator &) const;
bool operator!=(const nanofann_child_iterator &) const;
bool operator==(const bool) const;
bool operator!=(const bool) const;
// private member functions
bool equal(nanofann_child_iterator const &) const;
bool equal(const bool) const;
reference dereference() const;
void increment();
};

Description

nanofann_child_iterator public construct/copy/destruct


1. nanofann_child_iterator();

2. nanofann_child_iterator(pointer start, const box_type & bounds);

nanofann_child_iterator public member functions


1. void go_to(const double_d & position);

2. int get_child_number() const;

3. bool is_high() const;

https://martinjrobins.github.io/Aboria/Aboria/nanoflann_child_iterator.html[10/22/2018 7:54:41 AM]


Class template nanoflann_child_iterator

4. box_type get_bounds() const;

5. reference operator*() const;

6. reference operator->() const;

7. nanofann_child_iterator & operator++();

8. nanofann_child_iterator operator++(int);

9. bool operator==(const nanofann_child_iterator & rhs) const;

10. bool operator!=(const nanofann_child_iterator & rhs) const;

11. bool operator==(const bool rhs) const;

12. bool operator!=(const bool rhs) const;

nanofann_child_iterator private member functions


1. bool equal(nanofann_child_iterator const & other) const;

2. bool equal(const bool other) const;

3. reference dereference() const;

4. void increment();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/nanoflann_child_iterator.html[10/22/2018 7:54:41 AM]


Struct template iterator_range

Struct template iterator_range


Aboria::iterator_range — lightweight object that holds two iterators to the beginning and end of an STL range

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
template<typename IteratorType>
struct iterator_range {
// types
typedef IteratorType iterator;
// construct/copy/destruct
iterator_range(const IteratorType &, const IteratorType &);
// public member functions
const IteratorType & begin() const;
const IteratorType & end() const;
IteratorType & begin();
IteratorType & end();
// public data members
IteratorType m_begin;
IteratorType m_end;
};

Description

Template Parameters
1. typename IteratorType

the type of the iterators to be held

iterator_range public construct/copy/destruct


1. iterator_range(const IteratorType & begin, const IteratorType & end);

iterator_range public member functions


1. const IteratorType & begin() const;

2. const IteratorType & end() const;

3. IteratorType & begin();

4. IteratorType & end();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/iterator_range.html[10/22/2018 7:54:52 AM]


Struct template iterator_range

https://martinjrobins.github.io/Aboria/Aboria/iterator_range.html[10/22/2018 7:54:52 AM]


Class template neighbour_search_base

Class template neighbour_search_base


Aboria::neighbour_search_base — A base class for the spatial data structure classes.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
template<typename Derived, typename Traits, typename QueryType>
class neighbour_search_base {
public:
// types
typedef QueryType query_type;
typedef Traits::double_d double_d;
typedef Traits::bool_d bool_d;
typedef Traits::iterator iterator;
typedef Traits::vector_unsigned_int vector_unsigned_int;
typedef Traits::vector_int vector_int;
typedef Traits::vector_size_t vector_size_t;
typedef Traits::reference reference;
typedef Traits::raw_reference raw_reference;
// member classes/structs/unions
// A function object used to enforce the domain extents on the set of
// particles.
template<unsigned int D, typename Reference>
struct enforce_domain_lambda {
// types
typedef Vector< double, D > double_d;
typedef Vector< bool, D > bool_d;
typedef position_d< D > position;
// construct/copy/destruct
enforce_domain_lambda(const double_d &, const double_d &, const bool_d &);
// public member functions
void operator()(Reference) const;
// public data members
const double_d low;
const double_d high;
const bool_d periodic;
};
// construct/copy/destruct
neighbour_search_base();
// public member functions
const Derived & cast() const;
Derived & cast();
void set_domain(const double_d &, const double_d &, const bool_d &,
const double = 10, const bool = true);
size_t fnd_id_map(const size_t) const;
void init_id_map();
void print_id_map();
bool update_positions(iterator, iterator, iterator, iterator,
const bool = true);
void update_iterators(iterator, iterator);
const query_type & get_query() const;
const vector_int & get_alive_indicies() const;
bool get_id_map() const;
const double_d & get_min() const;
const double_d & get_max() const;
const bool_d & get_periodic() const;
bool domain_has_been_set() const;
double get_max_bucket_size() const;
// public static functions
static constexpr bool ordered();
};

Description

https://martinjrobins.github.io/Aboria/Aboria/neighbour_search_base.html[10/22/2018 7:55:03 AM]


Class template neighbour_search_base

It implements generic functionality such as setting up the spatial domain, logging, and the fnd-by-id map. In particular see

<xrefsect><xreftitle>Todo</xreftitle><xrefdescription>

it uses curiously recurring template pattern (CRTP) to implement compile-time polymorphism for historical reasons, but I don't think this is
neccessary anymore as all the member functions are quite slow

</xrefdescription></xrefsect>

Template Parameters
1. typename Derived

the derived class type

2. typename Traits

an instantiation of the class

3. typename QueryType

the query type associated with Derived

neighbour_search_base public construct/copy/destruct


1. neighbour_search_base();

constructs a new spatial data structure

The spatial domain is set to 1/3 of the maximum and minimum extents possible using the double type. All periodicity is turned off,
and the number of particle per bucket is set to 10

neighbour_search_base public member functions


1. const Derived & cast() const;

2. Derived & cast();

3. void set_domain(const double_d & min_in, const double_d & max_in,


const bool_d & periodic_in,
const double n_particles_in_leaf = 10,
const bool not_in_constructor = true);

resets the domain extents, periodicity and number of particles within each bucket

Parameters:
max_in the upper extent of the search domain
min_in the lower extent of the search domain
n_particles_in_leaf indicates the average, or maximum number of particles in each bucket
not_in_constructor used to determine if this function is called within the constructor
periodic_in wether or not each dimension is periodic

4. size_t fnd_id_map(const size_t id) const;

returns an index into the particle set given a particle id

Parameters:

https://martinjrobins.github.io/Aboria/Aboria/neighbour_search_base.html[10/22/2018 7:55:03 AM]


Class template neighbour_search_base

id the id to search for

Returns: size_t the index into the particle set

5. void init_id_map();

This function initialises the fnd-by-id functionality.

Find-by-id works using a key and value vector pair that act as a map between ids and particle indicies. This pair is sorted by id for
quick(ish) searching, especially in parallel. It is not as good as std::map on a (single-core) CPU, but can be done on a GPU using
thrust::vector

See Also:

fnd_id_map

6. void print_id_map();

print to stdout the fnd-by-id id-index map

7. bool update_positions(iterator begin, iterator end, iterator update_begin,


iterator update_end,
const bool delete_dead_particles = true);

This is the base function for updates to any of the spatial data structures. It handles the domain enforcement, the deletion or
addition of particles, and the fnd-by-id map. It also calls the update_positions_impl of the Derived class.

One of the key responsibilities of this function is to set m_alive_indices, which is a vector of indices that are still alive after taking into
account the alive fags and the position of the particles within the domain. The Particles::update_positions() function uses this
vector to delete and reorder the particles in the container

Parameters:
begin The begin iterator of the particle set
delete_dead_particles If true (the default), the function will ensure that the particles with
an false alive variable are removed from the particle set. Note
that this function does not actually do this
end The end iterator of the particle set
update_begin The begin iterator of the range of particles to be updated
update_end The end iterator of the range of particles to be updated. Note that if
any particles are to be deleted, this must be the same as end

Returns: true if the particles need to be reordered/deleted


false if the particles don't need to be reordered/deleted

8. void update_iterators(iterator begin, iterator end);

updates the internal copies held of the begin and end iterators of the particle set

Parameters:
begin the begin iterator of the particle set
end the end iterator of the particle set

9. const query_type & get_query() const;

Returns: the query object

10. const vector_int & get_alive_indicies() const;

See Also:

update_positions(), m_alive_indices

https://martinjrobins.github.io/Aboria/Aboria/neighbour_search_base.html[10/22/2018 7:55:03 AM]


Class template neighbour_search_base

Returns: a vector of ints that shows the new order of the particles within the particle container

11. bool get_id_map() const;

Returns: true if fnd-by-id functionality switched on

12. const double_d & get_min() const;

Returns: the minimum extent of the cuboid domain

13. const double_d & get_max() const;

Returns: the maximum extent of the cuboid domain

14. const bool_d & get_periodic() const;

Returns: the periodicity of the domain

15. bool domain_has_been_set() const;

See Also:

set_domain()

Returns: true if domain has been initialised

16. double get_max_bucket_size() const;

Returns: the number of particles in each bucket (average or maximum)

neighbour_search_base public static functions


1. static constexpr bool ordered();

Returns true if this spatial data structure relies on the order of particles in the Particles container. This is overloaded by the
Derived class.

Returns: true

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/neighbour_search_base.html[10/22/2018 7:55:03 AM]


Class template ranges_iterator

Class template ranges_iterator


Aboria::ranges_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
template<typename Traits>
class ranges_iterator {
public:
// types
typedef Traits traits_type;
typedef const p_pointer pointer;
typedef std::random_access_iterator_tag iterator_category;
typedef const p_reference reference;
typedef const p_reference value_type;
typedef std::ptrdiff_t difference_type;
// construct/copy/destruct
ranges_iterator();
ranges_iterator(const p_pointer &, const p_pointer &);
// public member functions
size_t distance_to_end() const;
reference operator*() const;
reference operator->() const;
ranges_iterator & operator++();
ranges_iterator operator++(int);
ranges_iterator operator+(int);
size_t operator-(ranges_iterator) const;
bool operator==(const ranges_iterator &) const;
bool operator!=(const ranges_iterator &) const;
bool operator==(const bool) const;
bool operator!=(const bool) const;
// private member functions
bool equal(ranges_iterator const &) const;
bool equal(const bool) const;
reference dereference() const;
void increment();
void increment(const int);
};

Description

ranges_iterator public construct/copy/destruct


1. ranges_iterator();

2. ranges_iterator(const p_pointer & begin, const p_pointer & end);

ranges_iterator public member functions


1. size_t distance_to_end() const;

2. reference operator*() const;

3. reference operator->() const;

https://martinjrobins.github.io/Aboria/Aboria/ranges_iterator.html[10/22/2018 7:55:14 AM]


Class template ranges_iterator

4. ranges_iterator & operator++();

5. ranges_iterator operator++(int);

6. ranges_iterator operator+(int n);

7. size_t operator-(ranges_iterator start) const;

8. bool operator==(const ranges_iterator & rhs) const;

9. bool operator!=(const ranges_iterator & rhs) const;

10. bool operator==(const bool rhs) const;

11. bool operator!=(const bool rhs) const;

ranges_iterator private member functions


1. bool equal(ranges_iterator const & other) const;

2. bool equal(const bool other) const;

3. reference dereference() const;

4. void increment();

5. void increment(const int n);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/ranges_iterator.html[10/22/2018 7:55:14 AM]


Class template linked_list_iterator

Class template linked_list_iterator


Aboria::linked_list_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
template<typename Traits>
class linked_list_iterator {
public:
// types
typedef Traits traits_type;
typedef const p_pointer pointer;
typedef std::forward_iterator_tag iterator_category;
typedef const p_reference reference;
typedef const p_reference value_type;
typedef std::ptrdiff_t difference_type;
// construct/copy/destruct
linked_list_iterator();
linked_list_iterator(const int, const p_pointer &, int *const);
linked_list_iterator(const linked_list_iterator &);
linked_list_iterator& operator=(const linked_list_iterator &);
// public member functions
size_t distance_to_end() const;
reference operator*() const;
reference operator->();
linked_list_iterator & operator++();
linked_list_iterator operator++(int);
linked_list_iterator operator+(int);
size_t operator-(linked_list_iterator) const;
bool operator==(const linked_list_iterator &) const;
bool operator!=(const linked_list_iterator &) const;
bool operator==(const bool) const;
bool operator!=(const bool) const;
// private member functions
bool increment();
bool equal(linked_list_iterator const &) const;
bool equal(const bool) const;
reference dereference() const;
};

Description
A const iterator to a set of neighbouring points. This iterator implements a STL forward iterator type

linked_list_iterator public construct/copy/destruct


1. linked_list_iterator();

2. linked_list_iterator(const int index, const p_pointer & particles_begin,


int *const linked_list_begin);

this constructor is used to start the iterator at the head of a bucket list

3. linked_list_iterator(const linked_list_iterator & other);

4. linked_list_iterator& operator=(const linked_list_iterator & other);

https://martinjrobins.github.io/Aboria/Aboria/linked_list_iterator.html[10/22/2018 7:55:26 AM]


Class template linked_list_iterator

linked_list_iterator public member functions


1. size_t distance_to_end() const;

2. reference operator*() const;

3. reference operator->();

4. linked_list_iterator & operator++();

5. linked_list_iterator operator++(int);

6. linked_list_iterator operator+(int n);

7. size_t operator-(linked_list_iterator start) const;

8. bool operator==(const linked_list_iterator & rhs) const;

9. bool operator!=(const linked_list_iterator & rhs) const;

10. bool operator==(const bool rhs) const;

11. bool operator!=(const bool rhs) const;

linked_list_iterator private member functions


1. bool increment();

2. bool equal(linked_list_iterator const & other) const;

3. bool equal(const bool other) const;

4. reference dereference() const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/linked_list_iterator.html[10/22/2018 7:55:26 AM]


Class template index_vector_iterator

Class template index_vector_iterator


Aboria::index_vector_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
template<typename Traits, typename Iterator>
class index_vector_iterator {
public:
// types
typedef Traits traits_type;
typedef const p_pointer pointer;
typedef std::forward_iterator_tag iterator_category;
typedef const p_reference reference;
typedef const p_reference value_type;
typedef std::ptrdiff_t difference_type;
// construct/copy/destruct
index_vector_iterator();
index_vector_iterator(Iterator, const p_pointer &);
// public member functions
reference operator*() const;
reference operator->();
iterator & operator++();
iterator operator++(int);
size_t operator-(iterator) const;
bool operator==(const iterator &) const;
bool operator!=(const iterator &) const;
// private member functions
void increment();
bool equal(iterator const &) const;
reference dereference() const;
};

Description

index_vector_iterator public construct/copy/destruct


1. index_vector_iterator();

2. index_vector_iterator(Iterator begin, const p_pointer & particles_begin);

this constructor is used to start the iterator at the head of a bucket list

index_vector_iterator public member functions


1. reference operator*() const;

2. reference operator->();

3. iterator & operator++();

4. iterator operator++(int);

https://martinjrobins.github.io/Aboria/Aboria/index_vector_iterator.html[10/22/2018 7:55:37 AM]


Class template index_vector_iterator

5. size_t operator-(iterator start) const;

6. bool operator==(const iterator & rhs) const;

7. bool operator!=(const iterator & rhs) const;

index_vector_iterator private member functions


1. void increment();

2. bool equal(iterator const & other) const;

3. reference dereference() const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/index_vector_iterator.html[10/22/2018 7:55:37 AM]


Class template depth_first_iterator

Class template depth_frst_iterator


Aboria::depth_frst_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
template<typename Query>
class depth_frst_iterator {
public:
// types
typedef child_iterator::value_type value_type;
typedef child_iterator pointer;
typedef std::forward_iterator_tag iterator_category;
typedef child_iterator::reference reference;
typedef std::ptrdiff_t difference_type;
// construct/copy/destruct
depth_frst_iterator();
depth_frst_iterator(const child_iterator &, const unsigned, const Query *);
depth_frst_iterator(const iterator &);
depth_frst_iterator& operator=(const iterator &);
~depth_frst_iterator();
// public member functions
const child_iterator & get_child_iterator() const;
reference operator*() const;
reference operator->();
iterator & operator++();
iterator operator++(int);
size_t operator-(iterator) const;
bool operator==(const iterator &) const;
bool operator!=(const iterator &) const;
bool operator==(const bool) const;
bool operator!=(const bool) const;
// private member functions
void increment();
bool equal(iterator const &) const;
bool equal(const bool) const;
reference dereference() const;
};

Description

depth_frst_iterator public construct/copy/destruct


1. depth_frst_iterator();

2. depth_frst_iterator(const child_iterator & start_node,


const unsigned tree_depth, const Query * query);

this constructor is used to start the iterator at the head of a bucket list

3. depth_frst_iterator(const iterator & copy);

4. depth_frst_iterator& operator=(const iterator & copy);

5. ~depth_frst_iterator();

https://martinjrobins.github.io/Aboria/Aboria/depth_first_iterator.html[10/22/2018 7:55:48 AM]


Class template depth_first_iterator

depth_frst_iterator public member functions


1. const child_iterator & get_child_iterator() const;

2. reference operator*() const;

3. reference operator->();

4. iterator & operator++();

5. iterator operator++(int);

6. size_t operator-(iterator start) const;

7. bool operator==(const iterator & rhs) const;

8. bool operator!=(const iterator & rhs) const;

9. bool operator==(const bool rhs) const;

10. bool operator!=(const bool rhs) const;

depth_frst_iterator private member functions


1. void increment();

2. bool equal(iterator const & other) const;

3. bool equal(const bool other) const;

4. reference dereference() const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/depth_first_iterator.html[10/22/2018 7:55:48 AM]


Class template tree_query_iterator

Class template tree_query_iterator


Aboria::tree_query_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
template<typename Query, int LNormNumber>
class tree_query_iterator {
public:
// types
typedef child_iterator::value_type value_type;
typedef child_iterator::pointer pointer;
typedef std::forward_iterator_tag iterator_category;
typedef child_iterator::reference reference;
typedef std::ptrdiff_t difference_type;
// construct/copy/destruct
tree_query_iterator();
tree_query_iterator(const child_iterator &, const double_d &,
const double_d &, const unsigned, const Query *,
const bool = false);
tree_query_iterator(const iterator &);
tree_query_iterator& operator=(const iterator &);
~tree_query_iterator();
// public member functions
child_iterator get_child_iterator() const;
reference operator*() const;
reference operator->();
iterator & operator++();
iterator operator++(int);
size_t operator-(iterator) const;
bool operator==(const iterator &) const;
bool operator!=(const iterator &) const;
bool operator==(const bool) const;
bool operator!=(const bool) const;
// private member functions
bool child_is_within_query(const child_iterator &);
void increment_stack();
void go_to_next_leaf();
void increment();
bool equal(iterator const &) const;
bool equal(const bool) const;
reference dereference() const;
};

Description

tree_query_iterator public construct/copy/destruct


1. tree_query_iterator();

2. tree_query_iterator(const child_iterator & start,


const double_d & query_point,
const double_d & max_distance, const unsigned tree_depth,
const Query * query, const bool ordered = false);

this constructor is used to start the iterator at the head of a bucket list

3. tree_query_iterator(const iterator & copy);

https://martinjrobins.github.io/Aboria/Aboria/tree_query_iterator.html[10/22/2018 7:55:58 AM]


Class template tree_query_iterator

4. tree_query_iterator& operator=(const iterator & copy);

5. ~tree_query_iterator();

tree_query_iterator public member functions


1. child_iterator get_child_iterator() const;

2. reference operator*() const;

3. reference operator->();

4. iterator & operator++();

5. iterator operator++(int);

6. size_t operator-(iterator start) const;

7. bool operator==(const iterator & rhs) const;

8. bool operator!=(const iterator & rhs) const;

9. bool operator==(const bool rhs) const;

10. bool operator!=(const bool rhs) const;

tree_query_iterator private member functions


1. bool child_is_within_query(const child_iterator & node);

2. void increment_stack();

3. void go_to_next_leaf();

4. void increment();

5. bool equal(iterator const & other) const;

6. bool equal(const bool other) const;

7. reference dereference() const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/tree_query_iterator.html[10/22/2018 7:55:58 AM]


Class template lattice_iterator

Class template lattice_iterator


Aboria::lattice_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
template<unsigned int D>
class lattice_iterator {
public:
// types
typedef proxy_int_d pointer;
typedef std::random_access_iterator_tag iterator_category;
typedef const proxy_int_d & reference;
typedef proxy_int_d value_type;
typedef std::ptrdiff_t difference_type;
// member classes/structs/unions
struct proxy_int_d : public Aboria::Vector< int, D > {
// construct/copy/destruct
proxy_int_d();
proxy_int_d(const int_d &);
// public member functions
proxy_int_d & operator&();
const proxy_int_d & operator&() const;
const proxy_int_d & operator*() const;
proxy_int_d & operator*();
const proxy_int_d * operator->() const;
proxy_int_d * operator->();
};
// construct/copy/destruct
lattice_iterator();
lattice_iterator(const int_d &, const int_d &);
lattice_iterator(const int_d &, const int_d &, const int_d &);
lattice_iterator& operator=(const int_d &);
// public member functions
explicit operator size_t() const;
const lattice_iterator & get_child_iterator() const;
reference operator*() const;
reference operator->() const;
iterator & operator++();
iterator operator++(int);
iterator operator+(const int);
iterator & operator+=(const int);
iterator & operator-=(const int);
iterator operator-(const int);
size_t operator-(const iterator &) const;
bool operator==(const iterator &) const;
bool operator==(const bool) const;
bool operator!=(const iterator &) const;
bool operator!=(const bool) const;
// private static functions
static int_d minus(const int_d &, const int_d &);
static int_d minus(const int_d &, const int);
// private member functions
int collapse_index_vector(const int_d &) const;
int_d reassemble_index_vector(const int) const;
bool equal(iterator const &) const;
bool equal(const bool) const;
reference dereference() const;
void increment();
void increment(const int);
};

Description

https://martinjrobins.github.io/Aboria/Aboria/lattice_iterator.html[10/22/2018 7:56:09 AM]


Class template lattice_iterator

lattice_iterator public construct/copy/destruct


1. lattice_iterator();

2. lattice_iterator(const int_d & min, const int_d & max);

3. lattice_iterator(const int_d & min, const int_d & max, const int_d & index);

4. lattice_iterator& operator=(const int_d & copy);

lattice_iterator public member functions


1. explicit operator size_t() const;

2. const lattice_iterator & get_child_iterator() const;

3. reference operator*() const;

4. reference operator->() const;

5. iterator & operator++();

6. iterator operator++(int);

7. iterator operator+(const int n);

8. iterator & operator+=(const int n);

9. iterator & operator-=(const int n);

10. iterator operator-(const int n);

11. size_t operator-(const iterator & start) const;

12. bool operator==(const iterator & rhs) const;

13. bool operator==(const bool rhs) const;

14. bool operator!=(const iterator & rhs) const;

15. bool operator!=(const bool rhs) const;

lattice_iterator private static functions


1. static int_d minus(const int_d & arg1, const int_d & arg2);

2. static int_d minus(const int_d & arg1, const int arg2);

lattice_iterator private member functions


1. int collapse_index_vector(const int_d & vindex) const;

2. int_d reassemble_index_vector(const int index) const;

3. bool equal(iterator const & other) const;

4. bool equal(const bool other) const;

https://martinjrobins.github.io/Aboria/Aboria/lattice_iterator.html[10/22/2018 7:56:09 AM]


Class template lattice_iterator

5. reference dereference() const;

6. void increment();

7. void increment(const int n);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/lattice_iterator.html[10/22/2018 7:56:09 AM]


Class template lattice_iterator_within_distance

Class template lattice_iterator_within_distance


Aboria::lattice_iterator_within_distance

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>
template<typename Query, int LNormNumber>
class lattice_iterator_within_distance {
public:
// types
typedef proxy_int_d pointer;
typedef std::random_access_iterator_tag iterator_category;
typedef const proxy_int_d & reference;
typedef proxy_int_d value_type;
typedef std::ptrdiff_t difference_type;
// member classes/structs/unions
struct proxy_int_d : public Aboria::Vector< int, dimension > {
// construct/copy/destruct
proxy_int_d();
proxy_int_d(const int_d &);
// public member functions
proxy_int_d & operator&();
const proxy_int_d & operator&() const;
const proxy_int_d & operator*() const;
proxy_int_d & operator*();
const proxy_int_d * operator->() const;
proxy_int_d * operator->();
};
// construct/copy/destruct
lattice_iterator_within_distance();
lattice_iterator_within_distance(const double_d &, const double_d &,
const Query *);
// public member functions
explicit operator size_t() const;
lattice_iterator< dimension > get_child_iterator() const;
reference operator*() const;
reference operator->() const;
iterator & operator++();
iterator operator++(int);
size_t operator-(const iterator &) const;
bool operator==(const iterator &) const;
bool operator==(const bool) const;
bool operator!=(const iterator &) const;
bool operator!=(const bool) const;
// private member functions
bool equal(iterator const &) const;
bool equal(const bool) const;
reference dereference() const;
bool ith_quadrant_bit(const int) const;
void reset_min_and_index();
bool outside_domain(const double_d &, const double_d &);
void increment();
};

Description

lattice_iterator_within_distance public construct/copy/destruct


1. lattice_iterator_within_distance();

https://martinjrobins.github.io/Aboria/Aboria/lattice__idp46631328611296.html[10/22/2018 7:56:19 AM]


Class template lattice_iterator_within_distance

2. lattice_iterator_within_distance(const double_d & query_point,


const double_d & max_distance,
const Query * query);

lattice_iterator_within_distance public member functions


1. explicit operator size_t() const;

2. lattice_iterator< dimension > get_child_iterator() const;

3. reference operator*() const;

4. reference operator->() const;

5. iterator & operator++();

6. iterator operator++(int);

7. size_t operator-(const iterator & start) const;

8. bool operator==(const iterator & rhs) const;

9. bool operator==(const bool rhs) const;

10. bool operator!=(const iterator & rhs) const;

11. bool operator!=(const bool rhs) const;

lattice_iterator_within_distance private member functions


1. bool equal(iterator const & other) const;

2. bool equal(const bool other) const;

3. reference dereference() const;

4. bool ith_quadrant_bit(const int i) const;

5. void reset_min_and_index();

6. bool outside_domain(const double_d & position, const double_d & max_distance);

7. void increment();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/lattice__idp46631328611296.html[10/22/2018 7:56:19 AM]


Function template make_iterator_range

Function template make_iterator_range


Aboria::make_iterator_range — helper function to make an iterator_range from a begin and end pair of iterators

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>

template<typename IteratorType>
iterator_range< IteratorType >
make_iterator_range(IteratorType && begin, IteratorType && end);

Description
Parameters:
begin the iterator pointing to the beginning of the range
end the iterator pointing to the end of the range

Template Parameters:
IteratorType the type of the iterators

Returns: CUDA_HOST_DEVICE iterator_range<IteratorType>

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/make_iterator_range.html[10/22/2018 7:56:30 AM]


Class template octree_child_iterator

Class template octree_child_iterator


Aboria::octree_child_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/OctTree.h>
template<unsigned int D>
class octree_child_iterator {
public:
// types
typedef const int * pointer;
typedef std::forward_iterator_tag iterator_category;
typedef const int * value_type;
typedef const int & reference;
typedef std::ptrdiff_t difference_type;
// construct/copy/destruct
octree_child_iterator();
octree_child_iterator(const int *, const box_type &);
// public member functions
void go_to(const double_d &);
int get_child_number() const;
bool is_high(const size_t) const;
box_type get_bounds() const;
reference operator*() const;
reference operator->() const;
octree_child_iterator & operator++();
octree_child_iterator operator++(int);
bool operator==(const octree_child_iterator &) const;
bool operator!=(const octree_child_iterator &) const;
bool operator==(const bool) const;
bool operator!=(const bool) const;
// private member functions
bool equal(octree_child_iterator const &) const;
bool equal(const bool) const;
reference dereference() const;
void increment();
};

Description

octree_child_iterator public construct/copy/destruct


1. octree_child_iterator();

2. octree_child_iterator(const int * start, const box_type & bounds);

octree_child_iterator public member functions


1. void go_to(const double_d & position);

2. int get_child_number() const;

3. bool is_high(const size_t i) const;

https://martinjrobins.github.io/Aboria/Aboria/octree_child_iterator.html[10/22/2018 7:56:40 AM]


Class template octree_child_iterator

4. box_type get_bounds() const;

5. reference operator*() const;

6. reference operator->() const;

7. octree_child_iterator & operator++();

8. octree_child_iterator operator++(int);

9. bool operator==(const octree_child_iterator & rhs) const;

10. bool operator!=(const octree_child_iterator & rhs) const;

11. bool operator==(const bool rhs) const;

12. bool operator!=(const bool rhs) const;

octree_child_iterator private member functions


1. bool equal(octree_child_iterator const & other) const;

2. bool equal(const bool other) const;

3. reference dereference() const;

4. void increment();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/octree_child_iterator.html[10/22/2018 7:56:40 AM]


Function template create_matrix_operator

Function template create_matrix_operator


Aboria::create_matrix_operator — creates a matrix linear operator for use with Eigen

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Operators.h>

template<typename RowParticles, typename ColParticles, typename F,


typename Kernel = KernelMatrix<RowParticles, ColParticles, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_matrix_operator(const RowParticles & row_particles,
const ColParticles & col_particles,
const F & function);

Description
This function returns a MatrixReplacement object that acts like a dense linear operator (i.e. matrix) in Eigen.

Parameters:
col_particles The columns of the linear operator index this frst particle set
function A function object that returns the value of the operator for a given particle
pair
row_particles The rows of the linear operator index this frst particle set

Template
Parameters: ColParticles The type of the column particle set
F The type of the function object
RowParticles The type of the row particle set

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/create_matrix_operator.html[10/22/2018 7:56:51 AM]


Function template create_sparse_operator

Function template create_sparse_operator


Aboria::create_sparse_operator — creates a sparse matrix-free linear operator for use with Eigen

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Operators.h>

template<typename RowParticles, typename ColParticles, typename F,


typename Kernel = KernelSparseConst<RowParticles, ColParticles, F>,
typename Operator = MatrixReplacement<1, 1, std::tuple<Kernel>> >
Operator create_sparse_operator(const RowParticles & row_particles,
const ColParticles & col_particles,
const double radius, const F & function);

Description
This function returns a MatrixReplacement object that acts like a sparse linear operator (i.e. matrix) in Eigen, in that only particle pairs
(i.e. a row/column pair) with a separation less that a given value are considered to be non-zero

Parameters:
col_particles The columns of the linear operator index this frst particle set
function A function object that returns the value of the operator for a given particle pair
radius It is assumed that function returns a zero value for all particle pairs with a
separation greater than this value
row_particles The rows of the linear operator index this frst particle set

Template
Parameters: ColParticles The type of the column particle set
F The type of the function object
RowParticles The type of the row particle set

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/create_s_idp46631328990032.html[10/22/2018 7:57:01 AM]


Class template bucket_pair_iterator

Class template bucket_pair_iterator


Aboria::bucket_pair_iterator

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Search.h>
template<typename Query>
class bucket_pair_iterator {
public:
// types
typedef const std::tuple< const int_d &, const int_d &, const double_d & > * pointer;
typedef std::forward_iterator_tag iterator_category;
typedef const std::tuple< const int_d &, const int_d &, const double_d & > reference;
typedef const std::tuple< const int_d, const int_d, const double_d > value_type;
typedef std::ptrdiff_t difference_type;
// construct/copy/destruct
bucket_pair_iterator();
bucket_pair_iterator(const Query &);
// public static functions
static lattice_iterator< dimension > get_periodic_it(const bool_d);
// public member functions
reference operator*() const;
reference operator->();
bucket_pair_iterator & operator++();
bucket_pair_iterator operator++(int);
size_t operator-(bucket_pair_iterator) const;
bool operator==(const bucket_pair_iterator &);
bool operator!=(const bucket_pair_iterator &);
bool operator==(const bool) const;
bool operator!=(const bool) const;
// private member functions
bool equal(bucket_pair_iterator const &) const;
bool equal(const bool) const;
void increment();
lattice_iterator< dimension >
get_neighbouring_buckets(const Query &, const int_d &) const;
lattice_iterator< dimension >
get_neighbouring_buckets(const Query &, const int_d &, const int_d &) const;
lattice_iterator< dimension >
get_regular_buckets(const Query &, const int_d &) const;
reference dereference() const;
};

Description

bucket_pair_iterator public construct/copy/destruct


1. bucket_pair_iterator();

2. bucket_pair_iterator(const Query & query);

bucket_pair_iterator public static functions


1. static lattice_iterator< dimension > get_periodic_it(const bool_d is_periodic);

https://martinjrobins.github.io/Aboria/Aboria/bucket_pair_iterator.html[10/22/2018 7:57:12 AM]


Class template bucket_pair_iterator

bucket_pair_iterator public member functions


1. reference operator*() const;

2. reference operator->();

3. bucket_pair_iterator & operator++();

4. bucket_pair_iterator operator++(int);

5. size_t operator-(bucket_pair_iterator start) const;

6. bool operator==(const bucket_pair_iterator & rhs);

7. bool operator!=(const bucket_pair_iterator & rhs);

8. bool operator==(const bool rhs) const;

9. bool operator!=(const bool rhs) const;

bucket_pair_iterator private member functions


1. bool equal(bucket_pair_iterator const & other) const;

2. bool equal(const bool other) const;

3. void increment();

4. lattice_iterator< dimension >


get_neighbouring_buckets(const Query & query, const int_d & bucket) const;

5. lattice_iterator< dimension >


get_neighbouring_buckets(const Query & query, const int_d & bucket,
const int_d & quadrant) const;

6. lattice_iterator< dimension >


get_regular_buckets(const Query & query, const int_d & quadrant) const;

7. reference dereference() const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/bucket_pair_iterator.html[10/22/2018 7:57:12 AM]


Struct Normal

Struct Normal
Aboria::Normal

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

struct Normal {
};

Description
a symbolic class used to return a normally distributed random variable. This uses the random number generator of the current particle to
generate the random variable

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Normal.html[10/22/2018 7:57:23 AM]


Struct Uniform

Struct Uniform
Aboria::Uniform

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

struct Uniform {
};

Description
a symbolic class used to return a uniformly distributed random variable. This uses the random number generator of the current particle to
generate the random variable

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Uniform.html[10/22/2018 7:57:38 AM]


Struct template VectorSymbolic

Struct template VectorSymbolic


Aboria::VectorSymbolic — a symbolic class that, when evaluated, returns a Vect3d class.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>
template<typename T, unsigned int N>
struct VectorSymbolic {
// types
typedef unspecifed expr_type;
typedef unspecifed data_type;
// construct/copy/destruct
explicit VectorSymbolic();
};

Description

VectorSymbolic public construct/copy/destruct


1. explicit VectorSymbolic();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/VectorSymbolic.html[10/22/2018 7:57:50 AM]


Struct template AccumulateWithinDistance

Struct template AccumulateWithinDistance


Aboria::AccumulateWithinDistance

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>
template<typename T, int LNormNumber = 2,
typename Terminal = typename detail::accumulate_within_distance< T,
mpl::int_<LNormNumber>> >
struct AccumulateWithinDistance {
// types
typedef Terminal data_type;
typedef proto::terminal< data_type >::type expr_type;
// construct/copy/destruct
explicit AccumulateWithinDistance(const double = 1);
template<typename T2>
explicit AccumulateWithinDistance(const double, const T2 &);
// public member functions
void set_init(const typename data_type::init_type &);
void set_max_distance(const double);
};

Description
an accumulation expression, for example a sum or product, over neighbouring particles within a given radius

AccumulateWithinDistance public construct/copy/destruct


1. explicit AccumulateWithinDistance(const double max_distance = 1);

empty constructor, makes an instantiation of the functor class T

2. template<typename T2>
explicit AccumulateWithinDistance(const double max_distance, const T2 & arg);

constructor that passes a single argument to the functor class T

AccumulateWithinDistance public member functions


1. void set_init(const typename data_type::init_type & arg);

a function used to set the initial value of the accumulation

2. void set_max_distance(const double max_distance);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/AccumulateWithinDistance.html[10/22/2018 7:58:00 AM]


Struct template min

Struct template min


Aboria::min

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>
template<typename T>
struct min {
// types
typedef T result_type;
// public member functions
T operator()(const T, const T) const;
};

Description
convenient functor to get a minumum value using the Accumulate expression

Accumulate<max<double>> max;

min public member functions


1. T operator()(const T arg1, const T arg2) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/min.html[10/22/2018 7:58:10 AM]


Struct template max

Struct template max


Aboria::max

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>
template<typename T>
struct max {
// types
typedef T result_type;
// public member functions
T operator()(const T, const T) const;
};

Description
convenient functor to get a maximum value using the Accumulate expression

Accumulate<min<double>> min;

max public member functions


1. T operator()(const T arg1, const T arg2) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/max.html[10/22/2018 7:58:21 AM]


Function template deep_copy

Function template deep_copy


Aboria::deep_copy

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename Expr> unspecifed deep_copy(Expr const & expr);

Description
returns a symbolic expression with the terminals held by value, rather than the normal held by reference.

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/deep_copy.html[10/22/2018 7:58:31 AM]


Function template eval

Function template eval


Aboria::eval

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename Expr> unspecifed eval(Expr & expr);

Description
evaluate a given expression that returns a constant value (scaler or vector) expr the expression to evaluate. Must be an expression that
returns a constant, i.e. that does not depend on a particle's variables

Returns: the result of the expression

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/eval_idp46631329421120.html[10/22/2018 7:58:41 AM]


Function template eval

Function template eval


Aboria::eval

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename Expr> unspecifed eval(Expr & expr, unspecifed particle_a);

Description
evaluate a given expression that depends on a single label $i$, for a single input particle expr the expression to evaluate particle_a the
particle to be substituted for the label $i$

Returns: the result of the expression after substituting in the particle values

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/eval_idp46631329424512.html[10/22/2018 7:58:52 AM]


Function template eval

Function template eval


Aboria::eval

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename Expr, typename ParticleReference>


unspecifed eval(Expr & expr, const ParticleReference & particle_a);

Description
evaluate a given expression that depends on a single label $i$, for a single input particle expr the expression to evaluate particle_a the
particle to be substituted for the label $i$

Returns: the result of the expression after substituting in the particle values

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/eval_idp46631329428736.html[10/22/2018 7:59:04 AM]


Function template eval

Function template eval


Aboria::eval

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename Expr, typename AnyRef>


unspecifed eval(Expr & expr, const AnyRef & particle_a);

Description
evaluate a given expression that returns a constant value (scaler or vector) expr the expression to evaluate. Must be an expression that
returns a constant, i.e. that does not depend on a particle's variables particle_a dummy arguement, not used

Returns: the result of the expression

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/eval_idp46631329433408.html[10/22/2018 7:59:15 AM]


Function template eval

Function template eval


Aboria::eval

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename Expr>
unspecifed eval(Expr & expr, unspecifed dx, unspecifed particle_a,
unspecifed particle_b);

Description
evaluate a given expression that depends on two labels $i$ and $j$ expr the expression to evaluate dx the shortest vector from particle_a
to particle_b particle_a the particle to be substituted for the label $i$ particle_b the particle to be substituted for the label $j$

Returns: the result of the expression after substituting in the particle values

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/eval_idp46631329438096.html[10/22/2018 7:59:25 AM]


Function template eval

Function template eval


Aboria::eval

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename Expr, typename AnyRef>


unspecifed eval(Expr & expr, unspecifed dx, unspecifed particle_a,
const AnyRef & particle_b);

Description
evaluate a given expression that depends on a single label $i$, for a single input particle expr the expression to evaluate dx dummy
arguement not used particle_a the particle to be substituted for the label $i$ particle_b dummy particle, not used

Returns: the result of the expression after substituting in the particle values

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/eval_idp46631329444032.html[10/22/2018 7:59:35 AM]


Function template eval

Function template eval


Aboria::eval

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename Expr, typename AnyRef>


unspecifed eval(Expr & expr, unspecifed dx, const AnyRef & particle_a,
unspecifed particle_b);

Description
evaluate a given expression that depends on a single label $i$, for a single input particle expr the expression to evaluate dx dummy
arguement not used particle_a dummy particle, not used particle_b the particle to be substituted for the label $i$

Returns: the result of the expression after substituting in the particle values

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/eval_idp46631329450384.html[10/22/2018 7:59:45 AM]


Function template eval

Function template eval


Aboria::eval

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename Expr, typename AnyDx, typename AnyRef1, typename AnyRef2>


unspecifed eval(Expr & expr, const AnyDx & dx, const AnyRef1 & particle_a,
const AnyRef2 & particle_b);

Description
evaluate a given expression that returns a constant value (scalar or vector) expr the expression to evaluate. Must be an expression that
returns a constant, i.e. that does not depend on a particle's variables dx dummy argument, not used particle_a dummy argument, not used
particle_b dummy argument, not used

Returns: the result of the expression

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/eval_idp46631329456736.html[10/22/2018 7:59:55 AM]


Function template is_trivially_zero

Function template is_trivially_zero


Aboria::is_trivially_zero

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Symbolic.h>

template<typename Expr> unspecifed is_trivially_zero(Expr & expr);

Description
returns true if the expression always evaluates to less than or equal to std::numeric_limits<double>::epsilon()

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/is_trivi_idp46631329463984.html[10/22/2018 8:00:05 AM]


Struct default_traits

Struct default_traits
Aboria::default_traits

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

struct default_traits {
// member classes/structs/unions
template<std::size_t I, typename T>
struct tuple_element {
// types
typedef std::tuple_element< I, T > type;
};
template<typename T>
struct tuple_size {
// types
typedef std::tuple_size< T > type;
};
template<typename... T>
struct tuple_type {
// types
typedef std::tuple< T...> type;
};
template<typename T>
struct vector_type {
// types
typedef std::vector< T > type;
};
// public static functions
template<typename ElementIterator, typename IndexIterator>
static auto make_permutation_iterator(ElementIterator, IndexIterator);
template<typename AdaptableUnaryFunction, typename Iterator>
static auto make_transform_iterator(Iterator, AdaptableUnaryFunction);
template<typename... T> static auto make_tuple(T...);
template<typename IteratorTuple>
static auto make_zip_iterator(IteratorTuple);
template<typename Incrementable>
static auto make_counting_iterator(Incrementable);
};

Description

default_traits public static functions


1. template<typename ElementIterator, typename IndexIterator>
static auto make_permutation_iterator(ElementIterator e, IndexIterator i);

2. template<typename AdaptableUnaryFunction, typename Iterator>


static auto make_transform_iterator(Iterator it, AdaptableUnaryFunction fun);

3. template<typename... T> static auto make_tuple(T... args);

4. template<typename IteratorTuple>
static auto make_zip_iterator(IteratorTuple arg);

5. template<typename Incrementable>
static auto make_counting_iterator(Incrementable x);

https://martinjrobins.github.io/Aboria/Aboria/default_traits.html[10/22/2018 8:00:16 AM]


Struct default_traits

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/default_traits.html[10/22/2018 8:00:16 AM]


Struct Traits<std::vector>

Struct Traits<std::vector>
Aboria::Traits<std::vector>

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

struct Traits<std::vector> : public Aboria::default_traits {


};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_s_idp46631329523328.html[10/22/2018 8:00:26 AM]


Struct Traits<thrust::device_vector>

Struct Traits<thrust::device_vector>
Aboria::Traits<thrust::device_vector>

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

struct Traits<thrust::device_vector> : public Aboria::default_traits {


// member classes/structs/unions
template<std::size_t I, typename T>
struct tuple_element {
// types
typedef thrust::tuple_element< I, T > type;
};
template<typename T>
struct tuple_size {
// types
typedef thrust::tuple_size< T > type;
};
template<typename T1 = thrust::null_type, typename T2 = thrust::null_type,
typename T3 = thrust::null_type, typename T4 = thrust::null_type,
typename T5 = thrust::null_type, typename T6 = thrust::null_type,
typename T7 = thrust::null_type, typename T8 = thrust::null_type,
typename T9 = thrust::null_type>
struct tuple_type {
// types
typedef thrust::tuple< T1, T2, T3, T4, T5, T6, T7, T8, T9 > type;
};
template<typename T>
struct vector_type {
// types
typedef thrust::device_vector< T > type;
};
// public static functions
template<typename ElementIterator, typename IndexIterator>
static auto make_permutation_iterator(ElementIterator, IndexIterator);
template<typename AdaptableUnaryFunction, typename Iterator>
static auto make_transform_iterator(Iterator, AdaptableUnaryFunction);
template<typename... T> static auto make_tuple(T...);
template<typename IteratorTuple>
static auto make_zip_iterator(IteratorTuple);
template<typename Incrementable>
static auto make_counting_iterator(Incrementable);
};

Description

Traits public static functions


1. template<typename ElementIterator, typename IndexIterator>
static auto make_permutation_iterator(ElementIterator e, IndexIterator i);

2. template<typename AdaptableUnaryFunction, typename Iterator>


static auto make_transform_iterator(Iterator it, AdaptableUnaryFunction fun);

3. template<typename... T> static auto make_tuple(T... args);

4. template<typename IteratorTuple>
static auto make_zip_iterator(IteratorTuple arg);

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329524992.html[10/22/2018 8:00:36 AM]


Struct Traits<thrust::device_vector>

5. template<typename Incrementable>
static auto make_counting_iterator(Incrementable x);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329524992.html[10/22/2018 8:00:36 AM]


Struct Traits<thrust::host_vector>

Struct Traits<thrust::host_vector>
Aboria::Traits<thrust::host_vector>

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

struct Traits<thrust::host_vector> : public Aboria::default_traits {


// member classes/structs/unions
template<std::size_t I, typename T>
struct tuple_element {
// types
typedef thrust::tuple_element< I, T > type;
};
template<typename T>
struct tuple_size {
// types
typedef thrust::tuple_size< T > type;
};
template<typename T1 = thrust::null_type, typename T2 = thrust::null_type,
typename T3 = thrust::null_type, typename T4 = thrust::null_type,
typename T5 = thrust::null_type, typename T6 = thrust::null_type,
typename T7 = thrust::null_type, typename T8 = thrust::null_type,
typename T9 = thrust::null_type>
struct tuple_type {
// types
typedef thrust::tuple< T1, T2, T3, T4, T5, T6, T7, T8, T9 > type;
};
template<typename T>
struct vector_type {
// types
typedef thrust::host_vector< T > type;
};
// public static functions
template<typename ElementIterator, typename IndexIterator>
static auto make_permutation_iterator(ElementIterator, IndexIterator);
template<typename AdaptableUnaryFunction, typename Iterator>
static auto make_transform_iterator(Iterator, AdaptableUnaryFunction);
template<typename... T> static auto make_tuple(T...);
template<typename IteratorTuple>
static auto make_zip_iterator(IteratorTuple);
template<typename Incrementable>
static auto make_counting_iterator(Incrementable);
};

Description

Traits public static functions


1. template<typename ElementIterator, typename IndexIterator>
static auto make_permutation_iterator(ElementIterator e, IndexIterator i);

2. template<typename AdaptableUnaryFunction, typename Iterator>


static auto make_transform_iterator(Iterator it, AdaptableUnaryFunction fun);

3. template<typename... T> static auto make_tuple(T... args);

4. template<typename IteratorTuple>
static auto make_zip_iterator(IteratorTuple arg);

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329558064.html[10/22/2018 8:00:47 AM]


Struct Traits<thrust::host_vector>

5. template<typename Incrementable>
static auto make_counting_iterator(Incrementable x);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329558064.html[10/22/2018 8:00:47 AM]


Struct template TraitsCommon

Struct template TraitsCommon


Aboria::TraitsCommon

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>
template<typename ARG, unsigned int DomainD, unsigned int SelfD,
typename TRAITS>
struct TraitsCommon {
// types
typedef ARG::ERROR_FIRST_TEMPLATE_ARGUMENT_TO_PARTICLES_MUST_BE_A_STD_TUPLE_TYPE error;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/TraitsCommon.html[10/22/2018 8:00:57 AM]


Struct template TraitsCommon<std::tuple< TYPES...>, DomainD, SelfD, traits>

Struct template TraitsCommon<std::tuple< TYPES...>, DomainD,


SelfD, traits>
Aboria::TraitsCommon<std::tuple< TYPES...>, DomainD, SelfD, traits>

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>
template<typename traits, unsigned int DomainD, unsigned int SelfD,
typename... TYPES>
struct TraitsCommon<std::tuple< TYPES...>, DomainD, SelfD, traits> : public traits {
// types
typedef typename traits::template tuple_type< T...>::type
tuple;
typedef typename traits::template tuple_element< I, T >::type
tuple_element;
typedef typename traits::template vector_type< T >::type
vector;
typedef vector< Vector< double, DomainD > >
vector_double_d;
typedef vector_double_d::iterator
vector_double_d_iterator;
typedef vector_double_d::const_iterator
vector_double_d_const_iterator;
typedef traits::template vector_type< Vector< int, DomainD > >::type
vector_int_d;
typedef traits::template vector_type< Vector< unsigned int, DomainD > >::type
vector_unsigned_int_d;
typedef vector_unsigned_int_d::iterator
vector_unsigned_int_d_iterator;
typedef vector_unsigned_int_d::const_iterator
vector_unsigned_int_d_const_iterator;
typedef traits::template vector_type< Vector< bool, DomainD > >::type
vector_bool_d;
typedef traits::template vector_type< int >::type
vector_int;
typedef traits::template vector_type< double >::type
vector_double;
typedef traits::template vector_type< size_t >::type
vector_size_t;
typedef traits::template vector_type< unsigned int >::type
vector_unsigned_int;
typedef vector_unsigned_int::iterator
vector_unsigned_int_iterator;
typedef vector_unsigned_int::const_iterator
vector_unsigned_int_const_iterator;
typedef traits::template vector_type< Vector< int, 2 > >::type
vector_int2;
typedef Vector< double, dimension >
double_d;
typedef Vector< int, dimension >
int_d;
typedef Vector< unsigned int, dimension >
unsigned_int_d;
typedef Vector< bool, dimension >
bool_d;
typedef std::conditional<(SelfD > 1), particles_d< SelfD >, position_d< dimension > >::type
position;
typedef position::value_type
position_value_type;
typedef alive::value_type
alive_value_type;
typedef id::value_type
id_value_type;
typedef generator::value_type
random_value_type;
typedef traits::template vector_type< position_value_type >::type
position_vector_type;
typedef traits::template vector_type< alive_value_type >::type
alive_vector_type;
typedef traits::template vector_type< id_value_type >::type
id_vector_type;
typedef traits::template vector_type< random_value_type >::type
random_vector_type;

https://martinjrobins.github.io/Aboria/Aboria/TraitsCo_idp46631329595392.html[10/22/2018 8:01:09 AM]


Struct template TraitsCommon<std::tuple< TYPES...>, DomainD, SelfD, traits>

typedef traits
traits_type;
typedef mpl::vector< position, id, alive, generator, TYPES...>
mpl_type_vector;
typedef tuple< typename position_vector_type::iterator, typename id_vector_type::iterator,
typename alive_vector_type::iterator, typename random_vector_type::iterator, typename
traits::template vector_type< typename TYPES::value_type >::type::iterator...>
tuple_of_iterators_type;
typedef tuple< typename position_vector_type::const_iterator, typename
id_vector_type::const_iterator, typename alive_vector_type::const_iterator, typename
random_vector_type::const_iterator, typename traits::template vector_type< typename
TYPES::value_type >::type::const_iterator...> tuple_of_const_iterators_type;
typedef std::tuple< position_vector_type, id_vector_type, alive_vector_type, random_vector_type,
typename traits::template vector_type< typename TYPES::value_type >::type...>
vectors_data_type;
typedef Aboria::zip_iterator< tuple_of_iterators_type, mpl_type_vector >
iterator;
typedef Aboria::zip_iterator< tuple_of_const_iterators_type, mpl_type_vector >
const_iterator;
typedef iterator::reference
reference;
typedef iterator::value_type
value_type;
typedef iterator::pointer
pointer;
typedef iterator::getter_raw_pointer
raw_pointer;
typedef iterator::getter_raw_reference
raw_reference;
typedef const_iterator::getter_raw_reference
raw_const_reference;
typedef const_iterator::reference
const_reference;
typedef Aboria::getter_type< vectors_data_type, mpl_type_vector >
data_type;
typedef position_vector_type::size_type
size_type;
typedef position_vector_type::difference_type
difference_type;
// public static functions
template<std::size_t... I>
static iterator begin_impl(data_type &, unspecifed);
template<std::size_t... I>
static iterator end_impl(data_type &, unspecifed);
template<std::size_t... I>
static const_iterator cbegin_impl(const data_type &, unspecifed);
template<std::size_t... I>
static const_iterator cend_impl(const data_type &, unspecifed);
template<std::size_t... I>
static reference
index_impl(data_type &, const size_t, unspecifed, std::true_type);
template<std::size_t... I>
static reference
index_impl(data_type &, const size_t, unspecifed, std::false_type);
template<std::size_t... I>
static const_reference
index_const_impl(const data_type &, const size_t, unspecifed,
std::true_type);
template<std::size_t... I>
static const_reference
index_const_impl(const data_type &, const size_t, unspecifed,
std::false_type);
template<std::size_t... I> static void clear_impl(data_type &, unspecifed);
template<std::size_t... I>
static void resize_impl(data_type &, const size_t, unspecifed);
template<std::size_t... I>
static void push_back_impl(data_type &, const value_type &, unspecifed);
template<std::size_t... I>
static void pop_back_impl(data_type &, unspecifed);
template<std::size_t... I>
static iterator erase_impl(data_type &, iterator, unspecifed);
template<std::size_t... I>
static iterator erase_impl(data_type &, iterator, iterator, unspecifed);
template<std::size_t... I>
static iterator
insert_impl(data_type &, iterator, const value_type &, unspecifed);
template<std::size_t... I>
static void insert_impl(data_type &, iterator, size_t, const value_type &,
unspecifed);
template<typename InputIterator, std::size_t... I>
static iterator
insert_impl(data_type &, iterator, InputIterator, InputIterator,
unspecifed);
template<typename InputIterator, std::size_t... I>
static data_type construct_impl(InputIterator, InputIterator, unspecifed);
template<std::size_t... I>
static void header_to_stream_impl(std::ostream &, unspecifed);
template<typename InputIterator, std::size_t... I>
static void to_stream_impl(InputIterator, std::ostream &, unspecifed);
template<typename InputIterator, std::size_t... I>
static void from_stream_impl(InputIterator, std::istream &, unspecifed);
template<typename Archive, std::size_t... I>
static void serialize_impl(const data_type &, Archive &,
const unsigned int, unspecifed);
template<typename Indices = detail::make_index_sequence<N> >
static iterator begin(data_type &);
template<typename Indices = detail::make_index_sequence<N> >

https://martinjrobins.github.io/Aboria/Aboria/TraitsCo_idp46631329595392.html[10/22/2018 8:01:09 AM]


Struct template TraitsCommon<std::tuple< TYPES...>, DomainD, SelfD, traits>

static iterator end(data_type &);


template<typename Indices = detail::make_index_sequence<N> >
static const_iterator cbegin(const data_type &);
template<typename Indices = detail::make_index_sequence<N> >
static const_iterator cend(const data_type &);
template<typename Indices = detail::make_index_sequence<N> >
static reference index(data_type &, const size_t);
template<typename Indices = detail::make_index_sequence<N> >
static const_reference index(const data_type &, const size_t);
template<typename Indices = detail::make_index_sequence<N> >
static void clear(data_type &);
template<typename Indices = detail::make_index_sequence<N> >
static void resize(data_type &, const size_t);
template<typename Indices = detail::make_index_sequence<N> >
static void push_back(data_type &, const value_type &);
template<typename Indices = detail::make_index_sequence<N> >
static void pop_back(data_type &);
template<typename Indices = detail::make_index_sequence<N> >
static iterator erase(data_type &, iterator);
template<typename Indices = detail::make_index_sequence<N> >
static iterator erase(data_type &, iterator, iterator);
template<typename Indices = detail::make_index_sequence<N> >
static iterator insert(data_type &, iterator, const value_type &);
template<typename Indices = detail::make_index_sequence<N> >
static void insert(data_type &, iterator, size_t, const value_type &);
template<typename InputIterator,
typename Indices = detail::make_index_sequence<N> >
static iterator
insert(data_type &, iterator, InputIterator, InputIterator);
template<typename InputIterator,
typename Indices = detail::make_index_sequence<N> >
static data_type construct(InputIterator, InputIterator);
template<typename Indices = detail::make_index_sequence<N> >
static void header_to_stream(std::ostream &);
template<typename InputIterator,
typename Indices = detail::make_index_sequence<N> >
static void to_stream(InputIterator, std::ostream &);
template<typename InputIterator,
typename Indices = detail::make_index_sequence<N> >
static void from_stream(InputIterator, std::istream &);
template<typename Archive,
typename Indices = detail::make_index_sequence<N> >
static void serialize(const data_type &, Archive &, const unsigned int);
// public data members
static const unsigned int dimension;
static const size_t N;
};

Description

TraitsCommon public static functions


1. template<std::size_t... I>
static iterator begin_impl(data_type & data, unspecifed);

2. template<std::size_t... I>
static iterator end_impl(data_type & data, unspecifed);

3. template<std::size_t... I>
static const_iterator cbegin_impl(const data_type & data, unspecifed);

4. template<std::size_t... I>
static const_iterator cend_impl(const data_type & data, unspecifed);

5. template<std::size_t... I>
static reference
index_impl(data_type & data, const size_t i, unspecifed, std::true_type);

6. template<std::size_t... I>
static reference
index_impl(data_type & data, const size_t i, unspecifed, std::false_type);

7. template<std::size_t... I>
static const_reference
index_const_impl(const data_type & data, const size_t i, unspecifed,
std::true_type);

https://martinjrobins.github.io/Aboria/Aboria/TraitsCo_idp46631329595392.html[10/22/2018 8:01:09 AM]


Struct template TraitsCommon<std::tuple< TYPES...>, DomainD, SelfD, traits>

8. template<std::size_t... I>
static const_reference
index_const_impl(const data_type & data, const size_t i, unspecifed,
std::false_type);

9. template<std::size_t... I>
static void clear_impl(data_type & data, unspecifed);

10. template<std::size_t... I>


static void resize_impl(data_type & data, const size_t new_size,
unspecifed);

11. template<std::size_t... I>


static void push_back_impl(data_type & data, const value_type & val,
unspecifed);

12. template<std::size_t... I>


static void pop_back_impl(data_type & data, unspecifed);

13. template<std::size_t... I>


static iterator erase_impl(data_type & data, iterator position, unspecifed);

14. template<std::size_t... I>


static iterator
erase_impl(data_type & data, iterator frst, iterator last, unspecifed);

15. template<std::size_t... I>


static iterator
insert_impl(data_type & data, iterator position, const value_type & val,
unspecifed);

16. template<std::size_t... I>


static void insert_impl(data_type & data, iterator position, size_t n,
const value_type & val, unspecifed);

17. template<typename InputIterator, std::size_t... I>


static iterator
insert_impl(data_type & data, iterator position, InputIterator frst,
InputIterator last, unspecifed);

18. template<typename InputIterator, std::size_t... I>


static data_type
construct_impl(InputIterator frst, InputIterator last, unspecifed);

19. template<std::size_t... I>


static void header_to_stream_impl(std::ostream & os, unspecifed);

20. template<typename InputIterator, std::size_t... I>


static void to_stream_impl(InputIterator i, std::ostream & os, unspecifed);

21. template<typename InputIterator, std::size_t... I>


static void from_stream_impl(InputIterator i, std::istream & is,
unspecifed);

22. template<typename Archive, std::size_t... I>


static void serialize_impl(const data_type & data, Archive & ar,
const unsigned int version, unspecifed);

23. template<typename Indices = detail::make_index_sequence<N> >


static iterator begin(data_type & data);

24. template<typename Indices = detail::make_index_sequence<N> >


static iterator end(data_type & data);

https://martinjrobins.github.io/Aboria/Aboria/TraitsCo_idp46631329595392.html[10/22/2018 8:01:09 AM]


Struct template TraitsCommon<std::tuple< TYPES...>, DomainD, SelfD, traits>

25. template<typename Indices = detail::make_index_sequence<N> >


static const_iterator cbegin(const data_type & data);

26. template<typename Indices = detail::make_index_sequence<N> >


static const_iterator cend(const data_type & data);

27. template<typename Indices = detail::make_index_sequence<N> >


static reference index(data_type & data, const size_t i);

28. template<typename Indices = detail::make_index_sequence<N> >


static const_reference index(const data_type & data, const size_t i);

29. template<typename Indices = detail::make_index_sequence<N> >


static void clear(data_type & data);

30. template<typename Indices = detail::make_index_sequence<N> >


static void resize(data_type & data, const size_t new_size);

31. template<typename Indices = detail::make_index_sequence<N> >


static void push_back(data_type & data, const value_type & val);

32. template<typename Indices = detail::make_index_sequence<N> >


static void pop_back(data_type & data);

33. template<typename Indices = detail::make_index_sequence<N> >


static iterator erase(data_type & data, iterator pos);

34. template<typename Indices = detail::make_index_sequence<N> >


static iterator erase(data_type & data, iterator frst, iterator last);

35. template<typename Indices = detail::make_index_sequence<N> >


static iterator
insert(data_type & data, iterator pos, const value_type & val);

36. template<typename Indices = detail::make_index_sequence<N> >


static void insert(data_type & data, iterator position, size_t n,
const value_type & val);

37. template<typename InputIterator,


typename Indices = detail::make_index_sequence<N> >
static iterator
insert(data_type & data, iterator pos, InputIterator frst,
InputIterator last);

38. template<typename InputIterator,


typename Indices = detail::make_index_sequence<N> >
static data_type construct(InputIterator frst, InputIterator last);

39. template<typename Indices = detail::make_index_sequence<N> >


static void header_to_stream(std::ostream & os);

40. template<typename InputIterator,


typename Indices = detail::make_index_sequence<N> >
static void to_stream(InputIterator i, std::ostream & os);

41. template<typename InputIterator,


typename Indices = detail::make_index_sequence<N> >
static void from_stream(InputIterator i, std::istream & is);

42. template<typename Archive, typename Indices = detail::make_index_sequence<N> >


static void serialize(const data_type & data, Archive & ar,
const unsigned int version);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/TraitsCo_idp46631329595392.html[10/22/2018 8:01:09 AM]


Struct template TraitsCommon<std::tuple< TYPES...>, DomainD, SelfD, traits>

https://martinjrobins.github.io/Aboria/Aboria/TraitsCo_idp46631329595392.html[10/22/2018 8:01:09 AM]


Macro ABORIA_VARIABLE_VECTOR

Macro ABORIA_VARIABLE_VECTOR
ABORIA_VARIABLE_VECTOR

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Variable.h>
ABORIA_VARIABLE_VECTOR(NAME, DATA_TYPE, NAME_STRING)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/ABORIA_VARIABLE_VECTOR.html[10/22/2018 8:01:21 AM]


Macro UNARY_OPERATOR

Macro UNARY_OPERATOR
UNARY_OPERATOR

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
UNARY_OPERATOR(the_op)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/UNARY_OPERATOR.html[10/22/2018 8:01:31 AM]


Macro OPERATOR

Macro OPERATOR
OPERATOR

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
OPERATOR(the_op)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/OPERATOR.html[10/22/2018 8:01:41 AM]


Macro COMPARISON

Macro COMPARISON
COMPARISON

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
COMPARISON(the_op)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/COMPARISON.html[10/22/2018 8:01:51 AM]


Macro COMPOUND_ASSIGN

Macro COMPOUND_ASSIGN
COMPOUND_ASSIGN

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
COMPOUND_ASSIGN(the_op)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/COMPOUND_ASSIGN.html[10/22/2018 8:02:02 AM]


Macro UFUNC

Macro UFUNC
UFUNC

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
UFUNC(the_op)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/UFUNC.html[10/22/2018 8:02:12 AM]


Struct template is_vector

Struct template is_vector


Aboria::is_vector

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T>
struct is_vector : public false_type {
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/is_vector.html[10/22/2018 8:02:22 AM]


Struct template is_vector<Vector< T, N >>

Struct template is_vector<Vector< T, N >>


Aboria::is_vector<Vector< T, N >>

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T, unsigned int N>
struct is_vector<Vector< T, N >> : public true_type {
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/is_vecto_idp46631329943120.html[10/22/2018 8:02:32 AM]


Struct template is_eigen_vector

Struct template is_eigen_vector


Aboria::is_eigen_vector

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T>
struct is_eigen_vector : public false_type {
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/is_eigen_vector.html[10/22/2018 8:02:42 AM]


Struct template is_eigen_vector<Eigen::Matrix< T, N, 1 >>

Struct template is_eigen_vector<Eigen::Matrix< T, N, 1 >>


Aboria::is_eigen_vector<Eigen::Matrix< T, N, 1 >>

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T, int N>
struct is_eigen_vector<Eigen::Matrix< T, N, 1 >> : public true_type {
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/is_eigen_idp46631329948288.html[10/22/2018 8:02:53 AM]


Struct template scalar

Struct template scalar


Aboria::scalar

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T, typename Enable = void>
struct scalar {
// types
typedef void type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/scalar.html[10/22/2018 8:03:03 AM]


Struct template scalar<T, typename std::enable_if< std::is_arithmetic< T >::value >::type>

Struct template scalar<T, typename std::enable_if<


std::is_arithmetic< T >::value >::type>
Aboria::scalar<T, typename std::enable_if< std::is_arithmetic< T >::value >::type>

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T>
struct scalar<T, typename std::enable_if< std::is_arithmetic< T >::value >::type> {
// types
typedef T type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/scalar_T_idp46631329954720.html[10/22/2018 8:03:13 AM]


Struct template scalar<T, typename std::enable_if< is_vector< T >::value >::type>

Struct template scalar<T, typename std::enable_if< is_vector< T


>::value >::type>
Aboria::scalar<T, typename std::enable_if< is_vector< T >::value >::type>

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T>
struct scalar<T, typename std::enable_if< is_vector< T >::value >::type> {
// types
typedef T::value_type type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/scalar_T_idp46631329957408.html[10/22/2018 8:03:23 AM]


Struct template dim

Struct template dim


Aboria::dim

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T, typename Enable = void>
struct dim {
// types
typedef void type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/dim.html[10/22/2018 8:03:33 AM]


Struct template dim<T, typename std::enable_if< std::is_arithmetic< T >::value >::type>

Struct template dim<T, typename std::enable_if<


std::is_arithmetic< T >::value >::type>
Aboria::dim<T, typename std::enable_if< std::is_arithmetic< T >::value >::type>

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T>
struct dim<T, typename std::enable_if< std::is_arithmetic< T >::value >::type> {
// public data members
static const size_t value;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/dim_T__t_idp46631329962864.html[10/22/2018 8:03:43 AM]


Struct template dim<T, typename std::enable_if< is_vector< T >::value >::type>

Struct template dim<T, typename std::enable_if< is_vector< T


>::value >::type>
Aboria::dim<T, typename std::enable_if< is_vector< T >::value >::type>

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>
template<typename T>
struct dim<T, typename std::enable_if< is_vector< T >::value >::type> {
// public data members
static const size_t value;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/dim_T__t_idp46631329965824.html[10/22/2018 8:03:54 AM]


Function template norm

Function template norm


Aboria::norm — element-wise foor rounding function for Vector class

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>

template<typename T, int I> double norm(const Vector< T, I > & arg1);

Description
element-wise ceil rounding function for Vector class element-wise round rounding function for Vector class return arg1.norm()

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/norm_idp46631330319904.html[10/22/2018 8:04:04 AM]


Function template dot

Function template dot


Aboria::dot

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>

template<typename T1, typename T2, int I>


double dot(const Vector< T1, I > & arg1, const Vector< T2, I > & arg2);

Description
external dot product for vector class (probably conficts with symbolic dot?)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/dot_idp46631330331472.html[10/22/2018 8:04:14 AM]


Function template abs

Function template abs


Aboria::abs

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Vector.h>

template<typename T, unsigned int N>


const Vector< T, N > abs(const Vector< T, N > & x);

Description
returns new Vector made from element-wise absolute value of input arg (for Eigen)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/abs_idp46631330356528.html[10/22/2018 8:04:26 AM]


Struct copy_points_in_bucket_lambda

Struct copy_points_in_bucket_lambda
Aboria::CellList::copy_points_in_bucket_lambda — function object to copy a range of particles to another index range

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellList.h>

// function object to copy a range of particles to another index range


struct copy_points_in_bucket_lambda {
// construct/copy/destruct
copy_points_in_bucket_lambda(size_t, size_t, size_t, int *, int *);
// public member functions
void operator()(const int);
// public data members
int * m_linked_list;
int * m_buckets;
size_t start_index_deleted;
size_t start_index_copied;
size_t end_index_copied;
};

Description

copy_points_in_bucket_lambda public construct/copy/destruct


1. copy_points_in_bucket_lambda(size_t start_index_deleted,
size_t start_index_copied,
size_t end_index_copied, int * m_linked_list,
int * m_buckets);

copy_points_in_bucket_lambda public member functions


1. void operator()(const int celli);

goes through bucket celli and updates the particle indices to point to the new range

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellList/copy_poi_idp46631326720864.html[10/22/2018 8:04:38 AM]


Struct delete_points_in_bucket_lambda

Struct delete_points_in_bucket_lambda
Aboria::CellList::delete_points_in_bucket_lambda — function object to delete a range of particles within the buckets

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellList.h>

// function object to delete a range of particles within the buckets


struct delete_points_in_bucket_lambda {
// construct/copy/destruct
delete_points_in_bucket_lambda(int, int, int *, int *);
// public member functions
void operator()(const int);
// public data members
int * m_linked_list;
int * m_buckets;
int start_index_deleted;
int end_index_deleted;
};

Description

delete_points_in_bucket_lambda public construct/copy/destruct


1. delete_points_in_bucket_lambda(int start_index_deleted, int end_index_deleted,
int * m_linked_list, int * m_buckets);

delete_points_in_bucket_lambda public member functions


1. void operator()(const int celli);

goes through all the particles in bucket celli and deletes particles within the range given by m_start_index_deleted < i <
m_end_index_deleted

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellList/delete_p_idp46631326731872.html[10/22/2018 8:04:48 AM]


Struct insert_points_lambda_non_sequential

Struct insert_points_lambda_non_sequential
Aboria::CellList::insert_points_lambda_non_sequential — thread-safe function object to insert a list of non-consecutive particles into the
data structure

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellList.h>

// thread-safe function object to insert a list of non-consecutive particles


// into the data structure
struct insert_points_lambda_non_sequential {
// types
typedef Traits::double_d double_d;
typedef unspecifed ptobl_type;
// construct/copy/destruct
insert_points_lambda_non_sequential(double_d *, int *, const ptobl_type &,
int *, int *, int *, int);
// public member functions
void operator()(const int);
// public data members
double_d * m_positions;
int * m_alive_indices;
ptobl_type m_point_to_bucket_index;
int * m_buckets;
int * m_dirty_buckets;
int * m_linked_list;
int start;
};

Description

insert_points_lambda_non_sequential public construct/copy/destruct


1. insert_points_lambda_non_sequential(double_d * m_positions,
int * m_alive_indices,
const ptobl_type & m_point_to_bucket_index,
int * m_buckets, int * m_dirty_buckets,
int * m_linked_list, int start);

copy all the required info

insert_points_lambda_non_sequential public member functions


1. void operator()(const int i);

insert a particle with index i into the data structure

implements a lock-free linked list using atomic CAS

https://martinjrobins.github.io/Aboria/Aboria/CellList/insert_p_idp46631326741568.html[10/22/2018 8:04:58 AM]


Struct insert_points_lambda_non_sequential

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellList/insert_p_idp46631326741568.html[10/22/2018 8:04:58 AM]


Struct insert_points_lambda_non_sequential_serial

Struct insert_points_lambda_non_sequential_serial
Aboria::CellList::insert_points_lambda_non_sequential_serial — non-threadsafe function object to insert a non-consecutive list of particles
into the data structure

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellList.h>

// non-threadsafe function object to insert a non-consecutive list of


// particles into the data structure
struct insert_points_lambda_non_sequential_serial {
// types
typedef Traits::double_d double_d;
typedef unspecifed ptobl_type;
// construct/copy/destruct
insert_points_lambda_non_sequential_serial(double_d *, int *,
const ptobl_type &, int *,
int *, int *, int *, int);
// public member functions
void operator()(const int);
// public data members
double_d * m_positions;
int * m_alive_indices;
ptobl_type m_point_to_bucket_index;
int * m_buckets;
int * m_dirty_buckets;
int * m_linked_list;
int * m_linked_list_reverse;
int start;
};

Description

insert_points_lambda_non_sequential_serial public construct/copy/destruct


1. insert_points_lambda_non_sequential_serial(double_d * m_positions,
int * m_alive_indices,
const ptobl_type & m_point_to_bucket_index,
int * m_buckets,
int * m_dirty_buckets,
int * m_linked_list,
int * m_linked_list_reverse,
int start);

copy all the neccessary info into the function object

insert_points_lambda_non_sequential_serial public member functions


1. void operator()(const int i);

https://martinjrobins.github.io/Aboria/Aboria/CellList/insert_p_idp46631326757600.html[10/22/2018 8:05:09 AM]


Struct insert_points_lambda_non_sequential_serial

insert a particle at index i into the data structure

It is assumed that this is run in serial (not thread-safe)

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellList/insert_p_idp46631326757600.html[10/22/2018 8:05:09 AM]


Struct insert_points_lambda_sequential

Struct insert_points_lambda_sequential
Aboria::CellList::insert_points_lambda_sequential — thread-safe function object to insert a list of consecutive particles into the data
structure

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellList.h>

// thread-safe function object to insert a list of consecutive particles into


// the data structure
struct insert_points_lambda_sequential {
// types
typedef Traits::double_d double_d;
typedef unspecifed ptobl_type;
// construct/copy/destruct
insert_points_lambda_sequential(double_d *, const ptobl_type &, int *,
int *, int *, int);
// public member functions
void operator()(const int);
// public data members
double_d * m_positions;
ptobl_type m_point_to_bucket_index;
int * m_buckets;
int * m_dirty_buckets;
int * m_linked_list;
int start;
};

Description

insert_points_lambda_sequential public construct/copy/destruct


1. insert_points_lambda_sequential(double_d * m_positions,
const ptobl_type & m_point_to_bucket_index,
int * m_buckets, int * m_dirty_buckets,
int * m_linked_list, int start);

copy all the info

insert_points_lambda_sequential public member functions


1. void operator()(const int i);

insert the particle at index i

implements a lock-free linked list using atomic CAS

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellList/insert_p_idp46631326775056.html[10/22/2018 8:05:19 AM]


Struct insert_points_lambda_sequential

https://martinjrobins.github.io/Aboria/Aboria/CellList/insert_p_idp46631326775056.html[10/22/2018 8:05:19 AM]


Struct insert_points_lambda_sequential_serial

Struct insert_points_lambda_sequential_serial
Aboria::CellList::insert_points_lambda_sequential_serial — non-threadsafe insert a consecutive vector of particles into the data structure

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/CellList.h>

// non-threadsafe insert a consecutive vector of particles into the data


// structure
struct insert_points_lambda_sequential_serial {
// types
typedef Traits::double_d double_d;
typedef unspecifed ptobl_type;
// construct/copy/destruct
insert_points_lambda_sequential_serial(double_d *, const ptobl_type &,
int *, int *, int *, int *, int);
// public member functions
void operator()(const int);
// public data members
double_d * m_positions;
ptobl_type m_point_to_bucket_index;
int * m_buckets;
int * m_dirty_buckets;
int * m_linked_list;
int * m_linked_list_reverse;
int start;
};

Description

insert_points_lambda_sequential_serial public construct/copy/destruct


1. insert_points_lambda_sequential_serial(double_d * m_positions,
const ptobl_type & m_point_to_bucket_index,
int * m_buckets,
int * m_dirty_buckets,
int * m_linked_list,
int * m_linked_list_reverse,
int start);

copy in all the required info

insert_points_lambda_sequential_serial public member functions


1. void operator()(const int i);

insert a particle at index i into the data structure

It is assumed that this is run in serial (not thread-safe)

https://martinjrobins.github.io/Aboria/Aboria/CellList/insert_p_idp46631326789680.html[10/22/2018 8:05:29 AM]


Struct insert_points_lambda_sequential_serial

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/CellList/insert_p_idp46631326789680.html[10/22/2018 8:05:29 AM]


Struct template enforce_domain_lambda

Struct template enforce_domain_lambda


Aboria::neighbour_search_base::enforce_domain_lambda — A function object used to enforce the domain extents on the set of particles.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>

// A function object used to enforce the domain extents on the set of


// particles.
template<unsigned int D, typename Reference>
struct enforce_domain_lambda {
// types
typedef Vector< double, D > double_d;
typedef Vector< bool, D > bool_d;
typedef position_d< D > position;
// construct/copy/destruct
enforce_domain_lambda(const double_d &, const double_d &, const bool_d &);
// public member functions
void operator()(Reference) const;
// public data members
const double_d low;
const double_d high;
const bool_d periodic;
};

Description

Template Parameters
1. unsigned int D

the spatial dimension of the particle set

2. typename Reference

a raw reference to a particle in the particle set

enforce_domain_lambda public construct/copy/destruct


1. enforce_domain_lambda(const double_d & low, const double_d & high,
const bool_d & periodic);

enforce_domain_lambda public member functions


1. void operator()(Reference i) const;

updates the position of i (periodic domain) or its alive fag (non-periodic domain) based on its position relative to the spatial domain

https://martinjrobins.github.io/Aboria/Aboria/neighbour_search_base/enforce_domain_lambda.html[10/22/2018 8:05:40 AM]


Struct template enforce_domain_lambda

If dimension $j$ is periodic, and $r_j$ is outside the domain, then $r_j$ is updated to the correct position within the domain. If
dimensino $j$ is non-periodic, and $r_j$ is outside the domain, then the alive variable for i is set to false

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/neighbour_search_base/enforce_domain_lambda.html[10/22/2018 8:05:40 AM]


Struct particle_iterator

Struct particle_iterator
Aboria::NeighbourQueryBase::particle_iterator — An iterator that steps through the particles within a given bucket.

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>

// An iterator that steps through the particles within a given bucket.


struct particle_iterator {
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/NeighbourQueryBase/particle_iterator.html[10/22/2018 8:05:50 AM]


Struct child_index_to_tag_mask

Struct child_index_to_tag_mask
Aboria::HyperOctree::child_index_to_tag_mask

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/OctTree.h>

struct child_index_to_tag_mask {
// types
typedef vector_int::const_pointer ptr_type;
// construct/copy/destruct
child_index_to_tag_mask(int, int, ptr_type);
// public member functions
int operator()(int) const;
// public data members
const int level;
const int max_level;
ptr_type m_nodes;
static const unsigned mask;
};

Description

child_index_to_tag_mask public construct/copy/destruct


1. child_index_to_tag_mask(int lvl, int max_lvl, ptr_type nodes);

child_index_to_tag_mask public member functions


1. int operator()(int idx) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/HyperOctree/child_index_to_tag_mask.html[10/22/2018 8:06:00 AM]


Struct classify_node

Struct classify_node
Aboria::HyperOctree::classify_node

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/OctTree.h>

struct classify_node {
// construct/copy/destruct
classify_node(int, int);
// public member functions
template<typename tuple_type> int operator()(const tuple_type &) const;
// public data members
const int threshold;
const int last_level;
};

Description

classify_node public construct/copy/destruct


1. classify_node(int threshold, int last_level);

classify_node public member functions


1. template<typename tuple_type> int operator()(const tuple_type & t) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/HyperOctree/classify_node.html[10/22/2018 8:06:10 AM]


Struct classify_point

Struct classify_point
Aboria::HyperOctree::classify_point

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/OctTree.h>

struct classify_point {
// construct/copy/destruct
classify_point(const bbox< dimension > &, int);
// public member functions
int operator()(const double_d &);
// public data members
bbox< dimension > box;
int max_level;
};

Description

classify_point public construct/copy/destruct


1. classify_point(const bbox< dimension > & b, int lvl);

classify_point public member functions


1. int operator()(const double_d & p);

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/HyperOctree/classify_point.html[10/22/2018 8:06:21 AM]


Struct make_leaf

Struct make_leaf
Aboria::HyperOctree::make_leaf

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/OctTree.h>

struct make_leaf {
// types
typedef vint2 result_type;
// public member functions
template<typename tuple_type>
result_type operator()(const tuple_type &) const;
};

Description

make_leaf public member functions


1. template<typename tuple_type>
result_type operator()(const tuple_type & t) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/HyperOctree/make_leaf.html[10/22/2018 8:06:31 AM]


Struct write_nodes

Struct write_nodes
Aboria::HyperOctree::write_nodes

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/OctTree.h>

struct write_nodes {
// construct/copy/destruct
write_nodes(int, int);
// public member functions
template<typename tuple_type> int operator()(const tuple_type &) const;
// public data members
int num_nodes;
int num_leaves;
};

Description

write_nodes public construct/copy/destruct


1. write_nodes(int num_nodes, int num_leaves);

write_nodes public member functions


1. template<typename tuple_type> int operator()(const tuple_type & t) const;

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/HyperOctree/write_nodes.html[10/22/2018 8:06:41 AM]


Struct template vector_type

Struct template vector_type


Aboria::default_traits::vector_type

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<typename T>
struct vector_type {
// types
typedef std::vector< T > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/default_traits/vector_type.html[10/22/2018 8:06:51 AM]


Struct template return_type

Struct template return_type


Aboria::zip_iterator<std::tuple< Types...>, mpl_vector_type>::return_type

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>

template<typename T>
struct return_type {
// types
typedef unspecifed type;
// public data members
static const size_t N;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/zip_iter_idp46631327432688/return_type.html[10/22/2018 8:07:02 AM]


Struct template return_type

Struct template return_type


Aboria::zip_iterator<thrust::tuple< Types...>, mpl_vector_type>::return_type

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Get.h>

template<typename T>
struct return_type {
// types
typedef unspecifed type;
// public data members
static const size_t N;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/zip_iter_idp46631327462224/return_type.html[10/22/2018 8:07:12 AM]


Struct value_type

Struct value_type
Aboria::KdtreeChildIterator::value_type

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Kdtree.h>

struct value_type {
// public data members
int high;
const int * parent;
box_type bounds;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/KdtreeChildIterator/value_type.html[10/22/2018 8:07:22 AM]


Struct proxy_int_d

Struct proxy_int_d
Aboria::lattice_iterator::proxy_int_d

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>

struct proxy_int_d : public Aboria::Vector< int, D > {


// construct/copy/destruct
proxy_int_d();
proxy_int_d(const int_d &);
// public member functions
proxy_int_d & operator&();
const proxy_int_d & operator&() const;
const proxy_int_d & operator*() const;
proxy_int_d & operator*();
const proxy_int_d * operator->() const;
proxy_int_d * operator->();
};

Description

proxy_int_d public construct/copy/destruct


1. proxy_int_d();

2. proxy_int_d(const int_d & arg);

proxy_int_d public member functions


1. proxy_int_d & operator&();

2. const proxy_int_d & operator&() const;

3. const proxy_int_d & operator*() const;

4. proxy_int_d & operator*();

5. const proxy_int_d * operator->() const;

6. proxy_int_d * operator->();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/lattice_iterator/proxy_int_d.html[10/22/2018 8:07:33 AM]


Struct proxy_int_d

Struct proxy_int_d
Aboria::lattice_iterator_within_distance::proxy_int_d

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/NeighbourSearchBase.h>

struct proxy_int_d : public Aboria::Vector< int, dimension > {


// construct/copy/destruct
proxy_int_d();
proxy_int_d(const int_d &);
// public member functions
proxy_int_d & operator&();
const proxy_int_d & operator&() const;
const proxy_int_d & operator*() const;
proxy_int_d & operator*();
const proxy_int_d * operator->() const;
proxy_int_d * operator->();
};

Description

proxy_int_d public construct/copy/destruct


1. proxy_int_d();

2. proxy_int_d(const int_d & arg);

proxy_int_d public member functions


1. proxy_int_d & operator&();

2. const proxy_int_d & operator&() const;

3. const proxy_int_d & operator*() const;

4. proxy_int_d & operator*();

5. const proxy_int_d * operator->() const;

6. proxy_int_d * operator->();

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/lattice__idp46631328611296/proxy_int_d.html[10/22/2018 8:07:43 AM]


Struct template tuple_element

Struct template tuple_element


Aboria::default_traits::tuple_element

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<std::size_t I, typename T>


struct tuple_element {
// types
typedef std::tuple_element< I, T > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/default_traits/tuple_element.html[10/22/2018 8:07:54 AM]


Struct template tuple_size

Struct template tuple_size


Aboria::default_traits::tuple_size

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<typename T>
struct tuple_size {
// types
typedef std::tuple_size< T > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/default_traits/tuple_size.html[10/22/2018 8:08:05 AM]


Struct template tuple_type

Struct template tuple_type


Aboria::default_traits::tuple_type

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<typename... T>
struct tuple_type {
// types
typedef std::tuple< T...> type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/default_traits/tuple_type.html[10/22/2018 8:08:15 AM]


Struct template tuple_element

Struct template tuple_element


Aboria::Traits<thrust::device_vector>::tuple_element

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<std::size_t I, typename T>


struct tuple_element {
// types
typedef thrust::tuple_element< I, T > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329524992/tuple_element.html[10/22/2018 8:08:26 AM]


Struct template tuple_size

Struct template tuple_size


Aboria::Traits<thrust::device_vector>::tuple_size

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<typename T>
struct tuple_size {
// types
typedef thrust::tuple_size< T > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329524992/tuple_size.html[10/22/2018 8:08:36 AM]


Struct template tuple_type

Struct template tuple_type


Aboria::Traits<thrust::device_vector>::tuple_type

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<typename T1 = thrust::null_type, typename T2 = thrust::null_type,


typename T3 = thrust::null_type, typename T4 = thrust::null_type,
typename T5 = thrust::null_type, typename T6 = thrust::null_type,
typename T7 = thrust::null_type, typename T8 = thrust::null_type,
typename T9 = thrust::null_type>
struct tuple_type {
// types
typedef thrust::tuple< T1, T2, T3, T4, T5, T6, T7, T8, T9 > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329524992/tuple_type.html[10/22/2018 8:08:46 AM]


Struct template vector_type

Struct template vector_type


Aboria::Traits<thrust::device_vector>::vector_type

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<typename T>
struct vector_type {
// types
typedef thrust::device_vector< T > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329524992/vector_type.html[10/22/2018 8:08:56 AM]


Struct template tuple_element

Struct template tuple_element


Aboria::Traits<thrust::host_vector>::tuple_element

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<std::size_t I, typename T>


struct tuple_element {
// types
typedef thrust::tuple_element< I, T > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329558064/tuple_element.html[10/22/2018 8:09:06 AM]


Struct template tuple_size

Struct template tuple_size


Aboria::Traits<thrust::host_vector>::tuple_size

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<typename T>
struct tuple_size {
// types
typedef thrust::tuple_size< T > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329558064/tuple_size.html[10/22/2018 8:09:16 AM]


Struct template tuple_type

Struct template tuple_type


Aboria::Traits<thrust::host_vector>::tuple_type

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<typename T1 = thrust::null_type, typename T2 = thrust::null_type,


typename T3 = thrust::null_type, typename T4 = thrust::null_type,
typename T5 = thrust::null_type, typename T6 = thrust::null_type,
typename T7 = thrust::null_type, typename T8 = thrust::null_type,
typename T9 = thrust::null_type>
struct tuple_type {
// types
typedef thrust::tuple< T1, T2, T3, T4, T5, T6, T7, T8, T9 > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329558064/tuple_type.html[10/22/2018 8:09:27 AM]


Struct template vector_type

Struct template vector_type


Aboria::Traits<thrust::host_vector>::vector_type

Synopsis
// In header: </home/travis/build/martinjrobins/Aboria/src/Traits.h>

template<typename T>
struct vector_type {
// types
typedef thrust::host_vector< T > type;
};

Copyright © 2015-2018 Martin Robinson

https://martinjrobins.github.io/Aboria/Aboria/Traits_t_idp46631329558064/vector_type.html[10/22/2018 8:09:37 AM]

You might also like