UniformPoints Function

public function UniformPoints(a, b, firstInd, lastInd) result(xU)

\addtogroup SELF_SupportRoutines @{ \fn UniformPoints Generates a REAL(prec) array of N points evenly spaced between two points.

Usage :

REAL(prec) :: a
REAL(prec) :: b
REAL(prec) :: xU(0:N)
INTEGER :: N
....
xU = UniformPoints( a, b, N )

Parameters :

in a REAL(prec) Starting point of the interval
in b REAL(prec) Ending point of the interval
in N INTEGER The number of points in the interval \f$[a,b]\f$
in xU(0:N) REAL(prec) Array of evenly spaced points in the interval \f$[a,b]\f$

@}

Arguments

TypeIntentOptionalAttributesName
real(kind=prec) :: a
real(kind=prec) :: b
integer :: firstInd
integer :: lastInd

Return Value real(kind=prec)(firstInd:lastInd)


Contents

Source Code


Source Code

  function UniformPoints(a,b,firstInd,lastInd) result(xU)

    implicit none
    real(prec) :: a,b
    integer    :: firstInd,lastInd
    real(prec) :: xU(firstInd:lastInd)
    ! LOCAL
    real(prec)    :: dx
    integer :: i

    dx = (b-a)/real((lastInd-firstInd),prec)

    do i = firstInd,lastInd

      xU(i) = a+dx*real(i-firstInd,prec)

    enddo

  endfunction UniformPoints