allocate_sparse_ham_row Subroutine

public subroutine allocate_sparse_ham_row(sparse_matrix, row, sparse_row_size, sparse_matrix_name, sparse_tags)

Arguments

Type IntentOptional Attributes Name
type(sparse_matrix_real), intent(inout) :: sparse_matrix(:)
integer, intent(in) :: row
integer, intent(in) :: sparse_row_size
character(len=*), intent(in) :: sparse_matrix_name
integer(kind=TagIntType), intent(inout) :: sparse_tags(2)

Contents


Source Code

    subroutine allocate_sparse_ham_row(sparse_matrix, row, sparse_row_size, sparse_matrix_name, sparse_tags)

        ! Allocate a single row and add it to the memory manager.

        type(sparse_matrix_real), intent(inout) :: sparse_matrix(:)
        integer, intent(in) :: row, sparse_row_size
        character(len=*), intent(in) :: sparse_matrix_name
        integer(TagIntType), intent(inout) :: sparse_tags(2)
        integer :: ierr
        character(len=1024) :: string_row
        character(len=1024) :: var_name
        character(len=*), parameter :: t_r = "allocate_sparse_ham_row"

        write(string_row, '(I10)') row

        var_name = trim(sparse_matrix_name)//"_"//trim(string_row)//"_elements"
        allocate(sparse_matrix(row)%elements(sparse_row_size), stat=ierr)
        call LogMemAlloc(var_name, sparse_row_size, 8, t_r, sparse_tags(1), ierr)

        var_name = trim(sparse_matrix_name)//"_"//trim(string_row)//"_positions"
        allocate(sparse_matrix(row)%positions(sparse_row_size), stat=ierr)
        call LogMemAlloc(var_name, sparse_row_size, sizeof_int, t_r, sparse_tags(2), ierr)

    end subroutine allocate_sparse_ham_row