Proper use of FORTRAN INTENT () for large arrays

I am trying to find a better way to use FORTRAN routines to work with large data sets. I have code that works on large 3.4 or 5 dimensional arrays. I work with many routines and wonder what is the best way to call these arrays a reference, but not letting them write (except for the output array, obviously).

I read in [this related intent () question]: What is the obvious difference between fortran (in, out, inout) intentions? which I must (out) to call all output arrays by reference, however, if I do the same with input arrays, then I probably need a C-shaped CONST to make it write-protected.

So, the bottom line: 1. How to declare dummy variables in terms of INTENT () for input and output variables? 2. How to make variables with write-protected labels for a subroutine?

+1
source share
1 answer

Actually, a reference to C ++ as const is very similar to intent(in), but more important is the difference between the arguments of the intended form, the estimated size, the explicit size of the array.

Fortran rules have several requirements for explicit arrays of size and estimated size, which (combined with the possibility of an implicit interface) make it necessary to use the classic pass-by reference with a pointer to the first element.

, .

, , ( ). , . , , allocatable pointer array, .

, value. ( ) .

- , , . , .

, , intent(in) intent(out).

+2

Source: https://habr.com/ru/post/1661365/


All Articles