csdms / bmi-fortran

Basic Model Interface for Fortran
https://bmi.readthedocs.io
MIT License
6 stars 10 forks source link

Use generic procedures for BMI getters and setters #17

Closed mdpiper closed 5 years ago

mdpiper commented 5 years ago

This PR addresses #14. Fortran needs the type and rank of array parameters at compile time. Rank isn't an issue here because arrays are flattened in BMI; however, we do need separate getters and setters for all Fortran intrinsic types. Here, I've implemented those for integers, floats, and doubles, following the guide of SIDL types in Babel. This places an additional burden on the model developer because they have to implement more BMI methods (even if they're just stubs). However, the user of the BMI doesn't need to worry about these typed getters and setters because they're implemented as generic procedures -- this means the user calls get_value, for example, and the compiler sorts out which typed method to call, based upon the the argument type.

cc @sc0tts, @mcflugen