Allcoate 6-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 |
||
integer, | intent(in) | :: | start6 | Starting index of Var array's dimension |
||
integer, | intent(in) | :: | stop6 | 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_rank6_real(var, start1, stop1, start2, stop2, &
!< Allcoate 6-Dimensional array of type: real
start3, stop3, start4, stop4, start5, stop5, start6, stop6, errmsg)
implicit none
real, dimension(:, :, :, :, :,:), intent(inout), allocatable :: var
!< Variable to which memory is allocated
integer, intent(in) :: start1, start2, start3, start4, start5, start6
!< Starting index of Var array's dimension
integer, intent(in) :: stop1, stop2, stop3, stop4, stop5, stop6
!< 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, start6:stop6), 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_rank6_real