11 integer(I4B),
allocatable,
dimension(:) :: icolarray
15 integer(I4B) :: offset
19 integer(I4B) :: nnz_od
20 type(
rowtype),
allocatable,
dimension(:) :: row
48 integer(I4B),
intent(in) :: nrow, ncol
49 integer(I4B),
intent(in),
dimension(nrow) :: rowmaxnnz
58 allocate (this%row(nrow))
60 allocate (this%row(i)%icolarray(rowmaxnnz(i)))
61 this%row(i)%icolarray = 0
70 integer(I4B),
intent(in) :: nrow, ncol
71 integer(I4B),
intent(in) :: maxnnz
73 integer(I4B),
dimension(:),
allocatable :: rowmaxnnz
76 allocate (rowmaxnnz(nrow))
82 call this%initialize(nrow, ncol, rowmaxnnz)
83 deallocate (rowmaxnnz)
87 subroutine filliaja(this, ia, ja, ierror, sort)
97 integer(I4B),
dimension(:),
intent(inout) :: ia, ja
98 integer(I4B),
intent(inout) :: ierror
99 logical,
intent(in),
optional :: sort
102 integer(I4B) :: i, j, ipos
106 if (
present(sort))
then
116 if (ubound(ia, dim=1) /= this%nrow + 1)
then
119 if (ubound(ja, dim=1) /= this%nnz)
then
122 if (ierror /= 0)
then
135 do j = 1, this%row(i)%nnz
136 ja(ipos) = this%row(i)%icolarray(j)
149 integer(I4B),
intent(in) :: i, j, inodup
150 integer(I4B),
optional,
intent(inout) :: iaddop
152 integer(I4B) :: irow_local
153 integer(I4B) :: iadded
157 irow_local = i - this%offset
159 call insert(j, this%row(irow_local), inodup, iadded)
160 this%nnz = this%nnz + iadded
161 if (j < this%offset + 1 .or. j > this%offset + this%nrow)
then
163 this%nnz_od = this%nnz_od + iadded
165 if (
present(iaddop)) iaddop = iadded
168 subroutine insert(j, thisrow, inodup, iadded)
174 integer(I4B),
intent(in) :: j, inodup
175 type(
rowtype),
intent(inout) :: thisrow
176 integer(I4B),
allocatable,
dimension(:) :: iwk
177 integer(I4B),
intent(inout) :: iadded
179 integer(I4B) :: jj, maxnnz
182 maxnnz = ubound(thisrow%icolarray, dim=1)
183 if (thisrow%icolarray(1) == 0)
then
184 thisrow%icolarray(1) = j
185 thisrow%nnz = thisrow%nnz + 1
189 if (thisrow%nnz == maxnnz)
then
191 allocate (iwk(thisrow%nnz))
192 iwk = thisrow%icolarray
193 deallocate (thisrow%icolarray)
199 allocate (thisrow%icolarray(maxnnz))
200 thisrow%icolarray(1:thisrow%nnz) = iwk(1:thisrow%nnz)
201 thisrow%icolarray(thisrow%nnz + 1:maxnnz) = 0
203 if (inodup == 1)
then
204 do jj = 1, thisrow%nnz
205 if (thisrow%icolarray(jj) == j)
then
212 thisrow%nnz = thisrow%nnz + 1
213 thisrow%icolarray(thisrow%nnz) = j
217 subroutine sort(this, with_csr)
222 logical(LGP),
optional :: with_csr
224 integer(I4B) :: i, nval, start_idx
227 if (
present(with_csr))
then
235 nval = this%row(i)%nnz
237 this%row(i)%icolarray(start_idx:nval))
246 integer(I4B),
intent(in) :: nval
247 integer(I4B),
intent(inout),
dimension(nval) :: iarray
249 integer(I4B) :: i, j, itemp
253 if (iarray(i) > iarray(j))
then
255 iarray(j) = iarray(i)
266 integer(I4B),
dimension(:),
contiguous :: ia
267 real(DP),
dimension(:),
contiguous :: flowja
269 integer(I4B) :: nodes
271 integer(I4B) :: iposdiag
277 do ipos = ia(n) + 1, ia(n + 1) - 1
278 flowja(iposdiag) = flowja(iposdiag) + flowja(ipos)
This module defines variable data types.
subroutine sort(this, with_csr)
subroutine csr_diagsum(ia, flowja)
subroutine filliaja(this, ia, ja, ierror, sort)
subroutine initialize(this, nrow, ncol, rowmaxnnz)
subroutine initializefixed(this, nrow, ncol, maxnnz)
subroutine sortintarray(nval, iarray)
subroutine addconnection(this, i, j, inodup, iaddop)
subroutine insert(j, thisrow, inodup, iadded)