1*DECK DCHFIE
2      DOUBLE PRECISION FUNCTION DCHFIE (X1, X2, F1, F2, D1, D2, A, B)
3C***BEGIN PROLOGUE  DCHFIE
4C***SUBSIDIARY
5C***PURPOSE  Evaluates integral of a single cubic for DPCHIA
6C***LIBRARY   SLATEC (PCHIP)
7C***TYPE      DOUBLE PRECISION (CHFIE-S, DCHFIE-D)
8C***AUTHOR  Fritsch, F. N., (LLNL)
9C***DESCRIPTION
10C
11C          DCHFIE:  Cubic Hermite Function Integral Evaluator.
12C
13C     Called by  DPCHIA  to evaluate the integral of a single cubic (in
14C     Hermite form) over an arbitrary interval (A,B).
15C
16C ----------------------------------------------------------------------
17C
18C  Calling sequence:
19C
20C        DOUBLE PRECISION  X1, X2, F1, F2, D1, D2, A, B
21C        DOUBLE PRECISION  VALUE, DCHFIE
22C
23C        VALUE = DCHFIE (X1, X2, F1, F2, D1, D2, A, B)
24C
25C   Parameters:
26C
27C     VALUE -- (output) value of the requested integral.
28C
29C     X1,X2 -- (input) endpoints if interval of definition of cubic.
30C
31C     F1,F2 -- (input) function values at the ends of the interval.
32C
33C     D1,D2 -- (input) derivative values at the ends of the interval.
34C
35C     A,B -- (input) endpoints of interval of integration.
36C
37C***SEE ALSO  DPCHIA
38C***ROUTINES CALLED  (NONE)
39C***REVISION HISTORY  (YYMMDD)
40C   820730  DATE WRITTEN
41C   820805  Converted to SLATEC library version.
42C   870707  Corrected subroutine name from DCHIV to DCHFIV.
43C   870813  Minor cosmetic changes.
44C   890411  1. Added SAVE statements (Vers. 3.2).
45C           2. Added SIX to DOUBLE PRECISION declaration.
46C   890411  REVISION DATE from Version 3.2
47C   891214  Prologue converted to Version 4.0 format.  (BAB)
48C   900315  CALLs to XERROR changed to CALLs to XERMSG.  (THJ)
49C   900328  Added TYPE section.  (WRB)
50C   910408  Updated AUTHOR section in prologue.  (WRB)
51C   930503  Corrected to set VALUE=0 when IERR.ne.0.  (FNF)
52C   930504  Eliminated IERR and changed name DCHFIV to DCHFIE.  (FNF)
53C***END PROLOGUE  DCHFIE
54C
55C  Programming notes:
56C  1. There is no error return from this routine because zero is
57C     indeed the mathematically correct answer when X1.EQ.X2 .
58C**End
59C
60C  DECLARE ARGUMENTS.
61C
62      DOUBLE PRECISION  X1, X2, F1, F2, D1, D2, A, B
63C
64C  DECLARE LOCAL VARIABLES.
65C
66      DOUBLE PRECISION  DTERM, FOUR, FTERM, H, HALF, PHIA1, PHIA2,
67     *      PHIB1, PHIB2, PSIA1, PSIA2, PSIB1, PSIB2, SIX, TA1, TA2,
68     *      TB1, TB2, THREE, TWO, UA1, UA2, UB1, UB2
69      SAVE HALF, TWO, THREE, FOUR, SIX
70C
71C  INITIALIZE.
72C
73      DATA  HALF/.5D0/, TWO/2.D0/, THREE/3.D0/, FOUR/4.D0/, SIX/6.D0/
74C
75C  VALIDITY CHECK INPUT.
76C
77C***FIRST EXECUTABLE STATEMENT  DCHFIE
78      IF (X1 .EQ. X2)  THEN
79         DCHFIE = 0
80      ELSE
81         H = X2 - X1
82         TA1 = (A - X1) / H
83         TA2 = (X2 - A) / H
84         TB1 = (B - X1) / H
85         TB2 = (X2 - B) / H
86C
87         UA1 = TA1**3
88         PHIA1 = UA1 * (TWO - TA1)
89         PSIA1 = UA1 * (THREE*TA1 - FOUR)
90         UA2 = TA2**3
91         PHIA2 =  UA2 * (TWO - TA2)
92         PSIA2 = -UA2 * (THREE*TA2 - FOUR)
93C
94         UB1 = TB1**3
95         PHIB1 = UB1 * (TWO - TB1)
96         PSIB1 = UB1 * (THREE*TB1 - FOUR)
97         UB2 = TB2**3
98         PHIB2 =  UB2 * (TWO - TB2)
99         PSIB2 = -UB2 * (THREE*TB2 - FOUR)
100C
101         FTERM =   F1*(PHIA2 - PHIB2) + F2*(PHIB1 - PHIA1)
102         DTERM = ( D1*(PSIA2 - PSIB2) + D2*(PSIB1 - PSIA1) )*(H/SIX)
103C
104         DCHFIE = (HALF*H) * (FTERM + DTERM)
105      ENDIF
106C
107      RETURN
108C------------- LAST LINE OF DCHFIE FOLLOWS -----------------------------
109      END
110