Akantu means a little element in Kinyarwanda, a Bantu language. From now on it is also an opensource object-oriented Finite Element library which has the ambition to be generic and efficient. Akantu is developed within the LSMS (Computational Solid Mechanics Laboratory, lsms.epfl.ch), where research is conducted at the interface of mechanics, material science, and scientific computing. The open-source philosophy is important for any scientific software project evolution. The collaboration permitted by shared codes enforces sanity when users (and not only developers) can criticize the implementation details. Akantu was born with the vision to associate genericity, robustness and efficiency while benefiting the open-source visibility.

Genericity is necessary to allow the easy exploration of mathematical formulations through algorithmic ideas. Robustness and reliability is naturally expected from any simulation software, even more in the context of parallel computations. In order to achieve these goals, we made noticeable choices in the architecture of Akantu.

First, due to the need of genericity and to the common features between material properties, we decided to use the object-oriented paradigm through C++. This is also useful for code factorization. It relies on the concepts of inherence and polymorphism, wich allows to identify common interface of objects and to define high-level classes. These latters are derived in specialized classes. For example, in the finite-element method applied to solid mechanics, we need to compute different constitutive laws depending on the material. Most of them take the strain as an input to compute the stress. We can clearly see that we can define a common interface to meterial objects that contains a function to compute stresses from strains. The polymorphism is a useful mechanism that allows the use of a common interface with any kind of material instantiated. However, it relies on virtual function calls, which consist in finding the right function to invocate from the table containing all the implementations. This represents an extra cost that affects strongly the efficiency.

Fig2. – Full Object versus mixed object/vector.

Therefore, the virtual function calls need to be limited to specific situations and avoided in critical sections of the program. In finite-element algorithms, in order to perform field manipulation, loops over the elements are always necessary and form the critical sections. Virtual calls should be excluded from these loops in order to maintain good calculation times. This motivates the current implementation in Akantu: object/vector implementation.

A mesh is defined as a set of elements that connect some nodes. These elements can be of different types depending on the meshing process and the problem (triangles in 2D, tetrahedra in 3D, …). In an object-oriented implementation, the natural idea is to define a generic element class that describe a common interface. Thus any element will derive from this parent class and will inherit its properties. In this view the element embeds a lot of intelligence. For example, one element should know how to integrate a given field. In this full object architecture, each element is a complex object which is also autonomous (see Fig2.a)). In any processing loop over the elements, virtual calls will be performed for each one of them and this leads to a drop of performance. Due to the need of genericity, the usage of the object-oriented paradigm needs to be maintained but to improve the performance the virtual function calls need to be performed outside critical loops.

In the object/vector view, the data manipulated inside these loops is structured in vectors. For meshes, elements is defined as a group represented by a vector of nodal coordinates and a vector of connectivities (see Fig2.b)). Global functions, like integration procedure, operate on the entire set of elements. The counter part is that genericity i reduced when compared to a full object view: the high level classes contain now more complex functions.

In order to improve performance, decisions need to be avoided from critical loops since a single If condition can drop the performance significantly. This situation can happen when a mesh contains different element types and an integration loop will include a decision per element to select the appropriate integration method. The solution is to make the decision outside the loops by specialized functions to a typical situation: in other words the code needs to be vectorized.

Then, in order to prevent extra cost associated to virtual function calls we designed the library as an hybrid architecture with objects at high level layers and vectorization for low level layers. Thus, Akantu benefits the inheritance and polymorphism mechanisms without the counter part of having virtual calls within critical loops. This coding philosophy, which was demonstrated in the past to be really efficient, is quite innovative in the field of Finite Element software.