scatter_max_r Subroutine

public subroutine scatter_max_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_max_r~~CallsGraph proc~scatter_max_r scatter_max_r proc~assert_eq2 assert_eq2 proc~scatter_max_r->proc~assert_eq2

Called by

proc~~scatter_max_r~~CalledByGraph proc~scatter_max_r scatter_max_r interface~scatter_max scatter_max interface~scatter_max->proc~scatter_max_r

Contents

Source Code


Source Code

	SUBROUTINE scatter_max_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_max_r')
	m=size(dest)
	do j=1,n
		i=dest_index(j)
		if (i > 0 .and. i <= m) dest(i)=max(dest(i),source(j))
	end do
	END SUBROUTINE scatter_max_r