LCOV - code coverage report
Current view: | top level - hemco - hco_esmf_wrappers.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 0 | 22 | 0.0 %
Date: | 2025-01-13 21:54:50 |  | Functions: | 0 | 2 | 0.0 %

              Line data    Source code
           1             : !------------------------------------------------------------------------------
           2             : !                    Harmonized Emissions Component (HEMCO)                   !
           3             : !------------------------------------------------------------------------------
           4             : !BOP
           5             : !
           6             : ! !MODULE: hco_esmf_wrappers
           7             : !
           8             : ! !DESCRIPTION: Module HCO\_ESMF\_WRAPPERS defines quick wrapper functions for
           9             : !  error checking and common ESMF operations, similar to "MAPL_Generic.h" in MAPL.
          10             : !\\
          11             : !\\
          12             : ! !INTERFACE:
          13             : !
          14             : module hco_esmf_wrappers
          15             : !
          16             : ! !USES:
          17             : !
          18             :     ! ESMF Types
          19             :     use ESMF,                     only: ESMF_SUCCESS, ESMF_FAILURE
          20             :
          21             :     ! MPI status in CESM
          22             :     use cam_abortutils,           only: endrun      ! fatal terminator
          23             :     use spmd_utils,               only: iam, masterproc
          24             :     use cam_logfile,              only: iulog
          25             :
          26             :     implicit none
          27             :     private
          28             :
          29             :     public :: HCO_ESMF_VRFY
          30             :     public :: HCO_ESMF_ASRT
          31             :
          32             : contains
          33             :
          34             :     ! Note that the VERIFY and ASSERT functions here are inverse of MAPL and
          35             :     ! return 1 on success, 0 on failure.
          36           0 :     logical function HCO_ESMF_VRFY(A, subname, line, ECRC)
          37             :         integer, intent(in)       :: A
          38             :         character*(*), intent(in) :: subname
          39             :         integer, intent(in)       :: line
          40             :         integer, optional, intent(out) :: ECRC
          41             :
          42             :         character(len=512)        :: errmsg
          43             :
          44           0 :         HCO_ESMF_VRFY = A==ESMF_SUCCESS
          45           0 :         if(.not. HCO_ESMF_VRFY) then
          46           0 :             if(present(ECRC)) then
          47           0 :                 print'(A40,I10)', subname, line
          48           0 :                 ECRC = A
          49             :             endif
          50             :
          51           0 :             write(errmsg,*) 'ABORT in HCO_ESMF_WRAPPERS. VRFY error in ', subname, ' line ', line
          52           0 :             if(masterproc) then
          53           0 :                 write(iulog,*) errmsg
          54             :             endif
          55           0 :             call endrun(errmsg)
          56             :         endif
          57           0 :     end function HCO_ESMF_VRFY
          58             :
          59           0 :     logical function HCO_ESMF_ASRT(A, subname, line, ECRC)
          60             :         logical, intent(in)       :: A
          61             :         character*(*), intent(in) :: subname
          62             :         integer, intent(in)       :: line
          63             :         integer, optional, intent(out) :: ECRC
          64             :
          65             :         character(len=512)        :: errmsg
          66             :
          67           0 :         HCO_ESMF_ASRT = A
          68           0 :         if(.not. HCO_ESMF_ASRT) then
          69           0 :             if(present(ECRC)) then
          70           0 :                 print'(A40,I10)', subname, line
          71           0 :                 ECRC = ESMF_FAILURE
          72             :             endif
          73             :
          74           0 :             write(errmsg,*) 'ABORT in HCO_ESMF_WRAPPERS. ASRT error in ', subname, ' line ', line
          75           0 :             if(masterproc) then
          76           0 :                 write(iulog,*) errmsg
          77             :             endif
          78           0 :             call endrun(errmsg)
          79             :         endif
          80           0 :     end function HCO_ESMF_ASRT
          81             : !EOC
          82             : end module hco_esmf_wrappers

Generated by: LCOV version 1.14