The interface for functions in the dune-functions module

Christian Engwer, Carsten Gräser, Steffen Müthing, Oliver Sander

Abstract


The dune-functions Dune module introduces a new programmer interface for discrete and non-discrete functions. Unlike the previous interfaces considered in the existing Dune modules, it is based on overloading operator(), and returning values by-value.  This makes user code much more readable, and allows the incorporation of newer C++ features such as lambda expressions.  Run-time polymorphism is implemented not by inheritance, but by type erasure, generalizing the ideas of the std::function class from the C++11 standard library.  We describe the new interface, show its possibilities, and measure the  performance impact of type erasure and return-by-value.

Keywords


dune; dune-functions; functions; type erasure; return-by-value; duck typing

Full Text:

PDF

References


P. Bastian, M. Blatt, A. Dedner, C. Engwer, R. Klöfkorn, R. Kornhuber, M. Ohlberger, and O. Sander. A generic grid interface for adaptive and parallel scientific computing. Part II: Implementation and tests in DUNE. Computing, 82(2–3):121–138, 2008.

P. Bastian, M. Blatt, A. Dedner, C. Engwer, R. Klöfkorn, M. Ohlberger, and O. Sander. A generic grid interface for adaptive and parallel scientific computing. Part I: Abstract framework. Computing, 82(2–3):103–119, 2008.

K. Driesen and U. Hölzle. The direct cost of virtual function calls in C++. In Proceedings of the 11th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, OOPSLA ’96, pages 306–323. ACM, 1996.

C. Engwer, C. Gräser, S. Müthing, and O. Sander. Dune-functions module. http://www. dune-project.org/modules/dune-functions.

J. Hubička. Devirtualization in C++. online blog, http://hubicka.blogspot.de/2014/

/devirtualization-in-c-part-1.html, 2014. (at least) seven parts, last checked on Dec. 8. 2015.

International Organization for Standardization. ISO/IEC 14882:2011 Programming Language C++, 9 2011.

E. Niebler. Range-v3 library. https://github.com/ericniebler/range-v3.

E. Niebler. Concept checking in C++11. online blog, http://ericniebler.com/2013/11/23/concept-checking-in-c11, 2013. last checked on Dec. 8. 2015.

S. Parent, M. Marcus, and F. Brereton. Adobe source libraries. http://stlab.adobe.com/.

S. Watanabe. Boost type erasure library. http://www.boost.org/doc/libs/release/libs/type_erasure/.





DOI: https://doi.org/10.11588/ans.2017.1.27683

URN (PDF): http://nbn-resolving.de/urn:nbn:de:bsz:16-ans-276833