alloc Subroutine

private subroutine alloc(this, n_elem, htsize)

Allocate the internal (shared) memory @param[in] n_elem number of distinct values to store @param[in] htsize range of the hash function

Type Bound

shared_rhash_t

Arguments

Type IntentOptional Attributes Name
class(shared_rhash_t), intent(inout) :: this
integer(kind=int64), intent(in) :: n_elem
integer(kind=int64), intent(in) :: htsize

Contents

Source Code


Source Code

    subroutine alloc(this, n_elem, htsize)
        class(shared_rhash_t), intent(inout) :: this
        integer(int64), intent(in) :: n_elem
        integer(int64), intent(in) :: htsize

        this%hval_range = htsize
        ! Store all the indices with nonzero entries
        call this%indices%shared_alloc(n_elem)
        ! For each possible hash value, there will be on offset
        ! Add one additional offset at the end for easier initialization
        call this%hval_offsets%shared_alloc(this%hval_range + 1)
        ! Only on node-root, the multiplicity of each hash value is counted during setup
        if (iProcIndex_intra == 0) then
            allocate(this%mult(this%hval_range))
            ! Initialize with 0
            this%hval_offsets%ptr = 0
            this%mult = 1
        end if
    end subroutine alloc