LOGICAL FUNCTION CheckIncrementRoundOff( RootFinderData, X )
! FUNCTION INFORMATION:
! AUTHOR Dimitri Curtil (LBNL)
! DATE WRITTEN February 2006
! MODIFIED
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! This function checks whether the current iterate X satisfies the
! round-off criterion or not.
!
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
TYPE(RootFinderDataType), INTENT(IN) :: RootFinderData ! Data used by root finding algorithm
REAL(r64), INTENT(IN) :: X ! X value for current iterate
! FUNCTION PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: DeltaX ! Increment in X since last iterate
REAL(r64) :: TolX ! Tolerance to satisfy for X increment
! FLOW:
CheckIncrementRoundOff = .FALSE.
! Check for round-off error in X increments since last iterate
IF ( RootFinderData%CurrentPoint%DefinedFlag ) THEN
! TODO: Use typical value for X averaged over successive iterations
TolX = RootFinderData%Controls%TolX * ABS(X) + RootFinderData%Controls%ATolX
DeltaX = X - RootFinderData%CurrentPoint%Y
IF ( ABS(DeltaX) <= ABS(TolX) ) THEN
CheckIncrementRoundOff = .TRUE.
RETURN
END IF
END IF
RETURN
END FUNCTION CheckIncrementRoundOff