11 #include "sll_assert.h"
12 #include "sll_errors.h"
13 #include "sll_memory.h"
14 #include "sll_working_precision.h"
69 sll_real64,
parameter ::
inv_2 = 1._f64/2._f64
70 sll_real64,
parameter ::
inv_3 = 1._f64/3._f64
71 sll_real64,
parameter ::
inv_4 = 1._f64/4._f64
72 sll_real64,
parameter ::
inv_6 = 1._f64/6._f64
73 sll_real64,
parameter ::
inv_7 = 1._f64/7._f64
74 sll_real64,
parameter ::
inv_8 = 1._f64/8._f64
75 sll_real64,
parameter ::
inv_12 = 1._f64/12._f64
76 sll_real64,
parameter ::
inv_16 = 1._f64/16._f64
77 sll_real64,
parameter ::
inv_18 = 1._f64/18._f64
78 sll_real64,
parameter ::
inv_20 = 1._f64/20._f64
79 sll_real64,
parameter ::
inv_24 = 1._f64/24._f64
80 sll_real64,
parameter ::
inv_30 = 1._f64/30._f64
81 sll_real64,
parameter ::
inv_36 = 1._f64/36._f64
82 sll_real64,
parameter ::
inv_48 = 1._f64/48._f64
83 sll_real64,
parameter ::
inv_60 = 1._f64/60._f64
84 sll_real64,
parameter ::
inv_72 = 1._f64/72._f64
85 sll_real64,
parameter ::
inv_80 = 1._f64/80._f64
86 sll_real64,
parameter ::
inv_120 = 1._f64/120._f64
87 sll_real64,
parameter ::
inv_240 = 1._f64/240._f64
88 sll_real64,
parameter ::
inv_144 = 1._f64/144._f64
90 sll_real64,
parameter ::
inv_720 = 1._f64/720._f64
91 sll_real64,
parameter ::
inv_5040 = 1._f64/5040._f64
96 sll_real64,
allocatable :: poly_coeffs(:, :)
97 sll_real64,
allocatable :: poly_coeffs_fp(:, :)
98 sll_real64,
allocatable :: poly_coeffs_fpa(:, :)
99 sll_real64,
allocatable :: poly_coeffs_fd(:, :)
101 sll_int32 :: n_coeffs
102 sll_real64,
allocatable :: scratch_b(:)
103 sll_real64,
allocatable :: scratch_p(:)
105 sll_real64,
allocatable :: poly_coeffs_boundary_left(:, :, :)
106 sll_real64,
allocatable :: poly_coeffs_boundary_right(:, :, :)
107 sll_real64,
allocatable :: poly_coeffs_fd_boundary_left(:, :, :)
108 sll_real64,
allocatable :: poly_coeffs_fd_boundary_right(:, :, :)
125 sll_real64,
allocatable :: scratch_b(:)
126 sll_real64,
allocatable :: scratch_p(:)
127 sll_real64,
allocatable :: scratch_pp(:)
128 sll_real64,
allocatable :: scratch_coeffs(:, :)
137 sll_int32,
intent(in) :: n_cells
138 sll_real64,
intent(out) :: b_coeffs(0:n_cells - 1)
139 sll_real64,
intent(in):: pp_coeffs(self%degree + 1, 0:n_cells - 1)
141 sll_int32 :: i, j, imin
144 do i = 0, n_cells - 1
145 imin = i - self%degree
146 do j = 0, self%degree
147 b_coeffs(modulo(imin + j, n_cells)) = b_coeffs(modulo(imin + j, n_cells)) + &
148 sum(pp_coeffs(:, i)*self%poly_coeffs(:, j + 1))
157 sll_int32,
intent(in) :: n_cells
158 sll_real64,
intent(in) :: b_coeffs(n_cells + self%degree)
159 sll_real64,
intent(out):: pp_coeffs(self%degree + 1, n_cells)
160 sll_int32 :: i, upper
162 do i = 1, self%degree - 1
164 b_coeffs(i:i + self%degree), pp_coeffs(:, i))
167 upper = n_cells - self%degree + 1
168 do i = self%degree, upper
170 b_coeffs(i:i + self%degree), pp_coeffs(:, i))
173 do i = upper + 1, n_cells
175 b_coeffs(i:i + self%degree), pp_coeffs(:, i))
183 sll_int32,
intent(in) :: n_cells
184 sll_real64,
intent(in) :: b_coeffs(n_cells + self%degree - 1)
185 sll_real64,
intent(out):: pp_coeffs(self%degree + 1, n_cells)
186 sll_int32 :: i, upper
188 do i = 1, self%degree - 1
190 b_coeffs(i:i + self%degree), pp_coeffs(:, i))
193 upper = n_cells - self%degree + 1
194 do i = self%degree, upper
196 b_coeffs(i:i + self%degree), pp_coeffs(:, i))
199 do i = upper + 1, n_cells - 1
201 b_coeffs(i:i + self%degree), pp_coeffs(:, i))
204 [b_coeffs(i:i + self%degree - 1), 0.0_f64], pp_coeffs(:, i))
211 sll_int32,
intent(in) :: n_cells
212 sll_real64,
intent(in) :: b_coeffs(n_cells)
213 sll_real64,
intent(out):: pp_coeffs(self%degree + 1, n_cells)
216 do i = 1, self%degree
220 do i = self%degree + 1, n_cells
229 sll_real64,
intent(in) :: b_coeffs(self%degree + 1)
230 sll_real64,
intent(out) :: pp_coeffs(self%degree + 1)
234 degp1 = self%degree + 1
238 pp_coeffs(j) = pp_coeffs(j) + b_coeffs(i)*self%poly_coeffs(j, i)
246 sll_int32,
intent(in) :: degree
247 sll_real64,
intent(in) :: pp_b(degree + 1, degree + 1)
248 sll_real64,
intent(in) :: b_coeffs(degree + 1)
249 sll_real64,
intent(out) :: pp_coeffs(degree + 1)
257 pp_coeffs(j) = pp_coeffs(j) + b_coeffs(i)*pp_b(j, i)
267 sll_int32,
intent(in) :: n_cells(2)
268 sll_real64,
intent(in) :: b_coeffs(n_cells(1)*n_cells(2))
269 sll_real64,
intent(out):: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1), n_cells(1)*n_cells(2))
271 sll_int32 :: degree1, degree2
272 degree1 = self%spline1%degree
273 degree2 = self%spline2%degree
286 sll_int32,
intent(in) :: n_cells(2)
287 sll_real64,
intent(in) :: b_coeffs(:)
288 sll_real64,
intent(out):: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1), n_cells(1)*n_cells(2))
289 sll_int32 :: i, j, l1, l2
290 sll_int32 :: degree1, degree2
291 sll_real64 :: pp_coeffs_local(self%spline1%degree + 1, self%spline2%degree + 1)
292 sll_int32 :: offset1, offset2, cell, n_coeffs(2), index, upper(2)
294 degree1 = self%spline1%degree
295 degree2 = self%spline2%degree
296 n_coeffs(1) = self%spline1%n_coeffs
297 n_coeffs(2) = self%spline2%n_coeffs
299 select case (self%spline1%boundary_conditions)
308 upper(1) = n_cells(1) - degree1 + 1
309 upper(2) = n_cells(2) - degree2 + 1
312 cell = (j - 1)*n_cells(1) + i
314 select case (self%spline2%boundary_conditions)
316 offset2 = modulo(j - degree2 + l2 - 1, n_coeffs(2))*n_coeffs(1)
318 offset2 = (j + l2 - 2)*n_coeffs(1)
319 if (j == 1 .and. l2 == 0)
then
320 pp_coeffs_local(:, 1) = 0.0_f64
325 elseif (j == n_cells(2) .and. l2 == degree2)
then
326 pp_coeffs_local(:, degree2 + 1) = 0.0_f64
332 offset2 = (j + l2 - 1)*n_coeffs(1)
333 if (j == n_cells(2) .and. l2 == degree2)
then
334 pp_coeffs_local(:, degree2 + 1) = 0.0_f64
340 offset2 = (j + l2 - 2)*n_coeffs(1)
341 if (j == 1 .and. l2 == 0)
then
342 pp_coeffs_local(:, 1) = 0.0_f64
350 offset2 = (j + l2 - 1)*n_coeffs(1)
354 select case (self%spline1%boundary_conditions)
356 index = modulo(i + offset1 + l1 - 1, n_coeffs(1)) + 1
358 self%spline1%scratch_b(l1 + 1) = b_coeffs(offset2 + index)
360 index = i + offset1 + l1
361 self%spline1%scratch_b(l1 + 1) = b_coeffs(offset2 + index)
364 index = i + offset1 + l1
365 self%spline1%scratch_b(l1 + 1) = b_coeffs(offset2 + index)
368 index = i + offset1 + l1
369 self%spline1%scratch_b(l1 + 1) = b_coeffs(offset2 + index)
372 if (i == n_cells(1) .and. l1 == degree1)
then
373 self%spline1%scratch_b(l1 + 1) = 0.0_f64
375 index = i + offset1 + l1
376 self%spline1%scratch_b(l1 + 1) = b_coeffs(offset2 + index)
379 if (i == 1 .and. l1 == 0)
then
380 self%spline1%scratch_b(l1 + 1) = 0.0_f64
382 index = i + offset1 + l1
383 self%spline1%scratch_b(l1 + 1) = b_coeffs(offset2 + index)
386 if (i == 1 .and. l1 == 0)
then
387 self%spline1%scratch_b(l1 + 1) = 0.0_f64
388 elseif (i == n_cells(1) .and. l1 == degree1)
then
389 self%spline1%scratch_b(l1 + 1) = 0.0_f64
391 index = i + offset1 + l1
392 self%spline1%scratch_b(l1 + 1) = b_coeffs(offset2 + index)
397 select case (self%spline1%boundary_conditions)
400 self%spline1%scratch_b, pp_coeffs_local(:, l2 + 1))
402 if (i > degree1 - 1)
then
403 if (i < upper(1) + 1)
then
405 self%spline1%scratch_b, pp_coeffs_local(:, l2 + 1))
408 self%spline1%poly_coeffs_boundary_right(:, :, i - upper(1)), &
409 self%spline1%scratch_b, pp_coeffs_local(:, l2 + 1))
414 self%spline1%poly_coeffs_boundary_left(:, :, i), &
415 self%spline1%scratch_b, pp_coeffs_local(:, l2 + 1))
424 self%spline2%scratch_b = pp_coeffs_local(l1 + 1, :)
425 select case (self%spline2%boundary_conditions)
428 self%spline2%scratch_b, self%spline2%scratch_p)
430 if (j > degree2 - 1)
then
431 if (j < upper(2) + 1)
then
433 self%spline2%poly_coeffs, &
434 self%spline2%scratch_b, self%spline2%scratch_p)
437 self%spline2%poly_coeffs_boundary_right(:, :, j - upper(2)), &
438 self%spline2%scratch_b, self%spline2%scratch_p)
443 self%spline2%poly_coeffs_boundary_left(:, :, j), &
444 self%spline2%scratch_b, self%spline2%scratch_p)
452 pp_coeffs(l2*(degree1 + 1) + l1 + 1, cell) = self%spline2%scratch_p(l2 + 1)
480 sll_int32,
intent(in) :: n_cells(2)
481 sll_real64,
intent(in) :: b_coeffs(n_cells(1)*n_cells(2))
482 sll_real64,
intent(inout) :: pp_coeffs((spline1%degree + 1)*(spline2%degree + 1), n_cells(1)*n_cells(2))
483 sll_int32,
intent(in) :: i, j
485 sll_int32 :: degree1, degree2, degp1, degp2
486 degree1 = spline1%degree
487 degree2 = spline2%degree
491 if (i > degree1)
then
492 if (j > degree2)
then
494 spline1%scratch_b = b_coeffs(i - degree1 + (j - degp2 + l)*n_cells(1):i + (j - degp2 + l)*n_cells(1))
500 spline1%scratch_b = b_coeffs(i - degree1 + modulo(j - degp2 + l, n_cells(2))*n_cells(1):i + modulo(j - degp2 + l, n_cells(2))*n_cells(1))
508 spline1%scratch_b(k + 1) = b_coeffs(modulo(i - degp1 + k, n_cells(1)) + 1 + modulo(j - degp2 + l, n_cells(2))*n_cells(1))
518 spline2%scratch_b(l) = pp_coeffs(k + degp1*(l - 1), i + n_cells(1)*(j - 1))
522 pp_coeffs(k + degp1*(l - 1), i + n_cells(1)*(j - 1)) = spline2%scratch_p(l)
530 sll_int32,
intent(in) :: n_cells(3)
531 sll_real64,
intent(in) :: b_coeffs(n_cells(1)*n_cells(2), n_cells(2))
532 sll_real64,
intent(out):: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1)*(self%spline3%degree + 1), n_cells(1)*n_cells(2)*n_cells(3))
548 sll_int32,
intent(in) :: n_cells(3)
549 sll_real64,
intent(in) :: b_coeffs(n_cells(1)*n_cells(2)*n_cells(3))
550 sll_real64,
intent(inout) :: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1)*(self%spline3%degree + 1), n_cells(1)*n_cells(2)*n_cells(3))
551 sll_int32,
intent(in) :: i, j, k
554 sll_int32 :: degree1, degree2, degree3, degp1, degp2, degp3
555 degree1 = self%spline1%degree
556 degree2 = self%spline2%degree
557 degree3 = self%spline3%degree
562 if (i > degree1)
then
563 if (j > degree2)
then
564 if (k > degree3)
then
567 self%spline1%scratch_b = b_coeffs(i - degree1 + (j - degp2 + m)*n_cells(1) + (k - degp3 + n)*n_cells(1)*n_cells(2):i + (j - degp2 + m)*n_cells(1) + (k - degp3 + n)*n_cells(1)*n_cells(2))
575 self%spline1%scratch_b = b_coeffs(i - degree1 + (j - degp2 + m)*n_cells(1) + modulo(k - degp3 + n, n_cells(3))*n_cells(1)*n_cells(2):i + (j - degp2 + m)*n_cells(1) + modulo(k - degp3 + n, n_cells(3))*n_cells(1)*n_cells(2))
584 self%spline1%scratch_b = b_coeffs(i - degree1 + modulo(j - degp2 + m, n_cells(2))*n_cells(1) + modulo(k - degp3 + n, n_cells(3))*n_cells(1)*n_cells(2):i + modulo(j - degp2 + m, n_cells(2))*n_cells(1) + modulo(k - degp3 + n, n_cells(3))*n_cells(1)*n_cells(2))
594 self%spline1%scratch_b(l + 1) = b_coeffs(modulo(i - degp1 + l, n_cells(1)) + 1 + modulo(j - degp2 + m, n_cells(2))*n_cells(1) + modulo(k - degp3 + n, n_cells(3))*n_cells(1)*n_cells(2))
605 self%spline2%scratch_b(m) = self%scratch_pp(l + degp1*(m - 1) + degp1*degp2*(n - 1))
609 self%scratch_pp(l + degp1*(m - 1) + degp1*degp2*(n - 1)) = self%spline2%scratch_p(m)
618 self%spline3%scratch_b(n) = self%scratch_pp(l + degp1*(m - 1) + degp1*degp2*(n - 1))
622 pp_coeffs(l + degp1*(m - 1) + degp1*degp2*(n - 1), i + n_cells(1)*(j - 1) + n_cells(1)*n_cells(2)*(k - 1)) = self%spline3%scratch_p(n)
632 sll_int32,
intent(in) :: n_cells(3)
633 sll_real64,
intent(in) :: b_coeffs((n_cells(1) + self%spline1%degree)*n_cells(2)*n_cells(3))
634 sll_real64,
intent(inout) :: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1)*(self%spline3%degree + 1), n_cells(1)*n_cells(2)*n_cells(3))
635 sll_int32,
intent(in) :: i, j, k
638 sll_int32 :: degree1, degree2, degree3, degp1, degp2, degp3, n_dofs
639 degree1 = self%spline1%degree
640 degree2 = self%spline2%degree
641 degree3 = self%spline3%degree
645 n_dofs = n_cells(1) + degree1
647 if (i >= degree1 .and. i < n_cells(1) - degree1 + 2)
then
648 if (j > degree2)
then
649 if (k > degree3)
then
652 self%spline1%scratch_b = b_coeffs(i + (j - degp2 + m)*n_dofs + (k - degp3 + n)*n_dofs*n_cells(2):i + degree1 + (j - degp2 + m)*n_dofs + (k - degp3 + n)*n_dofs*n_cells(2))
660 self%spline1%scratch_b = b_coeffs(i + (j - degp2 + m)*n_dofs + modulo(k - degp3 + n, n_cells(3))*n_dofs*n_cells(2):i + degree1 + (j - degp2 + m)*n_dofs + modulo(k - degp3 + n, n_cells(3))*n_dofs*n_cells(2))
669 self%spline1%scratch_b = b_coeffs(i + modulo(j - degp2 + m, n_cells(2))*n_dofs + modulo(k - degp3 + n, n_cells(3))*n_dofs*n_cells(2):i + degree1 + modulo(j - degp2 + m, n_cells(2))*n_dofs + modulo(k - degp3 + n, n_cells(3))*n_dofs*n_cells(2))
674 else if (i < degree1)
then
679 self%spline1%scratch_b(l + 1) = b_coeffs(i + l + modulo(j - degp2 + m, n_cells(2))*n_dofs + modulo(k - degp3 + n, n_cells(3))*n_dofs*n_cells(2))
681 call sll_s_spline_pp_b_to_pp_1d_cella(degree1, self%spline1%poly_coeffs_boundary_left(:, :, i), self%spline1%scratch_b, self%scratch_pp(1 + m*degp1 + n*degp1*degp2:degp1*(1 + m + n*degp2)))
684 else if (i >= n_cells(1) - degree1 + 2)
then
689 self%spline1%scratch_b(l + 1) = b_coeffs(i + l + modulo(j - degp2 + m, n_cells(2))*n_dofs + modulo(k - degp3 + n, n_cells(3))*n_dofs*n_cells(2))
691 call sll_s_spline_pp_b_to_pp_1d_cella(degree1, self%spline1%poly_coeffs_boundary_right(:, :, i - (n_cells(1) - degree1 + 1)), self%spline1%scratch_b, self%scratch_pp(1 + m*degp1 + n*degp1*degp2:degp1*(1 + m + n*degp2)))
700 self%spline2%scratch_b(m) = self%scratch_pp(l + degp1*(m - 1) + degp1*degp2*(n - 1))
704 self%scratch_pp(l + degp1*(m - 1) + degp1*degp2*(n - 1)) = self%spline2%scratch_p(m)
713 self%spline3%scratch_b(n) = self%scratch_pp(l + degp1*(m - 1) + degp1*degp2*(n - 1))
717 pp_coeffs(l + degp1*(m - 1) + degp1*degp2*(n - 1), i + n_cells(1)*(j - 1) + n_cells(1)*n_cells(2)*(k - 1)) = self%spline3%scratch_p(n)
726 sll_int32,
intent(in) :: n_cells(3)
727 sll_real64,
intent(in) :: b_coeffs((n_cells(1) + self%spline1%degree)*n_cells(2)*(n_cells(3) + self%spline3%degree))
728 sll_real64,
intent(inout) :: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1)*(self%spline3%degree + 1), n_cells(1)*n_cells(2)*n_cells(3))
729 sll_int32,
intent(in) :: i, j, k
732 sll_int32 :: deg(3), degp(3), n_dofs(3), upper(3)
733 deg(1) = self%spline1%degree
734 deg(2) = self%spline2%degree
735 deg(3) = self%spline3%degree
737 n_dofs = n_cells + deg
738 n_dofs(2) = n_cells(2)
739 upper = n_cells - deg + 1
741 if (i >= deg(1) .and. i <= upper(1))
then
745 self%spline1%scratch_b = b_coeffs(i + (j - degp(2) + m)*n_dofs(1) + (k - 1 + n)*n_dofs(1)*n_dofs(2):i + deg(1) + (j - degp(2) + m)*n_dofs(1) + (k - 1 + n)*n_dofs(1)*n_dofs(2))
746 call sll_s_spline_pp_b_to_pp_1d_cell(self%spline1, self%spline1%scratch_b, self%scratch_pp(1 + m*degp(1) + n*degp(1)*degp(2):degp(1)*(1 + m + n*degp(2))))
753 self%spline1%scratch_b = b_coeffs(i + modulo(j - degp(2) + m, n_cells(2))*n_dofs(1) + (k - 1 + n)*n_dofs(1)*n_dofs(2):i + deg(1) + modulo(j - degp(2) + m, n_cells(2))*n_dofs(1) + (k - 1 + n)*n_dofs(1)*n_dofs(2))
754 call sll_s_spline_pp_b_to_pp_1d_cell(self%spline1, self%spline1%scratch_b, self%scratch_pp(1 + m*degp(1) + n*degp(1)*degp(2):degp(1)*(1 + m + n*degp(2))))
758 else if (i < deg(1))
then
762 self%spline1%scratch_b(l + 1) = b_coeffs(i + l + modulo(j - degp(2) + m, n_cells(2))*n_dofs(1) + (k + n - 1)*n_dofs(1)*n_dofs(2))
764 call sll_s_spline_pp_b_to_pp_1d_cella(deg(1), self%spline1%poly_coeffs_boundary_left(:, :, i), self%spline1%scratch_b, self%scratch_pp(1 + m*degp(1) + n*degp(1)*degp(2):degp(1)*(1 + m + n*degp(2))))
767 else if (i > upper(1))
then
771 self%spline1%scratch_b(l + 1) = b_coeffs(i + l + modulo(j - degp(2) + m, n_cells(2))*n_dofs(1) + (k + n - 1)*n_dofs(1)*n_dofs(2))
773 call sll_s_spline_pp_b_to_pp_1d_cella(deg(1), self%spline1%poly_coeffs_boundary_right(:, :, i - upper(1)), self%spline1%scratch_b, self%scratch_pp(1 + m*degp(1) + n*degp(1)*degp(2):degp(1)*(1 + m + n*degp(2))))
782 self%spline2%scratch_b(m + 1) = self%scratch_pp(1 + l + degp(1)*m + degp(1)*degp(2)*n)
786 self%scratch_pp(1 + l + m*degp(1) + n*degp(1)*degp(2)) = self%spline2%scratch_p(m + 1)
792 if (k >= deg(3) .and. k <= upper(3))
then
796 self%spline3%scratch_b(n + 1) = self%scratch_pp(1 + l + degp(1)*m + degp(1)*degp(2)*n)
800 pp_coeffs(1 + l + m*degp(1) + n*degp(1)*degp(2), i + (j - 1)*n_cells(1) + (k - 1)*n_cells(1)*n_cells(2)) = self%spline3%scratch_p(n + 1)
804 else if (k < deg(3))
then
808 self%spline3%scratch_b(n + 1) = self%scratch_pp(1 + l + degp(1)*m + degp(1)*degp(2)*n)
812 pp_coeffs(1 + l + m*degp(1) + n*degp(1)*degp(2), i + (j - 1)*n_cells(1) + (k - 1)*n_cells(1)*n_cells(2)) = self%spline3%scratch_p(n + 1)
816 else if (k > upper(3))
then
820 self%spline3%scratch_b(n + 1) = self%scratch_pp(1 + l + degp(1)*m + degp(1)*degp(2)*n)
824 pp_coeffs(1 + l + m*degp(1) + n*degp(1)*degp(2), i + (j - 1)*n_cells(1) + (k - 1)*n_cells(1)*n_cells(2)) = self%spline3%scratch_p(n + 1)
835 sll_int32,
intent(in) :: n_cells(3)
836 sll_real64,
intent(in) :: b_coeffs((n_cells(1) + self%spline1%degree)*(n_cells(2) + self%spline2%degree)*(n_cells(3) + self%spline3%degree))
837 sll_real64,
intent(inout) :: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1)*(self%spline3%degree + 1), n_cells(1)*n_cells(2)*n_cells(3))
838 sll_int32,
intent(in) :: i, j, k
841 sll_int32 :: deg(3), degp(3), n_dofs(3), upper(3)
842 deg(1) = self%spline1%degree
843 deg(2) = self%spline2%degree
844 deg(3) = self%spline3%degree
846 n_dofs = n_cells + deg
847 upper = n_cells - deg + 1
849 if (i >= deg(1) .and. i <= upper(1))
then
852 self%spline1%scratch_b = b_coeffs(i + (j - 1 + m)*n_dofs(1) + (k - 1 + n)*n_dofs(1)*n_dofs(2):i + deg(1) + (j - 1 + m)*n_dofs(1) + (k - 1 + n)*n_dofs(1)*n_dofs(2))
853 call sll_s_spline_pp_b_to_pp_1d_cell(self%spline1, self%spline1%scratch_b, self%scratch_pp(1 + m*degp(1) + n*degp(1)*degp(2):degp(1)*(1 + m + n*degp(2))))
856 else if (i < deg(1))
then
860 self%spline1%scratch_b(l + 1) = b_coeffs(i + l + (j + m - 1)*n_dofs(1) + (k + n - 1)*n_dofs(1)*n_dofs(2))
862 call sll_s_spline_pp_b_to_pp_1d_cella(deg(1), self%spline1%poly_coeffs_boundary_left(:, :, i), self%spline1%scratch_b, self%scratch_pp(1 + m*degp(1) + n*degp(1)*degp(2):degp(1)*(1 + m + n*degp(2))))
865 else if (i > upper(1))
then
869 self%spline1%scratch_b(l + 1) = b_coeffs(i + l + (j + m - 1)*n_dofs(1) + (k + n - 1)*n_dofs(1)*n_dofs(2))
871 call sll_s_spline_pp_b_to_pp_1d_cella(deg(1), self%spline1%poly_coeffs_boundary_right(:, :, i - upper(1)), self%spline1%scratch_b, self%scratch_pp(1 + m*degp(1) + n*degp(1)*degp(2):degp(1)*(1 + m + n*degp(2))))
877 if (j >= deg(2) .and. j <= upper(2))
then
881 self%spline2%scratch_b(m + 1) = self%scratch_pp(1 + l + degp(1)*m + degp(1)*degp(2)*n)
885 self%scratch_pp(1 + l + m*degp(1) + n*degp(1)*degp(2)) = self%spline2%scratch_p(m + 1)
889 else if (j < deg(2))
then
893 self%spline2%scratch_b(m + 1) = self%scratch_pp(1 + l + degp(1)*m + degp(1)*degp(2)*n)
897 self%scratch_pp(1 + l + m*degp(1) + n*degp(1)*degp(2)) = self%spline2%scratch_p(m + 1)
901 else if (j > upper(2))
then
905 self%spline2%scratch_b(m + 1) = self%scratch_pp(1 + l + degp(1)*m + degp(1)*degp(2)*n)
909 self%scratch_pp(1 + l + m*degp(1) + n*degp(1)*degp(2)) = self%spline2%scratch_p(m + 1)
916 if (k >= deg(3) .and. k <= upper(3))
then
920 self%spline3%scratch_b(n + 1) = self%scratch_pp(1 + l + degp(1)*m + degp(1)*degp(2)*n)
924 pp_coeffs(1 + l + m*degp(1) + n*degp(1)*degp(2), i + (j - 1)*n_cells(1) + (k - 1)*n_cells(1)*n_cells(2)) = self%spline3%scratch_p(n + 1)
928 else if (k < deg(3))
then
932 self%spline3%scratch_b(n + 1) = self%scratch_pp(1 + l + degp(1)*m + degp(1)*degp(2)*n)
936 pp_coeffs(1 + l + m*degp(1) + n*degp(1)*degp(2), i + (j - 1)*n_cells(1) + (k - 1)*n_cells(1)*n_cells(2)) = self%spline3%scratch_p(n + 1)
940 else if (k > upper(3))
then
944 self%spline3%scratch_b(n + 1) = self%scratch_pp(1 + l + degp(1)*m + degp(1)*degp(2)*n)
948 pp_coeffs(1 + l + m*degp(1) + n*degp(1)*degp(2), i + (j - 1)*n_cells(1) + (k - 1)*n_cells(1)*n_cells(2)) = self%spline3%scratch_p(n + 1)
959 sll_int32,
intent(in) :: n_cells(3)
960 sll_real64,
intent(in) :: b_coeffs((n_cells(1) + self%spline1%degree)*n_cells(2)*n_cells(3))
961 sll_real64,
intent(out):: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1)*(self%spline3%degree + 1), n_cells(1)*n_cells(2)*n_cells(3))
976 sll_int32,
intent(in) :: n_cells(3)
977 sll_real64,
intent(in) :: b_coeffs((n_cells(1) + self%spline1%degree)*n_cells(2)*(n_cells(3) + self%spline3%degree))
978 sll_real64,
intent(out):: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1)*(self%spline3%degree + 1), n_cells(1)*n_cells(2)*n_cells(3))
994 sll_int32,
intent(in) :: n_cells(3)
995 sll_real64,
intent(in) :: b_coeffs((n_cells(1) + self%spline1%degree)*(n_cells(2) + self%spline2%degree)*(n_cells(3) + self%spline3%degree))
996 sll_real64,
intent(out):: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1)*(self%spline3%degree + 1), n_cells(1)*n_cells(2)*n_cells(3))
1000 do j = 1, n_cells(2)
1001 do i = 1, n_cells(1)
1011 sll_int32,
intent(in) :: n_cells
1012 sll_real64,
intent(in) :: b_coeffs(n_cells + self%degree)
1013 sll_real64,
intent(out):: val(:)
1015 sll_real64 :: pp_coeffs(self%degree + 1, n_cells)
1025 sll_int32,
intent(in) :: n_cells
1026 sll_real64,
intent(in) :: b_coeffs(n_cells)
1027 sll_real64,
intent(out):: val(:)
1029 sll_real64 :: pp_coeffs(self%degree + 1, n_cells)
1039 sll_int32,
intent(in) :: n_cells
1040 sll_real64,
intent(in) :: pp_coeffs(self%degree + 1, n_cells)
1041 sll_real64,
intent(out):: val(:)
1046 val(i) = pp_coeffs(self%degree + 1, i)
1055 sll_int32,
intent(in) :: n_cells(3)
1056 sll_real64,
intent(in) :: b_coeffs((n_cells(1) + self%spline1%degree)*n_cells(2)*n_cells(3))
1057 sll_real64,
intent(out):: val(:)
1067 sll_int32,
intent(in) :: n_cells(3)
1068 sll_real64,
intent(in) :: b_coeffs(n_cells(1)*n_cells(2)*n_cells(3))
1069 sll_real64,
intent(out):: val(:)
1079 sll_int32,
intent(in) :: n_cells(3)
1080 sll_real64,
intent(in) :: pp_coeffs((self%spline1%degree + 1)*(self%spline2%degree + 1)*(self%spline3%degree + 1), n_cells(1)*n_cells(2)*n_cells(3))
1081 sll_real64,
intent(out):: val(:)
1083 sll_int32 :: i, j, k
1085 do k = 1, n_cells(3)
1086 do j = 1, n_cells(2)
1087 do i = 1, n_cells(1)
1089 val(i + (j - 1)*(n_cells(1) + 1) + (k - 1)*(n_cells(1) + 1)*(n_cells(2) + 1)) =
sll_f_spline_pp_horner_3d([self%spline1%degree, self%spline2%degree, self%spline3%degree], pp_coeffs, [0._f64, 0._f64, 0._f64], [i, j, k], n_cells)
1091 val(n_cells(1) + 1 + (j - 1)*(n_cells(1) + 1) + (k - 1)*(n_cells(1) + 1)*(n_cells(2) + 1)) =
sll_f_spline_pp_horner_3d([self%spline1%degree, self%spline2%degree, self%spline3%degree], pp_coeffs, [1._f64, 0._f64, 0._f64], [n_cells(1), j, k], n_cells)
1093 val(n_cells(1) + 1 + n_cells(2)*(n_cells(1) + 1) + (k - 1)*(n_cells(1) + 1)*(n_cells(2) + 1)) =
sll_f_spline_pp_horner_3d([self%spline1%degree, self%spline2%degree, self%spline3%degree], pp_coeffs, [1._f64, 1._f64, 0._f64], [n_cells(1), n_cells(2), k], n_cells)
1095 val(n_cells(1) + 1 + n_cells(2)*(n_cells(1) + 1) + n_cells(3)*(n_cells(1) + 1)*(n_cells(2) + 1)) =
sll_f_spline_pp_horner_3d([self%spline1%degree, self%spline2%degree, self%spline3%degree], pp_coeffs, [1._f64, 1._f64, 1._f64], [n_cells(1), n_cells(2), n_cells(3)], n_cells)
1097 do i = 1, n_cells(1)
1098 do k = 1, n_cells(3)
1099 val(i + n_cells(2)*(n_cells(1) + 1) + (k - 1)*(n_cells(1) + 1)*(n_cells(2) + 1)) =
sll_f_spline_pp_horner_3d([self%spline1%degree, self%spline2%degree, self%spline3%degree], pp_coeffs, [0._f64, 1._f64, 0._f64], [i, n_cells(2), k], n_cells)
1101 val(i + n_cells(2)*(n_cells(1) + 1) + n_cells(3)*(n_cells(1) + 1)*(n_cells(2) + 1)) =
sll_f_spline_pp_horner_3d([self%spline1%degree, self%spline2%degree, self%spline3%degree], pp_coeffs, [0._f64, 1._f64, 1._f64], [i, n_cells(2), n_cells(3)], n_cells)
1103 do j = 1, n_cells(2)
1104 do i = 1, n_cells(1)
1105 val(i + (j - 1)*(n_cells(1) + 1) + n_cells(3)*(n_cells(1) + 1)*(n_cells(2) + 1)) =
sll_f_spline_pp_horner_3d([self%spline1%degree, self%spline2%degree, self%spline3%degree], pp_coeffs, [0._f64, 0._f64, 1._f64], [i, j, n_cells(3)], n_cells)
1107 val(n_cells(1) + 1 + (j - 1)*(n_cells(1) + 1) + n_cells(3)*(n_cells(1) + 1)*(n_cells(2) + 1)) =
sll_f_spline_pp_horner_3d([self%spline1%degree, self%spline2%degree, self%spline3%degree], pp_coeffs, [1._f64, 0._f64, 1._f64], [n_cells(1), j, n_cells(3)], n_cells)
1115 sll_real64,
intent(out):: val(:)
1116 sll_int32,
intent(in) :: degree
1117 sll_real64,
intent(in) :: x
1120 do i = 1, degree + 1
1128 sll_real64,
intent(out):: val(:, :)
1129 sll_int32,
intent(in) :: degree(2)
1130 sll_real64,
intent(in) :: x(2)
1133 do i = 1, degree(1) + 1
1136 do i = 1, degree(2) + 1
1144 sll_real64,
intent(out):: val(:, :)
1145 sll_int32,
intent(in) :: degree(3)
1146 sll_real64,
intent(in) :: x(3)
1149 do i = 1, degree(1) + 1
1152 do i = 1, degree(2) + 1
1155 do i = 1, degree(3) + 1
1162 sll_real64,
intent(out):: val(:)
1163 sll_int32,
intent(in) :: degree
1164 sll_real64,
intent(in) :: pp_coeffs(:, :)
1165 sll_real64,
intent(in) :: x
1175 sll_int32,
intent(in) :: degree
1176 sll_real64,
intent(in) :: pp_coeffs(:, :)
1177 sll_real64,
intent(in) :: x
1178 sll_int32,
intent(in) :: index
1184 res = pp_coeffs(1, index)
1186 res = res*x + pp_coeffs(i + 1, index)
1192 sll_int32,
intent(in) :: degree
1193 sll_real64,
intent(in) :: pp_coeffs(:, :)
1194 sll_real64,
intent(in) :: x
1195 sll_int32,
intent(in) :: index
1201 res = pp_coeffs(1, index)*real(degree, f64)
1202 do i = 1, degree - 1
1203 res = res*x + pp_coeffs(i + 1, index)*real(degree - i, f64)
1209 sll_int32,
intent(in) :: degree(2)
1210 sll_real64,
intent(in) :: pp_coeffs(:, :)
1211 sll_real64,
intent(in) :: x(2)
1212 sll_int32,
intent(in) :: indices(2)
1213 sll_int32,
intent(in) :: n_cells(2)
1215 sll_real64 :: pp_coeffs_1d(degree(2) + 1, 1)
1219 pp_coeffs_1d(i + 1, 1) =
sll_f_spline_pp_horner_1d(degree(1), pp_coeffs(1 + i*(degree(1) + 1):(degree(1) + 1)*(i + 1), 1 + (indices(2) - 1)*n_cells(1):n_cells(1)*indices(2)), x(1), indices(1))
1227 sll_int32,
intent(in) :: degree(3)
1228 sll_real64,
intent(in) :: pp_coeffs(:, :)
1229 sll_real64,
intent(in) :: x(3)
1230 sll_int32,
intent(in) :: indices(3)
1231 sll_int32,
intent(in) :: n_cells(3)
1233 sll_real64 :: pp_coeffs_2d((degree(2) + 1)*(degree(3) + 1), 1)
1235 sll_int32 :: degp1, degp2
1236 degp1 = degree(1) + 1
1237 degp2 = degree(2) + 1
1241 pp_coeffs_2d(1 + i + j*degp2, 1) =
sll_f_spline_pp_horner_1d(degree(1), pp_coeffs(1 + i*degp1 + j*degp1*degp2:degp1 + i*degp1 + j*degp1*degp2, 1 + n_cells(1)*(indices(2) - 1 + (indices(3) - 1)*n_cells(2)):n_cells(1)*(indices(2) + (indices(3) - 1)*n_cells(2))), x(1), indices(1))
1251 sll_int32,
intent(in) :: degree(3)
1252 sll_real64,
intent(in) :: pp_coeffs(:, :)
1253 sll_real64,
intent(in) :: x(3)
1254 sll_int32,
intent(in) :: indices(3)
1255 sll_int32,
intent(in) :: n_cells(3)
1257 sll_real64 :: pp_coeffs_2d((degree(2) + 1)*(degree(3) + 1), 1)
1258 sll_real64 :: pp_coeffs_1d(degree(3) + 1, 1)
1260 sll_int32 :: degp1, degp2
1261 degp1 = degree(1) + 1
1262 degp2 = degree(2) + 1
1266 pp_coeffs_2d(1 + i + j*degp2, 1) =
sll_f_spline_pp_horner_derivative_1d(degree(1), pp_coeffs(1 + i*degp1 + j*degp1*degp2:degp1 + i*degp1 + j*degp1*degp2, indices(1) + n_cells(1)*(indices(2) - 1 + (indices(3) - 1)*n_cells(2)):indices(1) + n_cells(1)*(indices(2) - 1 + (indices(3) - 1)*n_cells(2))), x(1), 1)
1274 pp_coeffs_1d(i + 1, 1) =
sll_f_spline_pp_horner_1d(degree(2), pp_coeffs_2d(1 + i*(degree(2) + 1):(degree(2) + 1)*(i + 1), :), x(2), 1)
1283 sll_int32,
intent(in) :: degree(3)
1284 sll_real64,
intent(in) :: pp_coeffs(:, :)
1285 sll_real64,
intent(in) :: x(3)
1286 sll_int32,
intent(in) :: indices(3)
1287 sll_int32,
intent(in) :: n_cells(3)
1289 sll_real64 :: pp_coeffs_2d((degree(2) + 1)*(degree(3) + 1), 1)
1290 sll_real64 :: pp_coeffs_1d(degree(3) + 1, 1)
1292 sll_int32 :: degp1, degp2
1293 degp1 = degree(1) + 1
1294 degp2 = degree(2) + 1
1298 pp_coeffs_2d(1 + i + j*degp2, 1) =
sll_f_spline_pp_horner_1d(degree(1), pp_coeffs(1 + i*degp1 + j*degp1*degp2:degp1 + i*degp1 + j*degp1*degp2, indices(1) + n_cells(1)*(indices(2) - 1 + (indices(3) - 1)*n_cells(2)):indices(1) + n_cells(1)*(indices(2) - 1 + (indices(3) - 1)*n_cells(2))), x(1), 1)
1315 sll_int32,
intent(in) :: degree(3)
1316 sll_real64,
intent(in) :: pp_coeffs(:, :)
1317 sll_real64,
intent(in) :: x(3)
1318 sll_int32,
intent(in) :: indices(3)
1319 sll_int32,
intent(in) :: n_cells(3)
1321 sll_real64 :: pp_coeffs_2d((degree(2) + 1)*(degree(3) + 1), 1)
1322 sll_real64 :: pp_coeffs_1d(degree(3) + 1, 1)
1324 sll_int32 :: degp1, degp2
1325 degp1 = degree(1) + 1
1326 degp2 = degree(2) + 1
1330 pp_coeffs_2d(1 + i + j*degp2, 1) =
sll_f_spline_pp_horner_1d(degree(1), pp_coeffs(1 + i*degp1 + j*degp1*degp2:degp1 + i*degp1 + j*degp1*degp2, indices(1) + n_cells(1)*(indices(2) - 1 + (indices(3) - 1)*n_cells(2)):indices(1) + n_cells(1)*(indices(2) - 1 + (indices(3) - 1)*n_cells(2))), x(1), 1)
1338 pp_coeffs_1d(i + 1, 1) =
sll_f_spline_pp_horner_1d(degree(2), pp_coeffs_2d(1 + i*(degree(2) + 1):(degree(2) + 1)*(i + 1), :), x(2), 1)
1347 sll_int32,
intent(in) :: degree(3)
1348 sll_real64,
intent(in) :: pp_coeffs(:, :)
1349 sll_real64,
intent(in) :: x(3)
1350 sll_int32,
intent(in) :: indices(3)
1351 sll_int32,
intent(in) :: n_cells(3)
1352 sll_int32,
intent(in) :: component
1354 sll_real64,
allocatable :: coeffs(:, :), pp_coeffs_2d(:, :)
1355 sll_real64 :: exponents(maxval(degree) + 1, 3)
1356 sll_int32 :: h, i, j
1357 sll_int32 :: deg(3), degp1, degp2
1358 degp1 = degree(1) + 1
1359 degp2 = degree(2) + 1
1362 deg(component) = degree(component) - 1
1363 allocate (coeffs((deg(1) + 1), 1))
1364 allocate (pp_coeffs_2d((deg(2) + 1)*(deg(3) + 1), 1))
1367 do i = 1, degree(component)
1368 exponents(i, component) = real(degree(component) + 1 - i, f64)
1374 coeffs(h + 1, 1) = pp_coeffs(1 + h + i*degp1 + j*degp1*degp2, indices(1) + (indices(2) - 1)*n_cells(1) + (indices(3) - 1)*n_cells(1)*n_cells(2))*exponents(j + 1, 3)*exponents(i + 1, 2)*exponents(h + 1, 1)
1388 sll_int32,
intent(in) :: degree
1389 sll_int32,
intent(in) :: n_cells
1390 sll_int32,
intent(in),
optional :: boundary
1393 if (
present(boundary))
then
1394 self%boundary_conditions = boundary
1397 sll_assert(n_cells >= degree)
1398 self%degree = degree
1399 self%n_cells = n_cells
1400 sll_allocate(self%poly_coeffs(degree + 1, degree + 1), ierr)
1401 sll_assert(ierr == 0)
1402 sll_allocate(self%poly_coeffs_fp(degree + 1, degree + 1), ierr)
1403 sll_assert(ierr == 0)
1404 sll_allocate(self%poly_coeffs_fpa(degree + 2, degree + 1), ierr)
1405 sll_assert(ierr == 0)
1406 sll_allocate(self%poly_coeffs_fd(degree, degree + 1), ierr)
1407 sll_assert(ierr == 0)
1408 sll_allocate(self%scratch_b(degree + 1), ierr)
1409 sll_assert(ierr == 0)
1410 sll_allocate(self%scratch_p(degree + 1), ierr)
1411 sll_assert(ierr == 0)
1413 sll_allocate(self%poly_coeffs_boundary_left(degree + 1, degree + 1, degree - 1), ierr)
1414 sll_assert(ierr == 0)
1415 sll_allocate(self%poly_coeffs_boundary_right(degree + 1, degree + 1, degree - 1), ierr)
1416 sll_assert(ierr == 0)
1418 sll_allocate(self%poly_coeffs_fd_boundary_left(degree, degree + 1, degree - 1), ierr)
1419 sll_assert(ierr == 0)
1420 sll_allocate(self%poly_coeffs_fd_boundary_right(degree, degree + 1, degree - 1), ierr)
1421 sll_assert(ierr == 0)
1423 select case (self%boundary_conditions)
1425 self%n_coeffs = n_cells
1427 self%n_coeffs = n_cells + degree
1429 self%n_coeffs = n_cells + degree
1431 self%n_coeffs = n_cells + degree
1433 self%n_coeffs = n_cells + degree - 1
1435 self%n_coeffs = n_cells + degree - 2
1437 self%n_coeffs = n_cells + degree - 1
1439 sll_error(
'sll_s_spline_pp_init_1d',
'Wrong boundary condition.')
1442 select case (self%degree)
1446 self%poly_coeffs = reshape((/1._f64/), (/1, 1/))
1447 self%poly_coeffs_fp = reshape((/1._f64/), (/1, 1/))
1448 self%poly_coeffs_fpa = reshape((/1._f64, 0._f64/), (/2, 1/))
1450 self%poly_coeffs = reshape((/-1._f64, 1._f64, 1._f64, 0._f64/), (/2, 2/))
1451 self%poly_coeffs_fp = reshape((/-
inv_2, 1._f64,
inv_2, 0._f64/), (/2, 2/))
1452 self%poly_coeffs_fpa = reshape((/-
inv_2, 1._f64,
inv_2,
inv_2, 0._f64, 0._f64/), (/3, 2/))
1453 self%poly_coeffs_fd = reshape((/-1._f64, 1._f64/), (/1, 2/))
1456 self%poly_coeffs = reshape((/
inv_2, -1._f64,
inv_2, &
1457 -1._f64, 1._f64,
inv_2, &
1458 inv_2, 0._f64, 0._f64/), (/3, 3/))
1462 inv_6, 0._f64, 0._f64/), (/3, 3/))
1466 inv_6, 0._f64, 0._f64, 0._f64/), (/4, 3/))
1468 self%poly_coeffs_fd = reshape((/1._f64, -1._f64, &
1470 1._f64, 0._f64/), (/2, 3/))
1473 self%poly_coeffs_boundary_left(:, 1, 1) = [1._f64, -2._f64, 1._f64]
1474 self%poly_coeffs_boundary_left(:, 2, 1) = [-1.5_f64, 2._f64, 0._f64]
1475 self%poly_coeffs_boundary_left(:, 3, 1) = [
inv_2, 0._f64, 0._f64]
1477 self%poly_coeffs_fd_boundary_left(:, 1, 1) = [2._f64, -2._f64]
1478 self%poly_coeffs_fd_boundary_left(:, 2, 1) = [-3._f64, 2._f64]
1479 self%poly_coeffs_fd_boundary_left(:, 3, 1) = [1._f64, 0._f64]
1482 self%poly_coeffs_boundary_right(:, 1, 1) = [0.5_f64, -1._f64, 0.5_f64]
1483 self%poly_coeffs_boundary_right(:, 2, 1) = [-1.5_f64, 1._f64, 0.5_f64]
1484 self%poly_coeffs_boundary_right(:, 3, 1) = [1.0_f64, 0._f64, 0._f64]
1486 self%poly_coeffs_fd_boundary_right(:, 1, 1) = [1._f64, -1._f64]
1487 self%poly_coeffs_fd_boundary_right(:, 2, 1) = [-3._f64, 1._f64]
1488 self%poly_coeffs_fd_boundary_right(:, 3, 1) = [2.0_f64, 0._f64]
1491 self%poly_coeffs_boundary_left(:, 1, 1) = 0._f64
1492 self%poly_coeffs_boundary_right(:, 3, 1) = 0._f64
1499 inv_6, 0._f64, 0._f64, 0._f64/), (/4, 4/))
1504 inv_24, 0._f64, 0._f64, 0._f64/), (/4, 4/))
1509 inv_24, 0._f64, 0._f64, 0._f64, 0._f64/), (/5, 4/))
1511 self%poly_coeffs_fd = reshape((/-
inv_2, 1._f64, -
inv_2, &
1512 3._f64*
inv_2, -2._f64, 0._f64, &
1514 inv_2, 0._f64, 0._f64/), (/3, 4/))
1517 self%poly_coeffs_boundary_left(:, 1, 1) = [-1.0_f64, 3.0_f64, -3.0_f64, 1.0_f64]
1518 self%poly_coeffs_boundary_left(:, 2, 1) = [1.75_f64, -4.5_f64, 3.0_f64, 0._f64]
1519 self%poly_coeffs_boundary_left(:, 3, 1) = [-11._f64/12._f64, 1.5_f64, 0.0_f64, 0.0_f64]
1520 self%poly_coeffs_boundary_left(:, 4, 1) = [
inv_6, 0._f64, 0._f64, 0._f64]
1522 self%poly_coeffs_fd_boundary_left(:, 1, 1) = [-3.0_f64, 6.0_f64, -3.0_f64]
1523 self%poly_coeffs_fd_boundary_left(:, 2, 1) = [5.25_f64, -9._f64, 3.0_f64]
1524 self%poly_coeffs_fd_boundary_left(:, 3, 1) = [-11._f64/4._f64, 3._f64, 0.0_f64]
1525 self%poly_coeffs_fd_boundary_left(:, 4, 1) = [
inv_2, 0._f64, 0._f64]
1528 self%poly_coeffs_boundary_left(:, 1, 2) = [-0.25_f64, 0.75_f64, -0.75_f64, 0.25_f64]
1529 self%poly_coeffs_boundary_left(:, 2, 2) = [7._f64/12._f64, -1.25_f64, 0.25_f64, 7._f64/12._f64]
1530 self%poly_coeffs_boundary_left(:, 3, 2) = [-0.5_f64, 0.5_f64, 0.5_f64,
inv_6]
1531 self%poly_coeffs_boundary_left(:, 4, 2) = [
inv_6, 0._f64, 0._f64, 0._f64]
1533 self%poly_coeffs_fd_boundary_left(:, 1, 2) = [-0.75_f64, 1.5_f64, -0.75_f64]
1534 self%poly_coeffs_fd_boundary_left(:, 2, 2) = [7._f64/4._f64, -2.5_f64, 0.25_f64]
1535 self%poly_coeffs_fd_boundary_left(:, 3, 2) = [-1.5_f64, 1._f64, 0.5_f64]
1536 self%poly_coeffs_fd_boundary_left(:, 4, 2) = [
inv_2, 0._f64, 0._f64]
1540 self%poly_coeffs_boundary_right(:, 2, 1) = [
inv_2, -1._f64, 0._f64, 4._f64*
inv_6]
1541 self%poly_coeffs_boundary_right(:, 3, 1) = [-7.0_f64/12.0_f64, 0.5_f64, 0.5_f64,
inv_6]
1542 self%poly_coeffs_boundary_right(:, 4, 1) = [0.25_f64, 0.0_f64, 0.0_f64, 0.0_f64]
1544 self%poly_coeffs_fd_boundary_right(:, 1, 1) = [-
inv_2, 1._f64, -
inv_2]
1545 self%poly_coeffs_fd_boundary_right(:, 2, 1) = [3._f64*
inv_2, -2._f64, 0._f64]
1546 self%poly_coeffs_fd_boundary_right(:, 3, 1) = [-7.0_f64/4.0_f64, 1._f64, 0.5_f64]
1547 self%poly_coeffs_fd_boundary_right(:, 4, 1) = [0.75_f64, 0.0_f64, 0.0_f64]
1551 self%poly_coeffs_boundary_right(:, 2, 2) = [11.0_f64/12.0_f64, -1.25_f64, -0.25_f64, 7.0_f64/12.0_f64]
1552 self%poly_coeffs_boundary_right(:, 3, 2) = [-1.75_f64, 0.75_f64, 0.75_f64, 0.25_f64]
1553 self%poly_coeffs_boundary_right(:, 4, 2) = [1.0_f64, 0.0_f64, 0.0_f64, 0.0_f64]
1555 self%poly_coeffs_fd_boundary_right(:, 1, 2) = [-
inv_2, 1._f64, -
inv_2]
1556 self%poly_coeffs_fd_boundary_right(:, 2, 2) = [11.0_f64/4.0_f64, -2.5_f64, -0.25_f64]
1557 self%poly_coeffs_fd_boundary_right(:, 3, 2) = [-5.25_f64, 1.5_f64, 0.75_f64]
1558 self%poly_coeffs_fd_boundary_right(:, 4, 2) = [3.0_f64, 0.0_f64, 0.0_f64]
1561 self%poly_coeffs_boundary_left(:, 1, 1) = 0._f64
1562 self%poly_coeffs_boundary_right(:, 4, 2) = 0._f64
1569 ,
inv_24, 0._f64, 0._f64, 0._f64, 0._f64/), (/5, 5/))
1575 ,
inv_120, 0._f64, 0._f64, 0._f64, 0._f64/), (/5, 5/))
1581 ,
inv_120, 0._f64, 0._f64, 0._f64, 0._f64, 0.0_f64/), (/6, 5/))
1589 ,
inv_120, 0._f64, 0._f64, 0._f64, 0._f64, 0._f64/), (/6, 6/))
1596 ,
inv_720, 0._f64, 0._f64, 0._f64, 0._f64, 0._f64/), (/6, 6/))
1603 ,
inv_720, 0._f64, 0._f64, 0._f64, 0._f64, 0._f64, 0._f64/), (/7, 6/))
1611 ,
inv_720, 0._f64, 0._f64, 0._f64, 0._f64, 0._f64, 0._f64/), (/7, 7/))
1619 ,
inv_5040, 0._f64, 0._f64, 0._f64, 0._f64, 0._f64, 0.0_f64/), (/7, 7/))
1627 ,
inv_5040, 0._f64, 0._f64, 0._f64, 0._f64, 0._f64, 0.0_f64, 0._f64/), (/8, 7/))
1629 sll_error(
'sll_s_spline_pp_init',
'Not implemented')
1632 if (self%boundary_conditions > 0 .and. degree > 3)
then
1633 sll_error(
'sll_s_spline_pp_init_1d',
'Specified boundary conditions not implemented for given degree.')
1641 sll_int32,
intent(in) :: degree(2)
1642 sll_int32,
intent(in) :: n_cells(2)
1643 sll_int32,
intent(in),
optional :: boundary(2)
1645 if (
present(boundary))
then
1658 sll_int32,
intent(in) :: degree(3)
1659 sll_int32,
intent(in) :: n_cells(3)
1660 sll_int32,
intent(in),
optional :: boundary(3)
1663 if (
present(boundary))
then
1672 sll_allocate(self%scratch_b((degree(2) + 1)*(degree(3) + 1)), ierr)
1673 sll_assert(ierr == 0)
1674 sll_allocate(self%scratch_p((degree(2) + 1)*(degree(3) + 1)), ierr)
1675 sll_assert(ierr == 0)
1676 sll_allocate(self%scratch_pp((degree(1) + 1)*(degree(2) + 1)*(degree(3) + 1)), ierr)
1677 sll_assert(ierr == 0)
1678 sll_allocate(self%scratch_coeffs((degree(1) + 1)*(degree(2) + 1)*(degree(3) + 1), n_cells(1)*n_cells(2)*n_cells(3)), ierr)
1679 sll_assert(ierr == 0)
1687 deallocate (self%poly_coeffs)
1688 deallocate (self%poly_coeffs_fp)
1689 deallocate (self%scratch_b)
1690 deallocate (self%scratch_p)
1710 deallocate (self%scratch_b)
1711 deallocate (self%scratch_p)
1712 deallocate (self%scratch_pp)
real(kind=f64), parameter inv_72
real(kind=f64), parameter inv_12
subroutine, public sll_s_spline_pp_b_to_pp_3d_clamped_2full(self, n_cells, b_coeffs, pp_coeffs)
Convert 3d spline in B form to spline in pp form for clamped spline.
subroutine, public sll_s_spline_pp_init_3d(self, degree, n_cells, boundary)
Initialize sll_t_spline_pp_3d object.
real(kind=f64), parameter inv_6
real(kind=f64) function, public sll_f_spline_pp_horner_derivative_3d(degree, pp_coeffs, x, indices, n_cells, component)
Perform a 3d hornerschema on the pp_coeffs at the indices.
real(kind=f64) function, public sll_f_spline_pp_horner_2d(degree, pp_coeffs, x, indices, n_cells)
Perform a 2d hornerschema on the pp_coeffs at the indices.
subroutine, public sll_s_spline_pp_b_to_pp_3d_clamped(self, n_cells, b_coeffs, pp_coeffs)
Convert 3d spline in B form to spline in pp form for clamped spline.
real(kind=f64), parameter inv_20
subroutine sll_s_spline_pp_b_to_pp_1d_cell(self, b_coeffs, pp_coeffs)
Convert 1d spline in B form in a cell to spline in pp form with periodic boundary conditions.
subroutine sll_s_spline_pp_b_to_pp_3d_cella2f(self, n_cells, b_coeffs, pp_coeffs, i, j, k)
Convert 3d spline in B form in a cell to spline in pp form with clamped boundary in all three directi...
subroutine, public sll_s_spline_pp_horner_m_3d(self, val, degree, x)
Perform three times a 1d hornerschema on the poly_coeffs.
real(kind=f64), parameter inv_30
real(kind=f64), parameter inv_720
subroutine, public sll_s_spline_evaluate_basis_b_form_3d_clamped(self, n_cells, b_coeffs, val)
integer(kind=i32), parameter, public sll_p_boundary_clamped
Parameter specifying clamped boundary conditions.
real(kind=f64), parameter inv_24
subroutine sll_s_spline_pp_b_to_pp_1d_clamped_clampeddiri(self, n_cells, b_coeffs, pp_coeffs)
Convert 1d spline in B form to spline in pp form for clamped spline and Dirichlet conditions on the r...
subroutine, public sll_s_spline_pp_b_to_pp_3d(self, n_cells, b_coeffs, pp_coeffs)
Convert 3d spline in B form to spline in pp form with periodic boundary conditions.
subroutine sll_s_spline_pp_b_to_pp_1d_cella(degree, pp_b, b_coeffs, pp_coeffs)
Convert 1d spline in B form in a cell to spline in pp form for specified pp_coefficients of the b_spl...
real(kind=f64) function, public sll_f_spline_pp_horner_3d(degree, pp_coeffs, x, indices, n_cells)
Perform a 3d hornerschema on the pp_coeffs at the indices.
subroutine, public sll_s_spline_pp_horner_primitive_1d(val, degree, pp_coeffs, x)
Perform a 1d hornerschema on the pp_coeffs evaluate at x.
real(kind=f64), parameter inv_120
subroutine, public sll_s_spline_pp_horner_m_2d(self, val, degree, x)
Perform two times a 1d hornerschema on the poly_coeffs.
subroutine, public sll_s_spline_pp_free_3d(self)
Destructor 3d.
real(kind=f64), parameter inv_48
real(kind=f64), parameter inv_16
subroutine, public sll_s_spline_evaluate_basis_b_form_3d_periodic(self, n_cells, b_coeffs, val)
subroutine sll_s_spline_pp_b_to_pp_3d_cella(self, n_cells, b_coeffs, pp_coeffs, i, j, k)
Convert 3d spline in B form in a cell to spline in pp form with clamped boundary in first direction a...
real(kind=f64), parameter inv_80
real(kind=f64), parameter inv_144
subroutine, public sll_s_spline_pp_b_to_pp_2d_periodic(self, n_cells, b_coeffs, pp_coeffs)
Convert 2d spline in B form to spline in pp form with periodic boundary conditions This is a special ...
subroutine, public sll_s_spline_pp_init_1d(self, degree, n_cells, boundary)
Initialize sll_t_spline_pp_1d object (Set poly_coeffs depending on degree)
subroutine, public sll_s_spline_pp_free_1d(self)
Destructor 1d.
subroutine sll_s_spline_pp_b_to_pp_3d_cell(self, n_cells, b_coeffs, pp_coeffs, i, j, k)
Convert 3d spline in B form in a cell to spline in pp form with periodic boundary conditions.
real(kind=f64), parameter inv_5040
subroutine, public sll_s_spline_pp_b_to_pp_1d(self, n_cells, b_coeffs, pp_coeffs)
Convert 1d spline in B form to spline in pp form with periodic boundary conditions.
real(kind=f64), parameter inv_36
subroutine, public sll_s_spline_pp_horner_m_1d(self, val, degree, x)
Perform a 1d hornerschema on the poly_coeffs.
subroutine sll_s_spline_pp_b_to_pp_3d_cellaf(self, n_cells, b_coeffs, pp_coeffs, i, j, k)
Convert 3d spline in B form in a cell to spline in pp form with clamped boundary in all three directi...
real(kind=f64), parameter inv_7
integer(kind=i32), parameter, public sll_p_boundary_periodic
Parameter to specify boundary conditions.
integer(kind=i32), parameter, public sll_p_boundary_clamped_clampeddiri
Parameter specifying clamped boundary conditions with the last point left out (for Dirichlet conditio...
subroutine sll_s_spline_evaluate_basis_pp_form_1d(self, n_cells, pp_coeffs, val)
real(kind=f64) function, public sll_f_spline_pp_horner_3d_d1(degree, pp_coeffs, x, indices, n_cells)
Perform a 3d hornerschema on the pp_coeffs at the indices.
real(kind=f64), parameter inv_2
subroutine sll_s_spline_pp_b_to_pp_2d_cell(spline1, spline2, n_cells, b_coeffs, pp_coeffs, i, j)
Convert 2d spline in B form in a cell to spline in pp form with periodic boundary conditions.
real(kind=f64) function, public sll_f_spline_pp_horner_1d(degree, pp_coeffs, x, index)
Perform a 1d hornerschema on the pp_coeffs at index.
real(kind=f64), parameter inv_60
subroutine sll_s_spline_pp_b_to_pp_1d_clamped(self, n_cells, b_coeffs, pp_coeffs)
Convert 1d spline in B form to spline in pp form for clamped spline.
subroutine, public sll_s_spline_pp_init_2d(self, degree, n_cells, boundary)
Initialize sll_t_spline_pp_2d object.
integer(kind=i32), parameter, public sll_p_boundary_clampeddiri
Parameter specifying clamped boundary conditions with the first and last point left out (for Dirichle...
subroutine sll_s_spline_pp_b_to_pp_3d_clamped_full(self, n_cells, b_coeffs, pp_coeffs)
Convert 3d spline in B form to spline in pp form for clamped spline.
real(kind=f64) function sll_f_spline_pp_horner_derivative_1d(degree, pp_coeffs, x, index)
Perform a 1d hornerschema on the pp_coeffs at index.
integer(kind=i32), parameter, public sll_p_boundary_clamped_square
Parameter specifying clamped boundary conditions with square spline for the 0-form,...
subroutine, public sll_s_spline_pp_pp_to_b_1d(self, n_cells, pp_coeffs, b_coeffs)
Compute b_coeffs from coefficients of the monomials (in pp_coeffs)
real(kind=f64), parameter inv_3
subroutine, public sll_s_spline_pp_b_to_pp_2d(self, n_cells, b_coeffs, pp_coeffs)
Convert 2d spline in B form to spline in pp form.
subroutine, public sll_s_spline_evaluate_basis_b_form_1d_periodic(self, n_cells, b_coeffs, val)
real(kind=f64), parameter inv_18
subroutine, public sll_s_spline_evaluate_basis_b_form_1d_clamped(self, n_cells, b_coeffs, val)
real(kind=f64) function, public sll_f_spline_pp_horner_3d_d3(degree, pp_coeffs, x, indices, n_cells)
Perform a 3d hornerschema on the pp_coeffs at the indices.
integer(kind=i32), parameter, public sll_p_boundary_clampeddiri_clamped
Parameter specifying clamped boundary conditions with the first point left out (for Dirichlet conditi...
integer(kind=i32), parameter, public sll_p_boundary_clamped_cubic
Parameter specifying clamped boundary conditions with a cubic spline for the 0-form,...
real(kind=f64), parameter inv_8
real(kind=f64), parameter inv_240
subroutine, public sll_s_spline_pp_free_2d(self)
Destructor 2d.
real(kind=f64), parameter inv_4
real(kind=f64) function, public sll_f_spline_pp_horner_3d_d2(degree, pp_coeffs, x, indices, n_cells)
Perform a 3d hornerschema on the pp_coeffs at the indices.
subroutine sll_s_spline_evaluate_basis_pp_form_3d(self, n_cells, pp_coeffs, val)
arbitrary degree 1d spline
arbitrary degree 2d spline
arbitrary degree 3d spline