Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_sparta_type), | intent(in) | :: | me | |||
real(kind=double_k), | intent(inout), | allocatable | :: | val(:) | ||
integer, | intent(in) | :: | nComponents | |||
integer, | intent(in) | :: | comm |
subroutine tem_exchange_double( me, val, nComponents, comm )
! ---------------------------------------------------------------------------
type( tem_sparta_type ), intent(in) :: me
integer, intent(in) :: nComponents
real(kind=double_k), allocatable, intent(inout) :: val(:)
integer, intent(in) :: comm
! ---------------------------------------------------------------------------
real(kind=double_k), allocatable :: old_val(:)
integer :: iError
! ---------------------------------------------------------------------------
! Assumption check
if ( nComponents <= 0 ) then
write(logUnit(0),*) 'When call tem_exchange_data, nComponents <= 0!'
write(logUnit(0),*) 'Stop!'
call tem_abort()
end if
call move_alloc( val, old_val )
allocate( val(me%new_size*nComponents) )
call mpi_alltoallv( old_val, me%send_count*nComponents, me%send_index*nComponents, mpi_double_precision,&
val, me%recv_count*nComponents, me%recv_index*nComponents, mpi_double_precision,&
comm, ierror )
deallocate( old_val )
end subroutine tem_exchange_double