Expression templates implementation of continuous and discontinuous Galerkin methods
- 164 Downloads
Efficiency and flexibility are often mutually exclusive features in a code. This still prompts a large part of the Scientific Computing community to use traditional procedural languages. In the last years, however, new programming techniques have been introduced allowing for a high level of abstraction without loss of performance. In this paper we present an application of the Expression Templates technique introduced in (Veldhuizen in Expression templates. C++ Report magazine, vol 7, pp 26–31, 1995) to the assembly step of a finite element computation. We show that a suitable implementation, such that the compiler has the role of parsing abstract operations, allows for user-friendliness. Moreover, it gains in performance with respect to more traditional techniques for achieving this kind of abstraction. Both the cases of conforming and discontinuous Galerkin finite element discretization are considered. The proposed implementation is finally applied to a number of problems entailing different kind of complications.
KeywordsGalerkin methods Finite elements implementation Object-Oriented programming Expression templates
Unable to display preview. Download preview PDF.
- 4.Furnish G.: Disambiguated glommable expression templates. Comp. Phys. 11, 263–269 (1997)Google Scholar
- 5.Haney, S.W.: Beating the abstraction penalty in c++ using expression templates. In: Computers in Physics, vol. 10, pp. 552–557. Correction in vol. 11, n. 14 (1996)Google Scholar
- 7.Langer, A., Kreft, K.: C++ expression templates. In: C/C++ Users Journal (2003)Google Scholar
- 10.Quarteroni, A., Valli A.: Numerical approximation of partial differential equations, no. 23. In: Springer Series in Computational Mathematics. Springer, Berlin (1994)Google Scholar
- 12.Stroustrup B.: The C++ Programming Language. Addison Wesley, Longman, Reading (2000)Google Scholar
- 13.Veldhuizen, T.: Expression templates. In: C++ Report Magazine, vol. 7, pp. 26–31. See also the web page http://osl.iu.edu/tveldhui (1995)
- 14.Veldhuizen, T., Jernigan, M.: Will c++ be faster than fortran? In: Proc. First International Scientific Computing in Object Oriented Parallel Environments ’97. Springer, Heidelberg (1997)Google Scholar