LCOV - code coverage report
Current view: top level - src/common - cp_array_sort.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:936074a) Lines: 75.0 % 16 12
Test Date: 2025-12-04 06:27:48 Functions: 75.0 % 12 9

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2025 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \brief Routine for sorting an array
      10              : !> \note
      11              : !>      CP2K:
      12              : !>      Please use the interface defined in util.F for calling sort().
      13              : !>
      14              : !>      DBCSR:
      15              : !>      Please use the interface defined in dbcsr_toollib.F for calling sort().
      16              : !> \par History
      17              : !>      12.2012 first version [ole]
      18              : !> \author Ole Schuett
      19              : ! **************************************************************************************************
      20              : MODULE cp_array_sort
      21              : 
      22              :    USE kinds, ONLY: sp, dp, int_4, int_8
      23              : 
      24              : #include "../base/base_uses.f90"
      25              : 
      26              :    #:include 'array_sort.fypp'
      27              : 
      28              :    IMPLICIT NONE
      29              :    PRIVATE
      30              : 
      31              :    PUBLIC :: cp_1d_s_sort, cp_1d_r_sort, cp_1d_i4_sort, cp_1d_i8_sort
      32              : 
      33              : CONTAINS
      34              : 
      35            0 :    #:call array_sort(prefix='cp_1d_s', type='REAL(kind=sp)')
      36              :    #:endcall
      37              : 
      38            0 :    PURE FUNCTION cp_1d_s_less_than(a, b) RESULT(res)
      39              :       REAL(kind=sp), INTENT(IN) :: a, b
      40              :       LOGICAL                   :: res
      41            0 :       res = a < b
      42            0 :    END FUNCTION cp_1d_s_less_than
      43              : 
      44  34895553040 :    #:call array_sort(prefix='cp_1d_r', type='REAL(kind=dp)')
      45              :    #:endcall
      46              : 
      47  15758765050 :    PURE FUNCTION cp_1d_r_less_than(a, b) RESULT(res)
      48              :       REAL(kind=dp), INTENT(IN) :: a, b
      49              :       LOGICAL                   :: res
      50  15758765050 :       res = a < b
      51  15758765050 :    END FUNCTION cp_1d_r_less_than
      52              : 
      53   4285948761 :    #:call array_sort(prefix='cp_1d_i4', type='INTEGER(kind=int_4)')
      54              :    #:endcall
      55              : 
      56   1809776494 :    PURE FUNCTION cp_1d_i4_less_than(a, b) RESULT(res)
      57              :       INTEGER(kind=int_4), INTENT(IN) :: a, b
      58              :       LOGICAL                         :: res
      59   1809776494 :       res = a < b
      60   1809776494 :    END FUNCTION cp_1d_i4_less_than
      61              : 
      62    147540646 :    #:call array_sort(prefix='cp_1d_i8', type='INTEGER(kind=int_8)')
      63              :    #:endcall
      64              : 
      65     58803236 :    PURE FUNCTION cp_1d_i8_less_than(a, b) RESULT(res)
      66              :       INTEGER(kind=int_8), INTENT(IN) :: a, b
      67              :       LOGICAL                         :: res
      68     58803236 :       res = a < b
      69     58803236 :    END FUNCTION cp_1d_i8_less_than
      70              : 
      71              : END MODULE cp_array_sort
        

Generated by: LCOV version 2.0-1