434
435
end subroutine dcsr_assemble_local_lumped_mass
436
subroutine csr_dg_inverse_mass_from_mass(inv_mass, mass)
437
subroutine csr_dg_inverse_mass_from_mass(inv_mass, mass, only_owned_elements)
437
438
!!< Put the inverse of mass into inv_mass. This is short-circuited by
438
439
!!< knowing that mass is DG.
439
440
type(csr_matrix), intent(inout) :: inv_mass
440
441
type(csr_matrix), intent(in) :: mass
442
integer :: row, colm_pos, nloc
442
!! if present and true, only computed inverse mass for owned elements, the rest of inv_mass is zeroed
443
!! this means that after multiplication with this matrix, you need to halo_update:
444
logical, intent(in), optional :: only_owned_elements
446
integer :: row, colm_pos, nloc, last_row
451
if (present_and_true(only_owned_elements) .and. associated(mass%sparsity%row_halo)) then
452
last_row = halo_nowned_nodes(mass%sparsity%row_halo)
454
last_row = size(mass,1)
448
if(row>=size(mass,1)) exit
449
nloc=row_length(mass, row+1)
458
if(row>last_row) exit
459
nloc=row_length(mass, row)
450
460
inv_mass%val(colm_pos+1:colm_pos+nloc**2) &