Subroutine to allocate the array and set the size parameters
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(pf_encap_t), | intent(inout) | :: | q | |||
integer, | intent(in) | :: | shape(:) |
subroutine ndarray_build(q, shape)
class(pf_encap_t), intent(inout) :: q
integer, intent(in ) :: shape(:)
select type (q)
class is (ndarray)
allocate(q%shape(size(shape)))
allocate(q%flatarray(product(shape)))
q%dim = size(shape)
q%shape = shape
end select
end subroutine ndarray_build