Friday, January 6, 2012

Casting complex arrays in Fortran to (flat) real arrays.

Sometimes I find the need to cast complex F90 arrays to (flat) real arrays in Fortran. (By 'cast' I mean: without allocating a new array.) To make life a bit easier, I wrote a Python script to generate an F90 module with a single interface that can cast various complex arrays with different shapes.

The code is here, with an example: fcast.py

Enjoy!

No comments:

Post a Comment