Allcoate 5-Dimensional array of type: real
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(inout), | dimension(:, :, :, :, :), allocatable | :: | var | Variable to which memory is allocated |
|
integer, | intent(in) | :: | start1 | Starting index of Var array's dimension |
||
integer, | intent(in) | :: | stop1 | Last index of Var array's dimension |
||
integer, | intent(in) | :: | start2 | Starting index of Var array's dimension |
||
integer, | intent(in) | :: | stop2 | Last index of Var array's dimension |
||
integer, | intent(in) | :: | start3 | Starting index of Var array's dimension |
||
integer, | intent(in) | :: | stop3 | Last index of Var array's dimension |
||
integer, | intent(in) | :: | start4 | Starting index of Var array's dimension |
||
integer, | intent(in) | :: | stop4 | Last index of Var array's dimension |
||
integer, | intent(in) | :: | start5 | Starting index of Var array's dimension |
||
integer, | intent(in) | :: | stop5 | Last index of Var array's dimension |
||
character(len=*), | intent(in), | optional | :: | errmsg | Error message to print if mem_stat is not 0(successful) |
subroutine alloc_rank5_real(var, start1, stop1, start2, stop2, &
start3, stop3, start4, stop4, start5, stop5, errmsg)
!< Allcoate 5-Dimensional array of type: real
implicit none
real, dimension(:, :, :, :, :), intent(inout), allocatable :: var
!< Variable to which memory is allocated
integer, intent(in) :: start1, start2, start3, start4, start5
!< Starting index of Var array's dimension
integer, intent(in) :: stop1, stop2, stop3, stop4, stop5
!< Last index of Var array's dimension
integer :: mem_stat
!< Status of the memory allocation process
character(len=*), intent(in), optional :: errmsg
!< Error message to print if mem_stat is not 0(successful)
allocate(var(start1:stop1, start2:stop2, start3:stop3, &
start4:stop4, start5:stop5), stat=mem_stat)
if (mem_stat /= 0) then
if (present(errmsg)) then
print *, errmsg
else
print *, 'Error: Could not allocate memory.'
end if
print *, 'Required extent: ', stop1 - start1 + 1, &
stop2 - start2 + 1, stop3 - stop3 + 1, &
stop4 - start4 + 1, stop5 - start5 + 1
stop
end if
end subroutine alloc_rank5_real