Allocate a 2-dimensional array of reals
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string |
Human-readable description string of the allocation operation, just for output purpose. |
||
integer(kind=ip), | intent(in) | :: | len1 |
Dimensions of the vector |
||
integer(kind=ip), | intent(in) | :: | len2 |
Dimensions of the vector |
||
real(kind=rp), | intent(inout), | allocatable | :: | v(:,:) |
Vector to allocate |
subroutine r_alloc2(string, len1, len2, v)
!! Allocate a 2-dimensional array of reals
implicit none
character(len=*), intent(in) :: string
!! Human-readable description string of the allocation
!! operation, just for output purpose.
integer(ip), intent(in) :: len1, len2
!! Dimensions of the vector
real(rp), allocatable, intent(inout) :: v(:,:)
!! Vector to allocate
integer(ip) :: istat
if(.not. is_init) call memory_init(.false., 0.0_rp)
allocate(v(len1, len2), stat=istat)
call chk_alloc(string, len1*len2*size_of_real, istat)
end subroutine r_alloc2