MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
CsrUtils.f90
Go to the documentation of this file.
2 
3  implicit none
4  private
5 
6  public :: getcsrindex
7 
8 contains
9 
10  !> @brief Return index for element i,j in CSR storage,
11  !< returns -1 when not there
12  function getcsrindex(i, j, ia, ja) result(csrIndex)
13  use kindmodule, only: i4b
14  integer(I4B), intent(in) :: i !< the row index
15  integer(I4B), intent(in) :: j !< the column index
16  integer(I4B), dimension(:), intent(in) :: ia !< CSR ia array
17  integer(I4B), dimension(:), intent(in) :: ja !< CSR ja array
18  integer(I4B) :: csrindex !< the CSR ndex of element i,j
19  ! local
20  integer(I4B) :: idx
21 
22  csrindex = -1
23  do idx = ia(i), ia(i + 1) - 1
24  if (ja(idx) == j) then
25  csrindex = idx
26  return
27  end if
28  end do
29 
30  end function
31 
32 end module
integer(i4b) function, public getcsrindex(i, j, ia, ja)
Return index for element i,j in CSR storage,.
Definition: CsrUtils.f90:13
This module defines variable data types.
Definition: kind.f90:8