Rapid translation of finite-element theory into computer implementation based on a descriptive object-oriented programming approach

In this study, we present a framework for rapid prototyping of finite element (FE) theory for computer implementations. For this purpose, we propose an object-oriented (OO) application programming interface in the form of a domain-specific modeling language (DSML). In contrast to the traditional OO approach, the proposed framework deliberately avoids the use of subclassing for concrete implementations of node and element classes; it uses external objects, namely descriptors, instead. The descriptive design of the DSML provides developers with generic programming support for the construction and solution of discretization schemes, in the context of partial differential equations, in a self-explanatory syntax. We take advantage of Python's descriptor protocol to make descriptors behave like natural dependencies of their owner class. We propose several descriptors to account for both theoretical and implementation-specific aspects of FE programming. By using concrete examples, we demonstrate that enhancing these descriptors with both symbolic and numerical computational utilities results in a concise and customizable code base for analysis and pre/postprocessing purposes. We select Python as the base programming language because of its support for essential programming features such as customizable classes, dynamic code, arbitrary arguments, method decoration, and descriptor protocol.