Compute the MAX of a 2D map
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=xp), | intent(in), | dimension(:,:), allocatable | :: | map | 2D array |
|
integer, | intent(in) | :: | dim_y | dimension along spatial axis y |
||
integer, | intent(in) | :: | dim_x | dimension along spatial axis x |
function max_2D(map, dim_y, dim_x)
!! Compute the MAX of a 2D map
implicit none
integer, intent(in) :: dim_y !! dimension along spatial axis y
integer, intent(in) :: dim_x !! dimension along spatial axis x
real(xp), intent(in), dimension(:,:), allocatable :: map !! 2D array
real(xp), dimension(:), allocatable :: vector !! 1D array
real(xp) :: max_2D
allocate(vector(dim_y*dim_x))
call ravel_2D(map, vector, dim_y, dim_x)
max_2D = maxval(vector)
deallocate(vector)
end function max_2D