The Introspective May Achieve More: Enhancing existing geoscientific models with native-language emulated structural reflection

TitleThe Introspective May Achieve More: Enhancing existing geoscientific models with native-language emulated structural reflection
Publication TypeJournal Article
Year of Publication2017
AuthorsJi, Xinye, and Shen Chaopeng
JournalComputers & Geosciences
Date Published01/2017
Abstract

Geoscientific models manage myriad and increasingly complex data structures as trans-disciplinary models are integrated. They often incur significant redundancy with cross-cutting tasks. Reflection, the ability of a program to inspect and modify its structure and behavior at runtime, is known as a powerful tool to improve code reusability, abstraction, and separation of concerns. Reflection is rarely adopted in high-performance Geoscientific models, especially with Fortran, where it was previously deemed implausible. Practical constraints of language and legacy often limit us to feather-weight, native-language solutions. We demonstrate the usefulness of a structural-reflection-emulating, dynamically-linked metaObjects, gd. We show real-world examples including data structure self-assembly, effortless save/restart and upgrade to parallel I/O, recursive actions and batch operations. We share gd and a derived module that reproduces MATLAB-like structure in Fortran and C++. We suggest that both a gd representation and a Fortran-native representation are maintained to access the data, each for separate purposes. Embracing emulated reflection allows generically-written codes that are highly re-usable across projects.

URLhttps://doi.org/10.1016/j.cageo.2017.09.014
DOI10.1016/j.cageo.2017.09.014
Journal: Computers & Geosciences

Geoscientific models manage myriad and increasingly complex data structures as trans-disciplinary models are integrated. They often incur significant redundancy with cross-cutting tasks. Reflection, the ability of a program to inspect and modify its structure and behavior at runtime, is known as a powerful tool to improve code reusability, abstraction, and separation of concerns. Reflection is rarely adopted in high-performance Geoscientific models, especially with Fortran, where it was previously deemed implausible. Practical constraints of language and legacy often limit us to feather-weight, native-language solutions. We demonstrate the usefulness of a structural-reflection-emulating, dynamically-linked metaObjects, gd. We show real-world examples including data structure self-assembly, effortless save/restart and upgrade to parallel I/O, recursive actions and batch operations. We share gd and a derived module that reproduces MATLAB-like structure in Fortran and C++. We suggest that both a gd representation and a Fortran-native representation are maintained to access the data, each for separate purposes. Embracing emulated reflection allows generically-written codes that are highly re-usable across projects.

DOI: 10.1016/j.cageo.2017.09.014
Year of Publication: 2017
Citation:
Ji, X, and C Shen.  2017.  "The Introspective May Achieve More: Enhancing existing geoscientific models with native-language emulated structural reflection."  Computers & Geosciences, doi:10.1016/j.cageo.2017.09.014.