40 MODULE PROCEDURE int_regular_sp, int_regular_dp
54 FUNCTION int_regular_dp(dat, dx)
58 REAL(dp),
DIMENSION(:),
INTENT(IN) :: dat
59 REAL(dp),
OPTIONAL,
INTENT(IN) :: dx
60 REAL(dp) :: int_regular_dp
65 if (
size(dat,1) < 5) stop
'Error int_regular_dp: size(dat) < 5'
68 ddx = dx*2.0_dp/45.0_dp
76 if (ddx .gt. 0.0_dp)
then
77 int_regular_dp = sum( &
78 (7.0_dp*(dat(n0-4:n-4:4) + dat(n0:n:4)) + &
79 32.0_dp*(dat(n0-3:n-3:4) + dat(n0-1:n-1:4)) + &
80 12.0_dp*dat(n0-2:n-2:4)) )
82 if ( ddx .lt. 1.0_dp )
then
83 if ( int_regular_dp .gt. tiny(1.0_dp)/ddx )
then
84 int_regular_dp = ddx * int_regular_dp
86 int_regular_dp = tiny(1.0_dp)
89 int_regular_dp = ddx * int_regular_dp
92 int_regular_dp = 0.0_dp
95 END FUNCTION int_regular_dp
97 FUNCTION int_regular_sp(dat, dx)
101 REAL(sp),
DIMENSION(:),
INTENT(IN) :: dat
102 REAL(sp),
OPTIONAL,
INTENT(IN) :: dx
103 REAL(sp) :: int_regular_sp
108 if (
size(dat,1) < 5) stop
'Error int_regular_sp: size(dat) < 5'
110 if (
present(dx))
then
111 ddx = dx*2.0_sp/45.0_sp
118 if (ddx .gt. 0.0_sp)
then
119 int_regular_sp = sum( &
120 (7.0_sp*(dat(n0-4:n-4:4) + dat(n0:n:4)) + &
121 32.0_sp*(dat(n0-3:n-3:4) + dat(n0-1:n-1:4)) + &
122 12.0_sp*dat(n0-2:n-2:4)) )
124 if ( ddx .lt. 1.0_sp )
then
125 if ( int_regular_sp .gt. tiny(1.0_sp)/ddx )
then
126 int_regular_sp = ddx * int_regular_sp
128 int_regular_sp = tiny(1.0_sp)
131 int_regular_sp = ddx * int_regular_sp
134 int_regular_sp = 0.0_sp
137 END FUNCTION int_regular_sp
Integrate regularily spaced data.
Provides integration routines.
Define number representations.
integer, parameter sp
Single Precision Real Kind.
integer, parameter i4
4 Byte Integer Kind
integer, parameter dp
Double Precision Real Kind.