Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
function func(x)Arguments
Return Value real(kind=8) |
||||||||||||||||||||
real(kind=8), | dimension(2) | :: | xrange | |||||||||||||||||
real(kind=8), | dimension(2) | :: | yrange | |||||||||||||||||
integer, | optional | :: | N0 | |||||||||||||||||
logical, | optional | :: | iterative | |||||||||||||||||
real(kind=8), | optional | :: | threshold |
function d_trapz2d_func_recursive(func,xrange,yrange,N0,iterative,threshold) result(int) interface function func(x) real(8),dimension(:) :: x real(8) :: func end function func end interface real(8),dimension(2) :: xrange,yrange integer :: N,icount real(8) :: int,eps,int0 integer,optional :: N0 integer :: N0_ logical,optional :: iterative logical :: iterative_ real(8),optional :: threshold real(8) :: threshold_ iterative_=.false.;if(present(iterative))iterative_=iterative N0_=51;if(present(N0))N0_=N0 threshold_=1d0;if(iterative_)threshold_=5.d-3 if(present(threshold))threshold_=threshold N=N0_ eps=1d0 icount=1 int=d_trapz2d_func(func,xrange,yrange,N,N) do while (eps>threshold_) icount=icount+1 int0=int N=2*N-10 int=d_trapz2d_func(func,xrange,yrange,N,N) eps=abs(int-int0)/abs(int) enddo end function d_trapz2d_func_recursive