Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
comp_row_support.f90
Go to the documentation of this file.
1 !*********************************************************************
2 !* Illinois Open Source License *
3 !* *
4 !* University of Illinois/NCSA *
5 !* Open Source License *
6 !* *
7 !* Copyright@2008, University of Illinois. All rights reserved. *
8 !* *
9 !* Developed by: *
10 !* *
11 !* Center for Simulation of Advanced Rockets *
12 !* *
13 !* University of Illinois *
14 !* *
15 !* www.csar.uiuc.edu *
16 !* *
17 !* Permission is hereby granted, free of charge, to any person *
18 !* obtaining a copy of this software and associated documentation *
19 !* files (the "Software"), to deal with the Software without *
20 !* restriction, including without limitation the rights to use, *
21 !* copy, modify, merge, publish, distribute, sublicense, and/or *
22 !* sell copies of the Software, and to permit persons to whom the *
23 !* Software is furnished to do so, subject to the following *
24 !* conditions: *
25 !* *
26 !* *
27 !* @ Redistributions of source code must retain the above copyright *
28 !* notice, this list of conditions and the following disclaimers. *
29 !* *
30 !* @ Redistributions in binary form must reproduce the above *
31 !* copyright notice, this list of conditions and the following *
32 !* disclaimers in the documentation and/or other materials *
33 !* provided with the distribution. *
34 !* *
35 !* @ Neither the names of the Center for Simulation of Advanced *
36 !* Rockets, the University of Illinois, nor the names of its *
37 !* contributors may be used to endorse or promote products derived *
38 !* from this Software without specific prior written permission. *
39 !* *
40 !* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
41 !* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
42 !* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
43 !* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
44 !* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
45 !* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
46 !* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
47 !* USE OR OTHER DEALINGS WITH THE SOFTWARE. *
48 !*********************************************************************
49 !* Please acknowledge The University of Illinois Center for *
50 !* Simulation of Advanced Rockets in works and publications *
51 !* resulting from this software or its derivatives. *
52 !*********************************************************************
53 
54 !!****
55 !!
56 !! NAME
57 !! comp_row_add
58 !!
59 !! FUNCTION
60 !! This subroutine adds 2 matrices stored in compressed
61 !! row format and assigns them to the global variables
62 !! located in comp_row_global.
63 !
64 !!
65 !! INPUTS
66 !! ndim -- The size of one dimension of the global square matrices
67 !! gndim -- Currently the same as ndim
68 !! nrows1 -- The number of rows in matrix1 assigned to this processor
69 !! nrows2 -- The number of rows in matrix2 assigned to this processor (MUST be equal to nrows1 to work properly)
70 !! nnz1 -- The number of nonzeros in this processors section of matrix1
71 !! nnz2 -- The number of nonzeros in this processors section of matrix2
72 !! nstart1 -- The global number of the first row in matrix1 assigned to this processor
73 !! rp1 -- The row mapping vector for matrix1
74 !! cval1 -- The collumn mapping vector for matrix1
75 !! aval1 -- The nonzero values in matrix1
76 !! nstart2 -- The global number of the first row in matrix2 assigned to this processor
77 !! rp2 -- The row mapping vector for matrix2
78 !! cval2 -- The collumn mapping vector for matrix2
79 !! aval2 -- The nonzero values in matrix2
80 !!
81 !! OUTPUTS
82 !! none
83 !!
84 !! USES
85 !! none
86 !!
87 !!****
88 
89 SUBROUTINE comp_row_add(ndim,gndim,nrows1,nrows2,nnz1,nnz2, &
90  nstart1,rp1,cval1,aval1,nstart2,rp2,cval2,aval2)
91 
92  USE precision
93  USE comp_row_global
94 
95  IMPLICIT NONE
96 
97  ! Input variables
98  INTEGER :: ndim, gndim, nnz1, nnz2, nstart1, nstart2, nrows1, nrows2
99  REAL(kind=wp) :: a0
100  REAL(kind=wp), DIMENSION(nnz1) :: aval1
101  REAL(kind=wp), DIMENSION(nnz2) :: aval2
102  INTEGER, DIMENSION(nnz1) :: cval1
103  INTEGER, DIMENSION(nnz2) :: cval2
104  INTEGER, DIMENSION(nrows1+1) :: rp1
105  INTEGER, DIMENSION(nrows2+1) :: rp2
106 
107  ! Internal variables
108  INTEGER :: i, j, counter1, counter2, counter3, nnzrow, nnz, foundnz
109  REAL(kind=wp), DIMENSION(gndim) :: row1, row2, row3
110 
111  ! Count nonzeros
112  counter1 = 0
113  counter2 = 0
114  counter3 = 0
115  DO i = 1, nrows1 ! since nrows1 = nrows2
116  ! Construct the ith row in matrix 1
117  row1(1:gndim) = 0.0
118  DO j = 1, nnz1 ! Loop through collumns
119  !IF(i >= nstart1) THEN
120  IF(j > rp1(i-nstart1+1)) THEN
121  IF(j <= rp1(i-nstart1+2)) THEN
122  counter1 = counter1 + 1
123  row1(cval1(counter1)+1) = aval1(counter1)
124  ENDIF
125  ENDIF
126  !ENDIF
127  ENDDO
128  ! Construct the ith row in matrix 2
129  row2(1:gndim) = 0.0
130  DO j = 1, nnz2 ! Loop through collumns
131  !IF(i >= nstart2) THEN
132  IF(j > rp2(i-nstart2+1)) THEN
133  IF(j <= rp2(i-nstart2+2)) THEN
134  counter2 = counter2 + 1
135  row2(cval2(counter2)+1) = aval2(counter2)
136  ENDIF
137  ENDIF
138  !ENDIF
139  ENDDO
140  ! Add the rows together
141  DO j = 1, gndim
142  row3(j) = row1(j) + row2(j)
143  ENDDO
144  ! Count the nonzeros in the new row
145  DO j = 1, gndim
146  IF(abs(row3(j)) > 0.0 ) THEN
147  counter3 = counter3 + 1
148  !print*,'nonzero found at: ',i,j
149  ENDIF
150  ENDDO
151  !WRITE(*,1000) (row3(j),j=1,ndim)
152  ENDDO
153  nnz_temp = counter3
154 
155  ! Allocate variables
156  ALLOCATE(aval_temp(nnz_temp))
157  ALLOCATE(cval_temp(nnz_temp))
158  ALLOCATE(rp_temp(nrows1+1)) ! since nrows1 = nrows2
159 
160  ! Construct the new matrix
161  counter1 = 0
162  counter2 = 0
163  counter3 = 0
164  rp_temp(1) = 0
165  DO i = 1, nrows1
166  ! Construct the ith row in matrix 1
167  row1(1:gndim) = 0.0
168  DO j = 1, nnz1 ! Loop through collums
169  !print*,j,rp1(i-nstart1+1),rp1(i-nstart1+2),counter1,aval1(counter1),cval1(counter1)
170  !IF(i >= nstart1) THEN
171  IF(j > rp1(i-nstart1+1)) THEN
172  IF(j <= rp1(i-nstart1+2)) THEN
173  counter1 = counter1 + 1
174  row1(cval1(counter1)+1) = aval1(counter1)
175  !print*,'FOUND ONE: row: ',i,' row1(',j,') = ',row1(j)
176  ENDIF
177  ENDIF
178  !ENDIF
179  ENDDO
180  ! Construct the ith row in matrix 2
181  row2(1:gndim) = 0.0
182  DO j = 1, nnz2 ! Loop through collums
183  !IF(i >= nstart2) THEN
184  !print*,j,rp2(i-nstart2+1),rp2(i-nstart2+2),counter2,aval2(counter2)
185  IF(j > rp2(i-nstart2+1)) THEN
186  IF(j <= rp2(i-nstart2+2)) THEN
187  counter2 = counter2 + 1
188  row2(cval2(counter2)+1) = aval2(counter2)
189  !print*,'FOUND ONE: row: ',i,' row2(',j,') = ',row2(j)
190  ENDIF
191  ENDIF
192  !ENDIF
193  ENDDO
194  ! Add the rows together
195  DO j = 1, gndim
196  row3(j) = row1(j) + row2(j)
197  ENDDO
198  ! Put the new row into compressed row format
199  nnzrow = 0
200  DO j = 1, gndim
201  IF(abs(row3(j)) > 0.0 ) THEN
202  counter3 = counter3 + 1
203  nnzrow = nnzrow + 1
204  cval_temp(counter3) = j - 1
205  aval_temp(counter3) = row3(j)
206  ENDIF
207  ENDDO
208  rp_temp(i+1) = rp_temp(i) + nnzrow
209 
210 !!$ if(i==ndim)then
211 !!$ print*,'row1:'
212 !!$ WRITE(*,1000) (row1(j),j=1,ndim)
213 !!$ print*,'row2:'
214 !!$ WRITE(*,1000) (row2(j),j=1,ndim)
215 !!$ print*,'row3:'
216 !!$ WRITE(*,1000) (row3(j),j=1,ndim)
217 !!$ endif
218  ENDDO
219 
220  1000 FORMAT(1000(f5.1,' '))
221 
222 END SUBROUTINE comp_row_add
223 
224 
225 
226 !!****
227 !!
228 !! NAME
229 !! comp_row_vecmult
230 !!
231 !! FUNCTION
232 !! This subroutine multiplies a matrix in compressed
233 !! row format with an explicitly defined vector and
234 !! returns the vector created by this multiplication.
235 !!
236 !! INPUTS
237 !! gndim -- The size of one dimension of the global square matrices
238 !! nrows1 -- The number of rows in matrix1 assigned to this processor
239 !! nnz1 -- The number of nonzeros in this processors section of matrix1
240 !! nstart1 -- The global number of the first row in matrix1 assigned to this processor
241 !! rp1 -- The row mapping vector for matrix1
242 !! cval1 -- The collumn mapping vector for matrix1
243 !! aval1 -- The nonzero values in matrix1
244 !! vec -- The vector that the matrix will multiply
245 !!
246 !! OUTPUTS
247 !! ans -- The solution vector
248 !!
249 !! USES
250 !! none
251 !!
252 !!****
253 
254 SUBROUTINE comp_row_vecmult(gndim,nrows1,nnz1, &
255  nstart1,rp1,cval1,aval1,vec,ans)
256 
257  USE precision
258 
259  IMPLICIT NONE
260 
261  ! Input variables
262  INTEGER :: ndim, gndim, nnz1, nstart1, nrows1
263  REAL(kind=wp) :: a0
264  REAL(kind=wp), DIMENSION(nnz1) :: aval1
265  INTEGER, DIMENSION(nnz1) :: cval1
266  INTEGER, DIMENSION(nrows1+1) :: rp1
267  REAL(kind=wp) :: vec(gndim)
268 
269  ! Output variables
270  REAL(kind=wp) :: ans(nrows1)
271 
272  ! Internal variables
273  INTEGER :: i, j, counter1
274  REAL(kind=wp), DIMENSION(gndim) :: row1
275  REAL(kind=wp) :: tempval
276 
277  ! Construct the new vector
278  counter1 = 0
279  ans(1:nrows1) = 0.0
280  DO i = 1, gndim
281  IF ((i >= nstart1) .AND. (i < nstart1+nrows1)) THEN
282  row1(1:gndim) = 0.0
283  ! Construct the ith row in matrix 1
284  DO j = 1, nnz1 ! Loop through collums
285  IF(j > rp1(i-nstart1+1)) THEN
286  IF(j <= rp1(i-nstart1+2)) THEN
287  counter1 = counter1 + 1
288  row1(cval1(counter1)+1) = aval1(counter1)
289  ENDIF
290  ENDIF
291  ENDDO
292  ! Take the dot product of the row with the vector
293  DO j = 1, gndim
294  ans(i-nstart1+1) = ans(i-nstart1+1) + row1(j) * vec(j)
295  ENDDO
296  ENDIF
297  END DO
298 
299  1000 FORMAT(1000(f5.1,' '))
300 
301 END SUBROUTINE comp_row_vecmult
302 
303 
304 
305 
306 !!****
307 !!
308 !! NAME
309 !! comp_row_mat
310 !!
311 !! FUNCTION
312 !! This subroutine takes a matrix and puts it
313 !! into compressed row storage. The resulting
314 !! arrays are assigned to the global variables
315 !! located in comp_row_global.
316 !!
317 !! INPUTS
318 !! ndim -- The size of one dimension of the global square matrices
319 !! A -- The matrix
320 !! nstart -- The first row in the matrix that is assigned to this processor
321 !! nrows -- The number of rows in the matrix assigned to this processor
322 !!
323 !! OUTPUTS
324 !! none
325 !!
326 !! USES
327 !! none
328 !!
329 !!****
330 
331 SUBROUTINE comp_row_mat(ndim,A,nstart,nrows)
332 
333  USE comp_row_global
334  USE precision
335 
336  ! Input variables
337  INTEGER :: ndim, nstart, nrows
338  REAL(kind=wp), DIMENSION(1:ndim,1:ndim) :: a
339 
340  ! Internal variables
341  INTEGER :: i, j
342  INTEGER :: avali
343  INTEGER :: counter
344 
345  ! Count the nonzeros in the matrix
346  nnz_temp = 0
347  DO i = nstart, nstart+nrows-1
348  DO j = 1, ndim
349  IF ( abs(a(i,j)) > 0.0 ) THEN
350  nnz_temp = nnz_temp + 1
351  ENDIF
352  ENDDO
353  ENDDO
354  ALLOCATE(rp_temp(1:nrows+1))
355  ALLOCATE(cval_temp(1:nnz_temp))
356  ALLOCATE(aval_temp(1:nnz_temp))
357 
358  ! Construct the matrix in compressed row format
359  avali = 1
360  rp_temp(1) = 0
361  DO i = nstart, nstart+nrows-1
362  DO j = 1, ndim
363  IF( abs(a(i,j)) > 0.0 ) THEN
364  aval_temp(avali) = a(i,j)
365  cval_temp(avali) = j-1
366  avali = avali + 1
367  ENDIF
368  ENDDO
369  rp_temp(i-nstart+2) = avali-1
370  ENDDO
371 
372 END SUBROUTINE comp_row_mat
373 
374 
375 
376 
377 
378 !!****
379 !!
380 !! NAME
381 !! comp_row_addval
382 !!
383 !! FUNCTION
384 !! This subroutine adds a value to a matrix stored in
385 !! compressed row format. If a value exists in the
386 !! position for the new value to be added, they are
387 !! summed. The modified matrix is then stored in the
388 !! global variables located in implicit_global.
389 !!
390 !! INPUTS
391 !! ndim -- The size of one dimension of the global square matrices
392 !! nrows -- The number of rows in matrix1 assigned to this processor
393 !! nnz -- The number of nonzeros in this processors section of matrix1
394 !! nstart -- The global number of the first row in matrix1 assigned to this processor
395 !! rp -- The row mapping vector for matrix1
396 !! cval -- The collumn mapping vector for matrix1
397 !! aval -- The nonzero values in matrix1
398 !! ipos -- The global i index of the position to add the value within the matrix
399 !! jpos -- The global j index of the position to add the value within the matrix
400 !! val -- The value to add to the matrix
401 !!
402 !! OUTPUTS
403 !! none
404 !!
405 !! USES
406 !! none
407 !!
408 !!****
409 
410 SUBROUTINE comp_row_addval(ndim,nrows,nnz,nstart,rp,cval,aval,ipos,jpos,val)
411 
412  USE precision
413  USE comp_row_global
414 
415  IMPLICIT NONE
416 
417  ! Input variables
418  INTEGER :: ndim, nnz, nstart, nrows, ipos, jpos
419  REAL(kind=wp) :: val, tempval, tempval2
420  REAL(kind=wp), DIMENSION(nnz) :: aval
421  INTEGER, DIMENSION(nnz) :: cval
422  INTEGER, DIMENSION(nrows+1) :: rp
423 
424  ! Internal variables
425  INTEGER :: i, j, counter, counter1, nnzrow
426  REAL(kind=wp), DIMENSION(ndim) :: row
427 
428  ! Count nonzeros in new matrix
429  counter = 0
430  DO i = rp(ipos-nstart+1)+1, rp(ipos-nstart+2)
431  IF (cval(i) == jpos-1) THEN ! value already there
432  counter = 1
433  EXIT
434  ENDIF
435  ENDDO
436  IF (counter == 1) THEN
437  nnz_temp = nnz ! there was a value there already
438  ELSE
439  nnz_temp = nnz + 1 ! there was not a value there already
440  ENDIF
441 
442  ! Allocate variables
443  ALLOCATE(aval_temp(nnz_temp))
444  ALLOCATE(cval_temp(nnz_temp))
445  ALLOCATE(rp_temp(nrows+1))
446 
447  ! Construct the new matrix
448  IF (nnz_temp == nnz) THEN
449  rp_temp(1:nrows+1) = rp(1:nrows+1)
450  cval_temp(1:nnz_temp) = cval(1:nnz)
451  aval_temp(1:nnz_temp) = aval(1:nnz)
452  DO i = rp(ipos-nstart+1)+1, rp(ipos-nstart+2)
453  IF (cval(i) == jpos-1) THEN
454  aval_temp(i) = aval_temp(i) + val
455  ENDIF
456  ENDDO
457  ELSE
458  DO i = 1, rp(ipos-nstart+2)
459  cval_temp(i) = cval(i)
460  aval_temp(i) = aval(i)
461  ENDDO
462  cval_temp(rp(ipos-nstart+2)+1) = jpos-1
463  aval_temp(rp(ipos-nstart+2)+1) = val
464  DO i = rp(ipos-nstart+2)+1, rp(nrows+1)
465  cval_temp(i+1) = cval(i)
466  aval_temp(i+1) = aval(i)
467  ENDDO
468  DO i = 1, ipos-nstart+1
469  rp_temp(i) = rp(i)
470  ENDDO
471  DO i = ipos-nstart+2, nrows+1
472  rp_temp(i) = rp(i) + 1
473  ENDDO
474  ENDIF
475 
476 
477 END SUBROUTINE comp_row_addval
478 
479 
480 
481 
482 !!****
483 !!
484 !! NAME
485 !! comp_row_getval
486 !!
487 !! FUNCTION
488 !! This subroutine returns a value within a matrix
489 !! stored in compressed row format when given the
490 !! i and j indices of the value.
491 !!
492 !! INPUTS
493 !! ndim -- The size of one dimension of the global square matrices
494 !! nrows -- The number of rows in matrix1 assigned to this processor
495 !! nnz -- The number of nonzeros in this processors section of matrix1
496 !! nstart -- The global number of the first row in matrix1 assigned to this processor
497 !! rp -- The row mapping vector for matrix1
498 !! cval -- The collumn mapping vector for matrix1
499 !! aval -- The nonzero values in matrix1
500 !! ipos -- The global i index of the value
501 !! jpos -- The global j index of the value
502 !!
503 !! OUTPUTS
504 !! val -- The value at (ipos,jpos) in the matrix
505 !!
506 !! USES
507 !! none
508 !!
509 !!****
510 
511 SUBROUTINE comp_row_getval(ndim,nrows,nnz,nstart,rp,cval,aval,ipos,jpos,val)
512 
513  USE precision
514 
515  IMPLICIT NONE
516 
517  ! Input variables
518  INTEGER :: ndim, nnz, nstart, nrows, ipos, jpos
519  REAL(kind=wp) :: val
520  REAL(kind=wp), DIMENSION(nnz) :: aval
521  INTEGER, DIMENSION(nnz) :: cval
522  INTEGER, DIMENSION(nrows+1) :: rp
523 
524  ! Internal variables
525  INTEGER :: i, j, counter
526  REAL(kind=wp), DIMENSION(ndim) :: row
527 
528 !!$ ! Count nonzeros in new matrix
529 !!$ counter = 0
530 !!$ DO i = 1, nrows
531 !!$ row(1:ndim) = 0.0
532 !!$ DO j = 1, nnz
533 !!$ IF(j > rp(i)) THEN
534 !!$ IF(j <= rp(i+1)) THEN
535 !!$ counter = counter + 1
536 !!$ row(cval(counter)+1) = aval(counter)
537 !!$ ENDIF
538 !!$ ENDIF
539 !!$ ENDDO
540 !!$ IF (i == ipos-nstart+1) THEN
541 !!$ val = row(jpos)
542 !!$ EXIT
543 !!$ ENDIF
544 !!$ ENDDO
545 
546  val = 0.0
547  DO i = rp(ipos-nstart+1)+1, rp(ipos-nstart+2)
548  IF (cval(i) == jpos-1) THEN ! value already there
549  val = aval(i)
550  EXIT
551  ENDIF
552  ENDDO
553 
554  !IF(val /= 0.0) print*,'COMP_ROW_GETVAL returning nonzero at ',ipos,jpos,' of value ',val
555 
556 END SUBROUTINE comp_row_getval
557 
558 
559 
560 
561 
562 !!****
563 !!
564 !! NAME
565 !! comp_row_resize
566 !!
567 !! FUNCTION
568 !! This subroutine resizes the rows of a matrix
569 !! in compressed row storage and returns the new
570 !! matrix in the global variables in
571 !! comp_row_global
572 !!
573 !! INPUTS
574 !! ndim -- The size of one dimension of the global square matrices
575 !! nrows -- The number of rows in matrix1 assigned to this processor
576 !! nnz -- The number of nonzeros in this processors section of matrix1
577 !! nstart -- The global number of the first row in matrix1 assigned to this processor
578 !! rp -- The row mapping vector for matrix1
579 !! cval -- The collumn mapping vector for matrix1
580 !! aval -- The nonzero values in matrix1
581 !! newnstart -- The new starting row for this processor
582 !! newnrows -- The new number of rows for this processor
583 !!
584 !! OUTPUTS
585 !! none
586 !!
587 !! USES
588 !! none
589 !!
590 !!****
591 
592 SUBROUTINE comp_row_resize(ndim,nrows,nnz,nstart,rp,cval,aval,newnstart,newnrows)
593 
594 
595  USE precision
596  USE comp_row_global
597 
598  IMPLICIT NONE
599 
600  ! Input variables
601  INTEGER :: ndim, nnz, nstart, nrows, ipos, jpos, newnstart, newnrows
602  REAL(kind=wp) :: val
603  REAL(kind=wp), DIMENSION(nnz) :: aval
604  INTEGER, DIMENSION(nnz) :: cval
605  INTEGER, DIMENSION(nrows+1) :: rp
606 
607  ! Internal variables
608  INTEGER :: i, j, counter, counter1, counter2, nnzrow
609  REAL(kind=wp), DIMENSION(ndim) :: row
610 
611  ! Count nonzeros in new matrix
612  counter = 0
613  nnz_temp = 0
614  DO i = 1, nrows
615  row(1:ndim) = 0.0
616  DO j = 1, nnz
617  IF(j > rp(i)) THEN
618  IF(j <= rp(i+1)) THEN
619  counter = counter + 1
620  IF(i >= newnstart-nstart+1) THEN
621  IF(i < newnstart -nstart + 1 + newnrows) THEN
622  nnz_temp = nnz_temp + 1
623  ENDIF
624  ENDIF
625  ENDIF
626  ENDIF
627  ENDDO
628  ENDDO
629 
630  !print*,'nnz = ',nnz_temp
631 
632  ! Allocate variables
633  ALLOCATE(aval_temp(nnz_temp))
634  ALLOCATE(cval_temp(nnz_temp))
635  ALLOCATE(rp_temp(newnrows+1))
636 
637  ! Construct the new matrix
638  counter = 0
639  counter1 = 0
640  counter2 = 0
641  rp_temp(1) = 0
642  DO i = 1, nrows
643  ! Construct the ith row in matrix 1
644  row(1:ndim) = 0.0
645  DO j = 1, nnz ! Loop through collums
646  IF(j > rp(i)) THEN
647  IF(j <= rp(i+1)) THEN
648  counter = counter + 1
649  IF(i >= newnstart - nstart + 1) THEN
650  IF(i < newnstart + newnrows - nstart + 1) THEN
651  row(cval(counter)+1) = aval(counter)
652  ENDIF
653  ENDIF
654  ENDIF
655  ENDIF
656  ENDDO
657  ! Put the new row into compressed row format
658  nnzrow = 0
659  DO j = 1, ndim
660  IF(row(j) /= 0.0) THEN
661  IF(i >= newnstart - nstart + 1) THEN
662  IF(i < newnstart + newnrows - nstart + 1) THEN
663  counter1 = counter1 + 1
664  nnzrow = nnzrow + 1
665  cval_temp(counter1) = j - 1
666  aval_temp(counter1) = row(j)
667  ENDIF
668  ENDIF
669  ENDIF
670  ENDDO
671  IF(i >= newnstart - nstart + 1) THEN
672  IF(i < newnstart + newnrows - nstart + 1) THEN
673  counter2 = counter2 + 1
674  rp_temp(counter2+1) = rp_temp(counter2) + nnzrow
675  ENDIF
676  ENDIF
677  ENDDO
678 
679 
680 END SUBROUTINE comp_row_resize
681 
682 
683 
684 
subroutine comp_row_mat(ndim, A, nstart, nrows)
subroutine comp_row_add(ndim, gndim, nrows1, nrows2, nnz1, nnz2, nstart1, rp1, cval1, aval1, nstart2, rp2, cval2, aval2)
subroutine comp_row_getval(ndim, nrows, nnz, nstart, rp, cval, aval, ipos, jpos, val)
subroutine comp_row_vecmult(gndim, nrows1, nnz1, nstart1, rp1, cval1, aval1, vec, ans)
subroutine comp_row_resize(ndim, nrows, nnz, nstart, rp, cval, aval, newnstart, newnrows)
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
RT a() const
Definition: Line_2.h:140
subroutine comp_row_addval(ndim, nrows, nnz, nstart, rp, cval, aval, ipos, jpos, val)