shared_alloc_real_int32 Subroutine

private subroutine shared_alloc_real_int32(this, sizes)

Type Bound

shared_ragged_array_real_t

Arguments

Type IntentOptional Attributes Name
class(shared_ragged_array_real_t), intent(inout) :: this
integer(kind=int32), intent(in) :: sizes(:)

Contents


Source Code

    subroutine shared_alloc_real_int32(this, sizes)
        class(shared_ragged_array_real_t), intent(inout) :: this
        integer(int32), intent(in) :: sizes(:)

        integer(int64) :: n_entries

        ! Allocate the shared resource
        call this%data_array%shared_alloc(int(sum(sizes), int64))

        ! Assign the pointers
        n_entries = size(sizes, kind=int64)
        allocate(this%ptr(n_entries))

        ! Keep a local copy of sizes (fortran 2003 automatic allocation)
        allocate(this%store_sizes(n_entries))
        this%store_sizes(1:n_entries) = int(sizes(1:n_entries), int64)

        ! Set the internal pointers
        call this%reassign_pointers()
    end subroutine shared_alloc_real_int32