FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | ndim | |||
integer, | intent(in) | :: | lubd(2*ndim) | |||
complex, | intent(inout), | optional, | pointer | :: | a1(:) | |
complex, | intent(inout), | optional, | pointer | :: | a2(:,:) | |
complex, | intent(inout), | optional, | pointer | :: | a3(:,:,:) | |
integer, | intent(out), | optional | :: | tag | ||
character(len=maxlen), | intent(in), | optional | :: | label | ||
integer, | intent(out), | optional | :: | ierror |
subroutine shm_alloc_c(ndim, lubd, a1, a2, a3, tag, label, ierror)
use, intrinsic :: iso_c_binding, only : c_f_pointer, c_loc
implicit none
! allocated shared array and stores the information in shm_info
integer, intent(in) :: ndim ! array rank
integer, intent(in) :: lubd(2*ndim) ! upper * lowee bound in the following format (s1, e1, s2, e2, ...)
complex, pointer, optional, intent(inout) :: a1(:), a2(:,:), a3(:,:,:)
integer, optional, intent(out) :: tag
character(len=maxlen), optional, intent(in) :: label
integer, intent(out), optional :: ierror
type(c_ptr) :: base_ptr
integer(KIND=MPI_ADDRESS_KIND) asize
integer disp, id, i, win, ierr
integer, allocatable :: ashape(:)
complex x
!sanity checks
if ( ndim == 1 .and. .not. present(a1) .or. &
ndim == 2 .and. .not. present(a2) .or. &
ndim == 3 .and. .not. present(a3) ) then
call error_abort("inconsistent ndim and optional array argumnent in shm_alloc call")
end if
if (present(ierror)) ierror = 0
!call MPI_type_size(MPI_DOUBLE_COMPLEX,disp,ierr)
include "shm_mpi3_alloc_tmpl.inc"
end subroutine shm_alloc_c