next up previous contents
Next: FORTRAN 77 objects with Up: FORTRAN 77 Bindings Previous: Implementing Classes in FORTRAN   Contents

Accessing SIDL Arrays From FORTRAN 77

The normal SIDL C function API is available from FORTRAN 77 to create, destroy and access array elements and meta-data. The function name from FORTRAN has _f appended.

For SIDL types dcomplex, double, fcomplex , float, int and long, SIDL provides a method to get direct access to the array elements. For the other types, you must use the functional API to access array elements.

For type X, there is a FORTRAN 77 function called SIDL_X__array_access_f to provide a method to get direct access. An example is given below. Of course, this will not work if your FORTRAN 77 compiler does array bounds checking.

users_guide/f77/code/SIDL_int__array.f

To access a two dimensional array, the expression referring to element i, j is

users_guide/f77/code/SIDL_array_2.f

To access a three dimensional array, the expression referring to element i, j k is

users_guide/f77/code/SIDL_array_2.f

You can call things like LINPACK or BLAS if you want, but you should check the stride to make sure the array is packed as you need it to be. stride(i) indicates the distance between elements in dimension i. A value of 1 means elements are packed densely in dimension i. Negative stride values are possible, and when an array is a slice of another array, there may be no dimension with a stride of 1.

For a dcomplex array, the reference array should a FORTRAN array of REAL*8 instead of a FORTRAN array of double complex to avoid potential alignment problems. For a fcomplex array, the reference array is a COMPLEX*8 because we don't anticipate an alignment problem in this case.


next up previous contents
Next: FORTRAN 77 objects with Up: FORTRAN 77 Bindings Previous: Implementing Classes in FORTRAN   Contents


babel-0.8.0
users_guide Last Modified 2003-01-14

http://www.llnl.gov/CASC/components
components@llnl.gov