For a given value, get the position in a histogram of given window sizes
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | val |
value to get the position |
||
| real(kind=dp), | intent(in) | :: | minVal |
value to get the position smallest value appearing in the histogram |
||
| integer, | intent(in) | :: | nPoints |
number of bins in the histogram |
||
| real(kind=dp), | intent(in) | :: | windowSize |
value to get the position smallest value appearing in the histogram size of each bin |
function getHistIndex(val, minVal, nPoints, windowSize) result(ind) implicit none real(dp), intent(in) :: val, minVal, windowSize integer, intent(in) :: nPoints integer :: ind if(val <= minVal) then ind = 1 else if(val > minVal + nPoints*windowSize) then ind = nPoints else ind = ceiling((val - minVal) / windowSize) end if end function getHistIndex