{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,11,3]],"date-time":"2026-11-03T05:25:04Z","timestamp":1793683504500,"version":"4.5.1"},"reference-count":26,"publisher":"Society for Industrial & Applied Mathematics (SIAM)","issue":"1","funder":[{"DOI":"10.13039\/501100004481","name":"University of Tehran","doi-asserted-by":"publisher","award":["02\/1\/28745"],"award-info":[{"award-number":["02\/1\/28745"]}],"id":[{"id":"10.13039\/501100004481","id-type":"DOI","asserted-by":"publisher"}]}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["SIAM J. Sci. Comput."],"published-print":{"date-parts":[[2021,1]]},"abstract":"<jats:p>In this paper we investigate the utilization of variadic templates for numerical methods and finite difference schemes. Specifically, an efficient method for defining multivariate functions in the framework of expression templates for array-based computations in C++ and CUDA is introduced. One of the advantages of the method is its ease of use for users of computational fields. The user can define and use his own function with any number of input arguments without having the knowledge of templates programming. For three different functions, the efficiency of the proposed method for arrays of different sizes is compared with that of the other implementations in C++ and also that of Fortran. The Roofline analysis is presented for the C++ implementations. Furthermore, for different compilers, the performance of the method in terms of the compilation time and executable file size and also the vectorization status are demonstrated. A similar comparison on graphics processing units (GPUs) using CUDA is made and the efficiency of the method is shown. The results indicate that, for any array size, the present method has very good performance in terms of the computational time, compilation time, and executable file size. Also, the variadic templates are utilized to define linear and nonlinear finite difference schemes. The performance of three finite difference schemes is compared with that of the plain C implementation. The results show the method proposed for nonlinear schemes has the same performance as that of the plain C implementation. Finally, as a practical application, two numerical simulations, the simulation of the discharge process of a lead-acid battery cell on a CPU and the simulation of a two-dimensional Riemann problem using high-order weighted ENO schemes on a GPU, are carried out.<\/jats:p>","DOI":"10.1137\/19m1282581","type":"journal-article","created":{"date-parts":[[2021,2,11]],"date-time":"2021-02-11T11:59:09Z","timestamp":1613044749000},"page":"C89-C125","source":"Crossref","is-referenced-by-count":1,"title":["Investigation of C++ Variadic Templates for Numerical Methods and Finite Difference Schemes"],"prefix":"10.1137","volume":"43","author":[{"given":"Hossein Mahmoodi","family":"Darian","sequence":"first","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"351","published-online":{"date-parts":[[2021,2,11]]},"reference":[{"key":"atypb6","doi-asserted-by":"publisher","DOI":"10.1002\/num.10025"},{"key":"atypb7","volume-title":"Arch. Numeri. Software, 3","author":"M. S.","year":"2015"},{"key":"atypb8","doi-asserted-by":"publisher","DOI":"10.1016\/j.cpc.2014.01.005"},{"key":"atypb9","doi-asserted-by":"publisher","DOI":"10.1007\/s007910000048"},{"key":"atypb10","doi-asserted-by":"publisher","DOI":"10.1006\/jcph.2000.6443"},{"key":"atypb11","first-page":"24","author":"Bangerth W.","year":"2016","journal-title":"J. Numer. Math."},{"key":"atypb12","first-page":"33","author":"Bangerth W.","year":"2007","journal-title":"ACM Trans. Math. Software"},{"key":"atypb13","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-540-75755-9_82"},{"key":"atypb14","first-page":"56","volume":"4","author":"Blatt M.","year":"2008","journal-title":"Int. J. Comput. Sci. Engrg."},{"key":"atypb15","volume-title":"Electrochemical Society Series","author":"Bode H.","year":"1977"},{"key":"atypb16","doi-asserted-by":"publisher","DOI":"10.1016\/j.jpowsour.2014.12.149"},{"key":"atypb17","doi-asserted-by":"publisher","DOI":"10.1149\/1.2100322"},{"key":"atypb18","unstructured":"G. Guennebaud et al.\n                      Eigen v3\n                      ,http:\/\/eigen.tuxfamily.org, 2010."},{"key":"atypb19","doi-asserted-by":"publisher","DOI":"10.1007\/11428848_133"},{"key":"atypb20","first-page":"281","volume-title":"Proceedings of the 1st AFOSR Conference on Dynamic Motion","author":"Henshaw W. D.","year":"1996"},{"key":"atypb21","doi-asserted-by":"publisher","DOI":"10.1137\/110830125"},{"key":"atypb22","first-page":"1","volume-title":"Proceedings of the International Workshop on Coupled Methods in Numerical Dynamics","author":"Jasak H.","year":"2007"},{"key":"atypb23","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-23099-8"},{"key":"atypb24","first-page":"10","volume":"27","author":"Malas T.","year":"2012","journal-title":"Int. J. High Performance Comput. Appl."},{"key":"atypb25","doi-asserted-by":"publisher","DOI":"10.1137\/0914082"},{"key":"atypb26","doi-asserted-by":"publisher","DOI":"10.1016\/0021-9991(88)90177-5"},{"key":"atypb27","volume-title":"C++ Templates: The Complete Guide","author":"Vandevoorde D.","year":"2017","edition":"2"},{"key":"atypb28","first-page":"26","volume-title":"C++ Report, 7","author":"Veldhuizen T.","year":"1995"},{"key":"atypb29","volume-title":"Pearson Education","author":"Versteeg H.","year":"2007"},{"key":"atypb30","doi-asserted-by":"publisher","DOI":"10.1149\/1.1837741"},{"key":"atypb31","volume-title":"UC Berkeley","author":"Williams S. W.","year":"2008"}],"container-title":["SIAM Journal on Scientific Computing"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/epubs.siam.org\/doi\/pdf\/10.1137\/19M1282581","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,8,21]],"date-time":"2026-08-21T17:01:14Z","timestamp":1787331674000},"score":1,"resource":{"primary":{"URL":"https:\/\/epubs.siam.org\/doi\/10.1137\/19M1282581"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2021,1]]},"references-count":26,"journal-issue":{"issue":"1","published-print":{"date-parts":[[2021,1]]}},"alternative-id":["10.1137\/19M1282581"],"URL":"https:\/\/doi.org\/10.1137\/19m1282581","relation":{},"ISSN":["1064-8275","1095-7197"],"issn-type":[{"value":"1064-8275","type":"print"},{"value":"1095-7197","type":"electronic"}],"subject":[],"published":{"date-parts":[[2021,1]]}}}