Do not spend a lot of time collecting and translating. Do it.
Fortran Part 1 writes a file with files for Python. Write to stdout. Call this F1
Python reads the file, does Python calculate, writes file responses for Fortran. Name this P.
Fortran Part 2 reads a material file from stdin. These are the results of Python calculations.
Plug them
F1 | python p.py | F2
You are not recompiling anything. Also note that all three start at the same time, which can be significant acceleration.
The middle bit of Python should be something like this.
import sys import my_python_module for line in sys.stdin: x, y, p, q = map( float, line.split() ) print ("%8.3f"*6) % ( x, y, z, p, q, my_python_module.some_function( x, y, p, q ) )
A simple wrapper around a function that reads stdin and writes stdout in Fortran format.
source share