GCC Code Coverage Report


Directory: src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 76.9% 40 / 0 / 52
Functions: 100.0% 5 / 0 / 5
Branches: 68.2% 45 / 0 / 66

mform/m_mform_derham.f90
Line Branch Exec Source
1 !> @brief Module for the DeRham sequence of m-forms
2 module m_mform_derham
3
4 #include "petsc.fi"
5
6 implicit none
7
8 private
9 public :: DeRhamSequence, DeRhamSequence3C
10
11 interface DeRhamSequence
12 module procedure DeRhamSequence_1d, DeRhamSequence_2d, DeRhamSequence_3d
13 end interface DeRhamSequence
14
15 interface DeRhamSequence3C
16 module procedure DeRhamSequence3C_1d, DeRhamSequence3C_2d, DeRhamSequence_3d
17 end interface DeRhamSequence3C
18
19 contains
20 !> @brief Create a DeRham sequence of m-forms from a tensor product B-spline basis
21 !>
22 !> @param[in] bspline_x B-spline basis in x direction
23 !> @param[in] bspline_y B-spline basis in y direction
24 !> @param[in] bspline_z B-spline basis in z direction
25 !> @param[in] domain _(optional)_ Domain decomposition
26 !>
27 !> @return DeRham sequence (space of 0-forms, 1-forms, 2-forms, 3-forms)
28
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 5264 times.
5264 function DeRhamSequence_3d(bspline_x, bspline_y, bspline_z, domain) result(derham)
29 use m_bspline, only: BSplineSpace
30 use m_mform_basis, only: MFormSpace
31 use m_tensorprod, only: TensorProdSpace
32 use m_domain, only: DomainDecomp
33
34 implicit none
35
36 type(BSplineSpace), intent(in) :: bspline_x, bspline_y, bspline_z
37 type(DomainDecomp), intent(in), optional :: domain
38 type(MFormSpace) :: derham(0:3)
39
40 type(TensorProdSpace) :: tp_space0
41 integer :: m
42
43
3/6
✓ Branch 7 → 8 taken 5264 times.
✗ Branch 7 → 10 not taken.
✓ Branch 8 → 9 taken 5264 times.
✗ Branch 8 → 10 not taken.
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 20 taken 5264 times.
5264 if (bspline_x%degree <= 0 .or. bspline_y%degree <= 0 .or. bspline_z%degree <= 0) then
44 write (*, '(A,I0,A,I0,A,I0,A)') "ERROR in DeRhamSequence_3d: all B-spline spaces of the 0-form space must have degree > 0. " &
45 //"Got degrees [x, y, z] = [", bspline_x%degree, ", ", bspline_y%degree, ", ", bspline_z%degree, "]"
46 error stop 1
47 end if
48
49 5264 tp_space0 = TensorProdSpace(bspline_x, bspline_y, bspline_z, domain=domain)
50
51
2/2
✓ Branch 22 → 23 taken 21056 times.
✓ Branch 22 → 27 taken 5264 times.
26320 do m = 0, 3
52
1/2
✗ Branch 24 → 25 not taken.
✓ Branch 24 → 26 taken 21056 times.
26320 derham(m) = MFormSpace(m, tp_space0)
53 end do
54
2/2
✓ Branch 5 → 6 taken 21056 times.
✓ Branch 5 → 7 taken 5264 times.
26320 end function DeRhamSequence_3d
55
56 !> @brief Create a 2D DeRham sequence of m-forms from a tensor product B-spline basis
57 !>
58 !> @param[in] bspline_x B-spline basis in x direction
59 !> @param[in] bspline_y B-spline basis in y direction
60 !> @param[in] domain _(optional)_ Domain decomposition
61 !>
62 !> @return DeRham sequence (space of 0-forms, 1-forms, 2-forms)
63
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 983 times.
983 function DeRhamSequence_2d(bspline_x, bspline_y, domain) result(derham)
64 use m_bspline, only: BSplineSpace
65 use m_mform_basis, only: MFormSpace
66 use m_tensorprod, only: TensorProdSpace
67 use m_domain, only: DomainDecomp
68
69 implicit none
70
71 type(BSplineSpace), intent(in) :: bspline_x, bspline_y
72 type(DomainDecomp), intent(in), optional :: domain
73 type(MFormSpace) :: derham(0:2)
74
75 type(TensorProdSpace) :: tp_space0
76 integer :: m
77
78 type(DomainDecomp) :: domain_
79
80
2/4
✓ Branch 7 → 8 taken 983 times.
✗ Branch 7 → 9 not taken.
✗ Branch 8 → 9 not taken.
✓ Branch 8 → 17 taken 983 times.
983 if (bspline_x%degree <= 0 .or. bspline_y%degree <= 0) then
81 write (*, '(A,2I0)') "ERROR in DeRhamSequence_2d: all B-spline spaces of the 0-form space must have degree > 0. " &
82 //"Got degrees [x, y] = [", bspline_x%degree, ", ", bspline_y%degree, "]"
83 error stop 1
84 end if
85
86
2/2
✓ Branch 17 → 18 taken 848 times.
✓ Branch 17 → 19 taken 135 times.
983 if (present(domain)) then
87 848 domain_ = domain
88 else
89 135 domain_ = DomainDecomp(dimensionality=2)
90 end if
91
92 983 tp_space0 = TensorProdSpace(bspline_x, bspline_y, BSplineSpace(1, 0, is_periodic=.false.), domain=domain_)
93
94
2/2
✓ Branch 22 → 23 taken 2949 times.
✓ Branch 22 → 27 taken 983 times.
3932 do m = 0, 2
95
1/2
✗ Branch 24 → 25 not taken.
✓ Branch 24 → 26 taken 2949 times.
3932 derham(m) = MFormSpace(m, tp_space0)
96 end do
97
2/2
✓ Branch 5 → 6 taken 2949 times.
✓ Branch 5 → 7 taken 983 times.
3932 end function DeRhamSequence_2d
98
99 !> @brief Create a 1D DeRham sequence of m-forms from a tensor product B-spline basis
100 !>
101 !> @param[in] bspline_x B-spline basis in x direction
102 !> @param[in] domain _(optional)_ Domain decomposition
103 !>
104 !> @return DeRham sequence (space of 0-forms, 1-forms)
105
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 567 times.
567 function DeRhamSequence_1d(bspline_x, domain) result(derham)
106 use m_bspline, only: BSplineSpace
107 use m_mform_basis, only: MFormSpace
108 use m_tensorprod, only: TensorProdSpace
109 use m_domain, only: DomainDecomp
110
111 implicit none
112
113 type(BSplineSpace), intent(in) :: bspline_x
114 type(DomainDecomp), intent(in), optional :: domain
115 type(MFormSpace) :: derham(0:1)
116
117 type(TensorProdSpace) :: tp_space0
118 integer :: m
119
120 type(DomainDecomp) :: domain_
121
122
1/2
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 14 taken 567 times.
567 if (bspline_x%degree <= 0) then
123 write (*, '(A,I0)') "ERROR in DeRhamSequence_1d: all B-spline spaces of the 0-form space must have degree > 0. " &
124 //"Got degree [x] = [", bspline_x%degree, "]"
125 error stop 1
126 end if
127
128
2/2
✓ Branch 14 → 15 taken 512 times.
✓ Branch 14 → 16 taken 55 times.
567 if (present(domain)) then
129 512 domain_ = domain
130 else
131 55 domain_ = DomainDecomp(dimensionality=1)
132 end if
133
134 tp_space0 = TensorProdSpace(bspline_x, BSplineSpace(1, 0, is_periodic=.false.), BSplineSpace(1, 0, is_periodic=.false.), &
135 567 domain=domain_)
136
137
2/2
✓ Branch 19 → 20 taken 1134 times.
✓ Branch 19 → 24 taken 567 times.
1701 do m = 0, 1
138
1/2
✗ Branch 21 → 22 not taken.
✓ Branch 21 → 23 taken 1134 times.
1701 derham(m) = MFormSpace(m, tp_space0)
139 end do
140
2/2
✓ Branch 5 → 6 taken 1134 times.
✓ Branch 5 → 7 taken 567 times.
1701 end function DeRhamSequence_1d
141
142 !> @brief Create a 2D DeRham sequence of m-forms from a tensor product B-spline basis with 3 components for vector-valued forms
143 !>
144 !> @param[in] bspline_x B-spline basis in x direction
145 !> @param[in] bspline_y B-spline basis in y direction
146 !> @param[in] domain _(optional)_ Domain decomposition
147 !>
148 !> @return DeRham sequence (space of 0-forms, 1-forms, 2-forms, 3-forms)
149
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 16 times.
16 function DeRhamSequence3C_2d(bspline_x, bspline_y, domain) result(derham)
150 use m_bspline, only: BSplineSpace
151 use m_mform_basis, only: MFormSpace
152 use m_tensorprod, only: TensorProdSpace
153 use m_domain, only: DomainDecomp
154
155 implicit none
156
157 type(BSplineSpace), intent(in) :: bspline_x, bspline_y
158 type(DomainDecomp), intent(in), optional :: domain
159 type(MFormSpace) :: derham(0:3)
160
161 type(TensorProdSpace) :: tp_space0
162 integer :: m
163
164 type(DomainDecomp) :: domain_
165
166
2/4
✓ Branch 7 → 8 taken 16 times.
✗ Branch 7 → 9 not taken.
✗ Branch 8 → 9 not taken.
✓ Branch 8 → 17 taken 16 times.
16 if (bspline_x%degree <= 0 .or. bspline_y%degree <= 0) then
167 write (*, '(A,2I0)') "ERROR in DeRhamSequence3C_2d: all B-spline spaces of the 0-form space must have degree > 0. " &
168 //"Got degrees [x, y] = [", bspline_x%degree, ", ", bspline_y%degree, "]"
169 error stop 1
170 end if
171
172
1/2
✗ Branch 17 → 18 not taken.
✓ Branch 17 → 19 taken 16 times.
16 if (present(domain)) then
173 domain_ = domain
174 else
175 16 domain_ = DomainDecomp(dimensionality=2)
176 end if
177
178 ! We use a periodic, degree 1, B-spline in the z-direction; this is a hack to create a 3-component space for vector-valued forms
179 ! Note that there is only one degree 1 B-spline when a single interval is used, a self-overlapping hat function which, when
180 ! adding the overlap, simple results in the constant function. This means that despite the function being constant in the
181 ! z-direction, the derivative space is non-empty
182 16 tp_space0 = TensorProdSpace(bspline_x, bspline_y, BSplineSpace(1, 0, is_periodic=.true.), domain=domain_)
183
184
2/2
✓ Branch 22 → 23 taken 64 times.
✓ Branch 22 → 27 taken 16 times.
80 do m = 0, 3
185
1/2
✗ Branch 24 → 25 not taken.
✓ Branch 24 → 26 taken 64 times.
80 derham(m) = MFormSpace(m, tp_space0, allow_periodic_degree0=.true.)
186 end do
187
2/2
✓ Branch 5 → 6 taken 64 times.
✓ Branch 5 → 7 taken 16 times.
80 end function DeRhamSequence3C_2d
188
189 !> @brief Create a 1D DeRham sequence of m-forms from a tensor product B-spline basis with 3 components for vector-valued forms
190 !>
191 !> @param[in] bspline_x B-spline basis in x direction
192 !> @param[in] domain _(optional)_ Domain decomposition
193 !>
194 !> @return DeRham sequence (space of 0-forms, 1-forms, 2-forms, 3-forms)
195
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 48 times.
48 function DeRhamSequence3C_1d(bspline_x, domain) result(derham)
196 use m_bspline, only: BSplineSpace
197 use m_mform_basis, only: MFormSpace
198 use m_tensorprod, only: TensorProdSpace
199 use m_domain, only: DomainDecomp
200
201 implicit none
202
203 type(BSplineSpace), intent(in) :: bspline_x
204 type(DomainDecomp), intent(in), optional :: domain
205 type(MFormSpace) :: derham(0:3)
206
207 type(TensorProdSpace) :: tp_space0
208 integer :: m
209
210 type(DomainDecomp) :: domain_
211
212
1/2
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 14 taken 48 times.
48 if (bspline_x%degree <= 0) then
213 write (*, '(A,I0)') "ERROR in DeRhamSequence3C_1d: all B-spline spaces of the 0-form space must have degree > 0. " &
214 //"Got degree [x] = [", bspline_x%degree, "]"
215 error stop 1
216 end if
217
218
1/2
✗ Branch 14 → 15 not taken.
✓ Branch 14 → 16 taken 48 times.
48 if (present(domain)) then
219 domain_ = domain
220 else
221 48 domain_ = DomainDecomp(dimensionality=1)
222 end if
223
224 tp_space0 = TensorProdSpace(bspline_x, BSplineSpace(1, 0, is_periodic=.true.), BSplineSpace(1, 0, is_periodic=.true.), &
225 48 domain=domain_)
226
227
2/2
✓ Branch 19 → 20 taken 192 times.
✓ Branch 19 → 24 taken 48 times.
240 do m = 0, 3
228
1/2
✗ Branch 21 → 22 not taken.
✓ Branch 21 → 23 taken 192 times.
240 derham(m) = MFormSpace(m, tp_space0, allow_periodic_degree0=.true.)
229 end do
230
2/2
✓ Branch 5 → 6 taken 192 times.
✓ Branch 5 → 7 taken 48 times.
240 end function DeRhamSequence3C_1d
231
232 end module m_mform_derham
233