FLASH-X
Doxygen Generated Documentation From Interface Source Code
ut_sortOnProcs.F90
Go to the documentation of this file.
1!! NOTICE
2!! Copyright 2022 UChicago Argonne, LLC and contributors
3!!
4!! Licensed under the Apache License, Version 2.0 (the "License");
5!! you may not use this file except in compliance with the License.
6!!
7!! Unless required by applicable law or agreed to in writing, software
8!! distributed under the License is distributed on an "AS IS" BASIS,
9!! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10!! See the License for the specific language governing permissions and
11!! limitations under the License.
12!!
49
50
51subroutine ut_sortOnProcs(count, props, attrib, numProcs,&
52 storage, workspace, &
53 perProc, ifNonZeroProc,nonZeroProcsCount)
54
55#include "constants.h"
56#include "Simulation.h"
57
58 implicit none
59
60 integer, intent(IN) :: count, props, attrib, numProcs
61 real,dimension(props,count),intent(INOUT) ::storage,workspace
62 integer,dimension(numProcs),intent(OUT) :: perProc, ifNonZeroProc
63 integer, intent(OUT) :: nonZeroProcsCount
64
65 integer :: i,j,k,n
66
67 integer, dimension(numProcs) :: pntr
68
69 perProc=0
70 nonZeroProcsCount=0
71 ifNonZeroProc=0
72
73 if(count> 0) then
74
75 k=1
76 n=0
77 do i = 1,count
78 j=int(storage(attrib,i))
79 if(j/=NONEXISTENT) then
80 n=n+1
81 workspace(1:props,n)=storage(1:props,i)
82 j=j+1
83 perProc(j)=perProc(j)+1
84 if(ifNonZeroProc(j)==0) then
85 ifNonZeroProc(j)=1
86 nonZeroProcsCount=nonZeroProcsCount+1
87 end if
88 end if
89 end do
90
91 pntr(1)=1
92 do i = 2,numProcs
93 pntr(i)=pntr(i-1)+perProc(i-1)
94 end do
95
96 do i = 1,n
97 j=int(workspace(attrib,i))+1
98 k = pntr(j)
99 storage(1:props,k)=workspace(1:props,i)
100 pntr(j)=pntr(j)+1
101 end do
102 end if
103end subroutine ut_sortOnProcs
#define NONEXISTENT
Definition: constants.h:11
subroutine ut_sortOnProcs(count, props, attrib, numProcs, storage, workspace, perProc, ifNonZeroProc, nonZeroProcsCount)