|
|
@ -48,7 +48,7 @@ module psb_partidx_mod
|
|
|
|
module procedure ijk2idx3d, ijk2idxv, ijk2idx2d
|
|
|
|
module procedure ijk2idx3d, ijk2idxv, ijk2idx2d
|
|
|
|
end interface ijk2idx
|
|
|
|
end interface ijk2idx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logical, private, save : col_major=.true.
|
|
|
|
contains
|
|
|
|
contains
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! Given a global index IDX and the domain size (NX,NY,NZ)
|
|
|
|
! Given a global index IDX and the domain size (NX,NY,NZ)
|
|
|
@ -135,10 +135,17 @@ contains
|
|
|
|
! j = mod(idx_/nz,ny) + base_
|
|
|
|
! j = mod(idx_/nz,ny) + base_
|
|
|
|
! i = mod(idx_/(nx*ny),nx) + base_
|
|
|
|
! i = mod(idx_/(nx*ny),nx) + base_
|
|
|
|
!
|
|
|
|
!
|
|
|
|
do i=size(dims),1,-1
|
|
|
|
if (col_major) then
|
|
|
|
coords(i) = mod(idx_,dims(i)) + base_
|
|
|
|
do i=1,size(dims)
|
|
|
|
idx_ = idx_ / dims(i)
|
|
|
|
coords(i) = mod(idx_,dims(i)) + base_
|
|
|
|
end do
|
|
|
|
idx_ = idx_ / dims(i)
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
do i=size(dims),1,-1
|
|
|
|
|
|
|
|
coords(i) = mod(idx_,dims(i)) + base_
|
|
|
|
|
|
|
|
idx_ = idx_ / dims(i)
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
end subroutine idx2ijkv
|
|
|
|
end subroutine idx2ijkv
|
|
|
|
|
|
|
|
|
|
|
@ -174,12 +181,19 @@ contains
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
idx = coords(1) - base_
|
|
|
|
if (col_major) then
|
|
|
|
do i=2, sz
|
|
|
|
idx = coords(sz) - base_
|
|
|
|
idx = (idx * dims(i)) + coords(i) - base_
|
|
|
|
do i=sz-1,1,-1
|
|
|
|
end do
|
|
|
|
idx = (idx * dims(i)) + coords(i) - base_
|
|
|
|
idx = idx + base_
|
|
|
|
end do
|
|
|
|
|
|
|
|
idx = idx + base_
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
idx = coords(1) - base_
|
|
|
|
|
|
|
|
do i=2,sz
|
|
|
|
|
|
|
|
idx = (idx * dims(i)) + coords(i) - base_
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
idx = idx + base_
|
|
|
|
|
|
|
|
end if
|
|
|
|
end subroutine ijk2idxv
|
|
|
|
end subroutine ijk2idxv
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! Given a triple (I,J,K) and the domain size (NX,NY,NZ)
|
|
|
|
! Given a triple (I,J,K) and the domain size (NX,NY,NZ)
|
|
|
|