int_g1_cosine2 Function

public pure function int_g1_cosine2(r) result(val)

Integral of second cosine filter from 0 to r.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: r

Distance from filter center

Return Value real(kind=wp)

Result


Source Code

    pure function int_g1_cosine2(r) result(val)
      !> Integral of second cosine filter from 0 to r.
      implicit none
      real(wp), intent(in) :: r                                                !! Distance from filter center
      real(wp)             :: val                                              !! Result
      ! Work variable
      real(wp) :: new_r
      real(wp), parameter :: pi=4.0_wp*atan(1.0_wp)

      new_r = min(max(r,-1.0_wp),1.0_wp)
      val = 0.5_wp*(new_r+1.0_wp/pi*sin(pi*new_r))

      return
    end function int_g1_cosine2