tem_commbuf_long_fillmpimem Subroutine

private subroutine tem_commbuf_long_fillmpimem(me, pos, nvals)

fill the positions that describe how the data in the state vector relates to the entries in the buffer use memory that is allocated by mpi for the buffer.

Arguments

Type IntentOptional Attributes Name
type(tem_longbuffer_type), intent(inout) :: me
integer, intent(in) :: pos(nvals)
integer, intent(in) :: nvals

Calls

proc~~tem_commbuf_long_fillmpimem~~CallsGraph proc~tem_commbuf_long_fillmpimem tem_commbuf_long_fillmpimem alloc_mpif_mem alloc_mpif_mem proc~tem_commbuf_long_fillmpimem->alloc_mpif_mem free_mpif_mem free_mpif_mem proc~tem_commbuf_long_fillmpimem->free_mpif_mem

Source Code

  subroutine tem_commbuf_long_fillmpimem( me, pos, nvals )
    ! -------------------------------------------------------------------- !
    type(tem_longbuffer_type), intent(inout) :: me
    integer, intent(in) :: nvals
    integer, intent(in) :: pos(nvals)
    ! -------------------------------------------------------------------- !
    integer(kind=long_k) :: typesample
    integer(kind=mpi_address_kind) :: typelen
    ! -------------------------------------------------------------------- !

    typelen = int(c_sizeof(typesample), kind=mpi_address_kind)

    me%nvals = nvals

    if ( allocated(me%pos) ) deallocate(me%pos)
    allocate(me%pos(nvals))
    me%pos = pos

    if ( associated(me%val) ) then
      nullify(me%val)
      call free_mpif_mem(me%mem_mpi)
    end if
    call alloc_mpif_mem( asize   = nvals*typelen, &
      &                  baseptr = me%mem_mpi     )
    call c_f_pointer(me%mem_mpi, me%val, [me%nvals])

  end subroutine tem_commbuf_long_fillmpimem