Fix fortran interface: inout intent for arrays

This commit is contained in:
Shahram Najm 2015-06-01 16:01:50 +01:00
parent eff8dc5090
commit 1bffd064be
1 changed files with 32 additions and 26 deletions

View File

@ -2049,7 +2049,7 @@
subroutine grib_get_int_array ( gribid, key, value, status )
integer(kind=kindOfInt), intent(in) :: gribid
character(len=*), intent(in) :: key
integer(kind=kindOfInt), dimension(:),allocatable,intent(out) :: value
integer(kind=kindOfInt), dimension(:),allocatable,intent(inout) :: value
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
@ -2067,7 +2067,9 @@
endif
return
endif
if (.not.allocated(value)) allocate(value(nb_values))
if (allocated(value) .eqv. .false.) then
allocate(value(nb_values))
end if
size_value=size(value)
iret=grib_f_get_int_array ( gribid, key, value , nb_values )
if (iret==0 .and. nb_values==1 .and. size_value/=1) then
@ -2098,34 +2100,36 @@
subroutine grib_get_long_array ( gribid, key, value, status )
integer(kind=kindOfInt), intent(in) :: gribid
character(len=*), intent(in) :: key
integer(kind = kindOfLong),dimension(:),allocatable,intent(out) :: value
integer(kind = kindOfLong),dimension(:),allocatable,intent(inout) :: value
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: nb_values
integer(kind=kindOfInt) :: size_value
integer(kind=kindOfInt) :: i
iret=grib_f_get_size_int(gribid,key,nb_values)
if (iret /= 0) then
call grib_f_write_on_fail(gribid)
if (present(status)) then
status = iret
else
call grib_check(iret,'grib_get',key)
endif
return
iret=grib_f_get_size_int(gribid,key,nb_values)
if (iret /= 0) then
call grib_f_write_on_fail(gribid)
if (present(status)) then
status = iret
else
call grib_check(iret,'grib_get',key)
endif
if (.not.allocated(value)) allocate(value(nb_values))
size_value=size(value)
iret=grib_f_get_long_array ( gribid, key, value , nb_values )
if (iret==0 .and. nb_values==1 .and. size_value/=1) then
do i=2,size_value
value(i)=value(1)
enddo
endif
if (iret /= 0) then
call grib_f_write_on_fail(gribid)
endif
return
endif
if (allocated(value) .eqv. .false.) then
allocate(value(nb_values))
end if
size_value=size(value)
iret=grib_f_get_long_array ( gribid, key, value , nb_values )
if (iret==0 .and. nb_values==1 .and. size_value/=1) then
do i=2,size_value
value(i)=value(1)
enddo
endif
if (iret /= 0) then
call grib_f_write_on_fail(gribid)
endif
if (present(status)) then
status = iret
else
@ -2181,10 +2185,10 @@
!> @param key key name
!> @param value real(4) array value
!> @param status GRIB_SUCCESS if OK, integer value on error
subroutine grib_get_real4_array ( gribid, key, value, status)
subroutine grib_get_real4_array ( gribid, key, value, status )
integer(kind=kindOfInt), intent(in) :: gribid
character(len=*), intent(in) :: key
real(kind = kindOfFloat), dimension(:),allocatable,intent(out) :: value
real(kind = kindOfFloat), dimension(:),allocatable,intent(inout) :: value
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: nb_values
@ -2201,7 +2205,9 @@
endif
return
endif
if (.not.allocated(value)) allocate(value(nb_values))
if (allocated(value) .eqv. .false.) then
allocate(value(nb_values))
end if
size_value=size(value)
iret=grib_f_get_real4_array ( gribid, key, value , nb_values )
if (iret==0 .and. nb_values==1 .and. size_value/=1) then