In the previous post arrays were created in Python and passed to a Fortran dll as ctype pointers. The data written to these arrays in the Fortran routines was then converted back to Python arrays with statements such as: nodedisp = npc.as_array(nodedisp). In fact this conversion is not necessary. The data passed to the Fortran code is a pointer to the location of the arrays created in Python. The Fortran results are therefore written to these arrays, which may be read directly from Python using the original array names. More importantly, I found the results of using the npc.as_array() method to be inconsistent; sometimes returning the expected results, but sometimes empty or corrupted arrays. Reading the results of the Fortran code using the original Python arrays is therefore both simpler and more reliable.
I have updated the previous post to reflect the revised process, and also updated the download file with the revised code. The new file, including full open-source code, may be downloaded from: