next up previous contents index
Next: 6.6.1 Calling NEMO C Up: 6. Introduction Previous: 6.5 Programming in C++   Contents   Index


6.6 Programming in FORTRAN

Programming in FORTRAN can also be done, but since NEMO is written in C and there is no 'standard' way to link FORTRAN and C code, such a description is always bound to be system dependent (large differences exist between UNIX, VMS, MSDOS, and UNICOS is somewhat of a peculiar case). Even within a UNIX environment there are a number of ways how the industry has solved this problem (cf. Alliant). Most comments that will follow, apply to the BSD convention of binding FORTRAN and C.

In whatever language you program, we do suggest that the startup of the program is done in C, preferably through the nemo_main() function (see Section [*]). As long as file I/O is avoided in the FORTRAN routines, character and boolean variables are avoided in arguments of C callable FORTRAN functions, all is relatively simple. Some care is also needed for multidimensional arrays which are not fully utilized. The only thing needed are C names of the FORTRAN routines to be called from C. This can be handled automatically by a macro package.

Current examples can be found in the programs nbody0 and nbody2. In both cases data file I/O is done in C in NEMO's snapshot(5NEMO) format, but the CPU is used in the FORTRAN code.

Examples of proposals for other FORTRAN interfaces can be found in the directory $NEMOINC/fortran.

Again this remark: the potential(5NEMO) assumes for now a BSD type f2c interface, because character variables are passed. This has not been updated yet. You would have to provide your own f2c interface to use FORTRAN potential routines on other systems.

Simple FORTRAN interface workers within the snapshot interface are available in a routine snapwork(n,m,pos,vel,...).

More description will follow



Subsections
next up previous contents index
Next: 6.6.1 Calling NEMO C Up: 6. Introduction Previous: 6.5 Programming in C++   Contents   Index
(c) Peter Teuben