LCOV - code coverage report
Current view: top level - common - mo_common_functions.f90 (source / functions) Hit Total Coverage
Test: mHM coverage Lines: 4 4 100.0 %
Date: 2024-04-30 08:53:32 Functions: 1 1 100.0 %

          Line data    Source code
       1             : !> \file mo_common_functions.f90
       2             : !> \brief \copybrief mo_common_functions
       3             : !> \details \copydetails mo_common_functions
       4             : 
       5             : !> \brief Provides small utility functions used by multiple parts of the code (mHM, mRM, MPR)
       6             : !> \details Provides the functions in_bound used to check global_parameter ranges
       7             : !> \changelog
       8             : !!  - Robert Schweppe Dec 2017
       9             : !!    - refactoring
      10             : !> \authors Robert Schweppe
      11             : !> \date Dec 2017
      12             : !> \copyright Copyright 2005-\today, the mHM Developers, Luis Samaniego, Sabine Attinger: All rights reserved.
      13             : !! mHM is released under the LGPLv3+ license \license_note
      14             : !> \ingroup f_common
      15             : module mo_common_functions
      16             :   use mo_kind, only : dp
      17             : 
      18             :   IMPLICIT NONE
      19             : 
      20             :   PRIVATE
      21             : 
      22             :   PUBLIC :: in_bound ! check parameter bounds
      23             : 
      24             : contains
      25             : 
      26             :   !    NAME
      27             :   !        in_bound
      28             : 
      29             :   !    PURPOSE
      30             :   !>       \brief TODO: add description
      31             : 
      32             :   !>       \details TODO: add description
      33             : 
      34             :   !    INTENT(IN)
      35             :   !>       \param[in] "real(dp), dimension(:, :) :: params" parameter:
      36             :   !>       col_1=Lower bound,
      37             :   !>       col_2=Upper bound
      38             :   !>       col_3=initial
      39             : 
      40             :   !    HISTORY
      41             :   !>       \authors Robert Schweppe
      42             : 
      43             :   !>       \date Jun 2018
      44             : 
      45             :   ! Modifications:
      46             : 
      47         127 :   function in_bound(params)
      48             :     implicit none
      49             : 
      50             :     ! parameter:
      51             :     ! col_1=Lower bound,
      52             :     ! col_2=Upper bound
      53             :     ! col_3=initial
      54             :     real(dp), dimension(:, :), intent(in) :: params
      55             : 
      56             :     logical :: in_bound
      57             : 
      58             : 
      59        8134 :     if (any(params(:, 3) .lt. params(:, 1)) .or. any(params(:, 3) .gt. params(:, 2))) then
      60             :       in_bound = .false.
      61             :     else
      62         127 :       in_bound = .true.
      63             :     end if
      64             : 
      65         127 :   end function in_bound
      66             : end module mo_common_functions

Generated by: LCOV version 1.16