index2position Subroutine

public subroutine index2position(index_, nx, ny, nz, cx, cy, cz)

Subroutine to calculate the position ix,iy,iz inside a rectangular grid from index

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: index_

Integer variables, index_,nx,ny,nz

integer, intent(in) :: nx

Integer variables, index_,nx,ny,nz

integer, intent(in) :: ny

Integer variables, index_,nx,ny,nz

integer, intent(in) :: nz

Integer variables, index_,nx,ny,nz

integer, intent(inout) :: cx

Integer variables cx,cy,cz

integer, intent(inout) :: cy

Integer variables cx,cy,cz

integer, intent(inout) :: cz

Integer variables cx,cy,cz


Called by

proc~~index2position~2~~CalledByGraph proc~index2position~2 index2position proc~train_grid_layer two_level_self_organizing_map%train_grid_layer proc~train_grid_layer->proc~index2position~2 proc~update_weights~2 two_level_self_organizing_map%update_weights proc~update_weights~2->proc~index2position~2 proc~train_2lsom two_level_self_organizing_map%train_2lsom proc~train_2lsom->proc~train_grid_layer proc~train_two_level_som train_two_level_som proc~train_two_level_som->proc~train_2lsom

Source Code

   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_,nx,ny,nz
!! Integer variables, index_,nx,ny,nz
   integer,intent(inout) :: cx,cy,cz
!! Integer variables cx,cy,cz
   !  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