Initialize the 1D integration class. Must be called before integration is performed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integration_class_1d), | intent(inout) | :: | me | |||
procedure(func_1d) | :: | fx | 1d function: f(x) |
|||
real(kind=wp), | intent(in) | :: | xl | x integration lower bound |
||
real(kind=wp), | intent(in) | :: | xu | x integration upper bound |
||
real(kind=wp), | intent(in) | :: | tolx | error tolerance for dx integration |
||
integer, | intent(in) | :: | methodx | quadrature method to use for x |
subroutine initialize_integration_class(me,fx,&
xl,xu,tolx,methodx)
implicit none
class(integration_class_1d),intent(inout) :: me
procedure(func_1d) :: fx !! 1d function: f(x)
real(wp),intent(in) :: xl !! x integration lower bound
real(wp),intent(in) :: xu !! x integration upper bound
real(wp),intent(in) :: tolx !! error tolerance for dx integration
integer,intent(in) :: methodx !! quadrature method to use for x
! select quadrature rule
select case (methodx)
case(6); me%g => g6
case(8); me%g => g8
case(10); me%g => g10
case(12); me%g => g12
case(14); me%g => g14
case default
error stop 'invalid quadrature method in initialize_integration_class'
end select
me%fun => fx !the function f(x) to integrate
me%tol = tolx !tolerance
me%a = xl !lower bound
me%b = xu !upper bound
end subroutine initialize_integration_class