Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(piecewise2D), | intent(in) | :: | this | |||
real(kind=wp), | intent(out) | :: | x | |||
real(kind=wp), | intent(out) | :: | y | |||
real(kind=wp), | intent(in), | optional | :: | value |
subroutine sample2D(this, x, y, value) ! TODO cite where you got this from... use random, only : ran2, ranu class(piecewise2D), intent(in) :: this real(kind=wp), intent(out) :: x, y real(kind=wp), intent(in), optional :: value integer(kind=int32) :: xr, yr integer(kind=int64) :: idx real(kind=wp) :: val val = ran2() call search_1D(this%cdf, idx, val) call decode(idx, xr, yr) x = real(xr - this%xoffset, kind=wp) + ranu(-this%cell_width, this%cell_width) y = real(yr - this%yoffset, kind=wp) + ranu(-this%cell_height, this%cell_height) end subroutine sample2D