functionsorts_beforeprivate
logical function sorts_before(site, a, b)
True if a sorts before b, for the sort setting.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| site | type(site_t) | in | the site | |
| a | integer | in | one entity | |
| b | integer | in | the other |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| sorts_before | logical |
Calls
Source
Show the code
logical function sorts_before(site, a, b)
type(site_t), intent(in) :: site !! the site
integer, intent(in) :: a !! one entity
integer, intent(in) :: b !! the other
character(len=:), allocatable :: mode
integer :: pa, pb
mode = site%s%sort
sorts_before = .false.
if (mode == 'src') return
associate (x => site%p%list%box(a)%e, y => site%p%list%box(b)%e)
if (starts_with(mode, 'permission')) then
pa = permission_rank(x)
pb = permission_rank(y)
if (pa /= pb) then
sorts_before = pa < pb
return
end if
if (mode == 'permission') return
end if
if (starts_with(mode, 'type')) then
if (allocated(x%vartype) .and. allocated(y%vartype)) then
if (x%vartype /= y%vartype) then
sorts_before = llt(x%vartype, y%vartype)
return
end if
end if
if (mode == 'type') return
end if
sorts_before = llt(lowercase(x%name), lowercase(y%name))
end associate
end function sorts_before