| 1 | The NeXus Fortran 90 interface consists of a single Fortran 90 module |
|---|
| 2 | containing all the global parameters and function definitions. The |
|---|
| 3 | routines are called exactly like their C counterparts, although some |
|---|
| 4 | arguments have been made optional because their values can be determined |
|---|
| 5 | automatically. See <http://www.neutron.anl.gov/NeXus/NeXus_F90.html> |
|---|
| 6 | for details of the individual routines. |
|---|
| 7 | |
|---|
| 8 | There must be a USE statement to incorporate the NeXus module e.g. |
|---|
| 9 | |
|---|
| 10 | use NXmodule |
|---|
| 11 | |
|---|
| 12 | (N.B. if the F90 utility module NXUmodule is USEd, it is not necessary |
|---|
| 13 | to specify NXmodule as well.) |
|---|
| 14 | |
|---|
| 15 | The Fortran 90 interface uses two derived types for the NXhandle and |
|---|
| 16 | NXLink structures. |
|---|
| 17 | |
|---|
| 18 | type(NXhandle) :: file_id |
|---|
| 19 | type(NXlink) :: link_id |
|---|
| 20 | |
|---|
| 21 | There are also several KIND parameters defined for producing |
|---|
| 22 | different-length storage. They are not guaranteed to produce the |
|---|
| 23 | required result, but should work on most Fortran 90 compilers. |
|---|
| 24 | |
|---|
| 25 | NXi1 - one-byte integers |
|---|
| 26 | NXi2 - two-byte integers |
|---|
| 27 | NXi4 - four-byte integers |
|---|
| 28 | NXr4 - four-byte floating points |
|---|
| 29 | NXr8 - eight-byte floating points (double precision) |
|---|
| 30 | |
|---|
| 31 | There is no way of distinguishing signed and unsigned integers, so |
|---|
| 32 | unsigned integers are mapped to signed integers of the same length. It |
|---|
| 33 | is possible to read variables into arrays of different storage size, |
|---|
| 34 | provided there is no overflow. |
|---|
| 35 | |
|---|
| 36 | --- Compatibility Issues --- |
|---|
| 37 | |
|---|
| 38 | This version has been tested on Alpha/VMS, Windows NT, Linux, and Mac |
|---|
| 39 | OS X (using Absoft Pro Fortran 90). In the latest versions of the API |
|---|
| 40 | (after v 1.3.1), the Fortran 90 code does not require access to the |
|---|
| 41 | internal details of the NXhandle structure. |
|---|
| 42 | |
|---|
| 43 | --- Running the Examples --- |
|---|
| 44 | |
|---|
| 45 | The Fortran 90 library is now built by the standard Makefile with the |
|---|
| 46 | following option |
|---|
| 47 | |
|---|
| 48 | make libf90 |
|---|
| 49 | |
|---|
| 50 | See the README file for further instructions. |
|---|
| 51 | |
|---|
| 52 | The Fortran 90 test program, NXtest, should print the following: |
|---|
| 53 | |
|---|
| 54 | Number of global attributes: 4 |
|---|
| 55 | NeXus_version = 2.0.0. |
|---|
| 56 | file_name = NXtest.nx5 |
|---|
| 57 | HDF5_Version = 1.4.3 |
|---|
| 58 | file_time = 2002-05-17 15:22:29 |
|---|
| 59 | Group: entry(NXentry) contains 8 items |
|---|
| 60 | ch_data : NX_CHAR |
|---|
| 61 | Values : NeXus data |
|---|
| 62 | Subgroup: data(NXdata) |
|---|
| 63 | i1_data : NX_INT8 |
|---|
| 64 | Values : 1 2 3 4 |
|---|
| 65 | i2_data : NX_INT16 |
|---|
| 66 | Values : 1000 2000 3000 4000 |
|---|
| 67 | i4_data : NX_INT32 |
|---|
| 68 | Values : 1000000 2000000 3000000 4000000 |
|---|
| 69 | r4_data : NX_FLOAT32 |
|---|
| 70 | Values : 1.00000 2.00000 3.00000 4.00000 |
|---|
| 71 | : 5.00000 6.00000 7.00000 8.00000 |
|---|
| 72 | : 9.00000 10.0000 11.0000 12.0000 |
|---|
| 73 | : 13.0000 14.0000 15.0000 16.0000 |
|---|
| 74 | : 17.0000 18.0000 19.0000 20.0000 |
|---|
| 75 | r8_data : NX_FLOAT64 |
|---|
| 76 | Values : 1.00000 2.00000 3.00000 4.00000 |
|---|
| 77 | : 5.00000 6.00000 7.00000 8.00000 |
|---|
| 78 | : 9.00000 10.0000 11.0000 12.0000 |
|---|
| 79 | : 13.0000 14.0000 15.0000 16.0000 |
|---|
| 80 | : 17.0000 18.0000 19.0000 20.0000 |
|---|
| 81 | ch_attribute : NeXus |
|---|
| 82 | i4_attribute : 42 |
|---|
| 83 | r4_attribute : 3.14159 |
|---|
| 84 | Subgroup: sample(NXsample) |
|---|
| 85 | Link Check OK |
|---|
| 86 | |
|---|
| 87 | -- |
|---|
| 88 | Ray Osborn |
|---|
| 89 | Materials Science Division |
|---|
| 90 | Argonne National Laboratory |
|---|
| 91 | Argonne, IL 60439-4845, USA |
|---|
| 92 | |
|---|
| 93 | Email: ROsborn@anl.gov |
|---|
| 94 | |
|---|
| 95 | $Id$ |
|---|