1 2! Copyright (C) 2005 J. K. Dewhurst and S. Sharma. 3! This file is distributed under the terms of the GNU Lesser General Public 4! License. See the file COPYING for license details. 5 6!BOP 7! !ROUTINE: fsmooth 8! !INTERFACE: 9pure subroutine fsmooth(m,n,f) 10! !INPUT/OUTPUT PARAMETERS: 11! m : number of 3-point running averages to perform (in,integer) 12! n : number of point (in,integer) 13! f : function array (inout,real(n)) 14! !DESCRIPTION: 15! Removes numerical noise from a function by performing $m$ successive 16! 3-point running averages on the data. The endpoints are kept fixed. 17! 18! !REVISION HISTORY: 19! Created December 2005 (JKD) 20!EOP 21!BOC 22implicit none 23! arguments 24integer, intent(in) :: m,n 25real(8), intent(inout) :: f(n) 26! local variables 27integer i,j 28! automatic arrays 29real(8) g(n) 30do i=1,m 31 do j=2,n-1 32 g(j)=0.3333333333333333333d0*(f(j-1)+f(j)+f(j+1)) 33 end do 34 f(2:n-1)=g(2:n-1) 35end do 36end subroutine 37!EOC 38 39