LCOV - code coverage report
Current view: top level - src/input - cp_parser_ilist_methods.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:936074a) Lines: 92.3 % 26 24
Test Date: 2025-12-04 06:27:48 Functions: 100.0 % 3 3

            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 a module to allow simple internal preprocessing in input files.
      10              : !> \par History
      11              : !>      - standalone proof-of-concept implementation (20.02.2008,AK)
      12              : !>      - integration into cp2k (22.02.2008,tlaino)
      13              : !>      - variables added (25.02.2008,AK)
      14              : !> \author Axel Kohlmeyer [AK] - CMM/UPenn Philadelphia
      15              : !> \date 25.02.2008
      16              : ! **************************************************************************************************
      17              : MODULE cp_parser_ilist_methods
      18              :    USE cp_log_handling,                 ONLY: cp_to_string
      19              :    USE cp_parser_ilist_types,           ONLY: ilist_type
      20              : #include "../base/base_uses.f90"
      21              : 
      22              :    IMPLICIT NONE
      23              :    PRIVATE
      24              : 
      25              :    PUBLIC :: ilist_setup, ilist_update, ilist_reset
      26              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'cp_parser_ilist_methods'
      27              : 
      28              : CONTAINS
      29              : 
      30              : ! ****************************************************************************
      31              : !> \brief setup the integer listing type
      32              : !> \param ilist ...
      33              : !> \param token ...
      34              : !> \date  08.2008
      35              : !> \author Teodoro Laino [tlaino] - University of Zurich
      36              : ! **************************************************************************************************
      37          622 :    SUBROUTINE ilist_setup(ilist, token)
      38              :       TYPE(ilist_type), POINTER                          :: ilist
      39              :       CHARACTER(LEN=*)                                   :: token
      40              : 
      41              :       INTEGER                                            :: ind
      42              : 
      43          622 :       CPASSERT(ASSOCIATED(ilist))
      44          622 :       ind = INDEX(token, "..")
      45          622 :       READ (UNIT=token(:ind - 1), FMT=*) ilist%istart
      46          622 :       READ (UNIT=token(ind + 2:), FMT=*) ilist%iend
      47          622 :       IF (ilist%istart > ilist%iend) &
      48              :          CALL cp_abort(__LOCATION__, &
      49              :                        "Invalid list range specified: "// &
      50              :                        TRIM(ADJUSTL(cp_to_string(ilist%istart)))//".."// &
      51            0 :                        TRIM(ADJUSTL(cp_to_string(ilist%iend))))
      52          622 :       ilist%nel_list = ilist%iend - ilist%istart + 1
      53          622 :       ilist%ipresent = ilist%istart
      54          622 :       ilist%in_use = .TRUE.
      55              : 
      56          622 :    END SUBROUTINE ilist_setup
      57              : 
      58              : ! ****************************************************************************
      59              : !> \brief updates the integer listing type
      60              : !> \param ilist ...
      61              : !> \date  08.2008
      62              : !> \author Teodoro Laino [tlaino] - University of Zurich
      63              : ! **************************************************************************************************
      64        14308 :    SUBROUTINE ilist_update(ilist)
      65              :       TYPE(ilist_type), POINTER                          :: ilist
      66              : 
      67        14308 :       CPASSERT(ASSOCIATED(ilist))
      68        14308 :       ilist%ipresent = ilist%ipresent + 1
      69        14308 :       IF (ilist%ipresent > ilist%iend) THEN
      70            0 :          CALL ilist_reset(ilist)
      71              :       END IF
      72        14308 :    END SUBROUTINE ilist_update
      73              : 
      74              : ! ****************************************************************************
      75              : !> \brief updates the integer listing type
      76              : !> \param ilist ...
      77              : !> \date  08.2008
      78              : !> \author Teodoro Laino [tlaino] - University of Zurich
      79              : ! **************************************************************************************************
      80        14930 :    SUBROUTINE ilist_reset(ilist)
      81              :       TYPE(ilist_type), POINTER                          :: ilist
      82              : 
      83        14930 :       CPASSERT(ASSOCIATED(ilist))
      84        14930 :       IF (ilist%ipresent == ilist%iend) THEN
      85          622 :          ilist%istart = HUGE(0)
      86          622 :          ilist%iend = HUGE(0)
      87          622 :          ilist%nel_list = HUGE(0)
      88          622 :          ilist%ipresent = HUGE(0)
      89          622 :          ilist%in_use = .FALSE.
      90              :       END IF
      91        14930 :    END SUBROUTINE ilist_reset
      92              : 
      93              : END MODULE cp_parser_ilist_methods
        

Generated by: LCOV version 2.0-1