The subroutine Assert
checks if the output value is valid.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | RC | ||||
character(len=*), | intent(in) | :: | CallRoutine | |||
character(len=*), | intent(in), | optional | :: | CallMsg | ||
integer, | intent(in), | optional | :: | ncID |
Subroutine Assert(RC,CallRoutine,CallMsg,ncID) ! ! !USES: ! ! Use Precision_Mod, Only: f4 ! ! !INPUT PARAMETERS: ! Integer :: RC Character(Len=*),Intent(In) :: CallRoutine Character(Len=*),Intent(In),Optional :: CallMsg Integer,Intent(In),Optional :: ncID ! ! !OUTPUT PARAMETERS: ! !Real(kind=sp), Intent(Out) :: TestOut ! !----------------------------------------------------------------------- ! ! !LOCAL VARIABLES: ! Character(Len=255) :: OutMsg Integer :: status !================================================================= ! Assert starts here! !================================================================= If (RC.ne.0) Then If (Present(ncID)) Then ! Close the open file RC = NF90_CLOSE(ncid=ncID) End If If (Present(CallMsg)) Then OutMsg = Trim(CallMsg) Else Write(OutMsg,'(a,I8)') 'Error ID: ',RC End If Write(6,'(a)') '================ FAILURE ================' Write(6,'(a,a)') 'Regrid failed during: ', Trim(CallRoutine) Write(6,'(a,a)') 'Failure message : ', Trim(OutMsg) Call Cleanup(RC=status) Write(6,'(a)') '================ FAILURE ================' Status=RC stop 1 End If End Subroutine Assert