https://www.cdslab.org/paramonte/fortran/2
Current view: top level - main - pm_arrayReverse@routines.inc.F90 (source / functions) Hit Total Coverage
Test: ParaMonte 2.0.0 :: Serial Fortran - Code Coverage Report Lines: 13 13 100.0 %
Date: 2024-04-08 03:18:57 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!                                                                                                                            !!!!
       4             : !!!!    ParaMonte: Parallel Monte Carlo and Machine Learning Library.                                                           !!!!
       5             : !!!!                                                                                                                            !!!!
       6             : !!!!    Copyright (C) 2012-present, The Computational Data Science Lab                                                          !!!!
       7             : !!!!                                                                                                                            !!!!
       8             : !!!!    This file is part of the ParaMonte library.                                                                             !!!!
       9             : !!!!                                                                                                                            !!!!
      10             : !!!!    LICENSE                                                                                                                 !!!!
      11             : !!!!                                                                                                                            !!!!
      12             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/LICENSE.md                                                          !!!!
      13             : !!!!                                                                                                                            !!!!
      14             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      15             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      16             : 
      17             : !>  \brief
      18             : !>  This file contains the implementation details of the routines under the generic interface
      19             : !>  [setReversed](@ref pm_arrayReverse::setReversed).
      20             : !>
      21             : !>  \finmain
      22             : !>
      23             : !>  \author
      24             : !>  \AmirShahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin
      25             : 
      26             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      27             : 
      28             :         ! Set the indexing rules.
      29             : #if     SK_ENABLED && D0_ENABLED
      30             : #define GET_INDEX(i) i:i
      31             : #define GET_SIZE len
      32             : #elif   D1_ENABLED
      33             : #define GET_SIZE size
      34             : #define GET_INDEX(i) i
      35             : #else
      36             : #error  "Unrecognized interface."
      37             : #endif
      38             :         ! Set the array bounds.
      39             : #if     SK_ENABLED && D0_ENABLED && Old_ENABLED
      40             : #define GEN_UBOUND(array) len(array, kind = IK)
      41             : #define GET_LBOUND(array) 1_IK
      42             : #else
      43             : #define GEN_UBOUND(array) ubound(array, 1, kind = IK)
      44             : #define GET_LBOUND(array) lbound(array, 1, kind = IK)
      45             : #endif
      46             :         ! Declare the temporary storage.
      47             : #if     Old_ENABLED
      48             : #if     SK_ENABLED && D0_ENABLED
      49             :         character(1,SKC) :: temp
      50             : #elif   SK_ENABLED && D1_ENABLED
      51          18 :         character(len(array),SKC) :: temp
      52             : #elif   IK_ENABLED && D1_ENABLED
      53             :         integer(IKC) :: temp
      54             : #elif   LK_ENABLED && D1_ENABLED
      55             :         logical(LKC) :: temp
      56             : #elif   CK_ENABLED && D1_ENABLED
      57             :         complex(CKC) :: temp
      58             : #elif   RK_ENABLED && D1_ENABLED
      59             :         real(RKC) :: temp
      60             : #elif   PSSK_ENABLED && D1_ENABLED
      61             :         use pm_container, only: css_pdt
      62             :         type(css_pdt(SKC)) :: temp
      63             : #else
      64             : #error  "Unrecognized interface."
      65             : #endif
      66             : #elif   !New_ENABLED
      67             : #error  "Unrecognized interface."
      68             : #endif
      69             :         ! Begin the reversal.
      70             : #if     Old_ENABLED
      71             :         integer(IK) :: lb, ub
      72             :         lb = GET_LBOUND(array)
      73        9867 :         ub = GEN_UBOUND(array)
      74       24211 :         do
      75       34078 :             if (lb >= ub) exit
      76          34 :             temp = array(GET_INDEX(lb))
      77          34 :             array(GET_INDEX(lb)) = array(GET_INDEX(ub))
      78          34 :             array(GET_INDEX(ub)) = temp
      79       24211 :             ub = ub - 1_IK
      80       24211 :             lb = lb + 1_IK
      81             :         end do
      82             : #elif   New_ENABLED
      83             :         integer(IK) :: i, lenArray
      84          70 :         lenArray = GET_SIZE(array, kind = IK)
      85             : #if     setReversed_ENABLED
      86         210 :         CHECK_ASSERTION(__LINE__, GET_SIZE(array, kind = IK) == GET_SIZE(ArrayReversed, kind = IK), \
      87             :         SK_"@setReversed(): The sizes of the input `array` and `ArrayReversed` must equal. lenArray, lenArrayNew = "\
      88             :         //getStr([GET_SIZE(array, kind = IK), GET_SIZE(ArrayReversed, kind = IK)]))
      89             : #endif
      90       60569 :         do i = 1_IK, lenArray
      91       60569 :             ArrayReversed(GET_INDEX(i)) = array(GET_INDEX(lenArray - i + 1_IK))
      92             :         end do
      93             : #else
      94             : #error  "Unrecognized interface."
      95             : #endif
      96             : #undef  GEN_UBOUND
      97             : #undef  GET_LBOUND
      98             : #undef  GET_INDEX
      99             : #undef  GET_SIZE

ParaMonte: Parallel Monte Carlo and Machine Learning Library 
The Computational Data Science Lab
© Copyright 2012 - 2024