80 nx_block, ny_block, message)
81 character(len=*),
intent(in) :: component
83 integer,
intent(in) :: isc, iec, jsc, jec, kpts
84 integer,
intent(in) :: nx_block, ny_block
85 logical,
intent(inout) :: message
104 integer,
dimension(nx_block) :: i1, i2
105 integer,
dimension(ny_block) :: j1, j2
106 character(len=256) :: text
107 integer :: i, j, nblks, ix, ii, jj
108 integer :: non_uniform_blocks
111 non_uniform_blocks = 0
112 if ((mod(iec-isc+1,nx_block) .ne. 0) .or. (mod(jec-jsc+1,ny_block) .ne. 0))
then
113 non_uniform_blocks = 1
115 call mpp_sum(non_uniform_blocks)
116 if (non_uniform_blocks > 0 )
then
117 call mpp_error(note,
string(non_uniform_blocks)//
" out of "//
string(mpp_npes())//
" total domains "//&
118 "have non-uniform blocks for block size ("//
string(nx_block)//
","//
string(ny_block)//
")")
124 if (iec-isc+1 .lt. nx_block) &
125 call mpp_error(fatal,
'block_control: number of '//trim(component)//.gt.
' nxblocks &
126 &number of elements in MPI-domain size')
127 if (jec-jsc+1 .lt. ny_block) &
128 call mpp_error(fatal,
'block_control: number of '//trim(component)//.gt.
' nyblocks &
129 &number of elements in MPI-domain size')
133 nblks = nx_block*ny_block
139 block%nx_block = nx_block
140 block%ny_block = ny_block
143 if (.not.
allocated(block%ibs)) &
144 allocate (block%ibs(nblks), &
154 block%ibs(blocks) = i1(i)
155 block%jbs(blocks) = j1(j)
156 block%ibe(blocks) = i2(i)
157 block%jbe(blocks) = j2(j)
158 allocate(block%ix(blocks)%ix(i1(i):i2(i),j1(j):j2(j)) )
163 block%ix(blocks)%ix(ii,jj) = ix
179 kpts, blksz, message)
180 character(len=*),
intent(in) :: component
182 integer,
intent(in) :: isc, iec, jsc, jec, kpts
183 integer,
intent(inout) :: blksz
184 logical,
intent(inout) :: message
198 integer :: nblks, lblksz, tot_pts, nb, ix, ii, jj
199 character(len=256) :: text
201 tot_pts = (iec - isc + 1) * (jec - jsc + 1)
206 nblks = tot_pts/blksz
207 if (mod(tot_pts,blksz) .gt. 0)
then
213 if (mod(tot_pts,blksz) .ne. 0)
then
214 write( text,
'(a,a,2i4,a,i4,a,i4)' ) trim(component),
'define_blocks_packed: domain (',&
215 (iec-isc+1), (jec-jsc+1),
') is not an even divisor with definition (',&
216 blksz,
') - blocks will not be uniform with a remainder of ',mod(tot_pts,blksz)
228 if (.not.
allocated(block%blksz)) &
229 allocate (block%blksz(nblks), &
230 block%index(nblks), &
231 block%blkno(isc:iec,jsc:jec), &
232 block%ixp(isc:iec,jsc:jec))
237 if (nb .EQ. nblks) lblksz = tot_pts - (nb-1) * blksz
238 block%blksz(nb) = lblksz
239 allocate (block%index(nb)%ii(lblksz), &
240 block%index(nb)%jj(lblksz))
249 if (ix .GT. blksz)
then
253 block%ixp(ii,jj) = ix
254 block%blkno(ii,jj) = nb
255 block%index(nb)%ii(ix) = ii
256 block%index(nb)%jj(ix) = jj
subroutine, public define_blocks(component, block, isc, iec, jsc, jec, kpts, nx_block, ny_block, message)
Sets up "blocks" used for OpenMP threading of column-based calculations using rad_n[x/y]xblock from c...
subroutine, public define_blocks_packed(component, block, isc, iec, jsc, jec, kpts, blksz, message)
Creates and populates a data type which is used for defining the sub-blocks of the MPI-domain to enha...
subroutine mpp_compute_extent(isg, ieg, ndivs, ibegin, iend, extent)
Computes extents for a grid decomposition with the given indices and divisions.