next up previous contents
Next: clm_ptrs_check Up: Fortran: Module Interface initGridCellsMod Previous: initGridcells   Contents



   subroutine clm_ptrs_compdown()

Assumes the part of the subgrid pointing up has been set. Fills in the data pointing down. Up is p_c, p_l, p_g, c_l, c_g, and l_g.

This algorithm assumes all indices are monotonically increasing.

Algorithm works as follows. The p, c, and l loops march through the full arrays (nump, numc, and numl) checking the "up" indexes. As soon as the "up" index of the current (p,c,l) cell changes relative to the previous (p,c,l) cell, the *i array will be set to point down to that cell. The *f array follows the same logic, so it's always the last "up" index from the previous cell when an "up" index changes.

For example, a case where p_c(1:4) = 1 and p_c(5:12) = 2. This subroutine will set c_pi(1) = 1, c_pf(1) = 4, c_pi(2) = 5, c_pf(2) = 12.

!USES use clmtype, only : clm3, gridcell_type, landunit_type, & column_type, pft_type use decompMod , only : get_proc_bounds

!ARGUMENTS implicit none


   subroutines initGridCellsMod
   2005.11.15  T Craig Creation
     integer :: begg,endg,begl,endl,begc,endc,begp,endp ! beg/end glcp
     integer :: g,l,c,p               ! loop counters
     integer :: curg,curl,curc,curp   ! tracks g,l,c,p indexes in arrays
     type(gridcell_type), pointer  :: gptr ! pointer to gridcell derived subtype
     type(landunit_type), pointer  :: lptr ! pointer to landunit derived subtype
     type(column_type)  , pointer  :: cptr ! pointer to column derived subtype
     type(pft_type)     , pointer  :: pptr ! pointer to pft derived subtype

Erik Kluzek 2011-06-15