c_simps2d_func_recursive Function

function c_simps2d_func_recursive(func, xrange, yrange, N0, iterative, threshold) result(int)

Arguments

Type IntentOptional Attributes Name
function func(x)
Arguments
Type IntentOptional Attributes Name
real(kind=8), dimension(:) :: x
Return Value complex(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

Return Value complex(kind=8)


Calls

proc~~c_simps2d_func_recursive~~CallsGraph proc~c_simps2d_func_recursive c_simps2d_func_recursive c_simps2d_func c_simps2d_func proc~c_simps2d_func_recursive->c_simps2d_func

Source Code

function c_simps2d_func_recursive(func,xrange,yrange,N0,iterative,threshold) result(int)
  interface
     function func(x)
       real(8),dimension(:) :: x
       complex(8)           :: func
     end function func
  end interface
  real(8),dimension(2)      :: xrange,yrange
  integer                   :: N,icount
  real(8)                   :: eps,int0
  integer,optional          :: N0
  integer                   :: N0_
  logical,optional          :: iterative
  logical                   :: iterative_
  real(8),optional          :: threshold
  real(8)                   :: threshold_
  complex(8)                :: int
  iterative_=.false.;if(present(iterative))iterative_=iterative
  N0_=51;if(present(N0))N0_=N0
  threshold_=1d0;if(iterative_)threshold_=1.d-3
  if(present(threshold))threshold_=threshold
  N=N0_
  eps=1d0
  icount=1
  int=c_simps2d_func(func,xrange,yrange,N,N)
  do while (eps>threshold_)
     icount=icount+1
     int0=int
     N=2*N-10
     int=c_simps2d_func(func,xrange,yrange,N,N)
     eps=abs(int-int0)/abs(int)
  enddo
end function c_simps2d_func_recursive