Re: passing allocatable array to a function and getting the bounds



Michael Metcalf wrote:
"Paul Van Delst" <Paul.vanDelst@xxxxxxxx> wrote in message news:dsfk14$66k$1@xxxxxxxxxxxxxxxxxxxxx

Call your function thusly:

call f(x(0:))

and you'll have access to your actual argument bounds in testing your dummy argument.


I think not. Do you mean

integer, dimension(:), intent(in) :: x(0:)

Oopsy - yes, that's what I meant. I didn't check my own code before posting. ehem.

To attempt to shore up my diminishing cachet on clf, I'll quoteth some of my own code where this is an issue for me:

SUBROUTINE CRTM_Integrated_Predictors( Atmosphere, & ! Input
IntAbsorber, & ! Input, 0:K
Predictor ) ! Output, Iint x K

TYPE( CRTM_Atmosphere_type ), INTENT( IN ) :: Atmosphere
REAL( fp_kind ), DIMENSION( 0: ), INTENT( IN ) :: IntAbsorber ! 0:K
REAL( fp_kind ), DIMENSION( :, : ), INTENT( OUT ) :: Predictor ! Iint x K


and I call it thusly:

CALL CRTM_Integrated_Predictors( Atmosphere, &
AtmAbsorption%IntAbsorber( 0:, j ), &
AtmAbsorption%Predictor( i1:i2, : ) )

I think I specify the actual argument above as
AtmAbsorption%IntAbsorber( 0:, j )
rather than just
AtmAbsorption%IntAbsorber( :, j )
for visual reference (and I'm a belts-n-braces type of feller :o) and that's what I remembered most since I call the routine lots, but only wrote the interface once. :o)

Sorry 'bout the confusion.

cheers,

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
.