Subroutine to pack an array into a flat array for sending
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray_oc), | intent(in) | :: | this | |||
real(kind=pfdp), | intent(out) | :: | z(:) | |||
integer, | intent(in), | optional | :: | flags |
subroutine ndarray_oc_pack(this, z, flags)
class(ndarray_oc), intent(in ) :: this
real(pfdp), intent( out) :: z(:)
integer, intent(in ), optional :: flags
integer :: which
which = 0
if (present(flags)) which = flags
select case (which)
case (0)
!z = [sol%yflatarray, sol%pflatarray]
!z has to be right size? initialized to nvars, so it can hold either y or p
!is it ever needed to pack y and p simultaneously?
stop "ERROR in ndarray_oc_pack: only 1, 2 allowed as flags"
case (1)
z = this%yflatarray
case (2)
z = this%pflatarray
case default
stop "ERROR in ndarray_oc_pack: only 1, 2 allowed as flags"
end select
end subroutine ndarray_oc_pack