Smoothed Particle Hydrodynamics (SPH) is a particle-based method widely used in different application areas for simulating problems involving e.g., large deformations or free boundaries. Although the general SPH method does not differ very much from one application to another, current developed codes target on specific type of problems, e.g. fluid dynamics, astrophysics, deformation of solids, etc. Generic SPH Library (GSPHLib) is a recently started project to develop a generic library that facilitates the implementation of different physical models into SPH. The library is intended to provide a general framework in which generic algorithmic and numerical components can be developed independently of physical equations and particle properties, allowing to implement different models. C++ templates and meta-programming techniques are used, instead of class hierarchies and polymorphism, in order to reduce the efficiency penalties due to the generic design of the library.
The relevant feature of the library is the GSPHLib.Py package. This package provides facilities to allow the access and control of simulations and their data from python. The goal is to perform all the heavy calculations using suitable algorithms and data structures written in C++, while features and tools available in python can be used for: a) pre-processing; b) setting up simulations; c) interacting with simulations while running; d) post-processing; and e) analysis of the results. GSPHLib.Py internally uses meta-programming and Boost.Python to provide routines to adequately and smoothly expose to python the classes related with the implemented physical models.
In this work, we discuss the design of the library, in particular the GSPHLib.Py package. Additionally, we provide insights into the on-going implementation of GSPHLib and the techniques applied to combine the libraries Boost.MPL and Boost.Fusion with Boost.Python to exploit meta-programming.