10 #include "sll_assert.h"
11 #include "sll_errors.h"
12 #include "sll_memory.h"
13 #include "sll_working_precision.h"
40 sll_int32,
intent( in ) :: deg(3)
41 sll_int32,
intent( in ) :: n_cells(3)
46 sll_int32 :: n_nnz_per_row
47 sll_int32 :: ind, shift,row,i,j,k,k2
50 n_nnz_per_row = (2*deg(1)+1)*(2*deg(2)+1)*(2*deg(3)+1)
51 n_nnz = n_nnz_per_row*n_cells(1)*n_cells(2)*n_cells(3)
54 call spmat%create( n_rows=n_cells(1)*n_cells(2)*n_cells(3), n_cols=n_cells(1)*n_cells(2)*n_cells(3), n_nnz=n_nnz )
59 do row = 2, n_cells(1)*n_cells(2)*n_cells(3)+1
60 spmat%arr_ia(row) = spmat%arr_ia(row-1) + n_nnz_per_row
63 sll_assert( spmat%arr_ia(n_cells(1)*n_cells(2)*n_cells(3)+1) == n_nnz+1 )
74 shift = (k2-1)*n_cells(1)*n_cells(2)
75 call loop2( i, j, shift, deg, n_cells, ind, spmat )
77 do k2 = n_cells(3)+k-deg(3), n_cells(3)
78 shift = (k2-1)*n_cells(1)*n_cells(2)
79 call loop2( i, j, shift, deg, n_cells, ind, spmat )
81 sll_assert( ind == (i+(j-1)*n_cells(1)+(k-1)*n_cells(1)*n_cells(2))*n_nnz_per_row+1 )
84 elseif( k > deg(3) .and. k<= n_cells(3)-deg(3))
then
87 do k2 = k-deg(3), k+deg(3)
88 shift = (k2-1)*n_cells(1)*n_cells(2)
89 call loop2( i, j, shift, deg, n_cells, ind, spmat )
91 sll_assert( ind == (i+(j-1)*n_cells(1)+(k-1)*n_cells(1)*n_cells(2))*n_nnz_per_row+1 )
97 do k2 = 1, k+deg(3)-n_cells(3)
98 shift = (k2-1)*n_cells(1)*n_cells(2)
99 call loop2( i, j, shift, deg, n_cells, ind, spmat )
101 do k2 = k-deg(3), n_cells(3)
102 shift = (k2-1)*n_cells(1)*n_cells(2)
103 call loop2( i, j, shift, deg, n_cells, ind, spmat )
105 sll_assert( ind == (i+(j-1)*n_cells(1)+(k-1)*n_cells(1)*n_cells(2))*n_nnz_per_row+1 )
110 spmat%arr_a = 0.0_f64
112 sll_assert( maxval(spmat%arr_ja) == spmat%n_cols )
114 sll_assert( ind == spmat%n_nnz+1 )
119 subroutine loop2( i, j, shift, deg, n_cells, ind, spmat )
120 sll_int32,
intent( in ) :: i
121 sll_int32,
intent( in ) :: j
122 sll_int32,
intent( in ) :: shift
123 sll_int32,
intent( in ) :: deg(3)
124 sll_int32,
intent( in ) :: n_cells(3)
125 sll_int32,
intent( inout ) :: ind
128 sll_int32 :: j2, shift1
133 shift1 = (j2-1)*n_cells(1)+shift
134 call loop1( i, shift1, deg(1), n_cells(1), ind, spmat )
136 do j2 = n_cells(2)+j-deg(2), n_cells(2)
137 shift1 = (j2-1)*n_cells(1)+shift
138 call loop1( i, shift1, deg(1), n_cells(1), ind, spmat )
142 elseif( j > deg(2) .and. j<= n_cells(2)-deg(2))
then
143 do j2 = j-deg(2), j+deg(2)
144 shift1 = (j2-1)*n_cells(1)+shift
145 call loop1( i, shift1, deg(1), n_cells(1), ind, spmat )
150 do j2 = 1, j+deg(2)-n_cells(2)
151 shift1 = (j2-1)*n_cells(1)+shift
152 call loop1( i, shift1, deg(1), n_cells(1), ind, spmat )
154 do j2 = j-deg(2), n_cells(2)
155 shift1 = (j2-1)*n_cells(1)+shift
156 call loop1(i,shift1, deg(1),n_cells(1),ind,spmat)
163 subroutine loop1( i, shift, deg, n_cells, ind, spmat )
164 sll_int32,
intent( in ) :: i
165 sll_int32,
intent( in ) :: shift
166 sll_int32,
intent( in ) :: deg
167 sll_int32,
intent( in ) :: n_cells
168 sll_int32,
intent( inout ) :: ind
176 spmat%arr_ja(ind) = i2+shift
179 do i2 = n_cells+i-deg, n_cells
180 spmat%arr_ja(ind) = i2+shift
185 elseif( i > deg .and. i<= n_cells-deg)
then
187 spmat%arr_ja(ind) = i2+shift
193 do i2 = 1, i+deg-n_cells
194 spmat%arr_ja(ind) = i2+shift
197 do i2 = i-deg, n_cells
198 spmat%arr_ja(ind) = i2+shift
207 sll_int32,
intent( in ) :: deg(3)
208 sll_int32,
intent( in ) :: n_cells(3)
213 sll_int32 :: n_nnz_per_row
214 sll_int32 :: ind, shift,row,i,j,k,k2
217 n_nnz_per_row = (2*deg(1)+1)*(2*deg(2)+1)*(2*deg(3)+1)
218 n_nnz = (n_nnz_per_row*(n_cells(1)-deg(1))+(3*deg(1)**2+deg(1))*(2*deg(2)+1)*(2*deg(3)+1))*n_cells(2)*n_cells(3)
221 call spmat%create( n_rows=(n_cells(1)+deg(1))*n_cells(2)*n_cells(3), n_cols=(n_cells(1)+deg(1))*n_cells(2)*n_cells(3), n_nnz=n_nnz )
231 spmat%arr_ia(row) = spmat%arr_ia(row-1) + (deg(1) + i - 1)*(2*deg(2)+1)*(2*deg(3)+1)
233 do i = deg(1)+2, n_cells(1)+1
235 spmat%arr_ia(row) = spmat%arr_ia(row-1) + n_nnz_per_row
237 do i=n_cells(1)+2, n_cells(1)+deg(1)+1
239 spmat%arr_ia(row) = spmat%arr_ia(row-1) + (2*deg(1) + n_cells(1)+2 - i)*(2*deg(2)+1)*(2*deg(3)+1)
244 sll_assert( row == (n_cells(1)+deg(1))*n_cells(2)*n_cells(3)+1)
245 sll_assert( spmat%arr_ia(row) == n_nnz+1 )
253 do i=1,n_cells(1)+deg(1)
255 shift=(k2-1)*(n_cells(1)+deg(1))*n_cells(2)
259 do k2 = n_cells(3)+k-deg(3), n_cells(3)
260 shift=(k2-1)*(n_cells(1)+deg(1))*n_cells(2)
266 do k = deg(3)+1, n_cells(3)-deg(3)
268 do i=1,n_cells(1)+deg(1)
269 do k2 = k-deg(3), k+deg(3)
270 shift=(k2-1)*(n_cells(1)+deg(1))*n_cells(2)
276 do k = n_cells(3)-deg(3)+1, n_cells(3)
278 do i=1,n_cells(1)+deg(1)
279 do k2 = 1, k+deg(3)-n_cells(3)
280 shift=(k2-1)*(n_cells(1)+deg(1))*n_cells(2)
283 do k2 = k-deg(3), n_cells(3)
284 shift=(k2-1)*(n_cells(1)+deg(1))*n_cells(2)
290 spmat%arr_a = 0.0_f64
292 sll_assert( maxval(spmat%arr_ja) == spmat%n_cols )
293 sll_assert( ind == spmat%n_nnz+1 )
299 sll_int32,
intent( in ) :: i
300 sll_int32,
intent( in ) :: j
301 sll_int32,
intent( in ) :: shift
302 sll_int32,
intent( in ) :: deg(3)
303 sll_int32,
intent( in ) :: n_cells(3)
304 sll_int32,
intent( inout ) :: ind
307 sll_int32 :: j2, shift1
312 shift1=(j2-1)*(n_cells(1)+deg(1))+shift
313 call loop1_clamped( i, shift1, deg(1), n_cells(1), ind, spmat )
315 do j2 = n_cells(2)+j-deg(2), n_cells(2)
316 shift1=(j2-1)*(n_cells(1)+deg(1))+shift
317 call loop1_clamped( i, shift1, deg(1), n_cells(1), ind, spmat )
321 elseif( j > deg(2) .and. j<= n_cells(2)-deg(2) )
then
322 do j2 = j-deg(2), j+deg(2)
323 shift1=(j2-1)*(n_cells(1)+deg(1))+shift
324 call loop1_clamped( i, shift1, deg(1), n_cells(1), ind, spmat )
328 elseif( j > n_cells(2)-deg(2) .and. j<= n_cells(2) )
then
329 do j2 = 1, j+deg(2)-n_cells(2)
330 shift1=(j2-1)*(n_cells(1)+deg(1))+shift
331 call loop1_clamped( i, shift1, deg(1), n_cells(1), ind, spmat )
333 do j2 = j-deg(2), n_cells(2)
334 shift1=(j2-1)*(n_cells(1)+deg(1))+shift
338 print*,
'error in loop2_clamped'
346 sll_int32,
intent( in ) :: i
347 sll_int32,
intent( in ) :: shift
348 sll_int32,
intent( in ) :: deg
349 sll_int32,
intent( in ) :: n_cells
350 sll_int32,
intent( inout ) :: ind
358 spmat%arr_ja(ind) = i2+shift
362 elseif( i > deg .and. i <= n_cells)
then
364 spmat%arr_ja(ind) = i2+shift
368 elseif( i > n_cells .and. i <= n_cells + deg )
then
369 do i2 = i-deg, n_cells+deg
370 spmat%arr_ja(ind) = i2+shift
374 print*,
'error in loop1_clamped'
383 sll_int32,
intent( in ) :: deg1(3), deg2(3)
384 sll_int32,
intent( in ) :: n_cells(3)
389 sll_int32 :: n_nnz_per_row
390 sll_int32 :: ind, shift,row,i,j,k,l
393 n_nnz_per_row = (deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)*(deg1(3)+deg2(3)+1)
394 n_nnz = n_nnz_per_row*n_cells(1)*n_cells(2)*n_cells(3)
396 call spmat%create( n_rows=n_cells(1)*n_cells(2)*n_cells(3), n_cols=n_cells(1)*n_cells(2)*n_cells(3), n_nnz=n_nnz )
401 do row = 2, n_cells(1)*n_cells(2)*n_cells(3)+1
402 spmat%arr_ia(row) = spmat%arr_ia(row-1) + n_nnz_per_row
405 sll_assert( spmat%arr_ia(n_cells(1)*n_cells(2)*n_cells(3)+1) == n_nnz+1 )
412 if(k <= deg2(3))
then
416 shift = (l-1)*n_cells(1)*n_cells(2)
417 call mloop2( i, j, shift, deg1, deg2, n_cells, ind, spmat )
419 do l = n_cells(3)+k-deg2(3), n_cells(3)
420 shift = (l-1)*n_cells(1)*n_cells(2)
421 call mloop2( i, j, shift, deg1, deg2, n_cells, ind, spmat )
423 sll_assert( ind == (i+(j-1)*n_cells(1)+(k-1)*n_cells(1)*n_cells(2))*n_nnz_per_row+1 )
426 elseif( k > deg2(3) .and. k <= n_cells(3)-deg1(3))
then
429 do l = k-deg2(3), k+deg1(3)
430 shift = (l-1)*n_cells(1)*n_cells(2)
431 call mloop2( i, j, shift, deg1, deg2, n_cells, ind, spmat )
433 sll_assert( ind == (i+(j-1)*n_cells(1)+(k-1)*n_cells(1)*n_cells(2))*n_nnz_per_row+1 )
439 do l = 1, k+deg1(3)-n_cells(3)
440 shift = (l-1)*n_cells(1)*n_cells(2)
441 call mloop2( i, j, shift, deg1, deg2, n_cells, ind, spmat )
443 do l = k-deg2(3), n_cells(3)
444 shift = (l-1)*n_cells(1)*n_cells(2)
445 call mloop2( i, j, shift, deg1, deg2, n_cells, ind, spmat )
447 sll_assert( ind == (i+(j-1)*n_cells(1)+(k-1)*n_cells(1)*n_cells(2))*n_nnz_per_row+1 )
452 spmat%arr_a = 0.0_f64
454 sll_assert( maxval(spmat%arr_ja) == spmat%n_cols )
455 sll_assert( ind == spmat%n_nnz+1 )
460 subroutine mloop2( i, j, shift, deg1, deg2, n_cells, ind, spmat )
461 sll_int32,
intent( in ) :: i
462 sll_int32,
intent( in ) :: j
463 sll_int32,
intent( in ) :: shift
464 sll_int32,
intent( in ) :: deg1(3), deg2(3)
465 sll_int32,
intent( in ) :: n_cells(3)
466 sll_int32,
intent( inout ) :: ind
469 sll_int32 :: l, shift1
474 shift1 = (l-1)*n_cells(1)+shift
475 call mloop1( i, shift1, deg1(1), deg2(1), n_cells(1), ind, spmat )
477 do l = n_cells(2)+j-deg2(2), n_cells(2)
478 shift1 = (l-1)*n_cells(1)+shift
479 call mloop1( i, shift1, deg1(1), deg2(1), n_cells(1), ind, spmat )
483 elseif( j > deg2(2) .and. j <= n_cells(2)-deg1(2))
then
484 do l = j-deg2(2), j+deg1(2)
485 shift1 = (l-1)*n_cells(1)+shift
486 call mloop1( i, shift1, deg1(1), deg2(1), n_cells(1), ind, spmat )
491 do l = 1, j+deg1(2)-n_cells(2)
492 shift1 = (l-1)*n_cells(1)+shift
493 call mloop1( i, shift1, deg1(1), deg2(1), n_cells(1), ind, spmat )
495 do l = j-deg2(2), n_cells(2)
496 shift1 = (l-1)*n_cells(1)+shift
497 call mloop1(i, shift1, deg1(1), deg2(1), n_cells(1), ind,spmat)
504 subroutine mloop1( i, shift, deg1, deg2, n_cells, ind, spmat )
505 sll_int32,
intent( in ) :: i
506 sll_int32,
intent( in ) :: shift
507 sll_int32,
intent( in ) :: deg1, deg2
508 sll_int32,
intent( in ) :: n_cells
509 sll_int32,
intent( inout ) :: ind
517 spmat%arr_ja(ind) = l+shift
520 do l = n_cells+i-deg2, n_cells
521 spmat%arr_ja(ind) = l+shift
526 elseif( i > deg2 .and. i<= n_cells-deg1)
then
527 do l = i-deg2, i+deg1
528 spmat%arr_ja(ind) = l+shift
533 elseif(i > n_cells-deg1 .and. i <= n_cells)
then
534 do l = 1, i+deg1-n_cells
535 spmat%arr_ja(ind) = l+shift
538 do l = i-deg2, n_cells
539 spmat%arr_ja(ind) = l+shift
548 sll_int32,
intent( in ) :: deg1(3), deg2(3)
549 sll_int32,
intent( in ) :: n_cells(3)
553 sll_int32 :: n_nnz_per_row
554 sll_int32 :: ind, shift,row,i,j,k,l
557 n_nnz_per_row = (deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)*(deg1(3)+deg2(3)+1)
558 n_nnz = (n_nnz_per_row*(n_cells(1)-deg1(1))+deg1(1)*(2*deg2(1)+deg1(1)+1)*(deg1(2)+deg2(2)+1)*(deg1(3)+deg2(3)+1))*n_cells(2)*n_cells(3)
560 call spmat%create( n_rows=(n_cells(1)+deg1(1))*n_cells(2)*n_cells(3), n_cols=(n_cells(1)+deg2(1))*n_cells(2)*n_cells(3), n_nnz=n_nnz )
570 spmat%arr_ia(row) = spmat%arr_ia(row-1) + (deg2(1) + i - 1)*(deg1(2)+deg2(2)+1)*(deg1(3)+deg2(3)+1)
572 do i = deg1(1)+2, n_cells(1)+1
574 spmat%arr_ia(row) = spmat%arr_ia(row-1) + n_nnz_per_row
576 do i=n_cells(1)+2, n_cells(1)+deg1(1)+1
578 spmat%arr_ia(row) = spmat%arr_ia(row-1) + (deg1(1)+deg2(1) + n_cells(1)+2 - i)*(deg1(2)+deg2(2)+1)*(deg1(3)+deg2(3)+1)
583 sll_assert( row == (n_cells(1)+deg1(1))*n_cells(2)*n_cells(3)+1)
584 sll_assert( spmat%arr_ia(row) == n_nnz+1 )
593 do i=1,n_cells(1)+deg1(1)
595 shift=(l-1)*(n_cells(1)+deg2(1))*n_cells(2)
596 call mloop2_clamped( i, j, shift, deg1, deg2, n_cells, ind, spmat )
598 do l = n_cells(3)+k-deg2(3), n_cells(3)
599 shift=(l-1)*(n_cells(1)+deg2(1))*n_cells(2)
600 call mloop2_clamped( i, j, shift, deg1, deg2, n_cells, ind, spmat )
604 elseif( k > deg2(3) .and. k<= n_cells(3)-deg1(3))
then
606 do i=1,n_cells(1)+deg1(1)
607 do l = k-deg2(3), k+deg1(3)
608 shift=(l-1)*(n_cells(1)+deg2(1))*n_cells(2)
609 call mloop2_clamped( i, j, shift, deg1, deg2, n_cells, ind, spmat )
615 do i=1, n_cells(1)+deg1(1)
616 do l = 1, k+deg1(3)-n_cells(3)
617 shift=(l-1)*(n_cells(1)+deg2(1))*n_cells(2)
618 call mloop2_clamped( i, j, shift, deg1, deg2, n_cells, ind, spmat )
620 do l = k-deg2(3), n_cells(3)
621 shift=(l-1)*(n_cells(1)+deg2(1))*n_cells(2)
622 call mloop2_clamped( i, j, shift, deg1, deg2, n_cells, ind, spmat )
628 spmat%arr_a = 0.0_f64
630 sll_assert( maxval(spmat%arr_ja) == spmat%n_cols )
631 sll_assert( ind == spmat%n_nnz+1 )
637 sll_int32,
intent( in ) :: i
638 sll_int32,
intent( in ) :: j
639 sll_int32,
intent( in ) :: shift
640 sll_int32,
intent( in ) :: deg1(3), deg2(3)
641 sll_int32,
intent( in ) :: n_cells(3)
642 sll_int32,
intent( inout ) :: ind
645 sll_int32 :: l, shift1
650 shift1=(l-1)*(n_cells(1)+deg2(1))+shift
651 call mloop1_clamped( i, shift1, deg1(1), deg2(1), n_cells(1), ind, spmat )
653 do l = n_cells(2)+j-deg2(2), n_cells(2)
654 shift1=(l-1)*(n_cells(1)+deg2(1))+shift
655 call mloop1_clamped( i, shift1, deg1(1), deg2(1), n_cells(1), ind, spmat )
659 elseif( j > deg2(2) .and. j<= n_cells(2)-deg1(2))
then
660 do l = j-deg2(2), j+deg1(2)
661 shift1=(l-1)*(n_cells(1)+deg2(1))+shift
662 call mloop1_clamped( i, shift1, deg1(1), deg2(1), n_cells(1), ind, spmat )
667 do l = 1, j+deg1(2)-n_cells(2)
668 shift1=(l-1)*(n_cells(1)+deg2(1))+shift
669 call mloop1_clamped( i, shift1, deg1(1), deg2(1), n_cells(1), ind, spmat )
671 do l = j-deg2(2), n_cells(2)
672 shift1=(l-1)*(n_cells(1)+deg2(1))+shift
673 call mloop1_clamped(i,shift1, deg1(1), deg2(1),n_cells(1),ind,spmat)
681 sll_int32,
intent( in ) :: i
682 sll_int32,
intent( in ) :: shift
683 sll_int32,
intent( in ) :: deg1, deg2
684 sll_int32,
intent( in ) :: n_cells
685 sll_int32,
intent( inout ) :: ind
693 spmat%arr_ja(ind) = l+shift
697 elseif( i > deg1 .and. i<= n_cells)
then
698 do l = i-deg1, i+deg2
699 spmat%arr_ja(ind) = l+shift
703 elseif( i > n_cells .and. i <= n_cells + deg1 )
then
704 do l = i-deg1, n_cells+deg2
705 spmat%arr_ja(ind) = l+shift
715 sll_int32,
intent( in ) :: deg(3)
716 sll_int32,
intent( in ) :: n_cells(3)
717 sll_real64,
intent( in ) :: mass_line((2*deg(1)+1)*(2*deg(2)+1)*(2*deg(3)+1))
719 sll_int32,
intent( in ) :: row(3)
720 sll_int32,
intent( inout ) :: ind
722 sll_int32 :: column, shift
726 if(row(3) <= deg(3))
then
727 do column = 2-row(3)+deg(3), deg(3)
728 shift = (column-1)*(2*deg(1)+1)*(2*deg(2)+1)
729 call assemble2( deg, n_cells, mass_line, matrix, row, ind, shift )
731 do column = deg(3)+1,2*deg(3)+1
732 shift = (column-1)*(2*deg(1)+1)*(2*deg(2)+1)
733 call assemble2( deg, n_cells, mass_line, matrix, row, ind, shift )
736 do column = 1, deg(3)-row(3)+1
737 shift=(column-1)*(2*deg(1)+1)*(2*deg(2)+1)
738 call assemble2( deg, n_cells, mass_line, matrix, row, ind, shift )
740 else if(row(3) >= deg(3)+1 .and. row(3)<= n_cells(3)-deg(3))
then
741 do column = 1, 2*deg(3)+1
742 shift = (column-1)*(2*deg(1)+1)*(2*deg(2)+1)
743 call assemble2( deg, n_cells, mass_line, matrix, row, ind, shift )
747 else if(row(3) >= n_cells(3)-deg(3)+1 .and. row(3) <= n_cells(3))
then
749 do column = n_cells(3)-row(3)+deg(3)+2, 2*deg(3)+1
750 shift = (column-1)*(2*deg(1)+1)*(2*deg(2)+1)
751 call assemble2( deg, n_cells, mass_line, matrix, row, ind, shift )
754 do column = 1, deg(3)+1
755 shift = (column-1)*(2*deg(1)+1)*(2*deg(2)+1)
756 call assemble2( deg, n_cells, mass_line, matrix, row, ind, shift )
759 do column = 2+deg(3), n_cells(3)-row(3)+deg(3)+1
760 shift = (column-1)*(2*deg(1)+1)*(2*deg(2)+1)
761 call assemble2( deg, n_cells, mass_line, matrix, row, ind, shift )
764 sll_error(
'assemble',
'error in row in assemble_mass')
767 sll_assert( ind == (row(1)+(row(2)-1)*n_cells(1)+(row(3)-1)*n_cells(1)*n_cells(2))*(2*deg(1)+1)*(2*deg(2)+1)*(2*deg(3)+1)+1)
772 subroutine assemble2( deg, n_cells, mass_line, matrix, row, ind, shift )
773 sll_int32,
intent( in ) :: deg(3)
774 sll_int32,
intent( in ) :: n_cells(3)
775 sll_real64,
intent( in ) :: mass_line((2*deg(1)+1)*(2*deg(2)+1)*(2*deg(3)+1))
777 sll_int32,
intent( in ) :: row(3)
778 sll_int32,
intent( inout ) :: ind
779 sll_int32,
intent( in ) :: shift
781 sll_int32 :: column, shift1
783 if(row(2) <= deg(2))
then
784 do column = 2-row(2)+deg(2), deg(2)
785 shift1 = (column-1)*(2*deg(1)+1)+shift
786 call assemble1( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
788 do column = deg(2)+1, 2*deg(2)+1
789 shift1 = (column-1)*(2*deg(1)+1)+shift
790 call assemble1( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
793 do column = 1, deg(2)-row(2)+1
794 shift1 = (column-1)*(2*deg(1)+1)+shift
795 call assemble1( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
797 else if(row(2) >= deg(2)+1 .and. row(2)<= n_cells(2)-deg(2))
then
798 do column = 1, 2*deg(2)+1
799 shift1 = (column-1)*(2*deg(1)+1)+shift
800 call assemble1( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
804 else if(row(2) >= n_cells(2)-deg(2)+1 .and. row(2) <= n_cells(2))
then
806 do column = n_cells(2)-row(2)+deg(2)+2, 2*deg(2)+1
807 shift1 = (column-1)*(2*deg(1)+1)+shift
808 call assemble1( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
811 do column = 1, deg(2)+1
812 shift1 = (column-1)*(2*deg(1)+1)+shift
813 call assemble1(deg, n_cells(1), mass_line, matrix, row(1), ind, shift1)
816 do column = 2+deg(2), n_cells(2)-row(2)+deg(2)+1
817 shift1 = (column-1)*(2*deg(1)+1)+shift
818 call assemble1( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
821 sll_error(
'assemble',
'error in row in assemble_mass')
827 subroutine assemble1( deg, n_cells, mass_line, matrix, row, ind, shift )
828 sll_int32,
intent( in ) :: deg(3)
829 sll_int32,
intent( in ) :: n_cells
830 sll_real64,
intent( in ) :: mass_line((2*deg(1)+1)*(2*deg(2)+1)*(2*deg(3)+1))
832 sll_int32,
intent( in ) :: row
833 sll_int32,
intent( inout ) :: ind
834 sll_int32,
intent( in ) :: shift
839 if(row <= deg(1))
then
840 do column = 2-row+deg(1), deg(1)
841 matrix%arr_a(1,ind) = mass_line(column+shift)
845 matrix%arr_a(1,ind:ind+deg(1)) = mass_line(deg(1)+1+shift:2*deg(1)+1+shift)
848 do column = 1, deg(1)-row+1
849 matrix%arr_a(1,ind) = mass_line(column+shift)
852 else if(row > deg(1) .and. row <= n_cells-deg(1))
then
853 matrix%arr_a(1,ind:ind+2*deg(1)) = mass_line(1+shift:2*deg(1)+1+shift)
857 else if(row >= n_cells-deg(1)+1 .and. row <= n_cells)
then
859 do column = n_cells-row+deg(1)+2, 2*deg(1)+1
860 matrix%arr_a(1,ind) = mass_line(column+shift)
864 matrix%arr_a(1,ind:ind+deg(1)) = mass_line(1+shift:deg(1)+1+shift)
867 do column = 2+deg(1), n_cells-row+deg(1)+1
868 matrix%arr_a(1,ind) = mass_line(column+shift)
872 sll_error(
'assemble',
'error in row in assemble_mass')
880 sll_int32,
intent( in ) :: deg(3)
881 sll_int32,
intent( in ) :: n_cells(3)
882 sll_real64,
intent( in ) :: mass_line((2*deg(1)+1)*(2*deg(2)+1)*(2*deg(3)+1))
884 sll_int32,
intent( in ) :: row(3)
885 sll_int32,
intent( inout ) :: ind
887 sll_int32 :: column, shift, begin
893 if(row(3)<=deg(3))
then
894 do column = 2-row(3)+deg(3), deg(3)
895 shift=(column-1)*(2*deg(1)+1)*(2*deg(2)+1)
898 do column= deg(3)+1,2*deg(3)+1
899 shift=(column-1)*(2*deg(1)+1)*(2*deg(2)+1)
903 do column = 1, deg(3)-row(3)+1
904 shift=(column-1)*(2*deg(1)+1)*(2*deg(2)+1)
907 else if(row(3) >= deg(3)+1 .and. row(3)<= n_cells(3)-deg(3))
then
908 do column=1, 2*deg(3)+1
909 shift=(column-1)*(2*deg(1)+1)*(2*deg(2)+1)
914 else if(row(3) >= n_cells(3)-deg(3)+1 .and. row(3) <= n_cells(3))
then
916 do column = n_cells(3)-row(3)+deg(3)+2, 2*deg(3)+1
917 shift=(column-1)*(2*deg(1)+1)*(2*deg(2)+1)
921 do column=1, deg(3)+1
922 shift=(column-1)*(2*deg(1)+1)*(2*deg(2)+1)
926 do column = 2+deg(3), n_cells(3)-row(3)+deg(3)+1
927 shift=(column-1)*(2*deg(1)+1)*(2*deg(2)+1)
931 sll_error(
'assemble',
'error in row in assemble3_mass_clamped')
933 sll_assert( ind == begin+(2*deg(1)+1)*(2*deg(2)+1)*(2*deg(3)+1))
939 sll_int32,
intent( in ) :: deg(3)
940 sll_int32,
intent( in ) :: n_cells(3)
941 sll_real64,
intent( in ) :: mass_line((2*deg(1)+1)*(2*deg(2)+1)*(2*deg(3)+1))
943 sll_int32,
intent( in ) :: row(3)
944 sll_int32,
intent( inout ) :: ind
945 sll_int32,
intent( in ) :: shift
947 sll_int32 :: column, shift1
949 if(row(2)<=deg(2))
then
950 do column = 2-row(2)+deg(2), deg(2)
951 shift1=(column-1)*(2*deg(1)+1)+shift
952 call assemble1_clamped( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
954 do column= deg(2)+1,2*deg(2)+1
955 shift1=(column-1)*(2*deg(1)+1)+shift
956 call assemble1_clamped( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
959 do column = 1, deg(2)-row(2)+1
960 shift1=(column-1)*(2*deg(1)+1)+shift
961 call assemble1_clamped( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
963 else if(row(2) >= deg(2)+1 .and. row(2)<= n_cells(2)-deg(2))
then
964 do column=1, 2*deg(2)+1
965 shift1=(column-1)*(2*deg(1)+1)+shift
966 call assemble1_clamped( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
969 else if(row(2) >= n_cells(2)-deg(2)+1 .and. row(2) <= n_cells(2))
then
971 do column = n_cells(2)-row(2)+deg(2)+2, 2*deg(2)+1
972 shift1=(column-1)*(2*deg(1)+1)+shift
973 call assemble1_clamped( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
976 do column=1, deg(2)+1
977 shift1=(column-1)*(2*deg(1)+1)+shift
981 do column = 2+deg(2), n_cells(2)-row(2)+deg(2)+1
982 shift1=(column-1)*(2*deg(1)+1)+shift
983 call assemble1_clamped( deg, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
986 sll_error(
'assemble',
'error in row in assemble2_mass_clamped')
993 sll_int32,
intent( in ) :: deg(3)
994 sll_int32,
intent( in ) :: n_cells
995 sll_real64,
intent( in ) :: mass_line((2*deg(1)+1)*(2*deg(2)+1)*(2*deg(3)+1))
997 sll_int32,
intent( in ) :: row
998 sll_int32,
intent( inout ) :: ind
999 sll_int32,
intent( in ) :: shift
1001 if(row >= 2*deg(1) .and. row<= n_cells-deg(1)+1)
then
1002 matrix%arr_a(1,ind:ind+2*deg(1))=mass_line(1+shift:2*deg(1)+1+shift)
1004 ind = ind+2*deg(1)+1
1006 sll_error(
'assemble',
'error in row in assemble1_mass_clamped')
1013 sll_int32,
intent( in ) :: deg(3)
1014 sll_int32,
intent( in ) :: n_cells(3)
1015 sll_real64,
intent( in ) :: mass_line((7*deg(1)**2-deg(1)-2)/2*(2*deg(2)+1)*(2*deg(3)+1))
1017 sll_int32,
intent( in ) :: row(3)
1018 sll_int32,
intent( inout ) :: ind
1020 sll_int32 :: column, shift
1024 if(row(3)<=deg(3))
then
1025 do column = 2-row(3)+deg(3), deg(3)
1026 shift=(column-1)*(7*deg(1)**2-deg(1)-2)/2*(2*deg(2)+1)
1029 do column= deg(3)+1,2*deg(3)+1
1030 shift=(column-1)*(7*deg(1)**2-deg(1)-2)/2*(2*deg(2)+1)
1033 do column = 1, deg(3)-row(3)+1
1034 shift=(column-1)*(7*deg(1)**2-deg(1)-2)/2*(2*deg(2)+1)
1037 else if(row(3) >= deg(3)+1 .and. row(3)<= n_cells(3)-deg(3))
then
1038 do column=1, 2*deg(3)+1
1039 shift=(column-1)*(7*deg(1)**2-deg(1)-2)/2*(2*deg(2)+1)
1044 else if(row(3) >= n_cells(3)-deg(3)+1 .and. row(3) <= n_cells(3))
then
1045 do column = n_cells(3)-row(3)+deg(3)+2, 2*deg(3)+1
1046 shift=(column-1)*(7*deg(1)**2-deg(1)-2)/2*(2*deg(2)+1)
1049 do column=1, deg(3)+1
1050 shift=(column-1)*(7*deg(1)**2-deg(1)-2)/2*(2*deg(2)+1)
1053 do column = 2+deg(3), n_cells(3)-row(3)+deg(3)+1
1054 shift=(column-1)*(7*deg(1)**2-deg(1)-2)/2*(2*deg(2)+1)
1058 sll_error(
'assemble',
'error in row in assemble3_mass_clamped_boundary')
1065 sll_int32,
intent( in ) :: deg(3)
1066 sll_int32,
intent( in ) :: n_cells(3)
1067 sll_real64,
intent( in ) :: mass_line((7*deg(1)**2-deg(1)-2)/2*(2*deg(2)+1)*(2*deg(3)+1))
1069 sll_int32,
intent( in ) :: row(3)
1070 sll_int32,
intent( inout ) :: ind
1071 sll_int32,
intent( in ) :: shift
1073 sll_int32 :: column, shift1
1076 if(row(2)<=deg(2))
then
1077 do column = 2-row(2)+deg(2), deg(2)
1078 shift1=(column-1)*(7*deg(1)**2-deg(1)-2)/2+shift
1081 do column= deg(2)+1,2*deg(2)+1
1082 shift1=(column-1)*(7*deg(1)**2-deg(1)-2)/2+shift
1086 do column = 1, deg(2)-row(2)+1
1087 shift1=(column-1)*(7*deg(1)**2-deg(1)-2)/2+shift
1090 else if(row(2) >= deg(2)+1 .and. row(2)<= n_cells(2)-deg(2))
then
1091 do column=1, 2*deg(2)+1
1092 shift1=(column-1)*(7*deg(1)**2-deg(1)-2)/2+shift
1097 else if(row(2) >= n_cells(2)-deg(2)+1 .and. row(2) <= n_cells(2))
then
1099 do column = n_cells(2)-row(2)+deg(2)+2, 2*deg(2)+1
1100 shift1=(column-1)*(7*deg(1)**2-deg(1)-2)/2+shift
1104 do column=1, deg(2)+1
1105 shift1=(column-1)*(7*deg(1)**2-deg(1)-2)/2+shift
1109 do column = 2+deg(2), n_cells(2)-row(2)+deg(2)+1
1110 shift1=(column-1)*(7*deg(1)**2-deg(1)-2)/2+shift
1114 sll_error(
'assemble',
'error in row in assemble2_mass_clamped_boundary')
1121 sll_int32,
intent( in ) :: deg(3)
1122 sll_int32,
intent( in ) :: n_cells
1123 sll_real64,
intent( in ) :: mass_line((7*deg(1)**2-deg(1)-2)/2*(2*deg(2)+1)*(2*deg(3)+1))
1125 sll_int32,
intent( in ) :: row
1126 sll_int32,
intent( inout ) :: ind
1127 sll_int32,
intent( in ) :: shift
1129 sll_int32 :: shift1, column
1132 if(row <= deg(1))
then
1133 shift1 = ((row-1)*(2*deg(1)+row))/2 + shift
1134 do column = 1, deg(1)+row
1135 matrix%arr_a(1,ind) = mass_line(column+shift1)
1138 else if(row > deg(1) .and. row < 2*deg(1))
then
1139 shift1 = (row-deg(1)-1)*(2*deg(1)+1)+(3*deg(1)**2+deg(1))/2 + shift
1140 do column = 1, 2*deg(1)+1
1141 matrix%arr_a(1,ind) = mass_line(column+shift1)
1145 else if(row >= n_cells-deg(1)+2 .and. row <= n_cells)
then
1146 shift1 = (n_cells-row)*(2*deg(1)+1)+(3*deg(1)**2+deg(1))/2 + shift
1147 do column = 2*deg(1)+1,1,-1
1148 matrix%arr_a(1,ind)=mass_line(column+shift1)
1151 else if(row > n_cells .and. row <= n_cells+deg(1))
then
1152 shift1 = ((n_cells+deg(1)-row)*(2*deg(1)+n_cells+deg(1)+1-row))/2 + shift
1153 do column = deg(1)+1+n_cells+deg(1)-row,1,-1
1154 matrix%arr_a(1,ind) = mass_line(column+shift1)
1158 sll_error(
'assemble',
'error in row in assemble1_mass_clamped_boundary')
1167 sll_int32,
intent( in ) :: deg1(3), deg2(3)
1168 sll_int32,
intent( in ) :: n_cells(3)
1169 sll_real64,
intent( in ) :: mass_line((deg1(1)+deg2(1)+1)*(deg1(2)+ deg2(2)+1)*(deg1(3)+ deg2(3)+1))
1171 sll_int32,
intent( in ) :: row(3)
1172 sll_int32,
intent( inout ) :: ind
1174 sll_int32 :: column, shift
1178 if(row(3) <= deg2(3))
then
1179 do column = 2-row(3)+deg2(3), deg2(3)
1180 shift = (column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1181 call massemble2( deg1, deg2, n_cells, mass_line, matrix, row, ind, shift )
1183 do column = deg2(3)+1,deg1(3)+deg2(3)+1
1184 shift = (column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1185 call massemble2( deg1, deg2, n_cells, mass_line, matrix, row, ind, shift )
1188 do column = 1, deg2(3)-row(3)+1
1189 shift = (column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1190 call massemble2( deg1, deg2, n_cells, mass_line, matrix, row, ind, shift )
1193 sll_assert( ind == (row(1)+(row(2)-1)*n_cells(1)+(row(3)-1)*n_cells(1)*n_cells(2))*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)*(deg1(3)+deg2(3)+1)+1 )
1194 else if(row(3) > deg2(3) .and. row(3) <= n_cells(3)-deg1(3))
then
1195 do column = 1, deg1(3)+deg2(3)+1
1196 shift = (column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1197 call massemble2( deg1, deg2, n_cells, mass_line, matrix, row, ind, shift )
1199 sll_assert( ind == (row(1)+(row(2)-1)*n_cells(1)+(row(3)-1)*n_cells(1)*n_cells(2))*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)*(deg1(3)+deg2(3)+1)+1 )
1201 else if(row(3) > n_cells(3)-deg1(3) .and. row(3) <= n_cells(3))
then
1203 do column = n_cells(3)-row(3)+deg2(3)+2, deg1(3)+deg2(3)+1
1204 shift = (column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1205 call massemble2( deg1, deg2, n_cells, mass_line, matrix, row, ind, shift )
1208 do column = 1, deg2(3)+1
1209 shift = (column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1210 call massemble2( deg1, deg2, n_cells, mass_line, matrix, row, ind, shift )
1213 do column = 2+deg2(3), n_cells(3)-row(3)+deg2(3)+1
1214 shift = (column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1215 call massemble2( deg1, deg2, n_cells, mass_line, matrix, row, ind, shift )
1217 sll_assert( ind == (row(1)+(row(2)-1)*n_cells(1)+(row(3)-1)*n_cells(1)*n_cells(2))*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)*(deg1(3)+deg2(3)+1)+1 )
1219 sll_error(
'assemble',
'error in row in assemble_mass')
1225 subroutine massemble2( deg1, deg2, n_cells, mass_line, matrix, row, ind, shift )
1226 sll_int32,
intent( in ) :: deg1(3), deg2(3)
1227 sll_int32,
intent( in ) :: n_cells(3)
1228 sll_real64,
intent( in ) :: mass_line((deg1(1)+deg2(1)+1)*(deg1(2)+ deg2(2)+1)*(deg1(3)+ deg2(3)+1))
1230 sll_int32,
intent( in ) :: row(3)
1231 sll_int32,
intent( inout ) :: ind
1232 sll_int32,
intent( in ) :: shift
1234 sll_int32 :: column, shift1
1236 if(row(2) <= deg2(2))
then
1237 do column = 2-row(2)+deg2(2), deg2(2)
1238 shift1 = (column-1)*(deg1(1)+deg2(1)+1)+shift
1239 call massemble1( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1241 do column = deg2(2)+1,deg1(2)+deg2(2)+1
1242 shift1 = (column-1)*(deg1(1)+deg2(1)+1)+shift
1243 call massemble1( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1246 do column = 1, deg2(2)-row(2)+1
1247 shift1 = (column-1)*(deg1(1)+deg2(1)+1)+shift
1248 call massemble1( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1250 else if(row(2) > deg2(2) .and. row(2) <= n_cells(2)-deg1(2))
then
1251 do column = 1, deg1(2)+deg2(2)+1
1252 shift1 = (column-1)*(deg1(1)+deg2(1)+1)+shift
1253 call massemble1( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1257 else if(row(2) > n_cells(2)-deg1(2) .and. row(2) <= n_cells(2))
then
1259 do column = n_cells(2)-row(2)+deg2(2)+2, deg1(2)+deg2(2)+1
1260 shift1 = (column-1)*(deg1(1)+deg2(1)+1)+shift
1261 call massemble1( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1264 do column = 1, deg2(2)+1
1265 shift1 = (column-1)*(deg1(1)+deg2(1)+1)+shift
1266 call massemble1( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1)
1269 do column = 2+deg2(2), n_cells(2)-row(2)+deg2(2)+1
1270 shift1 = (column-1)*(deg1(1)+deg2(1)+1)+shift
1271 call massemble1( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1274 sll_error(
'assemble',
'error in row in assemble_mass')
1280 subroutine massemble1( deg1, deg2, n_cells, mass_line, matrix, row, ind, shift )
1281 sll_int32,
intent( in ) :: deg1(3), deg2(3)
1282 sll_int32,
intent( in ) :: n_cells
1283 sll_real64,
intent( in ) :: mass_line((deg1(1)+deg2(1)+1)*(deg1(2)+ deg2(2)+1)*(deg1(3)+ deg2(3)+1))
1285 sll_int32,
intent( in ) :: row
1286 sll_int32,
intent( inout ) :: ind
1287 sll_int32,
intent( in ) :: shift
1292 if(row <= deg2(1))
then
1293 do column = 2-row+deg2(1), deg2(1)
1294 matrix%arr_a(1,ind) = mass_line(column+shift)
1297 matrix%arr_a(1,ind:ind+deg1(1)) = mass_line(deg2(1)+1+shift:deg1(1)+deg2(1)+1+shift)
1300 do column = 1, deg2(1)-row+1
1301 matrix%arr_a(1,ind) = mass_line(column+shift)
1304 else if(row > deg2(1) .and. row <= n_cells-deg1(1))
then
1305 matrix%arr_a(1,ind:ind+deg1(1)+deg2(1))=mass_line(1+shift:deg1(1)+deg2(1)+1+shift)
1307 ind = ind+deg1(1)+deg2(1)+1
1309 else if(row > n_cells-deg1(1) .and. row <= n_cells)
then
1311 do column = n_cells-row+deg2(1)+2, deg1(1)+deg2(1)+1
1312 matrix%arr_a(1,ind) = mass_line(column+shift)
1316 matrix%arr_a(1,ind:ind+deg2(1)) = mass_line(1+shift:deg2(1)+1+shift)
1319 do column = 2+deg2(1), n_cells-row+deg2(1)+1
1320 matrix%arr_a(1,ind) = mass_line(column+shift)
1324 sll_error(
'assemble',
'error in row in assemble_mass')
1332 sll_int32,
intent( in ) :: deg1(3), deg2(3)
1333 sll_int32,
intent( in ) :: n_cells(3)
1334 sll_real64,
intent( in ) :: mass_line((deg1(1)+deg2(1)+1)*(deg1(2)+ deg2(2)+1)*(deg1(3)+ deg2(3)+1))
1336 sll_int32,
intent( in ) :: row(3)
1337 sll_int32,
intent( inout ) :: ind
1339 sll_int32 :: column, shift, begin
1345 if(row(3)<=deg2(3))
then
1346 do column = 2-row(3)+deg2(3), deg2(3)
1347 shift=(column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1350 do column= deg2(3)+1,deg1(3)+deg2(3)+1
1351 shift=(column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1355 do column = 1, deg2(3)-row(3)+1
1356 shift=(column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1359 else if(row(3) > deg2(3) .and. row(3)<= n_cells(3)-deg1(3))
then
1360 do column=1, deg1(3)+deg2(3)+1
1361 shift=(column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1365 else if(row(3) > n_cells(3)-deg1(3) .and. row(3) <= n_cells(3))
then
1367 do column = n_cells(3)-row(3)+deg2(3)+2, deg1(3)+deg2(3)+1
1368 shift=(column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1372 do column=1, deg2(3)+1
1373 shift=(column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1377 do column = 2+deg2(3), n_cells(3)-row(3)+deg2(3)+1
1378 shift=(column-1)*(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)
1382 sll_error(
'assemble',
'error in row in assemble_mass')
1384 sll_assert( ind == begin+(deg1(1)+deg2(1)+1)*(deg1(2)+deg2(2)+1)*(deg1(3)+deg2(3)+1) )
1390 sll_int32,
intent( in ) :: deg1(3), deg2(3)
1391 sll_int32,
intent( in ) :: n_cells(3)
1392 sll_real64,
intent( in ) :: mass_line((deg1(1)+deg2(1)+1)*(deg1(2)+ deg2(2)+1)*(deg1(3)+ deg2(3)+1))
1394 sll_int32,
intent( in ) :: row(3)
1395 sll_int32,
intent( inout ) :: ind
1396 sll_int32,
intent( in ) :: shift
1398 sll_int32 :: column, shift1
1401 if(row(2)<=deg2(2))
then
1402 do column = 2-row(2)+deg2(2), deg2(2)
1403 shift1=(column-1)*(deg1(1)+deg2(1)+1)+shift
1404 call massemble1_clamped( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1406 do column= deg2(2)+1,deg1(2)+deg2(2)+1
1407 shift1=(column-1)*(deg1(1)+deg2(1)+1)+shift
1408 call massemble1_clamped( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1411 do column = 1, deg2(2)-row(2)+1
1412 shift1=(column-1)*(deg1(1)+deg2(1)+1)+shift
1413 call massemble1_clamped( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1415 else if(row(2) > deg2(2) .and. row(2)<= n_cells(2)-deg1(2))
then
1416 do column=1, deg1(2)+deg2(2)+1
1417 shift1=(column-1)*(deg1(1)+deg2(1)+1)+shift
1418 call massemble1_clamped( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1421 else if(row(2) > n_cells(2)-deg1(2) .and. row(2) <= n_cells(2))
then
1423 do column = n_cells(2)-row(2)+deg2(2)+2, deg1(2)+deg2(2)+1
1424 shift1=(column-1)*(deg1(1)+deg2(1)+1)+shift
1425 call massemble1_clamped( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1428 do column=1, deg2(2)+1
1429 shift1=(column-1)*(deg1(1)+deg2(1)+1)+shift
1430 call massemble1_clamped( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1433 do column = 2+deg2(2), n_cells(2)-row(2)+deg2(2)+1
1434 shift1=(column-1)*(deg1(1)+deg2(1)+1)+shift
1435 call massemble1_clamped( deg1, deg2, n_cells(1), mass_line, matrix, row(1), ind, shift1 )
1438 sll_error(
'assemble',
'error in row in assemble_mass')
1445 sll_int32,
intent( in ) :: deg1(3), deg2(3)
1446 sll_int32,
intent( in ) :: n_cells
1447 sll_real64,
intent( in ) :: mass_line((deg1(1)+deg2(1)+1)*(deg1(2)+ deg2(2)+1)*(deg1(3)+ deg2(3)+1))
1449 sll_int32,
intent( in ) :: row
1450 sll_int32,
intent( inout ) :: ind
1451 sll_int32,
intent( in ) :: shift
1453 if(row > deg1(1)+deg2(1) .and. row <= n_cells-deg2(1))
then
1454 matrix%arr_a(1,ind:ind+deg1(1)+deg2(1))=mass_line(1+shift:deg1(1)+deg2(1)+1+shift)
1455 ind = ind+deg1(1)+deg2(1)+1
1457 sll_error(
'assemble',
'error in row in assemble1_mixedmass_clamped')
1465 sll_int32,
intent( in ) :: deg1(3), deg2(3)
1466 sll_int32,
intent( in ) :: n_cells(3)
1467 sll_real64,
intent( in ) :: mass_line(((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)*(deg1(2)+deg2(2)+1)*(deg1(3)+deg2(3)+1))
1469 sll_int32,
intent( in ) :: row(3)
1470 sll_int32,
intent( inout ) :: ind
1472 sll_int32 :: column, shift
1476 if(row(3)<=deg2(3))
then
1477 do column = 2-row(3)+deg2(3), deg2(3)
1478 shift=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)*(deg1(2)+deg2(2)+1)
1481 do column= deg2(3)+1,deg1(3)+deg2(3)+1
1482 shift=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)*(deg1(2)+deg2(2)+1)
1486 do column = 1, deg2(3)-row(3)+1
1487 shift=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)*(deg1(2)+deg2(2)+1)
1490 else if(row(3) > deg2(3) .and. row(3)<= n_cells(3)-deg1(3))
then
1491 do column=1, deg1(3)+deg2(3)+1
1492 shift=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)*(deg1(2)+deg2(2)+1)
1496 else if(row(3) > n_cells(3)-deg1(3) .and. row(3) <= n_cells(3))
then
1498 do column = n_cells(3)-row(3)+deg2(3)+2, deg1(3)+deg2(3)+1
1499 shift=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)*(deg1(2)+deg2(2)+1)
1503 do column=1, deg2(3)+1
1504 shift=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)*(deg1(2)+deg2(2)+1)
1508 do column = 2+deg2(3), n_cells(3)-row(3)+deg2(3)+1
1509 shift=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)*(deg1(2)+deg2(2)+1)
1513 sll_error(
'assemble',
'error in row in assemble_mass')
1520 sll_int32,
intent( in ) :: deg1(3), deg2(3)
1521 sll_int32,
intent( in ) :: n_cells(3)
1522 sll_real64,
intent( in ) :: mass_line(((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)*(deg1(2)+ deg2(2)+1)*(deg1(3)+ deg2(3)+1))
1524 sll_int32,
intent( in ) :: row(3)
1525 sll_int32,
intent( inout ) :: ind
1526 sll_int32,
intent( in ) :: shift
1528 sll_int32 :: column, shift1
1531 if(row(2)<=deg2(2))
then
1532 do column = 2-row(2)+deg2(2), deg2(2)
1533 shift1=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)+shift
1536 do column= deg2(2)+1,deg1(2)+deg2(2)+1
1537 shift1=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)+shift
1541 do column = 1, deg2(2)-row(2)+1
1542 shift1=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)+shift
1545 else if(row(2) > deg2(2) .and. row(2)<= n_cells(2)-deg1(2))
then
1546 do column=1, deg1(2)+deg2(2)+1
1547 shift1=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)+shift
1551 else if(row(2) > n_cells(2)-deg1(2) .and. row(2) <= n_cells(2))
then
1553 do column = n_cells(2)-row(2)+deg2(2)+2, deg1(2)+deg2(2)+1
1554 shift1=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)+shift
1558 do column=1, deg2(2)+1
1559 shift1=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)+shift
1563 do column = 2+deg2(2), n_cells(2)-row(2)+deg2(2)+1
1564 shift1=(column-1)*((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)+shift
1568 sll_error(
'assemble',
'error in row in assemble_mass')
1575 sll_int32,
intent( in ) :: deg1(3), deg2(3)
1576 sll_int32,
intent( in ) :: n_cells
1577 sll_real64,
intent( in ) :: mass_line(((deg1(1)+deg2(1))**2+(2*deg2(1)+deg1(1)-deg1(1)**2)/2)*(deg1(2)+ deg2(2)+1)*(deg1(3)+ deg2(3)+1))
1579 sll_int32,
intent( in ) :: row
1580 sll_int32,
intent( inout ) :: ind
1581 sll_int32,
intent( in ) :: shift
1583 sll_int32 :: column, shift1
1586 if(row<=deg1(1))
then
1587 shift1 = ((row-1)*(2*deg2(1)+row))/2 +shift
1588 do column = 1, deg2(1)+row
1589 matrix%arr_a(1,ind) = mass_line(column+shift1)
1592 else if(row > deg1(1) .and. row <= deg1(1)+deg2(1))
then
1593 shift1 = (row-deg1(1)-1)*(deg1(1)+deg2(1)+1)+(deg1(1)*(2*deg2(1)+deg1(1)+1))/2 + shift
1594 do column = 1, deg1(1)+deg2(1)+1
1595 matrix%arr_a(1,ind) = mass_line(column+shift1)
1600 else if(row >= n_cells-deg2(1)+1 .and. row <= n_cells)
then
1601 shift1 = (n_cells-row)*(deg1(1)+deg2(1)+1)+(deg1(1)*(2*deg2(1)+deg1(1)+1))/2 + shift
1602 do column = deg1(1)+deg2(1)+1,1,-1
1603 matrix%arr_a(1,ind)=mass_line(column+shift1)
1606 else if(row > n_cells .and. row <= n_cells+deg1(1))
then
1607 shift1 = ((n_cells+deg1(1)-row)*(2*deg2(1)+n_cells+deg1(1)+1-row))/2 + shift
1608 do column = deg2(1)+1+n_cells+deg1(1)-row,1,-1
1609 matrix%arr_a(1,ind) = mass_line(column+shift1)
1613 sll_error(
'assemble',
'error in row in assemble_mass')
module for Compressed Sparse Row Matrix (CSR)
Helper for spline finite elements utilites.
subroutine mloop2(i, j, shift, deg1, deg2, n_cells, ind, spmat)
subroutine massemble2_clamped_boundary(deg1, deg2, n_cells, mass_line, matrix, row, ind, shift)
subroutine assemble1_clamped(deg, n_cells, mass_line, matrix, row, ind, shift)
subroutine massemble1_clamped(deg1, deg2, n_cells, mass_line, matrix, row, ind, shift)
subroutine loop2(i, j, shift, deg, n_cells, ind, spmat)
subroutine, public assemble_mixedmass3d(deg1, deg2, n_cells, mass_line, matrix, row, ind)
Assemble the given row of the mixed mass matrix.
subroutine, public assemble_mixedmass3d_clamped(deg1, deg2, n_cells, mass_line, matrix, row, ind)
Assemble the given row of the clamped mixed mass matrix.
subroutine mloop1(i, shift, deg1, deg2, n_cells, ind, spmat)
subroutine massemble2_clamped(deg1, deg2, n_cells, mass_line, matrix, row, ind, shift)
subroutine assemble2_clamped(deg, n_cells, mass_line, matrix, row, ind, shift)
subroutine loop1(i, shift, deg, n_cells, ind, spmat)
subroutine assemble2_clamped_boundary(deg, n_cells, mass_line, matrix, row, ind, shift)
subroutine loop1_clamped(i, shift, deg, n_cells, ind, spmat)
subroutine, public assemble_mass3d(deg, n_cells, mass_line, matrix, row, ind)
Assemble the given row of the 3d mass matrix.
subroutine, public sll_s_spline_fem_sparsity_mixedmass3d_clamped(deg1, deg2, n_cells, spmat)
Helper function to create sparsity pattern of the 3d clamped mixed mass matrix.
subroutine massemble1_clamped_boundary(deg1, deg2, n_cells, mass_line, matrix, row, ind, shift)
subroutine, public assemble_mass3d_clamped_boundary(deg, n_cells, mass_line, matrix, row, ind)
Assemble the boundary part of the clamped mass matrix.
subroutine, public sll_s_spline_fem_sparsity_mass3d(deg, n_cells, spmat)
Helper function to create sparsity pattern of the 3d mass matrix.
subroutine assemble1(deg, n_cells, mass_line, matrix, row, ind, shift)
subroutine loop2_clamped(i, j, shift, deg, n_cells, ind, spmat)
subroutine massemble2(deg1, deg2, n_cells, mass_line, matrix, row, ind, shift)
subroutine, public assemble_mass3d_clamped(deg, n_cells, mass_line, matrix, row, ind)
Assemble the given row of the clamped mass matrix.
subroutine assemble1_clamped_boundary(deg, n_cells, mass_line, matrix, row, ind, shift)
subroutine, public assemble_mixedmass3d_clamped_boundary(deg1, deg2, n_cells, mass_line, matrix, row, ind)
Assemble the boundary part of the clamped mixed mass matrix.
subroutine mloop1_clamped(i, shift, deg1, deg2, n_cells, ind, spmat)
subroutine, public sll_s_spline_fem_sparsity_mixedmass3d(deg1, deg2, n_cells, spmat)
Helper function to create sparsity pattern of the 3d mass matrix.
subroutine, public sll_s_spline_fem_sparsity_mass3d_clamped(deg, n_cells, spmat)
Helper function to create sparsity pattern of the 3d clamped mass matrix.
subroutine massemble1(deg1, deg2, n_cells, mass_line, matrix, row, ind, shift)
subroutine mloop2_clamped(i, j, shift, deg1, deg2, n_cells, ind, spmat)
subroutine assemble2(deg, n_cells, mass_line, matrix, row, ind, shift)