SURFEX v8.1
General documentation of Surfex
mpl_tour_table_mod.F90
Go to the documentation of this file.
2 
3 USE parkind1 ,ONLY : jpim ,jprb
4 
7 
8 IMPLICIT NONE
9 
10 PRIVATE
11 PUBLIC mpl_tour_table
12 
13 CONTAINS
14 SUBROUTINE mpl_tour_table(KOPPONENT, KEVEN)
15 INTEGER(KIND=JPIM),INTENT(OUT)::KOPPONENT(:)
16 INTEGER(KIND=JPIM),INTENT(OUT),OPTIONAL::KEVEN
17 
18 INTEGER(KIND=JPIM) :: ICIRCULAR(mpl_numproc+1)
19 INTEGER(KIND=JPIM) :: IEVEN,IMYPOS,ITMP,JK,JI
20 LOGICAL :: LLABORT=.true.
21 
22 ieven = ((mpl_numproc+1)/2)*2
23 IF(SIZE(kopponent) < ieven) THEN
24  WRITE(mpl_errunit,*)'MPL_TOUR_TABLE: ERROR KOPPONENT dimension=',&
25  & SIZE(kopponent),'. MUST BE AT LEAST=',ieven
26  CALL mpl_message(cdmessage='MPL_TOUR_TABLE: ERROR KOPPONENT dimension wrong',&
27  & ldabort=llabort)
28 ENDIF
29 
30 DO jk = 1,ieven
31  icircular(jk) = jk
32 ENDDO
33 kopponent(:) = -1
34 imypos = mpl_rank
35 DO jk=1,ieven-1
36  kopponent(jk) = icircular(ieven-imypos+1)
37  itmp = icircular(ieven-1)
38  DO ji=ieven-2,1,-1
39  icircular(ji+1) = icircular(ji)
40  ENDDO
41  icircular(1) = itmp
42  IF(mpl_rank < ieven) imypos = mod(imypos,ieven-1)+1
43 ENDDO
44 
45 kopponent(ieven) = mpl_rank
46 
47 IF (PRESENT(keven)) keven = ieven
48 
49 END SUBROUTINE mpl_tour_table
50 END MODULE mpl_tour_table_mod
subroutine, public mpl_message(KERROR, CDMESSAGE, CDSTRING, LDABORT)
integer, parameter jpim
Definition: parkind1.F90:13
integer(kind=jpim) mpl_numproc
integer, parameter jprb
Definition: parkind1.F90:32
integer(kind=jpim) mpl_errunit
subroutine, public mpl_tour_table(KOPPONENT, KEVEN)
integer(kind=jpim) mpl_rank