https://www.cdslab.org/paramonte/fortran/2
Current view: top level - main - pm_arrayInit@routines.inc.F90 (source / functions) Hit Total Coverage
Test: ParaMonte 2.0.0 :: Serial Fortran - Code Coverage Report Lines: 12 12 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 of [pm_arrayInit](@ref pm_arrayInit).
      19             : !>
      20             : !>  \finmain
      21             : !>
      22             : !>  \author
      23             : !>  \FatemehBagheri, Wednesday 12:20 AM, October 13, 2021, Dallas, TX
      24             : 
      25             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      26             : 
      27             :         !%%%%%%%%%%%%%%%%%%
      28             : #if     getCoreHalo_ENABLED
      29             :         !%%%%%%%%%%%%%%%%%%
      30             : 
      31     2430802 :         call setCoreHalo(array, core, halo, coffset)
      32             : 
      33             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      34             : #elif   setCoreHalo_ENABLED && (D0_ENABLED || D1_ENABLED)
      35             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      36             : 
      37             :         integer(IK) :: i
      38             :         ! Set the size inference macros for scalar string vs. vectors of arbitrary types.
      39             : #if     D0_ENABLED
      40             : #define GET_SIZE(array) len(array, IK)
      41             : #elif   D1_ENABLED
      42             : #define GET_SIZE(array) size(array, 1, IK)
      43             : #else
      44             : #error  "Unrecognized interface."
      45             : #endif
      46             :         ! Set the core bounds `csize` for array vs. scalar `core` argument.
      47             : #if     Arr_ENABLED
      48             : #define GET_CORE(i) core(i : i)
      49             : #define GET_CSIZE GET_SIZE(core)
      50    17782560 :         CHECK_ASSERTION(__LINE__, coffset + GET_SIZE(core) <= GET_SIZE(array), \
      51             :         SK_"@setCoreHalo(): The condition `coffset + size(core) <= size(array)` must hold. rank(array), coffset, size(core), size(array) = "\
      52             :         //getStr([int(rank(array), IK), coffset, GET_SIZE(core), GET_SIZE(array)])) ! fpp
      53             : #elif   Sca_ENABLED
      54             : #define GET_CORE(i) core
      55             : #define GET_CSIZE csize
      56       88348 :         CHECK_ASSERTION(__LINE__, 0_IK <= csize, \
      57             :         SK_"@setCoreHalo(): The condition `0 <= csize` must hold. csize = "//getStr(csize)) ! fpp
      58      441740 :         CHECK_ASSERTION(__LINE__, coffset + csize <= GET_SIZE(array), \
      59             :         SK_"@setCoreHalo(): The condition `coffset + csize <= size(array)` must hold. rank(array), coffset, csize, size(array) = "\
      60             :         //getStr([int(rank(array), IK), coffset, csize, GET_SIZE(array)])) ! fpp
      61             : #else
      62             : #error  "Unrecognized interface."
      63             : #endif
      64     3644860 :         CHECK_ASSERTION(__LINE__, 0_IK <= coffset, \
      65             :         SK_"@setCoreHalo(): The condition `0 <= coffset` must hold. coffset = "//getStr(coffset)) ! fpp
      66             :         do concurrent(i = 1_IK : coffset)
      67    11457676 :             array(i:i) = halo
      68             :         end do
      69             :         do concurrent(i = 1_IK : GET_CSIZE)
      70   115355856 :             array(coffset + i : coffset + i) = GET_CORE(i)
      71             :         end do
      72             :         do concurrent(i = coffset + GET_CSIZE + 1_IK : GET_SIZE(array))
      73   101999803 :             array(i:i) = halo
      74             :         end do
      75             : 
      76             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      77             : #elif   setCoreHalo_ENABLED && (D2_ENABLED || D3_ENABLED)
      78             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      79             : 
      80             :         ! Set the core bounds `csize` for array vs. scalar `core` argument.
      81             : #if     Arr_ENABLED
      82             : #define GET_CSIZE(idim) size(core, idim, IK)
      83             : #elif   Sca_ENABLED
      84             : #define GET_CSIZE(idim) csize(idim)
      85             : #else
      86             : #error  "Unrecognized interface."
      87             : #endif
      88             :         ! Set the rank subset notation.
      89             : #if     D2_ENABLED
      90             : #define SUBSET :
      91             : #define GET_SUBSET(X) X(1)
      92             : #elif   D3_ENABLED
      93             : #define SUBSET :, :
      94             : #define GET_SUBSET(X) X(1 : rankArrM1)
      95             : #else
      96             : #error  "Unrecognized interface."
      97             : #endif
      98             :         integer(IK) :: i, rankArray, rankArrM1
      99             :         rankArray = int(rank(array), IK)
     100             :         rankArrM1 = rankArray - 1_IK
     101    61240636 :         array(SUBSET, 1 : coffset(rankArray)) = halo
     102     1825313 :         do i = 1_IK, GET_CSIZE(rankArray)
     103             :             call setCoreHalo( halo = halo & ! LCOV_EXCL_LINE
     104             :                             , array = array(SUBSET, coffset(rankArray) + i) & ! LCOV_EXCL_LINE
     105             :                             , coffset = GET_SUBSET(coffset) & ! LCOV_EXCL_LINE
     106             : #if                         Arr_ENABLED
     107             :                             , core = core(SUBSET, i) & ! LCOV_EXCL_LINE
     108             : #elif                       Sca_ENABLED
     109             :                             , csize = GET_SUBSET(csize) & ! LCOV_EXCL_LINE
     110             :                             , core = core & ! LCOV_EXCL_LINE
     111             : #else
     112             : #error                      "Unrecognized interface."
     113             : #endif
     114     1825313 :                             )
     115             :         end do
     116    69321271 :         array(SUBSET, coffset(rankArray) + GET_CSIZE(rankArray) + 1_IK : size(array, rankArray, IK)) = halo
     117             : #else
     118             :         !%%%%%%%%%%%%%%%%%%%%%%%%
     119             : #error  "Unrecognized interface."
     120             :         !%%%%%%%%%%%%%%%%%%%%%%%%
     121             : #endif
     122             : 
     123             : #undef  GET_SUBSET
     124             : #undef  GET_CSIZE
     125             : #undef  GET_SIZE
     126             : #undef  GET_CORE
     127             : #undef  SUBSET

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