scatter_add_r Subroutine

public subroutine scatter_add_r(dest, source, dest_index)

Arguments

Type IntentOptional AttributesName
real(kind=SP), intent(out), DIMENSION(:):: dest
real(kind=SP), intent(in), DIMENSION(:):: source
integer(kind=I4B), intent(in), DIMENSION(:):: dest_index

Calls

proc~~scatter_add_r~~CallsGraph proc~scatter_add_r scatter_add_r proc~assert_eq2 assert_eq2 proc~scatter_add_r->proc~assert_eq2

Called by

proc~~scatter_add_r~~CalledByGraph proc~scatter_add_r scatter_add_r interface~scatter_add scatter_add interface~scatter_add->proc~scatter_add_r

Contents

Source Code


Source Code

	SUBROUTINE scatter_add_r(dest,source,dest_index)
	REAL(SP), DIMENSION(:), INTENT(OUT) :: dest
	REAL(SP), DIMENSION(:), INTENT(IN) :: source
	INTEGER(I4B), DIMENSION(:), INTENT(IN) :: dest_index
	INTEGER(I4B) :: m,n,j,i
	n=assert_eq2(size(source),size(dest_index),'scatter_add_r')
	m=size(dest)
	do j=1,n
		i=dest_index(j)
		if (i > 0 .and. i <= m) dest(i)=dest(i)+source(j)
	end do
	END SUBROUTINE scatter_add_r