Subroutine to calculate the position ix,iy,iz inside a rectangular grid from index
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | index_ |
Integer variable representing the index |
||
integer, | intent(in) | :: | nx |
Integer variables representing the dimensions of the kohonen map |
||
integer, | intent(in) | :: | ny |
Integer variables representing the dimensions of the kohonen map |
||
integer, | intent(in) | :: | nz |
Integer variables representing the dimensions of the kohonen map |
||
integer, | intent(inout) | :: | cx |
Integer variables representing the position of the node |
||
integer, | intent(inout) | :: | cy |
Integer variables representing the position of the node |
||
integer, | intent(inout) | :: | cz |
Integer variables representing the position of the node |
subroutine index2position(index_,nx,ny,nz,cx,cy,cz) !======================================================================================== !! Subroutine to calculate the position ix,iy,iz inside a rectangular grid from index integer,intent(in) :: index_ !! Integer variable representing the index integer,intent(in) :: nx,ny,nz !! Integer variables representing the dimensions of the kohonen map integer,intent(inout) :: cx,cy,cz !! Integer variables representing the position of the node ! write(*,*) index_,nx,ny,1+int((index_-1)/(nx*ny)) cz=min(1+int((index_-1)/(nx*ny)),nz); cy=min(1+int((index_-1-(cz-1)*nx*ny)/nx),ny); cx=min(index_-(cz-1)*nx*ny-(cy-1)*nx,nx); ! end subroutine index2position