subroutine report_descriptor_string(PDS, iG, iD, iGfile, iDfile, &
reportType, localPET, localrc)
!-----------------------------------------------------------------------------
! routine displays the test result, followed by the problem descriptor string,
! followed by the entry number and file names for the grid and distribution
! specifiers.
!
! report string takes the form:
! {status}: {source string} {action} {destination string}
!-----------------------------------------------------------------------------
! arguments
type(problem_descriptor_strings), intent(inout) :: PDS
integer, intent(in ) :: iG, iD, iDfile, iGfile
character(THARN_MAXSTR), intent(in ) :: reportType
integer, intent(in ) :: localPET
integer, intent( out) :: localrc
! local character strings
character(THARN_MAXSTR) :: lstatus, lout, test_string
character(7) :: l1, l2, lpet
! local integer variables
integer :: test_status
! initialize return flag
localrc = ESMF_RC_NOT_IMPL
!-----------------------------------------------------------------------------
! extract variables
!-----------------------------------------------------------------------------
test_string = PDS%test_record(iDfile,iGfile)%test_string(iD,iG)%string
test_status = PDS%test_record(iDfile,iGfile)%test_status(iD,iG)
!-----------------------------------------------------------------------------
! output format
!-----------------------------------------------------------------------------
write(l1,"(i6)") iG
write(l2,"(i6)") iD
write(lpet,"(i6)") localPET
10 format('PET(',a,') ', a, /,' > element=', a,' of grid file= ', a, &
/,' > element=', a,' of dist file= ', a)
!-----------------------------------------------------------------------------
! set STATUS string
!-----------------------------------------------------------------------------
select case (trim(adjustL(reportType)))
case("FULL")
!--------------------------------------------------------------------------
! report both successes and failures
!--------------------------------------------------------------------------
if( test_status == HarnessTest_SUCCESS ) then
lstatus = "SUCCESS:"
lout = trim(adjustL(lstatus)) // trim(adjustL(test_string))
write(*,10) trim(adjustL(lpet)), trim(adjustL(lout)), &
trim(adjustL(l1)), trim(adjustL(PDS%Gfiles(iGfile)%filename)), &
trim(adjustL(l2)), trim(adjustL(PDS%Dfiles(iDfile)%filename))
elseif( test_status == HarnessTest_FAILURE ) then
lstatus = "FAILURE:"
lout = trim(adjustL(lstatus)) // trim(adjustL(test_string))
write(*,10) trim(adjustL(lpet)), trim(adjustL(lout)), &
trim(adjustL(l1)), trim(adjustL(PDS%Gfiles(iGfile)%filename)), &
trim(adjustL(l2)), trim(adjustL(PDS%Dfiles(iDfile)%filename))
else
! error
call ESMF_LogSetError( ESMF_FAILURE,msg="invalid test status value ", &
rcToReturn=localrc)
return
endif
case("FAILURE")
!--------------------------------------------------------------------------
! only report failures
!--------------------------------------------------------------------------
if( test_status == HarnessTest_FAILURE ) then
lstatus = "FAILURE:"
lout = trim(adjustL(lstatus)) // trim(adjustL(test_string))
write(*,10) trim(adjustL(lpet)), trim(adjustL(lout)), &
trim(adjustL(l1)), trim(adjustL(PDS%Gfiles(iGfile)%filename)), &
trim(adjustL(l2)), trim(adjustL(PDS%Dfiles(iDfile)%filename))
endif
case("SUCCESS")
!--------------------------------------------------------------------------
! only report success
!--------------------------------------------------------------------------
if( test_status == HarnessTest_SUCCESS ) then
lstatus = "SUCCESS:"
lout = trim(adjustL(lstatus)) // trim(adjustL(test_string))
write(*,10) trim(adjustL(lpet)), trim(adjustL(lout)), &
trim(adjustL(l1)), trim(adjustL(PDS%Gfiles(iGfile)%filename)), &
trim(adjustL(l2)), trim(adjustL(PDS%Dfiles(iDfile)%filename))
endif
case("NONE")
!--------------------------------------------------------------------------
! no report
!--------------------------------------------------------------------------
case default
! error
print*,"error, report flag improperly set"
call ESMF_LogSetError( ESMF_FAILURE, msg=" report flag improperly set", &
rcToReturn=localrc)
return
end select ! case of report flag
!-----------------------------------------------------------------------------
! if I've gotten this far without an error, then the routine has succeeded.
!-----------------------------------------------------------------------------
localrc = ESMF_SUCCESS
!-----------------------------------------------------------------------------
end subroutine report_descriptor_string