LCOV - code coverage report
Current view: top level - atmos_phys/to_be_ccppized - ccpp_const_utils.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 11 0.0 %
Date: 2025-03-13 19:21:45 Functions: 0 1 0.0 %

          Line data    Source code
       1             : ! ccpp_const_utils contains utility functions that use
       2             : ! the ccpp constituent properties pointer.
       3             : ! this code was separated out to remove circular dependencies.
       4             : module ccpp_const_utils
       5             :   implicit none
       6             :   private
       7             : 
       8             :   public :: ccpp_const_get_idx
       9             : 
      10             : contains
      11             : 
      12           0 :   subroutine ccpp_const_get_idx(constituent_props, name, cindex, errmsg, errflg)
      13             :     use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t
      14             : 
      15             :     ! Input arguments
      16             :     type(ccpp_constituent_prop_ptr_t), intent(in)  :: constituent_props(:)
      17             :     character(len=*),                  intent(in)  :: name   ! constituent name
      18             : 
      19             :     ! Output arguments
      20             :     integer,                           intent(out) :: cindex ! global constituent index
      21             :     character(len=512),                intent(out) :: errmsg ! error message
      22             :     integer,                           intent(out) :: errflg ! error flag
      23             : 
      24             :     ! Local variables
      25             :     integer            :: t_cindex
      26             :     character(len=256) :: t_const_name
      27             : 
      28           0 :     errmsg = ''
      29           0 :     errflg = 0
      30             : 
      31           0 :     cindex = -1
      32             : 
      33             :     ! This convoluted loop is brought to you in exchange for avoiding a
      34             :     ! circular dependency on cam_ccpp_cap::cam_const_get_index.
      35           0 :     const_props_loop: do t_cindex = lbound(constituent_props, 1), ubound(constituent_props, 1)
      36           0 :        call constituent_props(t_cindex)%standard_name(t_const_name, errflg, errmsg)
      37           0 :        if (errflg /= 0) then
      38             :           ! Abort subroutine and return with error.
      39           0 :           return
      40             :        end if
      41             : 
      42           0 :        if (trim(t_const_name) == trim(name)) then
      43           0 :           cindex = t_cindex
      44           0 :           exit const_props_loop
      45             :        end if
      46             :     enddo const_props_loop
      47             : 
      48             :   end subroutine ccpp_const_get_idx
      49             : 
      50             : end module ccpp_const_utils

Generated by: LCOV version 1.14