File: fsmooth.f90

package info (click to toggle)
elkcode 2.3.22-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,972 kB
  • ctags: 3,389
  • sloc: f90: 40,548; fortran: 20,560; perl: 965; makefile: 320; sh: 287; ansic: 67; python: 41
file content (42 lines) | stat: -rw-r--r-- 1,044 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

! Copyright (C) 2002-2005 J. K. Dewhurst and S. Sharma.
! This file is distributed under the terms of the GNU Lesser General Public
! License. See the file COPYING for license details.

!BOP
! !ROUTINE: fsmooth
! !INTERFACE:
subroutine fsmooth(m,n,ld,f)
! !INPUT/OUTPUT PARAMETERS:
!   m  : number of 3-point running averages to perform (in,integer)
!   n  : number of point (in,integer)
!   ld : leading dimension (in,integer)
!   f  : function array (inout,real(ld,n))
! !DESCRIPTION:
!   Removes numerical noise from a function by performing $m$ successive
!   3-point running averages on the data. The endpoints are kept fixed.
!
! !REVISION HISTORY:
!   Created December 2005 (JKD)
!EOP
!BOC
implicit none
! arguments
integer, intent(in) :: m
integer, intent(in) :: n
integer, intent(in) :: ld
real(8), intent(inout) :: f(ld,n)
! local variables
integer i,j
! automatic arrays
real(8) g(n)
do i=1,m
  do j=2,n-1
    g(j)=0.3333333333333333333d0*(f(1,j-1)+f(1,j)+f(1,j+1))
  end do
  f(1,2:n-1)=g(2:n-1)
end do
return
end subroutine
!EOC