Assert Subroutine

public subroutine Assert(RC, CallRoutine, CallMsg, ncID)

The subroutine Assert checks if the output value is valid.

History

  • 09 Jan 2016 - S. D. Eastham - Initial version.

Arguments

Type IntentOptional Attributes Name
integer :: RC
character(len=*), intent(in) :: CallRoutine
character(len=*), intent(in), optional :: CallMsg
integer, intent(in), optional :: ncID

Calls

proc~~assert~~CallsGraph proc~assert Assert nf90_close nf90_close proc~assert->nf90_close proc~cleanup Cleanup proc~assert->proc~cleanup proc~cleanup->nf90_close

Called by

proc~~assert~~CalledByGraph proc~assert Assert proc~readtilefile readTileFile proc~readtilefile->proc~assert proc~readtilefilenc_file readTileFileNC_file proc~readtilefilenc_file->proc~assert proc~set_fid Set_fID proc~set_fid->proc~assert none~initialize_subclass~2 TilingRegridder%initialize_subclass none~initialize_subclass~2->proc~readtilefilenc_file proc~readtilefilenc readTileFileNC proc~readtilefilenc->proc~readtilefilenc_file none~initialize~18 AbstractRegridder%initialize none~initialize~18->none~initialize_subclass~2 none~initialize_base AbstractRegridder%initialize_base none~initialize_base->none~initialize~18 none~make_regridder_from_grids RegridderManager%make_regridder_from_grids none~make_regridder_from_grids->none~initialize~18

Source Code

      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