make_sizes_dense Subroutine

public subroutine make_sizes_dense(old_sizes, mapping, nel_new, new_sizes)

Matches row/block sizes and offsets to a given distribution

Note

Used for making matrices dense/undense

Arguments

Type IntentOptional Attributes Name
type(array_i1d_obj), intent(in) :: old_sizes
type(array_i1d_obj), intent(in) :: mapping
integer, intent(in) :: nel_new
type(array_i1d_obj), intent(out) :: new_sizes

Source Code

   SUBROUTINE make_sizes_dense(old_sizes, mapping, nel_new, new_sizes)
      !! Matches row/block sizes and offsets to a given distribution
      !! @note Used for making matrices dense/undense

      TYPE(array_i1d_obj), INTENT(IN)                    :: old_sizes, mapping
      INTEGER, INTENT(IN)                                :: nel_new
      TYPE(array_i1d_obj), INTENT(OUT)                   :: new_sizes

      INTEGER                                            :: el, nel_old
      INTEGER, DIMENSION(:), POINTER, CONTIGUOUS         :: map, new_s, old_s

!   ---------------------------------------------------------------------------

      map => array_data(mapping)
      old_s => array_data(old_sizes)
      nel_old = array_size(old_sizes)
      ALLOCATE (new_s(nel_new))
      new_s(:) = 0
      DO el = 1, nel_old
         new_s(map(el)) = new_s(map(el)) + old_s(el)
      END DO
      CALL array_new(new_sizes, new_s, gift=.TRUE.)
   END SUBROUTINE make_sizes_dense