PnetCDF Fortran Binding Issues
Jianwei Li
jianwei at cheetah.cpdc.ece.nwu.edu
Mon Aug 4 13:21:04 CDT 2003
Bill,
I took a look at the original netCDF library User Guide and the src code,
The index in C interface is 0-based and that in Fortran is 1-based.
There is functions converting FORTRAN co-ordinates into C co-ordinates.
for (i = 0; i < ndims; ++i)
ccoords[i] = fcoords[ndims - 1 - i] - 1;
The dimension-ID vector, count, stride are also converted in such a way.
So, now I'm sure the original netCDF requires that Fortran users define
their array variables in a reverse dimension order than if C code is used.
In users' view, if we talk about most/least significant dimension instead
of the numerical order, Fortran interface and C interface look common.
Within the Fortran binding, however, it reverses all dimension-related
index vectors before calling the C functions, and it also converts between
0-based and 1-based indices.
That way, the data buffer of the array variables don't need to be
transposed in the Fortran binding implementation.
So, I think, all we need to do in the Fortran binding is to implement the
same index vector convertion for those involved functions --- convert
from F to C for input index vectors, and from C to F for output ones.
I can list those function and their victim arguments, if that helps.
As to the character-string parameter conventions, I need to think more
about it ...
Jianwei
More information about the parallel-netcdf
mailing list