read_data Subroutine

private subroutine read_data(this, indices, entries)

Add the (combined) indices and the corresponding integral values to the sparse storage @param[in] indices chunk of combined 6-index values @param[in] entries corresponding values of the 6-index integrals

Type Bound

sparse_lMat_t

Arguments

Type IntentOptional Attributes Name
class(sparse_lMat_t), intent(inout) :: this
integer(kind=int64), intent(in) :: indices(:)
integer(kind=int64), intent(in) :: entries(:)

Contents

Source Code


Source Code

    subroutine read_data(this, indices, entries)
        class(sparse_lMat_t), intent(inout) :: this
        integer(int64), intent(in) :: indices(:), entries(:)

        integer(int64), allocatable :: tmp_inds(:), tmp_entries(:)
        integer(int64) :: i, total_size, pos
        ! For typecasts
        HElement_t(dp), parameter :: rVal = 0.0_dp
        routine_name("read_data")
        ! Gather all data on node root
        call gather_block(indices, tmp_inds)
        call gather_block(entries, tmp_entries)
        total_size = size(tmp_inds)

        ! Then write there
        if (iProcIndex_intra == 0) then
            do i = 1, total_size
                if(tmp_inds(i) > 0) then
#ifdef CMPLX_
                    call stop_all(this_routine, "not implemented for complex")
                    unused_var(this)
#else
                    call this%set_elem(tmp_inds(i), 3.0_dp * transfer(tmp_entries(i), rVal))
#endif
                end if
            end do
        end if
        deallocate(tmp_inds)
        deallocate(tmp_entries)
    end subroutine read_data