6 USE ids_schemas
, ONLY: ids_real
16 SUBROUTINE lininterp( YIN , XIN , NIN , YOUT , XOUT , NOUT )
17 REAL(8),
INTENT(IN) :: yin(nin)
18 REAL(8),
INTENT(IN) :: xin(nin)
19 REAL(8),
INTENT(OUT) :: yout(nout)
20 REAL(8),
INTENT(IN) :: xout(nout)
21 INTEGER,
INTENT(IN) :: nin
22 INTEGER,
INTENT(IN) :: nout
25 REAL(8),
PARAMETER :: very_small = sqrt(tiny(1.0d0))
32 IF ( maxval(abs(xin-xout)) < very_small)
THEN
40 direction = sign(1d0, xin(nin) - xin(1))
45 IF (direction * (xout(jout) - xin(1)) <= 0.0d0)
THEN
47 ELSEIF ( direction * (xout(jout) - xin(nin)) >= 0.0d0 )
THEN
51 IF (direction * (xout(jout) - xin(jin+1)) <= 0.0d0)
THEN
52 frac = (xout(jout) - xin(jin)) / (xin(jin+1) - xin(jin))
53 yout(jout) = (1.0d0 - frac) * yin(jin) + frac * yin(jin+1)
63 SUBROUTINE linderiv( YIN , XIN , NIN , YOUT , XOUT , NOUT )
64 REAL(8),
INTENT(IN) :: yin(nin)
65 REAL(8),
INTENT(IN) :: xin(nin)
66 REAL(8),
INTENT(OUT) :: yout(nout)
67 REAL(8),
INTENT(IN) :: xout(nout)
68 INTEGER,
INTENT(IN) :: nin
69 INTEGER,
INTENT(IN) :: nout
78 direction = sign(1d0, xin(nin) - xin(1))
83 IF (direction * (xout(jout) - xin(1)) <= 0.0d0)
THEN
84 yout(jout) = (yin(2) - yin(1)) / (xin(2) - xin(1))
85 ELSEIF ( direction * (xout(jout) - xin(nin)) >= 0.0d0 )
THEN
86 yout(jout) = (yin(nin) - yin(nin-1)) / (xin(nin) - xin(nin-1))
89 IF (direction * (xout(jout) - xin(jin+1)) <= 0.0d0)
THEN
90 yout(jout) = (yin(jin+1) - yin(jin)) / (xin(jin+1) - xin(jin))
101 REAL(8),
POINTER,
INTENT(IN) :: yin(:)
102 REAL(8),
POINTER,
INTENT(IN) :: xin(:)
103 REAL(8),
INTENT(OUT) :: yout(:)
104 REAL(8),
INTENT(IN) :: xout(:)
106 IF ( (.NOT.
ASSOCIATED(xin)) .OR. (.NOT.
ASSOCIATED(yin)) )
THEN
110 IF (
SIZE(xin) /=
SIZE(yin) )
THEN
115 CALL
linderiv( yin , xin ,
SIZE(xin) , yout , xout ,
SIZE(xout) )
121 REAL(8),
POINTER,
INTENT(IN) :: yin(:)
122 REAL(8),
POINTER,
INTENT(IN) :: xin(:)
123 REAL(8),
INTENT(OUT) :: yout(:)
124 REAL(8),
INTENT(IN) :: xout(:)
126 IF ( (.NOT.
ASSOCIATED(xin)) .OR. (.NOT.
ASSOCIATED(yin)) )
THEN
130 IF (
SIZE(xin) /=
SIZE(yin) )
THEN
135 CALL l3interp( yin , xin ,
SIZE(xin) , yout , xout ,
SIZE(xout) )
143 REAL(8),
ALLOCATABLE,
INTENT(IN) :: yin(:)
144 REAL(8),
ALLOCATABLE,
INTENT(IN) :: xin(:)
145 REAL(8),
INTENT(OUT) :: yout(:)
146 REAL(8),
INTENT(IN) :: xout(:)
148 IF ( (.NOT.
ALLOCATED(xin)) .OR. (.NOT.
ALLOCATED(yin)) )
THEN
152 IF (
SIZE(xin) /=
SIZE(yin) )
THEN
157 CALL l3interp( yin , xin ,
SIZE(xin) , yout , xout ,
SIZE(xout) )
165 REAL(8),
POINTER,
INTENT(IN) :: yin(:)
166 REAL(8),
POINTER,
INTENT(IN) :: xin(:)
167 REAL(8),
INTENT(OUT) :: yout(:)
168 REAL(8),
INTENT(IN) :: xout(:)
170 IF ( (.NOT.
ASSOCIATED(xin)) .OR. (.NOT.
ASSOCIATED(yin)) )
THEN
174 IF (
SIZE(xin) /=
SIZE(yin) )
THEN
179 CALL l3deriv( yin , xin ,
SIZE(xin) , yout , xout ,
SIZE(xout) )
187 REAL(8),
ALLOCATABLE,
INTENT(IN) :: yin(:)
188 REAL(8),
ALLOCATABLE,
INTENT(IN) :: xin(:)
189 REAL(8),
INTENT(OUT) :: yout(:)
190 REAL(8),
INTENT(IN) :: xout(:)
192 IF ( (.NOT.
ALLOCATED(xin)) .OR. (.NOT.
ALLOCATED(yin)) )
THEN
196 IF (
SIZE(xin) /=
SIZE(yin) )
THEN
201 CALL l3deriv( yin , xin ,
SIZE(xin) , yout , xout ,
SIZE(xout) )
208 USE prec_rkind
, ONLY: rkind
209 USE interpos_module
, ONLY: interpos
210 REAL(IDS_REAL),
INTENT(IN) :: xin(:)
211 REAL(IDS_REAL),
INTENT(IN) :: yin(:)
214 REAL(RKIND) :: cum_integral(size(xin))
215 REAL(RKIND) :: xin_kind(size(xin))
216 REAL(RKIND) :: yin_kind(size(xin))
217 REAL(RKIND) :: ybc(2) = (/ 0.0_rkind , 0.0_rkind /)
218 INTEGER :: nbc(2) = (/ 0 , 0 /)
222 xin_kind =
REAL(xin, rkind)
223 yin_kind =
REAL(yin, rkind)
224 CALL interpos(xin_kind, yin_kind, nrho, &
225 nrho, xout=xin_kind, youtint=cum_integral, nbc=nbc, ybc=ybc)
226 integral =
REAL(CUM_INTEGRAL(NRHO), ids_real)
subroutine linderiv(YIN, XIN, NIN, YOUT, XOUT, NOUT)
Use linear interpolatation to calculate the derivatives YOUT at XOUT,.
subroutine linderiv_pointer(YIN, XIN, YOUT, XOUT)
Use linear interpolatation to calculate the derivatives YOUT at XOUT,.
subroutine l3interp_alloc(YIN, XIN, YOUT, XOUT)
Interpolate YIN(XIN) using L3INTERP, but the input arrays are allocatables.
subroutine l3deriv_alloc(YIN, XIN, YOUT, XOUT)
Calculate the derivative of YIN(XIN) using L3INTERP, but the input arrays are allocatables.
subroutine l3deriv_pointer(YIN, XIN, YOUT, XOUT)
Calculate the derivative of YIN(XIN) using L3INTERP, but the input arrays are pointers.
subroutine l3interp_pointer(YIN, XIN, YOUT, XOUT)
subroutine lininterp(YIN, XIN, NIN, YOUT, XOUT, NOUT)
Linear interpolatation and constant extrapolation. The input function is YIN given at XIN and with le...
Interpolations, derivatives and integrals of 1d functions. Includes wrappers to L3INTERP, L3DERIV and INTERPOS.
subroutine integral(n, h, r, f, int)