Tom, Malcolm
>From: "Clune, Thomas L. (GSFC-6101)" <[log in to unmask]>
>
>I must not be quite following the pieces here. The procedure where “it makes no difference whether …”, should easily be passed around with an explicit interface, as it does not use coarrays.
>
>To the extent I understand your concern, you have a _small_ number of procedures that must do different things depending on whether you are in case (1) or case (2). This would otherwise be a poster-child for object-orientation with two subclasses, but here the fact that both subclasses must have the same interface becomes an issue. Unfortunately, I lack enough experience with co-arrays to know if there is a way out of this. But others in the list surely have enough experience with the overlap to comment. (Damian?)
Thank you for the comments.
I think I remember my train of thought now, bear with me...
The use of halos in model data
typically leads to arrays with
non-default lower bounds,
e.g. the real data starts at 1
and the array starts at 1-hdepth,
where 'hdepth' is the halo depth.
Using assumed-shape dummy doesn't preserve
the bounds, which would means extra
code to operate on correct data.
Using allocatable dummy seems ideal as
I never need to worry about the bounds -
they are always the same inside the procedure
as in the calling scope.
Perhaps I abuse this facility, but
I use allocatable dummy for allocatable actual
arguments a lot, even though no change of
allocation status is intended in most procedures.
I think I also read somewhere that, at least
with some compilers, an allocatable dummy
is better performing than assumed-shape array.
Maybe I'm wrong here?
So - I really like allocatable dummy,
but passing allocatable coarray actual
to an allocatable dummy is illegal, as Bill
pointed out, 15.5.2.6p3.
So as Malcolm suggested I need to have
2 separate modules, one for option (1) and
another for option (2), which is essentially
code duplication, as the only change (not true,
there are a few other changes) is that some
allocatable dummy non-coarray
declarations become
allocatable dummy coarray
declarations.
Thanks again
Anton
|