Giter Site home page Giter Site logo

TravisCI Coverage Join the chat at https://gitter.im/Aboria/Lobby

Aboria is a C++ library that enables computations over a set of particles or points in N-dimensional space, with the aim of providing a useful library for implementing particle-based numerical algorithms, for example Molecular Dynamics, Smoothed Particle Hydrodynamics or Radial Basis Functions.

A standards-compliant particle container

The library gives you a STL compatible container class to store a particle set containing a position and unique id for each particle, as well as any number of user-defined variables with arbitrary types.

ABORIA_VARIABLE(scalar, double, "an example scalar variable")
const int DIM = 2;
using Particles_t = Particles<std::tuple<scalar>,DIM>;
using position = Particles_t::position;
Particles_t particles(100);

std::normal_distribution<double> normal(0.5, 0.2);
std::default_random_engine gen;
for (auto i: particles) {
  get<position>(i) = vdouble2(normal(gen), normal(gen));
  get<scalar>(i) = normal(gen);
}

Spatial data structures and queries

Aboria gives you the ability to embed each particle set within a hypercube domain with arbitrary periodicity. The underlying data structure can be a cell list, kd-tree or hyper oct-tree.

      

These data structures provide flexible neighbourhood queries that return iterators, and can use any integer p-norm distance measure for p > 0.

for (auto i = euclidean_search(particles.get_query(),
                               vdouble2::Constant(0), radius);
         i != false; ++i) {
  std::cout << "Found a particle with dx = " << i.dx()
            << " and id = " << get<id>(*i) << "\n";
}

An API for forming linear kernel operators

Aboria gives you an API for forming linear kernel operators from C++ lambda functions, This can be used, for example, to implement Radial Basis Function kernels. These can be wrapped as Eigen matrices in order to solve linear systems.

auto K = create_sparse_operator(
    particles, particles, radius,
    [epsilon](const vdouble2 &dx, auto i, auto j) {
      return (get<scalar>(i) * get<scalar>(j)) / (dx.norm() + epsilon);
    });

// matrix-vector multiply (matrix-free)
const int N = particles.size();
Eigen::VectorXd b = Eigen::VectorXd::LinSpaced(N, 0, 1.0);
Eigen::VectorXd c = K * b;

// matrix-vector multiply (assemble to a matrix first)
Eigen::MatrixXd K_eigen(N, N);
K.assemble(K_eigen);
c = K_eigen * b;

License and Contact

Aboria is distributed under a BSD 3-Clause License, see LICENCE for more details. For documentation see the Aboria website. If you are interested in contributing to Aboria, having trouble getting it working or just have a question, send me an email at [email protected] or create a GitHub issue or pull request.

aboria's Projects

aboria icon aboria

Enables computations over a set of particles in N-dimensional space

pybamm icon pybamm

Fast and flexible physics-based battery models in Python

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.