Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(RootFinderDataType), | intent(inout) | :: | RootFinderData | |||
real(kind=r64), | intent(in) | :: | X | |||
real(kind=r64), | intent(in) | :: | Y |
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.
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 UpdateHistory( RootFinderData, X, Y )
! SUBROUTINE INFORMATION:
! AUTHOR Dimitri Curtil (LBNL)
! DATE WRITTEN February 2006
! MODIFIED
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine updates the min/max support points in the root finder data.
!
! METHODOLOGY EMPLOYED:
!
! PRECONDITION:
! - The current iterate (X,Y) must be a valid iterate:
! MinPoint%X <= LowerPoint%X < X < UpperPoint%X <= MaxPoint%X
!
! POSTCONDITION:
! - RootFinderData%History(:) updated with last 3 best iterates
!
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
TYPE(RootFinderDataType), INTENT(INOUT) :: RootFinderData ! Data used by root finding algorithm
REAL(r64), INTENT(IN) :: X ! X value for current iterate
REAL(r64), INTENT(IN) :: Y ! Y value for current iterate, F(X)=Y
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: NumHistory
! FLOW:
! Update history with best iterates so that:
! ABS(History(1)%Y) <= ABS(History(2)%Y) <= ABS(History(3)%Y)
!
! Note that the history points are sorted so that
! SIGN(History(1)%Y) = - SIGN(History(3)%Y)
! to ensure that the history points bracket the candidate root.
RootFinderData%History(:)%DefinedFlag = .FALSE.
RootFinderData%History(:)%X = 0.0d0
RootFinderData%History(:)%Y = 0.0d0
NumHistory = 0
IF ( RootFinderData%LowerPoint%DefinedFlag ) THEN
NumHistory = NumHistory+1
RootFinderData%History(NumHistory)%DefinedFlag = RootFinderData%LowerPoint%DefinedFlag
RootFinderData%History(NumHistory)%X = RootFinderData%LowerPoint%X
RootFinderData%History(NumHistory)%Y = RootFinderData%LowerPoint%Y
END IF
IF ( RootFinderData%UpperPoint%DefinedFlag ) THEN
NumHistory = NumHistory+1
RootFinderData%History(NumHistory)%DefinedFlag = RootFinderData%UpperPoint%DefinedFlag
RootFinderData%History(NumHistory)%X = RootFinderData%UpperPoint%X
RootFinderData%History(NumHistory)%Y = RootFinderData%UpperPoint%Y
END IF
NumHistory = NumHistory+1
RootFinderData%History(NumHistory)%DefinedFlag = .TRUE.
RootFinderData%History(NumHistory)%X = X
RootFinderData%History(NumHistory)%Y = Y
RootFinderData%NumHistory = NumHistory
CALL SortHistory( NumHistory, RootFinderData%History )
RETURN
END SUBROUTINE UpdateHistory