decompose_dim Subroutine

subroutine decompose_dim(dim_world, dim_array, num_procs)

decompose_dim – For a given number of grid points along a dimension and a number of available processors for that diemsion,, !! determine the number of grid points assigned to each processor.

Arguments

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

total number of grid points

integer, intent(out) :: dim_array(0:num_procs-1)
integer, intent(in) :: num_procs

number of processors


Called by

proc~~decompose_dim~~CalledByGraph proc~decompose_dim decompose_dim proc~perform_domain_deposition perform_domain_deposition proc~perform_domain_deposition->proc~decompose_dim program~main~8 main program~main~8->proc~perform_domain_deposition

Source Code

   subroutine decompose_dim(dim_world, dim_array, num_procs )
!
      integer, intent(in)  :: dim_world                !! total number of grid points
      integer, intent(in)  :: num_procs                !! number of processors
      integer, intent(out) :: dim_array(0:num_procs-1)
!
      integer ::   n, im, rm
!------------------------------------------------------------------------------
      im = dim_world/num_procs
      rm = dim_world-num_procs*im
      do n = 0, num_procs-1
                      dim_array(n) = im
      if( n.le.rm-1 ) dim_array(n) = im+1
      enddo
   end subroutine decompose_dim