Graduation date: 2007
The code reuse problem is a common software engineering problem in scientific
computing. As a prevailing programming language in many scientific fields,
Fortran does not provide support to address this problem. One particular
reason is that Fortran lacks the support for generic programming. By applying program-generation techniques, we developed two approaches to address the code reuse problem. The first approach is to design a program generator for the equation-based specification of subroutines that can be
generic in the dimensions of arrays, parameter lists, and called subroutines.
We apply that approach to a real-world problem in scientific computing, which
requires the generic description of inverse ocean modeling tools. In addition to a compiler that can transform generic specifications into efficient Fortran code for models, we have also developed a type system that can identify possible errors already in the specifications. The second approach is to extend Fortran with the support for generic programming. The result is the language Parametric Fortran, which supports defining Fortran program templates by allowing the parameterization of arbitrary Fortran constructs. A Fortran program template can be translated
into a regular Fortran program guided by values for the parameters. Parametric Fortran is particularly useful in scientific computing. The applications include defining generic functions, removing duplicated code, and automatic differentiation. The described Fortran extension has also been successfully employed implementing the generic inverse ocean modeling system.