--On Monday, March 22, 2004 1:54 PM -0600 Renchi Raju
<[log in to unmask]> wrote:
> 77 codes perform better than f90 codes and they used (and still do) to
> use adjustable/assumed-size arrays.
Yes, but... the big problem area is not with pure f77 codes or what I might
call pure f90 code, but with codes that mix f77 and f90 styles. In
particular, those f77 codes never have array slices, allocatables, or
pointers as actual arguments. That's where you get into trouble - those
kinds of actual arguments don't always mesh well with f77-style dummies.
(Well, allocatables are usually ok, but array slices and pointers often
aren't).
I agree that you can make it work well if you are careful. Just be sure to
be careful. In particular, you need to understand what is likely to
trigger copy-in/copy-out and what is not. And you need to use reasonably
recent compilers; some of the earlier f90 compilers were pretty bad about
doing copy-in/copy-out in places where they really should have known better.
In particular, some earlier compilers would have done copy-in/copy-out
on the code you showed (or with *ANY* case of array slice actual arguments
and explicit-shape dummies).
> the reason for why i want to use adjustable dummy arrays, is that i want
> to use a global array as a storage array and want to use it in different
> contexts with different dimensions ( for eg, in one case (nx,ny/3,nz) and
> in another case as (nx,ny,nz/3) ). as the global array is an
> allocatable/pointer array, i can't use equivalence.
Ok. I understand that one. This is an area where other people have also
noticed some of the strict requirements of f90/f95 getting in the way. I
realize that you can't get f2003 compilers yet, but I'll note that there is
an f2003 feature specifically to help with this. In particular, if you
allocate the base array with rank 1, you can point at it with pointers of
other ranks/shapes as long as you stay within the allocated size. Much
like a pointer form of the equivalence tricks you are referring to.
The restriction to rank 1 base arrays is slightly annoying, but can be
worked with. Generalizing to other cases would have introduced some extra
"issues", though one of the f2003+ proposals has a way to handle those
issues (and I think it a proposal that has good support, though this is too
early to predict much about what will or won't make the cut in f2003+).
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|