I'm trying to figure out the best way to use FORTRAN subroutines to work with big arrays of data. I have a code which works on big 3,4 or 5 dimensional arrays. I'm working with many subroutines and was wondering what is the best way to call these arrays by reference yet keeping them safe from writing (except for the output array, obviously).
I have read in [this related intent() question]: What is the explicit difference between the fortran intents (in,out,inout)? that I should use intent(out) to call by reference all the output arrays, however if I do the same with input arrays, then I probably need a C-like CONST to make it write-protected.
So the bottom line is: 1. How should I declare the dummy variables in terms of INTENT() for input and output variables? 2. How do I make called-by-reference variables write-protected for the subroutine?