convert_matrice_format Subroutine

public subroutine convert_matrice_format(mat)

Arguments

Type IntentOptional AttributesName
type(MAT_SOLV), intent(inout), target:: mat

high level system type


Calls

proc~~convert_matrice_format~~CallsGraph proc~convert_matrice_format convert_matrice_format proc~from_elemental_to_assembled from_elemental_to_assembled proc~convert_matrice_format->proc~from_elemental_to_assembled

Called by

proc~~convert_matrice_format~~CalledByGraph proc~convert_matrice_format convert_matrice_format program~test_solvers test_solvers program~test_solvers->proc~convert_matrice_format

Contents


Source Code

   subroutine convert_matrice_format(mat)
   implicit none
   type(MAT_SOLV), intent(inout), target :: mat   !! *high level system type*
      integer(kind=I4) :: i

      ! =======================================================================================================================
      ! Compressed Column Storage (CCS) is also called the Harwell-Boeing sparse matrix format.
      ! ************************************************
      ! Elemental entries (example provided by MUMP):
      ! A1 = 1|-1  2  3| A2 = 3|2 -1  3|
      !      2| 2  1  1|      4|1  2 -1|
      !      3| 1  1  1|      5|3  2  1| => a_elt = (-1, 2, 1, 2, 1, 1, 3, 1, 1, 2, 1, 3, -1, 2, 2, 3, -1, 1)
      !
      ! A  = 1|-1  2  3  0  0|
      !      2| 2  1  1  0  0|
      !      3| 1  1  3 -1  3|
      !      4| 0  0  1  2 -1|
      !      5| 0  0  3  2  1| => eltvar = (1, 2, 3, 3, 4, 5), it locates the elemental matrix line in the assembled matrix
      !                        => eltptr = (1, 4, 7), it gives the elemental matrix first entry position in eltvar (last
      !                                               position being size(eltvar)+1)
      !
      ! ************************************************
      ! Assembled matrix :
      ! A being the same, a_elt = (-1, 2, 1, 2, 1, 1, 3, 1, 3, 1, 3, -1, 2, 2, 3, -1, 1)
      !                    irow = ( 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 5,  3, 4, 5, 3,  4, 5)
      !                    jptr = (1, 4, 7, 12, 15, 18)
      !
      ! =======================================================================================================================
      ! Triplet form
      ! ************************************************
      ! For each non zero a_elt entry, returns its row and column number
      ! A being the same, a_elt = (-1, 2, 1, 2, 1, 1, 3, 1, 3, 1, 3, -1, 2, 2, 3, -1, 1)
      !                    irow = ( 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 5,  3, 4, 5, 3,  4, 5)
      !                    jcol = ( 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3,  4, 4, 4, 5,  5, 5)

      call from_elemental_to_assembled(mat = mat)

      select case(mat%slv_t)

         case(MA48)  ! Triplet form: irow, jcol, a_elt
            continue

         case(MUMP)  ! Compressed row, elemental entries chosen: eltptr, eltvar, a_elt
            continue

         case(UMFP, SULU)  ! Compressed row, assembled form: irow, jptr, a_elt
            deallocate( mat%jcol ) ! no more needed
            ! UMFP and SULU allocations begin at 0 (C convention)
            do i = 1, mat%nn +1
               mat%jptr(i) = mat%jptr(i) -1
            enddo

            if (mat%slv_t==SULU) mat%matsulu%jptr => mat%jptr ! otherwise, matsulu%jptr will be associated to
                                                              ! a deallocated part of memory

            do i = 1, mat%nz
               mat%irow(i) = mat%irow(i) -1
            enddo

         case default
            stop 'Unknown solver type, CONVERT_MATRICE_FORMAT'

      endselect
   return
   endsubroutine convert_matrice_format