GCC Code Coverage Report


Directory: ./
File: src/coordinates/stencil_utils.f90
Date: 2026-10-22 05:02:02
Coverage Exec Excl Total
Lines: 100.0% 20 0 20
Functions: 100.0% 1 0 1
Branches: 100.0% 8 0 8

Line Branch Exec Source
1 module stencil_utils
2 implicit none
3
4 private
5 public :: init_derivative_stencil
6
7 contains
8
9 21 pure subroutine init_derivative_stencil(nh_stencil, h_grid, stencil)
10 integer, intent(in) :: nh_stencil
11 double precision, intent(in) :: h_grid
12 double precision, intent(out) :: stencil(-nh_stencil:nh_stencil)
13
14 2 select case (nh_stencil)
15 case (1)
16 ! 2nd order centered difference
17 2 stencil(-1) = -0.5d0
18 2 stencil(0) = 0.0d0
19 2 stencil(1) = 0.5d0
20 case (2)
21 ! 4th order centered difference
22 2 stencil(-2) = 1.d0/12.d0
23 2 stencil(-1) = -2.d0/3.d0
24 2 stencil(0) = 0.0d0
25 2 stencil(1) = 2.d0/3.d0
26 2 stencil(2) = -1.d0/12.d0
27 case (3)
28 ! 6th order centered difference
29 14 stencil(-3) = -1.d0/60.d0
30 14 stencil(-2) = 0.15d0
31 14 stencil(-1) = -0.75d0
32 14 stencil(0) = 0.0d0
33 14 stencil(1) = 0.75d0
34 14 stencil(2) = -0.15d0
35 14 stencil(3) = 1.d0/60.d0
36 case default
37 ! This should never happen if input validation is done properly
38
6/6
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 21 times.
✓ Branch 5 taken 3 times.
45 stencil = 0.0d0
39 end select
40
41 ! Scale by grid spacing
42
2/2
✓ Branch 0 taken 135 times.
✓ Branch 1 taken 21 times.
156 stencil = stencil/h_grid
43
44 21 end subroutine init_derivative_stencil
45
46 end module stencil_utils
47