*********************************************************************sdk ************************************************************************ * * Subroutine FSORT * * Function: * Sort value in descending order, co-sort peaks (real) * * Method: * Sorting by straight insertion * * Arguments: * Np (i) number of elements to sort * Peaks (i/o) associated 3 x np real array * Value (i/o) sort key real array * * History: * October 2 1991 sdk * Modified to co-sort unpacked peak coordinates * March 14 1988 sdk ************************************************************************ subroutine fsort ( np , peaks , value ) implicit none * Arguments integer np real value(np) real peaks(3,np) * Local variables integer i , j real valsav real peksav(3) *----------------------------------------------------------------------- do i = 1 , np - 1 valsav = value(i+1) peksav(1) = peaks(1,i+1) peksav(2) = peaks(2,i+1) peksav(3) = peaks(3,i+1) do j = i , 1 , -1 if ( valsav .le. value(j) ) then goto 20 else value(j+1) = value(j) peaks(1,j+1) = peaks(1,j) peaks(2,j+1) = peaks(2,j) peaks(3,j+1) = peaks(3,j) endif end do 20 value(j+1) = valsav peaks(1,j+1) = peksav(1) peaks(2,j+1) = peksav(2) peaks(3,j+1) = peksav(3) end do return end