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_oc_build(q, shape)
class(pf_encap_t), intent(inout) :: q
integer, intent(in ) :: shape(:)
select type (q)
class is (ndarray_oc)
allocate(q%shape(size(shape)))
allocate(q%yflatarray(product(shape)))
allocate(q%pflatarray(product(shape)))
q%dim = size(shape)
q%shape = shape
class default
print *, "wrong class in ndarray_oc_build!"
stop
end select
end subroutine ndarray_oc_build