Perform the 2D integration.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integration_class_2d), | intent(inout) | :: | me | |||
real(kind=wp), | intent(out) | :: | ans | |||
integer, | intent(out) | :: | ierr | |||
real(kind=wp), | intent(out) | :: | err |
subroutine integrate_2d (me, ans, ierr, err)
implicit none
class(integration_class_2d),intent(inout) :: me
real(wp),intent(out) :: ans
integer,intent(out) :: ierr
real(wp),intent(out) :: err
! set the two functions to the contained wrappers:
me%iy%fun => f_of_y
me%ix%fun => f_of_x
! call the low-level routine:
call me%iy%integrate(ans, ierr, err)
contains
function f_of_x(ix,x) result(f)
class(integration_class_1d),intent(inout) :: ix
real(wp), intent(in) :: x
real(wp) :: f
f = me%fxy(x,me%iy%val)
end function f_of_x
function f_of_y(iy,y) result(f)
class(integration_class_1d),intent(inout) :: iy
real(wp), intent(in) :: y
real(wp) :: f
iy%val = y !set y value
call me%ix%integrate(f, ierr, err)
end function f_of_y
end subroutine integrate_2d