GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: misc/coefpoly_m.F90 Lines: 10 10 100.0 %
Date: 2023-06-30 12:56:34 Branches: 0 0 - %

Line Branch Exec Source
1
module coefpoly_m
2
3
  IMPLICIT NONE
4
5
contains
6
7
129
  SUBROUTINE coefpoly(xf1, xf2, xprim1, xprim2, xtild1, xtild2, a0, a1, a2, a3)
8
9
    ! From LMDZ4/libf/dyn3d/coefpoly.F, version 1.1.1.1 2004/05/19 12:53:05
10
11
    ! Author: P. Le Van
12
13
    ! Calcul des coefficients a0, a1, a2, a3 du polynôme de degré 3 qui
14
    ! satisfait aux 4 équations suivantes :
15
16
    ! a0 + a1 * xtild1 + a2 * xtild1**2 + a3 * xtild1**3 = Xf1
17
    ! a0 + a1 * xtild2 + a2 * xtild2**2 + a3 * xtild2**3 = Xf2
18
    ! a1 + 2. * a2 * xtild1 + 3. * a3 * xtild1**2 = Xprim1
19
    ! a1 + 2. * a2 * xtild2 + 3. * a3 * xtild2**2 = Xprim2
20
21
    ! (passe par les points (Xf(it), xtild(it)) et (Xf(it + 1),
22
    ! xtild(it + 1))
23
24
    ! On en revient à resoudre un système de 4 équations à 4 inconnues
25
    ! a0, a1, a2, a3.
26
27
    use nrtype, only: k8
28
29
    REAL(K8), intent(in):: xf1, xf2, xprim1, xprim2, xtild1, xtild2
30
    REAL(K8), intent(out):: a0, a1, a2, a3
31
32
    ! Local:
33
    REAL(K8) xtil1car, xtil2car, derr, x1x2car
34
35
    !------------------------------------------------------------
36
37
129
    xtil1car = xtild1 * xtild1
38
129
    xtil2car = xtild2 * xtild2
39
40
129
    derr = 2. * (xf2-xf1)/(xtild1-xtild2)
41
42
129
    x1x2car = (xtild1-xtild2) * (xtild1-xtild2)
43
44
129
    a3 = (derr+xprim1+xprim2)/x1x2car
45
129
    a2 = (xprim1-xprim2+3. * a3 * (xtil2car-xtil1car))/(2. * (xtild1-xtild2))
46
47
129
    a1 = xprim1 - 3. * a3 * xtil1car - 2. * a2 * xtild1
48
129
    a0 = xf1 - a3 * xtild1 * xtil1car - a2 * xtil1car - a1 * xtild1
49
50
129
  END SUBROUTINE coefpoly
51
52
end module coefpoly_m