csdms / bmi-fortran

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

Is the correct intent used in BMI functions? #41

Open mdpiper opened 4 years ago

mdpiper commented 4 years ago

The BMI functions

are declared with a 1d array parameter of intent in in the SIDL file. This is done so that in a language like C, a pointer can be passed that will hold the shape, spacing, etc. output.

In Fortran, intent in is interpreted differently, in that declaring intent(in) on a parameter means the values of the parameter can't be changed in the subprogram. Setting intent(in) in the Fortran BMI wouldn't work. I've set the array parameter for these functions as intent(out), which means that they can only output information; information can't be communicated into the subprogram. For example, I can't change anything about the grid, I can only get back information (shape, spacing, etc.) about the grid from these functions.

I think this is the correct interpretation of the BMI, although I could also make a case for intent(inout).