Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | N | |||
type(PointType), | intent(inout) | :: | History(:) |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE SortHistory( N, History )
! SUBROUTINE INFORMATION:
! AUTHOR Dimitri Curtil (LBNL)
! DATE WRITTEN March 2006
! MODIFIED
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine orders the N points in the history array in increasing
! order of ABS(Y) values.
!
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: N ! Number of points to sort in history array
TYPE(PointType), INTENT(INOUT) :: History(:) ! Array of PointType variables. At least N of them
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: I, J
REAL(r64) :: XTemp, YTemp
! FLOW:
! Nothing to do if only one point stored in history
IF ( N <= 1 ) THEN
RETURN
END IF
DO I=1,N-1
DO J=I+1,N
IF ( History(J)%DefinedFlag ) THEN
! Swap I and J elements
IF ( ABS(History(J)%Y) < ABS(History(I)%Y) ) THEN
XTemp = History(I)%X
YTemp = History(I)%Y
History(I)%X = History(J)%X
History(I)%Y = History(J)%Y
History(J)%X = XTemp
History(J)%Y = YTemp
END IF
END IF
END DO
END DO
RETURN
END SUBROUTINE SortHistory