SURFEX v8.1
General documentation of Surfex
Functions | Variables
ecsort_shared.h File Reference

Go to the source code of this file.

Functions

ERROR in init Please note that we assume that a (:) occupies consecutive memory locations INTEGER(KIND
 
intent(out) overrides sub arrays one Sort by the least significant key first sum (iindex(1:n))
 
intent(out) overrides sub arrays one Sort by the least significant key first iindex (1:n) if(LLadjusted) then CALL DBGPRINT(-jkey
 
intent(out) overrides sub arrays one Sort by the least significant key first< BEGIN > else CALL DBGPRINT (-jkey,'< BEGIN >', a, iindex, n, ikey, 1, n, 0) endif ilastkey
 
intent(out) overrides sub arrays one Sort by the least significant key first< BEGIN > else CALL no reversing is needed savings if (imethod==quicksort_method .or. &imethod==countingsort_method) LLdescending
 
quick &counting sorts only if (.not.allocated(ista)) then allocate(ista(inumt+1)
 
quick &counting sorts only ichunk (inumt)) inc
 
quick &counting sorts only inumt ista (j)
 
quick &counting sorts only inumt inumt ichunk (j)
 
quick &counting sorts only inumt inumt method_name (imethod) write(0
 

Variables

ERROR in programming
 
ERROR in a
 
ERROR in n
 
ERROR in method
 
ERROR in descending
 
ERROR in index
 
 LLfast
 
intent(out) overrides sub arrays one lda
 
intent(out) overrides sub arrays one Sort by the least significant key first ikey
 
intent(out) overrides sub arrays one Sort by the least significant key first< BEGIN > iindex
 
 radix
 
quick &counting sorts only inumt inumt name ='
 
quick &counting sorts only inumt inumt imethod
 
quick &counting sorts only inumt inumt inumt
 
quick &counting sorts only inumt inumt nomp ='
 

Function Documentation

◆ a()

ERROR in init Please note that we assume that a ( )

◆ DBGPRINT()

intent (out) overrides sub arrays one Sort by the least significant key first<BEGIN> else CALL DBGPRINT ( jkey,
'< BEGIN >'  ,
a  ,
iindex  ,
n  ,
ikey  ,
,
n  ,
 
)

◆ ichunk() [1/2]

quick& counting sorts only ichunk ( inumt  )

◆ ichunk() [2/2]

quick& counting sorts only inumt inumt ichunk ( )

◆ if() [1/2]

intent (out) overrides sub arrays one Sort by the least significant key first<BEGIN> else CALL no reversing is needed savings if ( imethod  = =quicksort_method .or. &imethod==countingsort_method)
explicit

◆ if() [2/2]

quick& counting sorts only if ( .not.  allocatedista)

◆ iindex()

intent (out) overrides sub arrays one Sort by the least significant key first iindex ( 1:n  )

◆ ista()

quick& counting sorts only inumt ista ( )

◆ method_name()

quick& counting sorts only inumt inumt method_name ( imethod  )

◆ sum()

intent (out) overrides sub arrays one Sort by the least significant key first sum ( iindex(1:n )

Variable Documentation

◆ a

intent (out) overrides sub arrays one Sort by the least significant key first<BEGIN> a

Definition at line 90 of file ecsort_shared.h.

◆ descending

ERROR in descending

Definition at line 90 of file ecsort_shared.h.

◆ iindex

intent (out) overrides sub arrays one Sort by the least significant key first<BEGIN> iindex

Definition at line 344 of file ecsort_shared.h.

◆ ikey

intent (out) overrides sub arrays one Sort by the least significant key first<BEGIN> ikey
Initial value:
= abs(ikeys(jkey))
if (ikey == 0) cycle KEYLOOP
if (istride == 1) then
iptr = lda * (ikey - 1) + 1
else
iptr = ikey
endif
if (LLdebug) then
write(0,1000) '<BEGIN>iindex(1:n)='
intent(out) overrides sub arrays one lda
intent(out) overrides sub arrays one Sort by the least significant key first ikey

Definition at line 332 of file ecsort_shared.h.

◆ imethod

quick& counting sorts only inumt inumt imethod

Definition at line 421 of file ecsort_shared.h.

◆ index

ERROR in index

Definition at line 90 of file ecsort_shared.h.

◆ inumt

quick &counting sorts only inumt inumt inumt

Definition at line 422 of file ecsort_shared.h.

◆ lda

intent (out) overrides sub arrays one lda
Initial value:
= idiff/SIZEOF_ME
endif
ilastkey = 0
LLadjusted = .FALSE.
LLomp_prefix = .FALSE.
!$ LLomp_prefix = (istride == 1 .and. nomp >= inumt .and. n >= nomp)
if (LLomp_prefix) then
call get_environment_variable('EC_SORTING_DEBUG',clenv)
LLdebug = (clenv == '1' .and. n < 10000)
if (LLdebug) write(0,*)'>> EC_SORTING_DEBUG=1'
else
LLdebug = .FALSE.
endif
1000 format(1x,a,2i12,:,/,(10i5))
1001 format(1x,'[#',i2,']:',a,(10i5))
1002 format(1x,'[#',i2,']:',a,:,/,(10i5))
1003 format(1x,'[#',i2,']:',a,2i12,:,/,(10i5))
1004 format(1x,a,:,(10i5))
1005 format(1x,a,i2,1x,a)
imethod = imethod_1st
KEYLOOP: do jkey=inumkeys
ERROR in a
Definition: ecsort_shared.h:90
quick &counting sorts only inumt inumt imethod
quick &counting sorts only inumt inumt inumt
ERROR in n
Definition: ecsort_shared.h:90
quick &counting sorts only inumt inumt nomp

Definition at line 307 of file ecsort_shared.h.

◆ LLfast

LLfast
Initial value:
= (&
& .not.present(index) .and. &
& .not.present(init))
else if (imethod == countingsort_method) then
!-- index-presence is ok
LLfast = .TRUE.
endif
if (LLfast) then
!- Only Quick-sort & CountingSort covered
inumt = OML_MAX_THREADS()
LLomp_okay = (inumt > 1 .and. nomp >= inumt .and. n >= nomp)
LLomp_okay = (LLomp_okay .and. .not. OML_IN_PARALLEL()) ! Prevents nested OpenMP
if (LLomp_okay) then
!-- Max 2-way OpenMP parallelism for now ...
ichunk = n/2
!$OMP PARALLEL PRIVATE(iret)
!$OMP SECTIONS
!$OMP SECTION
CALL ecqsortfast(KEYSORT_NUMBER, ichunk, a(1), irev, iret)
!$OMP SECTION
CALL ecqsortfast(KEYSORT_NUMBER, n-ichunk, a(ichunk+1), irev, iret)
!$OMP END SECTIONS
!$OMP END PARALLEL
CALL ecmerge2(KEYSORT_NUMBER, 1, ichunk, n-ichunk, a(1), &
& idummy, 0, 1, irev, idummy, rc)
else
CALL ecqsortfast(KEYSORT_NUMBER, n, a(1), irev, rc)
endif
GOTO 99
if (.not.present(index)) then
CALL ec_countingsort(KEYSORT_NUMBER, n, 1, 1, a(1), idummy, 0, 1, irev, rc)
else
LLinit = .FALSE.
if (present(init)) LLinit = init
if (LLinit) then
CALL init_index(index, index_adj=-1)
index_adj = 0
else
index_adj = 1
endif
CALL ec_countingsort(KEYSORT_NUMBER, n, 1, 1, a(1), index(1), size(index), index_adj, irev, rc)
if (index_adj == 0) CALL adjust_index(index, +1)
endif
GOTO 99
else
LLfast = .false.
endif
endif
!-- LLfast == .FALSE. :
allocate(aa(n,1))
if (LLdescending) then
aa(1:n,1) = -a(1:n)
else
aa(1:n,1) = a(1:n)
endif
CALL keysort(rc, aa, n, method=method, index=index, init=init)
if (LLdescending) then
a(1:n) = -aa(1:n,1)
else
a(1:n) = aa(1:n,1)
endif
deallocate(aa)
99 continue
IF (LHOOK) CALL DR_HOOK(KEYSORT_1D_DRHOOKSTR,1,ZHOOK_HANDLE,n)
END SUBROUTINE
SUBROUTINE KEYSORT_2D(&
&rc, a, n,&
&key, multikey, method,&
&index, init, transposed)
INTEGER(KIND=JPIM)
static long size
Definition: bytes_io.c:262
integer(kind=jpim), parameter quicksort_method
Definition: ecsort_mix.F90:57
intent(out) overrides sub arrays one Sort by the least significant key first< BEGIN > else CALL no reversing is needed savings if(imethod==quicksort_method .or. &imethod==countingsort_method) LLdescending
ERROR in a
Definition: ecsort_shared.h:90
subroutine, public init_index(INDEX, INDEX_ADJ)
Definition: ecsort_mix.F90:253
ERROR in method
Definition: ecsort_shared.h:90
quick &counting sorts only ichunk(inumt)) inc
integer(kind=jpim) iret
Definition: distio_mix.F90:26
quick &counting sorts only inumt inumt imethod
quick &counting sorts only inumt inumt inumt
subroutine, public adjust_index(INDEX, INDEX_ADJ)
Definition: ecsort_mix.F90:273
LLfast
static unsigned char * init
Definition: memory_hook.c:19
ERROR in n
Definition: ecsort_shared.h:90
INTERFACE SUBROUTINE JPRB IMPLICIT NONE INTEGER(KIND=JPIM)
quick &counting sorts only inumt inumt nomp
!define ISRCHFLTPV_N !define ISRCHFLTPV_N ISRCHFLTPV_NBITER IF(ISRCHFLTPV_ARRAY(1+ISRCHFLTPV_INC *(ISRCHFLTPV_I-1)).LT.ISRCHFLTPV_TARGET) THEN IF(ISRCHFLTPV_ARRAY(1+ISRCHFLTPV_INC *(ISRCHFLTPV_I)).LT.ISRCHFLTPV_TARGET) THEN IF(ISRCHFLTPV_ARRAY(1+ISRCHFLTPV_INC *(ISRCHFLTPV_I+1)).LT.ISRCHFLTPV_TARGET) THEN IF(ISRCHFLTPV_ARRAY(1+ISRCHFLTPV_INC *(ISRCHFLTPV_I+2)).LT.ISRCHFLTPV_TARGET) THEN IF(ISRCHFLTPV_ARRAY(1+ISRCHFLTPV_INC *(ISRCHFLTPV_I+3)).LT.ISRCHFLTPV_TARGET) THEN IF(ISRCHFLTPV_ARRAY(1+ISRCHFLTPV_INC *(ISRCHFLTPV_I+4)).LT.ISRCHFLTPV_TARGET) THEN IF(ISRCHFLTPV_ARRAY(1+ISRCHFLTPV_INC *(ISRCHFLTPV_I+5)).LT.ISRCHFLTPV_TARGET) THEN IF(ISRCHFLTPV_ARRAY(1+ISRCHFLTPV_INC *(ISRCHFLTPV_I+6)).LT.ISRCHFLTPV_TARGET) THEN IF(ISRCHFLTPV_ARRAY(1+ISRCHFLTPV_INC *(ISRCHFLTPV_I+7)).LT.ISRCHFLTPV_TARGET) THEN ISRCHFLTPV_RESULT
ERROR in index
Definition: ecsort_shared.h:90
integer(kind=jpim), parameter countingsort_method
Definition: ecsort_mix.F90:58

Definition at line 131 of file ecsort_shared.h.

◆ method

ERROR in method

Definition at line 90 of file ecsort_shared.h.

◆ n

quick &counting sorts only inumt inumt n

Definition at line 90 of file ecsort_shared.h.

◆ name

quick& counting sorts only inumt inumt name ='

Definition at line 421 of file ecsort_shared.h.

◆ nomp

quick& counting sorts only inumt inumt nomp ='

Definition at line 422 of file ecsort_shared.h.

◆ programming

ERROR in programming

Definition at line 90 of file ecsort_shared.h.

◆ radix

radix

Definition at line 404 of file ecsort_shared.h.