I have the following lines in my code…
double precision, dimension(mj) :: temp, xl, r, pres
equivalence (x(1, 1), pres), (x(1, 4), temp)
equivalence (x(1, 2), r), (x(1, 3), xl)
I understand that equivalence
causes the two variables to share common memory allocation, thus as one variable’s contents change, the other changes as well (since they have the same memory allocation).
However, I note that pres
, temp
, r
and xl
are arrays with a dimension of mj
(set to 4000).
I am reading this as that every single part of those 4 arrays are linked to a single value in the corresponding index of x
.
For example, all 4000 elements of pres
are set to reflect the contents of x(1, 1)
. If x(1, 1)
's contents change, then every part of pres
will change accordingly. Equally, if any part of pres
changes, then all parts of pres
change, as does x(1, 1)
- Am I correct here?
- If so, does this not appear to be overly complex, wasting of space and time?
- If not, where am I going wrong in my thinking?
Thank you for any help received.