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
73 integer(I4B),
intent(in) :: nrow, ncol
74 integer(I4B),
intent(in) :: maxnnz
76 integer(I4B),
dimension(:),
allocatable :: rowmaxnnz
79 allocate (rowmaxnnz(nrow))
85 call this%initialize(nrow, ncol, rowmaxnnz)
86 deallocate (rowmaxnnz)
90 subroutine filliaja(this, ia, ja, ierror, sort)
100 integer(I4B),
dimension(:),
intent(inout) :: ia, ja
101 integer(I4B),
intent(inout) :: ierror
102 logical,
intent(in),
optional :: sort
105 integer(I4B) :: i, j, ipos
109 if (
present(sort))
then
119 if (ubound(ia, dim=1) /= this%nrow + 1)
then
122 if (ubound(ja, dim=1) /= this%nnz)
then
125 if (ierror /= 0)
then
138 do j = 1, this%row(i)%nnz
139 ja(ipos) = this%row(i)%icolarray(j)
155 integer(I4B),
intent(in) :: i, j, inodup
156 integer(I4B),
optional,
intent(inout) :: iaddop
158 integer(I4B) :: irow_local
159 integer(I4B) :: iadded
163 irow_local = i - this%offset
165 call insert(j, this%row(irow_local), inodup, iadded)
166 this%nnz = this%nnz + iadded
167 if (j < this%offset + 1 .or. j > this%offset + this%nrow)
then
169 this%nnz_od = this%nnz_od + iadded
171 if (
present(iaddop)) iaddop = iadded
177 subroutine insert(j, thisrow, inodup, iadded)
183 integer(I4B),
intent(in) :: j, inodup
184 type(
rowtype),
intent(inout) :: thisrow
185 integer(I4B),
allocatable,
dimension(:) :: iwk
186 integer(I4B),
intent(inout) :: iadded
188 integer(I4B) :: jj, maxnnz
191 maxnnz = ubound(thisrow%icolarray, dim=1)
192 if (thisrow%icolarray(1) == 0)
then
193 thisrow%icolarray(1) = j
194 thisrow%nnz = thisrow%nnz + 1
198 if (thisrow%nnz == maxnnz)
then
200 allocate (iwk(thisrow%nnz))
201 iwk = thisrow%icolarray
202 deallocate (thisrow%icolarray)
208 allocate (thisrow%icolarray(maxnnz))
209 thisrow%icolarray(1:thisrow%nnz) = iwk(1:thisrow%nnz)
210 thisrow%icolarray(thisrow%nnz + 1:maxnnz) = 0
212 if (inodup == 1)
then
213 do jj = 1, thisrow%nnz
214 if (thisrow%icolarray(jj) == j)
then
221 thisrow%nnz = thisrow%nnz + 1
222 thisrow%icolarray(thisrow%nnz) = j
229 subroutine sort(this, with_csr)
234 logical(LGP),
optional :: with_csr
236 integer(I4B) :: i, nval, start_idx
239 if (
present(with_csr))
then
247 nval = this%row(i)%nnz
249 this%row(i)%icolarray(start_idx:nval))
261 integer(I4B),
intent(in) :: nval
262 integer(I4B),
intent(inout),
dimension(nval) :: iarray
264 integer(I4B) :: i, j, itemp
268 if (iarray(i) > iarray(j))
then
270 iarray(j) = iarray(i)
284 integer(I4B),
dimension(:),
contiguous :: ia
285 real(DP),
dimension(:),
contiguous :: flowja
287 integer(I4B) :: nodes
289 integer(I4B) :: iposdiag
295 do ipos = ia(n) + 1, ia(n + 1) - 1
296 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)