Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=I8P), | intent(in) | :: | a1(1:) | First data stream. |
||
real(kind=R4P), | intent(in) | :: | a2(1:) | Second data stream. |
||
integer(kind=I1P), | intent(inout), | allocatable | :: | packed(:) | Packed data into I1P array. |
Pack different kinds of data into single I1P array.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=I1P), | public, | allocatable | :: | p1(:) | Temporary packed data of first stream. |
||
integer(kind=I1P), | public, | allocatable | :: | p2(:) | Temporary packed data of second stream. |
||
integer(kind=I4P), | public | :: | np | Size of temporary packed data. |
pure subroutine pack_data_I8_R4(a1, a2, packed)
!---------------------------------------------------------------------------------------------------------------------------------
!< Pack different kinds of data into single I1P array.
!---------------------------------------------------------------------------------------------------------------------------------
integer(I8P), intent(in) :: a1(1:) !< First data stream.
real(R4P), intent(in) :: a2(1:) !< Second data stream.
integer(I1P), allocatable, intent(inout) :: packed(:) !< Packed data into I1P array.
integer(I1P), allocatable :: p1(:) !< Temporary packed data of first stream.
integer(I1P), allocatable :: p2(:) !< Temporary packed data of second stream.
integer(I4P) :: np !< Size of temporary packed data.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1)
np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2)
if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2]
deallocate(p1,p2)
return
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine pack_data_I8_R4