GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: phylmd/rrtm/pe2set_mod.F90 Lines: 0 17 0.0 %
Date: 2023-06-30 12:51:15 Branches: 0 10 0.0 %

Line Branch Exec Source
1
MODULE PE2SET_MOD
2
CONTAINS
3
SUBROUTINE PE2SET(KPE,KPRGPNS,KPRGPEW,KPRTRW,KPRTRV)
4
5
#ifdef DOC
6
7
!**** *PE2SET* - Convert from PE number to set numbers
8
9
!     Purpose.
10
!     --------
11
!        Convert from PE number to set numbers in both
12
!                  grid-point space and spectral space
13
14
!**   Interface.
15
!     ----------
16
!        *CALL* *PE2SET(KPE,KPRGPNS,KPRGPEW,KPRTRW,KPRTRV)
17
18
!        Explicit arguments :
19
!        --------------------
20
!                  input:   KPE     - integer processor number
21
!                                     in the range 1 .. NPROC
22
!                  output:  KPRGPNS - integer A set number in grid space
23
!                                     in the range 1 .. NPRGPNS
24
!                           KPRGPEW - integer B set number in grid space
25
!                                     in the range 1 .. NPRGPEW
26
!                           KPRTRW  - integer A set number in spectral space
27
!                                     in the range 1 .. NPRTRW
28
!                           KPRTRV  - integer B set number in spectral space
29
!                                     in the range 1 .. NPRTRV
30
31
!        Implicit arguments :  YOMMP parameters
32
!                              NPRGPNS,NPRGPEW,NPRTRW,NPRTRV,NPROC
33
34
!        --------------------
35
!     Method.
36
!     -------
37
38
!        PE allocation order is row oriented (e.g. NPRGPNS or NPRTRW = 4):
39
40
!                1  2  3  4
41
!                5  6  7  8
42
!                9 10 11 12
43
!               13 14 15 16
44
!                .  .  .  .
45
46
!     Externals.
47
!     ----------
48
!         NONE
49
50
!     Reference.
51
!     ----------
52
!        ECMWF Research Department documentation of the IFS
53
54
!     Author.
55
!     -------
56
!        David Dent *ECMWF*
57
58
!     Modifications.
59
!     --------------
60
!        Original : 98-08-19
61
!        Revision : 98-10-13 row ordering
62
!     ------------------------------------------------------------------
63
#endif
64
65
USE PARKIND1  ,ONLY : JPIM     ,JPRB
66
67
USE TPM_DISTR
68
USE EQ_REGIONS_MOD
69
USE ABORT_TRANS_MOD
70
71
72
IMPLICIT NONE
73
INTEGER(KIND=JPIM),INTENT(IN)  :: KPE
74
INTEGER(KIND=JPIM),INTENT(OUT) :: KPRGPNS,KPRGPEW,KPRTRW,KPRTRV
75
76
INTEGER(KIND=JPIM) :: IPE,JA
77
!     ------------------------------------------------------------------
78
79
!*       1.    Check input argument for validity
80
!              ---------------------------------
81
82
IF(KPE <= 0.OR.KPE > NPROC) THEN
83
  WRITE(*,'(A,2I8)') ' PE2SET INVALID ARGUMENT ',KPE,NPROC
84
  CALL ABORT_TRANS(' PE2SET INVALID ARGUMENT ')
85
86
ELSE
87
88
!*       2.    Compute output parameters
89
!              -------------------------
90
91
  IF( LEQ_REGIONS )THEN
92
    KPRGPNS=1
93
    IPE=KPE
94
    DO JA=1,N_REGIONS_NS
95
      IF( IPE > N_REGIONS(JA) )THEN
96
        IPE=IPE-N_REGIONS(JA)
97
        KPRGPNS=KPRGPNS+1
98
        CYCLE
99
      ENDIF
100
      KPRGPEW=IPE
101
      EXIT
102
    ENDDO
103
  ELSE
104
    KPRGPEW=MOD(KPE-1,NPRGPEW)+1
105
    KPRGPNS=(KPE-1)/NPRGPEW+1
106
  ENDIF
107
  KPRTRV =MOD(KPE-1,NPRTRV)+1
108
  KPRTRW =(KPE-1)/NPRTRV+1
109
110
ENDIF
111
112
END SUBROUTINE PE2SET
113
END MODULE PE2SET_MOD