generate_table_nl Subroutine

private subroutine generate_table_nl(ps)

Arguments

Type IntentOptional Attributes Name
type(ps_t), intent(inout), target :: ps

Contents

Source Code


Source Code

subroutine generate_table_nl(ps)

  type(ps_t), intent(inout), target :: ps

  type(nonlocal_t), pointer :: nlp
  type(nlpj_t), pointer :: nlpp

  integer :: nprojs

  if (allocated(ps%nl_table)) then
     deallocate(ps%nl_table)
  endif

  nprojs = 0
  nlp => ps%nonlocal
  do while (associated(nlp))
     nlpp => nlp%proj
     do while (associated(nlpp))
        nprojs = nprojs + 1
        nlpp => nlpp%next
     enddo
     nlp => nlp%next
  enddo

  allocate(ps%nl_table(nprojs))
  
  nprojs = 0
  nlp => ps%nonlocal
  do while (associated(nlp))
     nlpp => nlp%proj
     do while (associated(nlpp))
        nprojs = nprojs + 1
        ps%nl_table(nprojs)%p => nlpp
        nlpp => nlpp%next
     enddo
     nlp => nlp%next
  enddo

end subroutine generate_table_nl