Bug Summary

File:mat/impls/aij/seq/aij.c
Warning:line 1684, column 15
3rd function call argument is an uninitialized value

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1
2/*
3 Defines the basic matrix operations for the AIJ (compressed row)
4 matrix storage format.
5*/
6
7
8#include <../src/mat/impls/aij/seq/aij.h> /*I "petscmat.h" I*/
9#include <petscblaslapack.h>
10#include <petscbt.h>
11#include <petsc/private/kernels/blocktranspose.h>
12
13PetscErrorCode MatSeqAIJSetTypeFromOptions(Mat A)
14{
15 PetscErrorCode ierr;
16 PetscBool flg;
17 char type[256];
18
19 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 19; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
20 ierr = PetscObjectOptionsBegin((PetscObject)A)0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems
*PetscOptionsObject = &PetscOptionsObjectBase; PetscOptionsObject
->options = ((PetscObject)(PetscObject)A)->options; for
(PetscOptionsObject->count=(PetscOptionsPublish?-1:1); PetscOptionsObject
->count<2; PetscOptionsObject->count++) { PetscErrorCode
_5_ierr = PetscObjectOptionsBegin_Private(PetscOptionsObject
,(PetscObject)A);do {if (__builtin_expect(!!(_5_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),20,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_5_ierr);}} while (0);
;
21 ierr = PetscOptionsFList("-mat_seqaij_type","Matrix SeqAIJ type","MatSeqAIJSetType",MatSeqAIJList,"seqaij",type,256,&flg)PetscOptionsFList_Private(PetscOptionsObject,"-mat_seqaij_type"
,"Matrix SeqAIJ type","MatSeqAIJSetType",MatSeqAIJList,"seqaij"
,type,256,&flg)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),21,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
22 if (flg) {
23 ierr = MatSeqAIJSetType(A,type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),23,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
24 }
25 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) {PetscError(((MPI_Comm)0x44000001
),25,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_5_ierr);}} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),25,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
26 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
27}
28
29PetscErrorCode MatGetColumnNorms_SeqAIJ(Mat A,NormType type,PetscReal *norms)
30{
31 PetscErrorCode ierr;
32 PetscInt i,m,n;
33 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)A->data;
34
35 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 35; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
36 ierr = MatGetSize(A,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),36,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
37 ierr = PetscMemzero(norms,n*sizeof(PetscReal));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),37,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
38 if (type == NORM_2) {
39 for (i=0; i<aij->i[m]; i++) {
40 norms[aij->j[i]] += PetscAbsScalar(aij->a[i]*aij->a[i]);
41 }
42 } else if (type == NORM_1) {
43 for (i=0; i<aij->i[m]; i++) {
44 norms[aij->j[i]] += PetscAbsScalar(aij->a[i]);
45 }
46 } else if (type == NORM_INFINITY) {
47 for (i=0; i<aij->i[m]; i++) {
48 norms[aij->j[i]] = PetscMax(PetscAbsScalar(aij->a[i]),norms[aij->j[i]])(((PetscAbsScalar(aij->a[i]))<(norms[aij->j[i]])) ? (
norms[aij->j[i]]) : (PetscAbsScalar(aij->a[i])))
;
49 }
50 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown NormType")return PetscError(((MPI_Comm)0x44000001),50,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,62,PETSC_ERROR_INITIAL,"Unknown NormType")
;
51
52 if (type == NORM_2) {
53 for (i=0; i<n; i++) norms[i] = PetscSqrtReal(norms[i])sqrt(norms[i]);
54 }
55 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
56}
57
58PetscErrorCode MatFindOffBlockDiagonalEntries_SeqAIJ(Mat A,IS *is)
59{
60 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
61 PetscInt i,m=A->rmap->n,cnt = 0, bs = A->rmap->bs;
62 const PetscInt *jj = a->j,*ii = a->i;
63 PetscInt *rows;
64 PetscErrorCode ierr;
65
66 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 66; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
67 for (i=0; i<m; i++) {
68 if ((ii[i] != ii[i+1]) && ((jj[ii[i]] < bs*(i/bs)) || (jj[ii[i+1]-1] > bs*((i+bs)/bs)-1))) {
69 cnt++;
70 }
71 }
72 ierr = PetscMalloc1(cnt,&rows)PetscMallocA(1,PETSC_FALSE,72,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(cnt)*sizeof(**(&rows)),(&rows))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),72,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
73 cnt = 0;
74 for (i=0; i<m; i++) {
75 if ((ii[i] != ii[i+1]) && ((jj[ii[i]] < bs*(i/bs)) || (jj[ii[i+1]-1] > bs*((i+bs)/bs)-1))) {
76 rows[cnt] = i;
77 cnt++;
78 }
79 }
80 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cnt,rows,PETSC_OWN_POINTER,is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),80,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
81 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
82}
83
84PetscErrorCode MatFindZeroDiagonals_SeqAIJ_Private(Mat A,PetscInt *nrows,PetscInt **zrows)
85{
86 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
87 const MatScalar *aa = a->a;
88 PetscInt i,m=A->rmap->n,cnt = 0;
89 const PetscInt *ii = a->i,*jj = a->j,*diag;
90 PetscInt *rows;
91 PetscErrorCode ierr;
92
93 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 93; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
94 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),94,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
95 diag = a->diag;
96 for (i=0; i<m; i++) {
97 if ((diag[i] >= ii[i+1]) || (jj[diag[i]] != i) || (aa[diag[i]] == 0.0)) {
98 cnt++;
99 }
100 }
101 ierr = PetscMalloc1(cnt,&rows)PetscMallocA(1,PETSC_FALSE,101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(cnt)*sizeof(**(&rows)),(&rows))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
102 cnt = 0;
103 for (i=0; i<m; i++) {
104 if ((diag[i] >= ii[i+1]) || (jj[diag[i]] != i) || (aa[diag[i]] == 0.0)) {
105 rows[cnt++] = i;
106 }
107 }
108 *nrows = cnt;
109 *zrows = rows;
110 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
111}
112
113PetscErrorCode MatFindZeroDiagonals_SeqAIJ(Mat A,IS *zrows)
114{
115 PetscInt nrows,*rows;
116 PetscErrorCode ierr;
117
118 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 118; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
119 *zrows = NULL((void*)0);
120 ierr = MatFindZeroDiagonals_SeqAIJ_Private(A,&nrows,&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),120,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
121 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)A),nrows,rows,PETSC_OWN_POINTER,zrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),121,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
122 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
123}
124
125PetscErrorCode MatFindNonzeroRows_SeqAIJ(Mat A,IS *keptrows)
126{
127 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
128 const MatScalar *aa;
129 PetscInt m=A->rmap->n,cnt = 0;
130 const PetscInt *ii;
131 PetscInt n,i,j,*rows;
132 PetscErrorCode ierr;
133
134 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 134; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
135 *keptrows = 0;
136 ii = a->i;
137 for (i=0; i<m; i++) {
138 n = ii[i+1] - ii[i];
139 if (!n) {
140 cnt++;
141 goto ok1;
142 }
143 aa = a->a + ii[i];
144 for (j=0; j<n; j++) {
145 if (aa[j] != 0.0) goto ok1;
146 }
147 cnt++;
148ok1:;
149 }
150 if (!cnt) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
151 ierr = PetscMalloc1(A->rmap->n-cnt,&rows)PetscMallocA(1,PETSC_FALSE,151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->rmap->n-cnt)*sizeof(**(&rows)),(&rows
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
152 cnt = 0;
153 for (i=0; i<m; i++) {
154 n = ii[i+1] - ii[i];
155 if (!n) continue;
156 aa = a->a + ii[i];
157 for (j=0; j<n; j++) {
158 if (aa[j] != 0.0) {
159 rows[cnt++] = i;
160 break;
161 }
162 }
163 }
164 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cnt,rows,PETSC_OWN_POINTER,keptrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
165 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
166}
167
168PetscErrorCode MatDiagonalSet_SeqAIJ(Mat Y,Vec D,InsertMode is)
169{
170 PetscErrorCode ierr;
171 Mat_SeqAIJ *aij = (Mat_SeqAIJ*) Y->data;
172 PetscInt i,m = Y->rmap->n;
173 const PetscInt *diag;
174 MatScalar *aa = aij->a;
175 const PetscScalar *v;
176 PetscBool missing;
177
178 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 178; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
179 if (Y->assembled) {
180 ierr = MatMissingDiagonal_SeqAIJ(Y,&missing,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
181 if (!missing) {
182 diag = aij->diag;
183 ierr = VecGetArrayRead(D,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),183,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
184 if (is == INSERT_VALUES) {
185 for (i=0; i<m; i++) {
186 aa[diag[i]] = v[i];
187 }
188 } else {
189 for (i=0; i<m; i++) {
190 aa[diag[i]] += v[i];
191 }
192 }
193 ierr = VecRestoreArrayRead(D,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
194 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
195 }
196 ierr = MatSeqAIJInvalidateDiagonal(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
197 }
198 ierr = MatDiagonalSet_Default(Y,D,is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
199 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
200}
201
202PetscErrorCode MatGetRowIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *m,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done)
203{
204 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
205 PetscErrorCode ierr;
206 PetscInt i,ishift;
207
208 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 208; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
209 *m = A->rmap->n;
210 if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
211 ishift = 0;
212 if (symmetric && !A->structurally_symmetric) {
213 ierr = MatToSymmetricIJ_SeqAIJ(A->rmap->n,a->i,a->j,PETSC_TRUE,ishift,oshift,(PetscInt**)ia,(PetscInt**)ja);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
214 } else if (oshift == 1) {
215 PetscInt *tia;
216 PetscInt nz = a->i[A->rmap->n];
217 /* malloc space and add 1 to i and j indices */
218 ierr = PetscMalloc1(A->rmap->n+1,&tia)PetscMallocA(1,PETSC_FALSE,218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->rmap->n+1)*sizeof(**(&tia)),(&tia)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
219 for (i=0; i<A->rmap->n+1; i++) tia[i] = a->i[i] + 1;
220 *ia = tia;
221 if (ja) {
222 PetscInt *tja;
223 ierr = PetscMalloc1(nz+1,&tja)PetscMallocA(1,PETSC_FALSE,223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz+1)*sizeof(**(&tja)),(&tja))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
224 for (i=0; i<nz; i++) tja[i] = a->j[i] + 1;
225 *ja = tja;
226 }
227 } else {
228 *ia = a->i;
229 if (ja) *ja = a->j;
230 }
231 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
232}
233
234PetscErrorCode MatRestoreRowIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done)
235{
236 PetscErrorCode ierr;
237
238 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 238; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
239 if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
240 if ((symmetric && !A->structurally_symmetric) || oshift == 1) {
241 ierr = PetscFree(*ia)((*PetscTrFree)((void*)(*ia),241,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*ia) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),241,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
242 if (ja) {ierr = PetscFree(*ja)((*PetscTrFree)((void*)(*ja),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*ja) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
243 }
244 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
245}
246
247PetscErrorCode MatGetColumnIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done)
248{
249 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
250 PetscErrorCode ierr;
251 PetscInt i,*collengths,*cia,*cja,n = A->cmap->n,m = A->rmap->n;
252 PetscInt nz = a->i[m],row,*jj,mr,col;
253
254 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 254; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
255 *nn = n;
256 if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
257 if (symmetric) {
258 ierr = MatToSymmetricIJ_SeqAIJ(A->rmap->n,a->i,a->j,PETSC_TRUE,0,oshift,(PetscInt**)ia,(PetscInt**)ja);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),258,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
259 } else {
260 ierr = PetscCalloc1(n+1,&collengths)PetscMallocA(1,PETSC_TRUE,260,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n+1)*sizeof(**(&collengths)),(&collengths))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),260,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
261 ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n+1)*sizeof(**(&cia)),(&cia))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
262 ierr = PetscMalloc1(nz+1,&cja)PetscMallocA(1,PETSC_FALSE,262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz+1)*sizeof(**(&cja)),(&cja))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
263 jj = a->j;
264 for (i=0; i<nz; i++) {
265 collengths[jj[i]]++;
266 }
267 cia[0] = oshift;
268 for (i=0; i<n; i++) {
269 cia[i+1] = cia[i] + collengths[i];
270 }
271 ierr = PetscMemzero(collengths,n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),271,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
272 jj = a->j;
273 for (row=0; row<m; row++) {
274 mr = a->i[row+1] - a->i[row];
275 for (i=0; i<mr; i++) {
276 col = *jj++;
277
278 cja[cia[col] + collengths[col]++ - oshift] = row + oshift;
279 }
280 }
281 ierr = PetscFree(collengths)((*PetscTrFree)((void*)(collengths),281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((collengths) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
282 *ia = cia; *ja = cja;
283 }
284 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
285}
286
287PetscErrorCode MatRestoreColumnIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done)
288{
289 PetscErrorCode ierr;
290
291 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 291; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
292 if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
293
294 ierr = PetscFree(*ia)((*PetscTrFree)((void*)(*ia),294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*ia) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
295 ierr = PetscFree(*ja)((*PetscTrFree)((void*)(*ja),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*ja) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
296 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
297}
298
299/*
300 MatGetColumnIJ_SeqAIJ_Color() and MatRestoreColumnIJ_SeqAIJ_Color() are customized from
301 MatGetColumnIJ_SeqAIJ() and MatRestoreColumnIJ_SeqAIJ() by adding an output
302 spidx[], index of a->a, to be used in MatTransposeColoringCreate_SeqAIJ() and MatFDColoringCreate_SeqXAIJ()
303*/
304PetscErrorCode MatGetColumnIJ_SeqAIJ_Color(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscInt *spidx[],PetscBool *done)
305{
306 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
307 PetscErrorCode ierr;
308 PetscInt i,*collengths,*cia,*cja,n = A->cmap->n,m = A->rmap->n;
309 PetscInt nz = a->i[m],row,*jj,mr,col;
310 PetscInt *cspidx;
311
312 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 312; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
313 *nn = n;
314 if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
315
316 ierr = PetscCalloc1(n+1,&collengths)PetscMallocA(1,PETSC_TRUE,316,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n+1)*sizeof(**(&collengths)),(&collengths))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),316,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
317 ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n+1)*sizeof(**(&cia)),(&cia))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
318 ierr = PetscMalloc1(nz+1,&cja)PetscMallocA(1,PETSC_FALSE,318,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz+1)*sizeof(**(&cja)),(&cja))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),318,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
319 ierr = PetscMalloc1(nz+1,&cspidx)PetscMallocA(1,PETSC_FALSE,319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz+1)*sizeof(**(&cspidx)),(&cspidx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
320 jj = a->j;
321 for (i=0; i<nz; i++) {
322 collengths[jj[i]]++;
323 }
324 cia[0] = oshift;
325 for (i=0; i<n; i++) {
326 cia[i+1] = cia[i] + collengths[i];
327 }
328 ierr = PetscMemzero(collengths,n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),328,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
329 jj = a->j;
330 for (row=0; row<m; row++) {
331 mr = a->i[row+1] - a->i[row];
332 for (i=0; i<mr; i++) {
333 col = *jj++;
334 cspidx[cia[col] + collengths[col] - oshift] = a->i[row] + i; /* index of a->j */
335 cja[cia[col] + collengths[col]++ - oshift] = row + oshift;
336 }
337 }
338 ierr = PetscFree(collengths)((*PetscTrFree)((void*)(collengths),338,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((collengths) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),338,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
339 *ia = cia; *ja = cja;
340 *spidx = cspidx;
341 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
342}
343
344PetscErrorCode MatRestoreColumnIJ_SeqAIJ_Color(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscInt *spidx[],PetscBool *done)
345{
346 PetscErrorCode ierr;
347
348 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 348; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
349 ierr = MatRestoreColumnIJ_SeqAIJ(A,oshift,symmetric,inodecompressed,n,ia,ja,done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),349,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
350 ierr = PetscFree(*spidx)((*PetscTrFree)((void*)(*spidx),350,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*spidx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),350,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
351 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
352}
353
354PetscErrorCode MatSetValuesRow_SeqAIJ(Mat A,PetscInt row,const PetscScalar v[])
355{
356 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
357 PetscInt *ai = a->i;
358 PetscErrorCode ierr;
359
360 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 360; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
361 ierr = PetscMemcpy(a->a+ai[row],v,(ai[row+1]-ai[row])*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
362 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
363}
364
365/*
366 MatSeqAIJSetValuesLocalFast - An optimized version of MatSetValuesLocal() for SeqAIJ matrices with several assumptions
367
368 - a single row of values is set with each call
369 - no row or column indices are negative or (in error) larger than the number of rows or columns
370 - the values are always added to the matrix, not set
371 - no new locations are introduced in the nonzero structure of the matrix
372
373 This does NOT assume the global column indices are sorted
374
375*/
376
377#include <petsc/private/isimpl.h>
378PetscErrorCode MatSeqAIJSetValuesLocalFast(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is)
379{
380 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
381 PetscInt low,high,t,row,nrow,i,col,l;
382 const PetscInt *rp,*ai = a->i,*ailen = a->ilen,*aj = a->j;
383 PetscInt lastcol = -1;
384 MatScalar *ap,value,*aa = a->a;
385 const PetscInt *ridx = A->rmap->mapping->indices,*cidx = A->cmap->mapping->indices;
386
387 row = ridx[im[0]];
388 rp = aj + ai[row];
389 ap = aa + ai[row];
390 nrow = ailen[row];
391 low = 0;
392 high = nrow;
393 for (l=0; l<n; l++) { /* loop over added columns */
394 col = cidx[in[l]];
395 value = v[l];
396
397 if (col <= lastcol) low = 0;
398 else high = nrow;
399 lastcol = col;
400 while (high-low > 5) {
401 t = (low+high)/2;
402 if (rp[t] > col) high = t;
403 else low = t;
404 }
405 for (i=low; i<high; i++) {
406 if (rp[i] == col) {
407 ap[i] += value;
408 low = i + 1;
409 break;
410 }
411 }
412 }
413 return 0;
414}
415
416PetscErrorCode MatSetValues_SeqAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is)
417{
418 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
419 PetscInt *rp,k,low,high,t,ii,row,nrow,i,col,l,rmax,N;
420 PetscInt *imax = a->imax,*ai = a->i,*ailen = a->ilen;
421 PetscErrorCode ierr;
422 PetscInt *aj = a->j,nonew = a->nonew,lastcol = -1;
423 MatScalar *ap=NULL((void*)0),value=0.0,*aa = a->a;
424 PetscBool ignorezeroentries = a->ignorezeroentries;
425 PetscBool roworiented = a->roworiented;
426
427 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 427; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
428 for (k=0; k<m; k++) { /* loop over added rows */
429 row = im[k];
430 if (row < 0) continue;
431#if defined(PETSC_USE_DEBUG1)
432 if (row >= A->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",row,A->rmap->n-1)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),432,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
433#endif
434 rp = aj + ai[row];
435 if (!A->structure_only) ap = aa + ai[row];
436 rmax = imax[row]; nrow = ailen[row];
437 low = 0;
438 high = nrow;
439 for (l=0; l<n; l++) { /* loop over added columns */
440 if (in[l] < 0) continue;
441#if defined(PETSC_USE_DEBUG1)
442 if (in[l] >= A->cmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",in[l],A->cmap->n-1)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),442,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
443#endif
444 col = in[l];
445 if (!A->structure_only) {
446 if (roworiented) {
447 value = v[l + k*n];
448 } else {
449 value = v[k + l*m];
450 }
451 } else { /* A->structure_only */
452 value = 1; /* avoid 'continue' below? */
453 }
454 if ((value == 0.0 && ignorezeroentries) && (is == ADD_VALUES) && row != col) continue;
455
456 if (col <= lastcol) low = 0;
457 else high = nrow;
458 lastcol = col;
459 while (high-low > 5) {
460 t = (low+high)/2;
461 if (rp[t] > col) high = t;
462 else low = t;
463 }
464 for (i=low; i<high; i++) {
465 if (rp[i] > col) break;
466 if (rp[i] == col) {
467 if (!A->structure_only) {
468 if (is == ADD_VALUES) ap[i] += value;
469 else ap[i] = value;
470 }
471 low = i + 1;
472 goto noinsert;
473 }
474 }
475 if (value == 0.0 && ignorezeroentries && row != col) goto noinsert;
476 if (nonew == 1) goto noinsert;
477 if (nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero at (%D,%D) in the matrix",row,col)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
478 if (A->structure_only) {
479 MatSeqXAIJReallocateAIJ_structure_only(A,A->rmap->n,1,nrow,row,col,rmax,ai,aj,rp,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data
; PetscInt CHUNKSIZE = 15,new_nz = ai[A->rmap->n] + CHUNKSIZE
,len,*new_i=0,*new_j=0; if (nonew == -2) do {if (__builtin_expect
(!!(63),0)) {PetscError(((MPI_Comm)0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0); ierr = PetscMallocA(1,PETSC_FALSE,479,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
(size_t)(new_nz)*sizeof(**(&new_j)),(&new_j));do {if (
__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001
),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = PetscMallocA(1,PETSC_FALSE,479
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->rmap->n+1)*sizeof(**(&new_i)),(&new_i
));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm
)0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); for (ii=0; ii<row+1; ii++) {new_i[
ii] = ai[ii];} for (ii=row+1; ii<A->rmap->n+1; ii++)
{new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = PetscMemcpy(new_j,aj,
(ai[row]+nrow)*sizeof(PetscInt));do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); len = (new_nz - CHUNKSIZE - ai[row] -
nrow); ierr = PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE,aj+ai
[row]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = MatSeqXAIJFreeAIJ(A,&Ain->
a,&Ain->j,&Ain->i);do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); Ain->a = ((void*)0); ai = Ain->
i = new_i; aj = Ain->j = new_j; Ain->singlemalloc = PETSC_FALSE
; Ain->free_a = PETSC_FALSE; rp = aj + ai[row]; rmax = imax
[row] = imax[row] + CHUNKSIZE; Ain->maxnz += 1*CHUNKSIZE; Ain
->reallocs++; }
;
480 } else {
481 MatSeqXAIJReallocateAIJ(A,A->rmap->n,1,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data
; PetscInt CHUNKSIZE = 15,new_nz = ai[A->rmap->n] + CHUNKSIZE
,len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) do
{if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0); ierr = PetscMallocA(3,PETSC_FALSE,481,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
(size_t)(1*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(A->
rmap->n+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),481,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); for (ii=0; ii<row+1; ii++) {new_i[
ii] = ai[ii];} for (ii=row+1; ii<A->rmap->n+1; ii++)
{new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = PetscMemcpy(new_j,aj,
(ai[row]+nrow)*sizeof(PetscInt));do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); len = (new_nz - CHUNKSIZE - ai[row] -
nrow); ierr = PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE,aj+ai
[row]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = PetscMemcpy(new_a,aa,1*(ai[row
]+nrow)*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),
0)) {PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = PetscMemzero(new_a+1*(ai[row]+
nrow),1*CHUNKSIZE*sizeof(MatScalar));do {if (__builtin_expect
(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),481,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = PetscMemcpy(new_a+1*(ai[row]+nrow
+CHUNKSIZE),aa+1*(ai[row]+nrow),1*len*sizeof(MatScalar));do {
if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001
),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = MatSeqXAIJFreeAIJ(A,&Ain->
a,&Ain->j,&Ain->i);do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); aa = new_a; Ain->a = (MatScalar*) new_a
; ai = Ain->i = new_i; aj = Ain->j = new_j; Ain->singlemalloc
= PETSC_TRUE; rp = aj + ai[row]; ap = aa + 1*ai[row]; rmax =
imax[row] = imax[row] + CHUNKSIZE; Ain->maxnz += 1*CHUNKSIZE
; Ain->reallocs++; }
;
482 }
483 N = nrow++ - 1; a->nz++; high++;
484 /* shift up all the later entries in this row */
485 for (ii=N; ii>=i; ii--) {
486 rp[ii+1] = rp[ii];
487 if (!A->structure_only) ap[ii+1] = ap[ii];
488 }
489 rp[i] = col;
490 if (!A->structure_only) ap[i] = value;
491 low = i + 1;
492 A->nonzerostate++;
493noinsert:;
494 }
495 ailen[row] = nrow;
496 }
497 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
498}
499
500
501PetscErrorCode MatGetValues_SeqAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],PetscScalar v[])
502{
503 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
504 PetscInt *rp,k,low,high,t,row,nrow,i,col,l,*aj = a->j;
505 PetscInt *ai = a->i,*ailen = a->ilen;
506 MatScalar *ap,*aa = a->a;
507
508 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 508; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
509 for (k=0; k<m; k++) { /* loop over rows */
510 row = im[k];
511 if (row < 0) {v += n; continue;} /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row: %D",row); */
512 if (row >= A->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",row,A->rmap->n-1)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),512,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
513 rp = aj + ai[row]; ap = aa + ai[row];
514 nrow = ailen[row];
515 for (l=0; l<n; l++) { /* loop over columns */
516 if (in[l] < 0) {v++; continue;} /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column: %D",in[l]); */
517 if (in[l] >= A->cmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",in[l],A->cmap->n-1)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),517,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
518 col = in[l];
519 high = nrow; low = 0; /* assume unsorted */
520 while (high-low > 5) {
521 t = (low+high)/2;
522 if (rp[t] > col) high = t;
523 else low = t;
524 }
525 for (i=low; i<high; i++) {
526 if (rp[i] > col) break;
527 if (rp[i] == col) {
528 *v++ = ap[i];
529 goto finished;
530 }
531 }
532 *v++ = 0.0;
533finished:;
534 }
535 }
536 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
537}
538
539
540PetscErrorCode MatView_SeqAIJ_Binary(Mat A,PetscViewer viewer)
541{
542 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
543 PetscErrorCode ierr;
544 PetscInt i,*col_lens;
545 int fd;
546 FILE *file;
547
548 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 548; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
549 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),549,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
550 ierr = PetscMalloc1(4+A->rmap->n,&col_lens)PetscMallocA(1,PETSC_FALSE,550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(4+A->rmap->n)*sizeof(**(&col_lens)),(&
col_lens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
551
552 col_lens[0] = MAT_FILE_CLASSID1211216;
553 col_lens[1] = A->rmap->n;
554 col_lens[2] = A->cmap->n;
555 col_lens[3] = a->nz;
556
557 /* store lengths of each row and write (including header) to file */
558 for (i=0; i<A->rmap->n; i++) {
559 col_lens[4+i] = a->i[i+1] - a->i[i];
560 }
561 ierr = PetscBinaryWrite(fd,col_lens,4+A->rmap->n,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),561,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
562 ierr = PetscFree(col_lens)((*PetscTrFree)((void*)(col_lens),562,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((col_lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),562,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
563
564 /* store column indices (zero start index) */
565 ierr = PetscBinaryWrite(fd,a->j,a->nz,PETSC_INT,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),565,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
566
567 /* store nonzero values */
568 ierr = PetscBinaryWrite(fd,a->a,a->nz,PETSC_SCALARPETSC_DOUBLE,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
569
570 ierr = PetscViewerBinaryGetInfoPointer(viewer,&file);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),570,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
571 if (file) {
572 fprintf(file,"-matload_block_size %d\n",(int)PetscAbs(A->rmap->bs)(((A->rmap->bs) >= 0) ? (A->rmap->bs) : (-(A->
rmap->bs)))
);
573 }
574 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
575}
576
577static PetscErrorCode MatView_SeqAIJ_ASCII_structonly(Mat A,PetscViewer viewer)
578{
579 PetscErrorCode ierr;
580 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
581 PetscInt i,k,m=A->rmap->N;
582
583 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 583; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
584 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),584,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
585 for (i=0; i<m; i++) {
586 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),586,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
587 for (k=a->i[i]; k<a->i[i+1]; k++) {
588 ierr = PetscViewerASCIIPrintf(viewer," (%D) ",a->j[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),588,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
589 }
590 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),590,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
591 }
592 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),592,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
593 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
594}
595
596extern PetscErrorCode MatSeqAIJFactorInfo_Matlab(Mat,PetscViewer);
597
598PetscErrorCode MatView_SeqAIJ_ASCII(Mat A,PetscViewer viewer)
599{
600 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
601 PetscErrorCode ierr;
602 PetscInt i,j,m = A->rmap->n;
603 const char *name;
604 PetscViewerFormat format;
605
606 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 606; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
607 if (A->structure_only) {
608 ierr = MatView_SeqAIJ_ASCII_structonly(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),608,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
609 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
610 }
611
612 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),612,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
613 if (format == PETSC_VIEWER_ASCII_MATLAB) {
614 PetscInt nofinalvalue = 0;
615 if (m && ((a->i[m] == a->i[m-1]) || (a->j[a->nz-1] != A->cmap->n-1))) {
616 /* Need a dummy value to ensure the dimension of the matrix. */
617 nofinalvalue = 1;
618 }
619 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),619,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
620 ierr = PetscViewerASCIIPrintf(viewer,"%% Size = %D %D \n",m,A->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),620,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
621 ierr = PetscViewerASCIIPrintf(viewer,"%% Nonzeros = %D \n",a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),621,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
622#if defined(PETSC_USE_COMPLEX)
623 ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,4);\n",a->nz+nofinalvalue);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),623,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
624#else
625 ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,3);\n",a->nz+nofinalvalue);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),625,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
626#endif
627 ierr = PetscViewerASCIIPrintf(viewer,"zzz = [\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),627,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
628
629 for (i=0; i<m; i++) {
630 for (j=a->i[i]; j<a->i[i+1]; j++) {
631#if defined(PETSC_USE_COMPLEX)
632 ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e %18.16e\n",i+1,a->j[j]+1,(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),632,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
633#else
634 ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+1,a->j[j]+1,(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),634,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
635#endif
636 }
637 }
638 if (nofinalvalue) {
639#if defined(PETSC_USE_COMPLEX)
640 ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e %18.16e\n",m,A->cmap->n,0.,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),640,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
641#else
642 ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",m,A->cmap->n,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),642,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
643#endif
644 }
645 ierr = PetscObjectGetName((PetscObject)A,&name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),645,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
646 ierr = PetscViewerASCIIPrintf(viewer,"];\n %s = spconvert(zzz);\n",name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),646,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
647 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),647,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
648 } else if (format == PETSC_VIEWER_ASCII_FACTOR_INFO || format == PETSC_VIEWER_ASCII_INFO) {
649 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
650 } else if (format == PETSC_VIEWER_ASCII_COMMON) {
651 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),651,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
652 for (i=0; i<m; i++) {
653 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),653,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
654 for (j=a->i[i]; j<a->i[i+1]; j++) {
655#if defined(PETSC_USE_COMPLEX)
656 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0 && PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
657 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),657,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
658 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0 && PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
659 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)-PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),659,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
660 } else if (PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
661 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),661,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
662 }
663#else
664 if (a->a[j] != 0.0) {ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),664,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
665#endif
666 }
667 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),667,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
668 }
669 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
670 } else if (format == PETSC_VIEWER_ASCII_SYMMODU) {
671 PetscInt nzd=0,fshift=1,*sptr;
672 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),672,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
673 ierr = PetscMalloc1(m+1,&sptr)PetscMallocA(1,PETSC_FALSE,673,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m+1)*sizeof(**(&sptr)),(&sptr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),673,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
674 for (i=0; i<m; i++) {
675 sptr[i] = nzd+1;
676 for (j=a->i[i]; j<a->i[i+1]; j++) {
677 if (a->j[j] >= i) {
678#if defined(PETSC_USE_COMPLEX)
679 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) != 0.0 || PetscRealPart(a->a[j])(a->a[j]) != 0.0) nzd++;
680#else
681 if (a->a[j] != 0.0) nzd++;
682#endif
683 }
684 }
685 }
686 sptr[m] = nzd+1;
687 ierr = PetscViewerASCIIPrintf(viewer," %D %D\n\n",m,nzd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),687,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
688 for (i=0; i<m+1; i+=6) {
689 if (i+4<m) {
690 ierr = PetscViewerASCIIPrintf(viewer," %D %D %D %D %D %D\n",sptr[i],sptr[i+1],sptr[i+2],sptr[i+3],sptr[i+4],sptr[i+5]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),690,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
691 } else if (i+3<m) {
692 ierr = PetscViewerASCIIPrintf(viewer," %D %D %D %D %D\n",sptr[i],sptr[i+1],sptr[i+2],sptr[i+3],sptr[i+4]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),692,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
693 } else if (i+2<m) {
694 ierr = PetscViewerASCIIPrintf(viewer," %D %D %D %D\n",sptr[i],sptr[i+1],sptr[i+2],sptr[i+3]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),694,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
695 } else if (i+1<m) {
696 ierr = PetscViewerASCIIPrintf(viewer," %D %D %D\n",sptr[i],sptr[i+1],sptr[i+2]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
697 } else if (i<m) {
698 ierr = PetscViewerASCIIPrintf(viewer," %D %D\n",sptr[i],sptr[i+1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
699 } else {
700 ierr = PetscViewerASCIIPrintf(viewer," %D\n",sptr[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),700,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
701 }
702 }
703 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),703,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
704 ierr = PetscFree(sptr)((*PetscTrFree)((void*)(sptr),704,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((sptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),704,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
705 for (i=0; i<m; i++) {
706 for (j=a->i[i]; j<a->i[i+1]; j++) {
707 if (a->j[j] >= i) {ierr = PetscViewerASCIIPrintf(viewer," %D ",a->j[j]+fshift);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),707,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
708 }
709 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),709,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
710 }
711 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),711,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
712 for (i=0; i<m; i++) {
713 for (j=a->i[i]; j<a->i[i+1]; j++) {
714 if (a->j[j] >= i) {
715#if defined(PETSC_USE_COMPLEX)
716 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) != 0.0 || PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
717 ierr = PetscViewerASCIIPrintf(viewer," %18.16e %18.16e ",(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),717,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
718 }
719#else
720 if (a->a[j] != 0.0) {ierr = PetscViewerASCIIPrintf(viewer," %18.16e ",(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),720,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
721#endif
722 }
723 }
724 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),724,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
725 }
726 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),726,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
727 } else if (format == PETSC_VIEWER_ASCII_DENSE) {
728 PetscInt cnt = 0,jcnt;
729 PetscScalar value;
730#if defined(PETSC_USE_COMPLEX)
731 PetscBool realonly = PETSC_TRUE;
732
733 for (i=0; i<a->i[m]; i++) {
734 if (PetscImaginaryPart(a->a[i])((PetscReal)0.) != 0.0) {
735 realonly = PETSC_FALSE;
736 break;
737 }
738 }
739#endif
740
741 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),741,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
742 for (i=0; i<m; i++) {
743 jcnt = 0;
744 for (j=0; j<A->cmap->n; j++) {
745 if (jcnt < a->i[i+1]-a->i[i] && j == a->j[cnt]) {
746 value = a->a[cnt++];
747 jcnt++;
748 } else {
749 value = 0.0;
750 }
751#if defined(PETSC_USE_COMPLEX)
752 if (realonly) {
753 ierr = PetscViewerASCIIPrintf(viewer," %7.5e ",(double)PetscRealPart(value)(value));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),753,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
754 } else {
755 ierr = PetscViewerASCIIPrintf(viewer," %7.5e+%7.5e i ",(double)PetscRealPart(value)(value),(double)PetscImaginaryPart(value)((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),755,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
756 }
757#else
758 ierr = PetscViewerASCIIPrintf(viewer," %7.5e ",(double)value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),758,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
759#endif
760 }
761 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),761,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
762 }
763 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),763,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
764 } else if (format == PETSC_VIEWER_ASCII_MATRIXMARKET) {
765 PetscInt fshift=1;
766 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),766,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
767#if defined(PETSC_USE_COMPLEX)
768 ierr = PetscViewerASCIIPrintf(viewer,"%%%%MatrixMarket matrix coordinate complex general\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),768,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
769#else
770 ierr = PetscViewerASCIIPrintf(viewer,"%%%%MatrixMarket matrix coordinate real general\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),770,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
771#endif
772 ierr = PetscViewerASCIIPrintf(viewer,"%D %D %D\n", m, A->cmap->n, a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),772,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
773 for (i=0; i<m; i++) {
774 for (j=a->i[i]; j<a->i[i+1]; j++) {
775#if defined(PETSC_USE_COMPLEX)
776 ierr = PetscViewerASCIIPrintf(viewer,"%D %D %g %g\n", i+fshift,a->j[j]+fshift,(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),776,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
777#else
778 ierr = PetscViewerASCIIPrintf(viewer,"%D %D %g\n", i+fshift, a->j[j]+fshift, (double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),778,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
779#endif
780 }
781 }
782 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),782,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
783 } else {
784 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),784,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
785 if (A->factortype) {
786 for (i=0; i<m; i++) {
787 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),787,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
788 /* L part */
789 for (j=a->i[i]; j<a->i[i+1]; j++) {
790#if defined(PETSC_USE_COMPLEX)
791 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) {
792 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
793 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) {
794 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)(-PetscImaginaryPart(a->a[j])((PetscReal)0.)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),794,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
795 } else {
796 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),796,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
797 }
798#else
799 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),799,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
800#endif
801 }
802 /* diagonal */
803 j = a->diag[i];
804#if defined(PETSC_USE_COMPLEX)
805 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) {
806 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i)",a->j[j],(double)PetscRealPart(1.0/a->a[j])(1.0/a->a[j]),(double)PetscImaginaryPart(1.0/a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),806,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
807 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) {
808 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i)",a->j[j],(double)PetscRealPart(1.0/a->a[j])(1.0/a->a[j]),(double)(-PetscImaginaryPart(1.0/a->a[j])((PetscReal)0.)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),808,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
809 } else {
810 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)PetscRealPart(1.0/a->a[j])(1.0/a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),810,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
811 }
812#else
813 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)(1.0/a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),813,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
814#endif
815
816 /* U part */
817 for (j=a->diag[i+1]+1; j<a->diag[i]; j++) {
818#if defined(PETSC_USE_COMPLEX)
819 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) {
820 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),820,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
821 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) {
822 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)(-PetscImaginaryPart(a->a[j])((PetscReal)0.)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),822,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
823 } else {
824 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),824,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
825 }
826#else
827 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),827,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
828#endif
829 }
830 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),830,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
831 }
832 } else {
833 for (i=0; i<m; i++) {
834 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),834,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
835 for (j=a->i[i]; j<a->i[i+1]; j++) {
836#if defined(PETSC_USE_COMPLEX)
837 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) {
838 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),838,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
839 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) {
840 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)-PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),840,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
841 } else {
842 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),842,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
843 }
844#else
845 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),845,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
846#endif
847 }
848 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),848,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
849 }
850 }
851 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),851,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
852 }
853 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),853,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
854 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
855}
856
857#include <petscdraw.h>
858PetscErrorCode MatView_SeqAIJ_Draw_Zoom(PetscDraw draw,void *Aa)
859{
860 Mat A = (Mat) Aa;
861 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
862 PetscErrorCode ierr;
863 PetscInt i,j,m = A->rmap->n;
864 int color;
865 PetscReal xl,yl,xr,yr,x_l,x_r,y_l,y_r;
866 PetscViewer viewer;
867 PetscViewerFormat format;
868
869 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 869; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
870 ierr = PetscObjectQuery((PetscObject)A,"Zoomviewer",(PetscObject*)&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),870,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
871 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),871,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
872 ierr = PetscDrawGetCoordinates(draw,&xl,&yl,&xr,&yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),872,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
873
874 /* loop over matrix elements drawing boxes */
875
876 if (format != PETSC_VIEWER_DRAW_CONTOUR) {
877 ierr = PetscDrawCollectiveBegin(draw)0; do { PetscErrorCode _Petsc_ierr; jmp_buf _Petsc_jmpbuf; volatile
PetscXIOErrorHandler _Petsc_xioerrhdl = ((void*)0); PetscBool
_Petsc_isdrawx, _Petsc_xioerr, _Petsc_xioerr_local = PETSC_FALSE
; _Petsc_ierr = PetscObjectTypeCompare((PetscObject)(draw),"x"
,&_Petsc_isdrawx);do {if (__builtin_expect(!!(_Petsc_ierr
),0)) {PetscError(((MPI_Comm)0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_isdrawx
) { _Petsc_ierr = PetscMemcpy(&_Petsc_jmpbuf,&PetscXIOErrorHandlerJumpBuf
,sizeof(_Petsc_jmpbuf));do {if (__builtin_expect(!!(_Petsc_ierr
),0)) {PetscError(((MPI_Comm)0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_xioerrhdl =
PetscSetXIOErrorHandler(PetscXIOErrorHandlerJump); if (_setjmp
(PetscXIOErrorHandlerJumpBuf)) {_Petsc_xioerr_local = PETSC_TRUE
; do {_Petsc_ierr = 0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler
(_Petsc_xioerrhdl); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf
,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do {
if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct
+= PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw)
))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr
),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject
)(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr
) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect
(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),877,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack
&& petscstack->currentsize > 0) { petscstack->
currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0); } } } while(0);do {if (__builtin_expect(!!(_Petsc_ierr
),0)) {PetscError(((MPI_Comm)0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0);} } do {} while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
878 /* Blue for negative, Cyan for zero and Red for positive */
879 color = PETSC_DRAW_BLUE5;
880 for (i=0; i<m; i++) {
881 y_l = m - i - 1.0; y_r = y_l + 1.0;
882 for (j=a->i[i]; j<a->i[i+1]; j++) {
883 x_l = a->j[j]; x_r = x_l + 1.0;
884 if (PetscRealPart(a->a[j])(a->a[j]) >= 0.) continue;
885 ierr = PetscDrawRectangle(draw,x_l,y_l,x_r,y_r,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),885,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
886 }
887 }
888 color = PETSC_DRAW_CYAN4;
889 for (i=0; i<m; i++) {
890 y_l = m - i - 1.0; y_r = y_l + 1.0;
891 for (j=a->i[i]; j<a->i[i+1]; j++) {
892 x_l = a->j[j]; x_r = x_l + 1.0;
893 if (a->a[j] != 0.) continue;
894 ierr = PetscDrawRectangle(draw,x_l,y_l,x_r,y_r,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),894,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
895 }
896 }
897 color = PETSC_DRAW_RED2;
898 for (i=0; i<m; i++) {
899 y_l = m - i - 1.0; y_r = y_l + 1.0;
900 for (j=a->i[i]; j<a->i[i+1]; j++) {
901 x_l = a->j[j]; x_r = x_l + 1.0;
902 if (PetscRealPart(a->a[j])(a->a[j]) <= 0.) continue;
903 ierr = PetscDrawRectangle(draw,x_l,y_l,x_r,y_r,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),903,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
904 }
905 }
906 ierr = PetscDrawCollectiveEnd(draw)0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler(_Petsc_xioerrhdl
); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf
,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do {
if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct
+= PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw)
))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr
),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject
)(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr
) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect
(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),906,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack
&& petscstack->currentsize > 0) { petscstack->
currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0); } } } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
907 } else {
908 /* use contour shading to indicate magnitude of values */
909 /* first determine max of all nonzero values */
910 PetscReal minv = 0.0, maxv = 0.0;
911 PetscInt nz = a->nz, count = 0;
912 PetscDraw popup;
913
914 for (i=0; i<nz; i++) {
915 if (PetscAbsScalar(a->a[i]) > maxv) maxv = PetscAbsScalar(a->a[i]);
916 }
917 if (minv >= maxv) maxv = minv + PETSC_SMALL1.e-10;
918 ierr = PetscDrawGetPopup(draw,&popup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),918,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
919 ierr = PetscDrawScalePopup(popup,minv,maxv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),919,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
920
921 ierr = PetscDrawCollectiveBegin(draw)0; do { PetscErrorCode _Petsc_ierr; jmp_buf _Petsc_jmpbuf; volatile
PetscXIOErrorHandler _Petsc_xioerrhdl = ((void*)0); PetscBool
_Petsc_isdrawx, _Petsc_xioerr, _Petsc_xioerr_local = PETSC_FALSE
; _Petsc_ierr = PetscObjectTypeCompare((PetscObject)(draw),"x"
,&_Petsc_isdrawx);do {if (__builtin_expect(!!(_Petsc_ierr
),0)) {PetscError(((MPI_Comm)0x44000001),921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_isdrawx
) { _Petsc_ierr = PetscMemcpy(&_Petsc_jmpbuf,&PetscXIOErrorHandlerJumpBuf
,sizeof(_Petsc_jmpbuf));do {if (__builtin_expect(!!(_Petsc_ierr
),0)) {PetscError(((MPI_Comm)0x44000001),921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_xioerrhdl =
PetscSetXIOErrorHandler(PetscXIOErrorHandlerJump); if (_setjmp
(PetscXIOErrorHandlerJumpBuf)) {_Petsc_xioerr_local = PETSC_TRUE
; do {_Petsc_ierr = 0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler
(_Petsc_xioerrhdl); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf
,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do {
if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct
+= PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw)
))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr
),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject
)(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr
) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect
(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),921,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack
&& petscstack->currentsize > 0) { petscstack->
currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0); } } } while(0);do {if (__builtin_expect(!!(_Petsc_ierr
),0)) {PetscError(((MPI_Comm)0x44000001),921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0);} } do {} while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
922 for (i=0; i<m; i++) {
923 y_l = m - i - 1.0;
924 y_r = y_l + 1.0;
925 for (j=a->i[i]; j<a->i[i+1]; j++) {
926 x_l = a->j[j];
927 x_r = x_l + 1.0;
928 color = PetscDrawRealToColor(PetscAbsScalar(a->a[count]),minv,maxv);
929 ierr = PetscDrawRectangle(draw,x_l,y_l,x_r,y_r,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),929,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
930 count++;
931 }
932 }
933 ierr = PetscDrawCollectiveEnd(draw)0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler(_Petsc_xioerrhdl
); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf
,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do {
if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),933,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct
+= PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw)
))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr
),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject
)(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),933,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr
) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect
(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),933,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack
&& petscstack->currentsize > 0) { petscstack->
currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0); } } } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),933,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
934 }
935 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
936}
937
938#include <petscdraw.h>
939PetscErrorCode MatView_SeqAIJ_Draw(Mat A,PetscViewer viewer)
940{
941 PetscErrorCode ierr;
942 PetscDraw draw;
943 PetscReal xr,yr,xl,yl,h,w;
944 PetscBool isnull;
945
946 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 946; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
947 ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),947,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
948 ierr = PetscDrawIsNull(draw,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),948,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
949 if (isnull) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
950
951 xr = A->cmap->n; yr = A->rmap->n; h = yr/10.0; w = xr/10.0;
952 xr += w; yr += h; xl = -w; yl = -h;
953 ierr = PetscDrawSetCoordinates(draw,xl,yl,xr,yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),953,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
954 ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",(PetscObject)viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),954,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
955 ierr = PetscDrawZoom(draw,MatView_SeqAIJ_Draw_Zoom,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),955,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
956 ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),956,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
957 ierr = PetscDrawSave(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),957,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
958 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
959}
960
961PetscErrorCode MatView_SeqAIJ(Mat A,PetscViewer viewer)
962{
963 PetscErrorCode ierr;
964 PetscBool iascii,isbinary,isdraw;
965
966 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 966; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
967 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),967,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
968 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),968,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
969 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),969,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
970 if (iascii) {
971 ierr = MatView_SeqAIJ_ASCII(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),971,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
972 } else if (isbinary) {
973 ierr = MatView_SeqAIJ_Binary(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),973,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
974 } else if (isdraw) {
975 ierr = MatView_SeqAIJ_Draw(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),975,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
976 }
977 ierr = MatView_SeqAIJ_Inode(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),977,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
978 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
979}
980
981PetscErrorCode MatAssemblyEnd_SeqAIJ(Mat A,MatAssemblyType mode)
982{
983 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
984 PetscErrorCode ierr;
985 PetscInt fshift = 0,i,j,*ai = a->i,*aj = a->j,*imax = a->imax;
986 PetscInt m = A->rmap->n,*ip,N,*ailen = a->ilen,rmax = 0;
987 MatScalar *aa = a->a,*ap;
988 PetscReal ratio = 0.6;
989
990 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 990; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
991 if (mode == MAT_FLUSH_ASSEMBLY) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
992
993 if (m) rmax = ailen[0]; /* determine row with most nonzeros */
994 for (i=1; i<m; i++) {
995 /* move each row back by the amount of empty slots (fshift) before it*/
996 fshift += imax[i-1] - ailen[i-1];
997 rmax = PetscMax(rmax,ailen[i])(((rmax)<(ailen[i])) ? (ailen[i]) : (rmax));
998 if (fshift) {
999 ip = aj + ai[i];
1000 ap = aa + ai[i];
1001 N = ailen[i];
1002 for (j=0; j<N; j++) {
1003 ip[j-fshift] = ip[j];
1004 if (!A->structure_only) ap[j-fshift] = ap[j];
1005 }
1006 }
1007 ai[i] = ai[i-1] + ailen[i-1];
1008 }
1009 if (m) {
1010 fshift += imax[m-1] - ailen[m-1];
1011 ai[m] = ai[m-1] + ailen[m-1];
1012 }
1013
1014 /* reset ilen and imax for each row */
1015 a->nonzerorowcnt = 0;
1016 if (A->structure_only) {
1017 ierr = PetscFree2(a->imax,a->ilen)PetscFreeA(2,1017,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(a->imax),&(a->ilen))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1017,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1018 } else { /* !A->structure_only */
1019 for (i=0; i<m; i++) {
1020 ailen[i] = imax[i] = ai[i+1] - ai[i];
1021 a->nonzerorowcnt += ((ai[i+1] - ai[i]) > 0);
1022 }
1023 }
1024 a->nz = ai[m];
1025 if (fshift && a->nounused == -1) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_PLIB, "Unused space detected in matrix: %D X %D, %D unneeded", m, A->cmap->n, fshift)do {if (__builtin_expect(!!(77),0)) {PetscError(((MPI_Comm)0x44000001
),1025,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
77);}} while (0)
;
1026
1027 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1027,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1028 ierr = PetscInfo4(A,"Matrix size: %D X %D; storage space: %D unneeded,%D used\n",m,A->cmap->n,fshift,a->nz)PetscInfo_Private(__func__,A,"Matrix size: %D X %D; storage space: %D unneeded,%D used\n"
,m,A->cmap->n,fshift,a->nz)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1028,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1029 ierr = PetscInfo1(A,"Number of mallocs during MatSetValues() is %D\n",a->reallocs)PetscInfo_Private(__func__,A,"Number of mallocs during MatSetValues() is %D\n"
,a->reallocs)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1029,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1030 ierr = PetscInfo1(A,"Maximum nonzeros in any row is %D\n",rmax)PetscInfo_Private(__func__,A,"Maximum nonzeros in any row is %D\n"
,rmax)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1030,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1031
1032 A->info.mallocs += a->reallocs;
1033 a->reallocs = 0;
1034 A->info.nz_unneeded = (PetscReal)fshift;
1035 a->rmax = rmax;
1036
1037 if (!A->structure_only) {
1038 ierr = MatCheckCompressedRow(A,a->nonzerorowcnt,&a->compressedrow,a->i,m,ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1038,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1039 }
1040 ierr = MatAssemblyEnd_SeqAIJ_Inode(A,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1040,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1041 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1041,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1042 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1043}
1044
1045PetscErrorCode MatRealPart_SeqAIJ(Mat A)
1046{
1047 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1048 PetscInt i,nz = a->nz;
1049 MatScalar *aa = a->a;
1050 PetscErrorCode ierr;
1051
1052 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1052; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1053 for (i=0; i<nz; i++) aa[i] = PetscRealPart(aa[i])(aa[i]);
1054 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1054,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1055 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1056}
1057
1058PetscErrorCode MatImaginaryPart_SeqAIJ(Mat A)
1059{
1060 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1061 PetscInt i,nz = a->nz;
1062 MatScalar *aa = a->a;
1063 PetscErrorCode ierr;
1064
1065 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1065; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1066 for (i=0; i<nz; i++) aa[i] = PetscImaginaryPart(aa[i])((PetscReal)0.);
1067 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1067,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1068 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1069}
1070
1071PetscErrorCode MatZeroEntries_SeqAIJ(Mat A)
1072{
1073 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1074 PetscErrorCode ierr;
1075
1076 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1076; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1077 ierr = PetscMemzero(a->a,(a->i[A->rmap->n])*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1077,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1078 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1078,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1079 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1080}
1081
1082PetscErrorCode MatDestroy_SeqAIJ(Mat A)
1083{
1084 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1085 PetscErrorCode ierr;
1086
1087 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1087; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1088#if defined(PETSC_USE_LOG1)
1089 PetscLogObjectState((PetscObject)A,"Rows=%D, Cols=%D, NZ=%D",A->rmap->n,A->cmap->n,a->nz);
1090#endif
1091 ierr = MatSeqXAIJFreeAIJ(A,&a->a,&a->j,&a->i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1091,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1092 ierr = ISDestroy(&a->row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1092,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1093 ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1093,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1094 ierr = PetscFree(a->diag)((*PetscTrFree)((void*)(a->diag),1094,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->diag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1094,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1095 ierr = PetscFree(a->ibdiag)((*PetscTrFree)((void*)(a->ibdiag),1095,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->ibdiag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1095,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1096 ierr = PetscFree2(a->imax,a->ilen)PetscFreeA(2,1096,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(a->imax),&(a->ilen))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1096,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1097 ierr = PetscFree(a->ipre)((*PetscTrFree)((void*)(a->ipre),1097,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->ipre) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1097,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1098 ierr = PetscFree3(a->idiag,a->mdiag,a->ssor_work)PetscFreeA(3,1098,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(a->idiag),&(a->mdiag),&(a->ssor_work)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1098,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1099 ierr = PetscFree(a->solve_work)((*PetscTrFree)((void*)(a->solve_work),1099,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->solve_work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1099,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1100 ierr = ISDestroy(&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1100,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1101 ierr = PetscFree(a->saved_values)((*PetscTrFree)((void*)(a->saved_values),1101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->saved_values) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1102 ierr = ISColoringDestroy(&a->coloring);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1102,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1103 ierr = PetscFree2(a->compressedrow.i,a->compressedrow.rindex)PetscFreeA(2,1103,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(a->compressedrow.i),&(a->compressedrow.rindex
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1103,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1104 ierr = PetscFree(a->matmult_abdense)((*PetscTrFree)((void*)(a->matmult_abdense),1104,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c") ||
((a->matmult_abdense) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1104,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1105
1106 ierr = MatDestroy_SeqAIJ_Inode(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1106,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1107 ierr = PetscFree(A->data)((*PetscTrFree)((void*)(A->data),1107,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((A->data) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1107,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1108
1109 ierr = PetscObjectChangeTypeName((PetscObject)A,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1109,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1110 ierr = PetscObjectComposeFunction((PetscObject)A,"MatSeqAIJSetColumnIndices_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatSeqAIJSetColumnIndices_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1110,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1111 ierr = PetscObjectComposeFunction((PetscObject)A,"MatStoreValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatStoreValues_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1111,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1112 ierr = PetscObjectComposeFunction((PetscObject)A,"MatRetrieveValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatRetrieveValues_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1112,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1113 ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_seqsbaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_seqsbaij_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1113,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1114 ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_seqbaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_seqbaij_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1114,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1115 ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_seqaijperm_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_seqaijperm_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1115,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1116#if defined(PETSC_HAVE_ELEMENTAL)
1117 ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_elemental_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_elemental_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1117,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1118#endif
1119#if defined(PETSC_HAVE_HYPRE)
1120 ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_hypre_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_hypre_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1120,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1121 ierr = PetscObjectComposeFunction((PetscObject)A,"MatMatMatMult_transpose_seqaij_seqaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatMatMatMult_transpose_seqaij_seqaij_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1121,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1122#endif
1123 ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_seqdense_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_seqdense_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1123,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1124 ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_seqsell_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_seqsell_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1124,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1125 ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_is_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_is_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1125,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1126 ierr = PetscObjectComposeFunction((PetscObject)A,"MatIsTranspose_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatIsTranspose_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1127 ierr = PetscObjectComposeFunction((PetscObject)A,"MatSeqAIJSetPreallocation_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatSeqAIJSetPreallocation_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1128 ierr = PetscObjectComposeFunction((PetscObject)A,"MatResetPreallocation_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatResetPreallocation_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1128,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1129 ierr = PetscObjectComposeFunction((PetscObject)A,"MatSeqAIJSetPreallocationCSR_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatSeqAIJSetPreallocationCSR_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1129,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1130 ierr = PetscObjectComposeFunction((PetscObject)A,"MatReorderForNonzeroDiagonal_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatReorderForNonzeroDiagonal_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1130,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1131 ierr = PetscObjectComposeFunction((PetscObject)A,"MatPtAP_is_seqaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatPtAP_is_seqaij_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1131,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1132 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1133}
1134
1135PetscErrorCode MatSetOption_SeqAIJ(Mat A,MatOption op,PetscBool flg)
1136{
1137 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1138 PetscErrorCode ierr;
1139
1140 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1140; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1141 switch (op) {
1142 case MAT_ROW_ORIENTED:
1143 a->roworiented = flg;
1144 break;
1145 case MAT_KEEP_NONZERO_PATTERN:
1146 a->keepnonzeropattern = flg;
1147 break;
1148 case MAT_NEW_NONZERO_LOCATIONS:
1149 a->nonew = (flg ? 0 : 1);
1150 break;
1151 case MAT_NEW_NONZERO_LOCATION_ERR:
1152 a->nonew = (flg ? -1 : 0);
1153 break;
1154 case MAT_NEW_NONZERO_ALLOCATION_ERR:
1155 a->nonew = (flg ? -2 : 0);
1156 break;
1157 case MAT_UNUSED_NONZERO_LOCATION_ERR:
1158 a->nounused = (flg ? -1 : 0);
1159 break;
1160 case MAT_IGNORE_ZERO_ENTRIES:
1161 a->ignorezeroentries = flg;
1162 break;
1163 case MAT_SPD:
1164 case MAT_SYMMETRIC:
1165 case MAT_STRUCTURALLY_SYMMETRIC:
1166 case MAT_HERMITIAN:
1167 case MAT_SYMMETRY_ETERNAL:
1168 case MAT_STRUCTURE_ONLY:
1169 /* These options are handled directly by MatSetOption() */
1170 break;
1171 case MAT_NEW_DIAGONALS:
1172 case MAT_IGNORE_OFF_PROC_ENTRIES:
1173 case MAT_USE_HASH_TABLE:
1174 ierr = PetscInfo1(A,"Option %s ignored\n",MatOptions[op])PetscInfo_Private(__func__,A,"Option %s ignored\n",MatOptions
[op])
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1174,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1175 break;
1176 case MAT_USE_INODES:
1177 /* Not an error because MatSetOption_SeqAIJ_Inode handles this one */
1178 break;
1179 case MAT_SUBMAT_SINGLEIS:
1180 A->submat_singleis = flg;
1181 break;
1182 default:
1183 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unknown option %d",op)return PetscError(((MPI_Comm)0x44000001),1183,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"unknown option %d",op)
;
1184 }
1185 ierr = MatSetOption_SeqAIJ_Inode(A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1185,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1186 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1187}
1188
1189PetscErrorCode MatGetDiagonal_SeqAIJ(Mat A,Vec v)
1190{
1191 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1192 PetscErrorCode ierr;
1193 PetscInt i,j,n,*ai=a->i,*aj=a->j,nz;
1194 PetscScalar *aa=a->a,*x,zero=0.0;
1195
1196 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1196; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1197 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1197,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1198 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),1198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
1199
1200 if (A->factortype == MAT_FACTOR_ILU || A->factortype == MAT_FACTOR_LU) {
1201 PetscInt *diag=a->diag;
1202 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1203 for (i=0; i<n; i++) x[i] = 1.0/aa[diag[i]];
1204 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1205 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1206 }
1207
1208 ierr = VecSet(v,zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1209 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1210 for (i=0; i<n; i++) {
1211 nz = ai[i+1] - ai[i];
1212 if (!nz) x[i] = 0.0;
1213 for (j=ai[i]; j<ai[i+1]; j++) {
1214 if (aj[j] == i) {
1215 x[i] = aa[j];
1216 break;
1217 }
1218 }
1219 }
1220 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1220,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1221 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1222}
1223
1224#include <../src/mat/impls/aij/seq/ftn-kernels/fmult.h>
1225PetscErrorCode MatMultTransposeAdd_SeqAIJ(Mat A,Vec xx,Vec zz,Vec yy)
1226{
1227 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1228 PetscScalar *y;
1229 const PetscScalar *x;
1230 PetscErrorCode ierr;
1231 PetscInt m = A->rmap->n;
1232#if !defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ)
1233 const MatScalar *v;
1234 PetscScalar alpha;
1235 PetscInt n,i,j;
1236 const PetscInt *idx,*ii,*ridx=NULL((void*)0);
1237 Mat_CompressedRow cprow = a->compressedrow;
1238 PetscBool usecprow = cprow.use;
1239#endif
1240
1241 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1241; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1242 if (zz != yy) {ierr = VecCopy(zz,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1243 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1243,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1244 ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1244,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1245
1246#if defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ)
1247 fortranmulttransposeaddaij_(&m,x,a->i,a->j,a->a,y);
1248#else
1249 if (usecprow) {
1250 m = cprow.nrows;
1251 ii = cprow.i;
1252 ridx = cprow.rindex;
1253 } else {
1254 ii = a->i;
1255 }
1256 for (i=0; i<m; i++) {
1257 idx = a->j + ii[i];
1258 v = a->a + ii[i];
1259 n = ii[i+1] - ii[i];
1260 if (usecprow) {
1261 alpha = x[ridx[i]];
1262 } else {
1263 alpha = x[i];
1264 }
1265 for (j=0; j<n; j++) y[idx[j]] += alpha*v[j];
1266 }
1267#endif
1268 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1268,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1269 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1269,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1270 ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1270,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1271 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1272}
1273
1274PetscErrorCode MatMultTranspose_SeqAIJ(Mat A,Vec xx,Vec yy)
1275{
1276 PetscErrorCode ierr;
1277
1278 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1278; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1279 ierr = VecSet(yy,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1279,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1280 ierr = MatMultTransposeAdd_SeqAIJ(A,xx,yy,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1280,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1281 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1282}
1283
1284#include <../src/mat/impls/aij/seq/ftn-kernels/fmult.h>
1285
1286PetscErrorCode MatMult_SeqAIJ(Mat A,Vec xx,Vec yy)
1287{
1288 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1289 PetscScalar *y;
1290 const PetscScalar *x;
1291 const MatScalar *aa;
1292 PetscErrorCode ierr;
1293 PetscInt m=A->rmap->n;
1294 const PetscInt *aj,*ii,*ridx=NULL((void*)0);
1295 PetscInt n,i;
1296 PetscScalar sum;
1297 PetscBool usecprow=a->compressedrow.use;
1298
1299#if defined(PETSC_HAVE_PRAGMA_DISJOINT)
1300#pragma disjoint(*x,*y,*aa)
1301#endif
1302
1303 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1303; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1304 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1305 ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1305,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1306 ii = a->i;
1307 if (usecprow) { /* use compressed row format */
1308 ierr = PetscMemzero(y,m*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1308,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1309 m = a->compressedrow.nrows;
1310 ii = a->compressedrow.i;
1311 ridx = a->compressedrow.rindex;
1312 for (i=0; i<m; i++) {
1313 n = ii[i+1] - ii[i];
1314 aj = a->j + ii[i];
1315 aa = a->a + ii[i];
1316 sum = 0.0;
1317 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1318 /* for (j=0; j<n; j++) sum += (*aa++)*x[*aj++]; */
1319 y[*ridx++] = sum;
1320 }
1321 } else { /* do not use compressed row format */
1322#if defined(PETSC_USE_FORTRAN_KERNEL_MULTAIJ)
1323 aj = a->j;
1324 aa = a->a;
1325 fortranmultaij_(&m,x,ii,aj,aa,y);
1326#else
1327 for (i=0; i<m; i++) {
1328 n = ii[i+1] - ii[i];
1329 aj = a->j + ii[i];
1330 aa = a->a + ii[i];
1331 sum = 0.0;
1332 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1333 y[i] = sum;
1334 }
1335#endif
1336 }
1337 ierr = PetscLogFlops(2.0*a->nz - a->nonzerorowcnt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1337,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1338 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1338,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1339 ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1339,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1340 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1341}
1342
1343PetscErrorCode MatMultMax_SeqAIJ(Mat A,Vec xx,Vec yy)
1344{
1345 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1346 PetscScalar *y;
1347 const PetscScalar *x;
1348 const MatScalar *aa;
1349 PetscErrorCode ierr;
1350 PetscInt m=A->rmap->n;
1351 const PetscInt *aj,*ii,*ridx=NULL((void*)0);
1352 PetscInt n,i,nonzerorow=0;
1353 PetscScalar sum;
1354 PetscBool usecprow=a->compressedrow.use;
1355
1356#if defined(PETSC_HAVE_PRAGMA_DISJOINT)
1357#pragma disjoint(*x,*y,*aa)
1358#endif
1359
1360 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1360; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1361 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1362 ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1362,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1363 if (usecprow) { /* use compressed row format */
1364 m = a->compressedrow.nrows;
1365 ii = a->compressedrow.i;
1366 ridx = a->compressedrow.rindex;
1367 for (i=0; i<m; i++) {
1368 n = ii[i+1] - ii[i];
1369 aj = a->j + ii[i];
1370 aa = a->a + ii[i];
1371 sum = 0.0;
1372 nonzerorow += (n>0);
1373 PetscSparseDenseMaxDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum = ((((sum))<
((aa[__i] * x[aj[__i]]))) ? ((aa[__i] * x[aj[__i]])) : ((sum)
));}
;
1374 /* for (j=0; j<n; j++) sum += (*aa++)*x[*aj++]; */
1375 y[*ridx++] = sum;
1376 }
1377 } else { /* do not use compressed row format */
1378 ii = a->i;
1379 for (i=0; i<m; i++) {
1380 n = ii[i+1] - ii[i];
1381 aj = a->j + ii[i];
1382 aa = a->a + ii[i];
1383 sum = 0.0;
1384 nonzerorow += (n>0);
1385 PetscSparseDenseMaxDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum = ((((sum))<
((aa[__i] * x[aj[__i]]))) ? ((aa[__i] * x[aj[__i]])) : ((sum)
));}
;
1386 y[i] = sum;
1387 }
1388 }
1389 ierr = PetscLogFlops(2.0*a->nz - nonzerorow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1390 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1390,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1391 ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1391,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1392 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1393}
1394
1395PetscErrorCode MatMultAddMax_SeqAIJ(Mat A,Vec xx,Vec yy,Vec zz)
1396{
1397 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1398 PetscScalar *y,*z;
1399 const PetscScalar *x;
1400 const MatScalar *aa;
1401 PetscErrorCode ierr;
1402 PetscInt m = A->rmap->n,*aj,*ii;
1403 PetscInt n,i,*ridx=NULL((void*)0);
1404 PetscScalar sum;
1405 PetscBool usecprow=a->compressedrow.use;
1406
1407 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1407; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1408 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1408,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1409 ierr = VecGetArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1409,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1410 if (usecprow) { /* use compressed row format */
1411 if (zz != yy) {
1412 ierr = PetscMemcpy(z,y,m*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1412,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1413 }
1414 m = a->compressedrow.nrows;
1415 ii = a->compressedrow.i;
1416 ridx = a->compressedrow.rindex;
1417 for (i=0; i<m; i++) {
1418 n = ii[i+1] - ii[i];
1419 aj = a->j + ii[i];
1420 aa = a->a + ii[i];
1421 sum = y[*ridx];
1422 PetscSparseDenseMaxDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum = ((((sum))<
((aa[__i] * x[aj[__i]]))) ? ((aa[__i] * x[aj[__i]])) : ((sum)
));}
;
1423 z[*ridx++] = sum;
1424 }
1425 } else { /* do not use compressed row format */
1426 ii = a->i;
1427 for (i=0; i<m; i++) {
1428 n = ii[i+1] - ii[i];
1429 aj = a->j + ii[i];
1430 aa = a->a + ii[i];
1431 sum = y[i];
1432 PetscSparseDenseMaxDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum = ((((sum))<
((aa[__i] * x[aj[__i]]))) ? ((aa[__i] * x[aj[__i]])) : ((sum)
));}
;
1433 z[i] = sum;
1434 }
1435 }
1436 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1436,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1437 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1437,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1438 ierr = VecRestoreArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1438,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1439 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1440}
1441
1442#include <../src/mat/impls/aij/seq/ftn-kernels/fmultadd.h>
1443PetscErrorCode MatMultAdd_SeqAIJ(Mat A,Vec xx,Vec yy,Vec zz)
1444{
1445 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1446 PetscScalar *y,*z;
1447 const PetscScalar *x;
1448 const MatScalar *aa;
1449 PetscErrorCode ierr;
1450 const PetscInt *aj,*ii,*ridx=NULL((void*)0);
1451 PetscInt m = A->rmap->n,n,i;
1452 PetscScalar sum;
1453 PetscBool usecprow=a->compressedrow.use;
1454
1455 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1455; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1456 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1456,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1457 ierr = VecGetArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1457,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1458 if (usecprow) { /* use compressed row format */
1459 if (zz != yy) {
1460 ierr = PetscMemcpy(z,y,m*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1460,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1461 }
1462 m = a->compressedrow.nrows;
1463 ii = a->compressedrow.i;
1464 ridx = a->compressedrow.rindex;
1465 for (i=0; i<m; i++) {
1466 n = ii[i+1] - ii[i];
1467 aj = a->j + ii[i];
1468 aa = a->a + ii[i];
1469 sum = y[*ridx];
1470 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1471 z[*ridx++] = sum;
1472 }
1473 } else { /* do not use compressed row format */
1474 ii = a->i;
1475#if defined(PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ)
1476 aj = a->j;
1477 aa = a->a;
1478 fortranmultaddaij_(&m,x,ii,aj,aa,y,z);
1479#else
1480 for (i=0; i<m; i++) {
1481 n = ii[i+1] - ii[i];
1482 aj = a->j + ii[i];
1483 aa = a->a + ii[i];
1484 sum = y[i];
1485 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1486 z[i] = sum;
1487 }
1488#endif
1489 }
1490 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1490,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1491 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1492 ierr = VecRestoreArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1492,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1493 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1494}
1495
1496/*
1497 Adds diagonal pointers to sparse matrix structure.
1498*/
1499PetscErrorCode MatMarkDiagonal_SeqAIJ(Mat A)
1500{
1501 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1502 PetscErrorCode ierr;
1503 PetscInt i,j,m = A->rmap->n;
1504
1505 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1505; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1506 if (!a->diag) {
1507 ierr = PetscMalloc1(m,&a->diag)PetscMallocA(1,PETSC_FALSE,1507,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&a->diag)),(&a->diag))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1507,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1508 ierr = PetscLogObjectMemory((PetscObject)A, m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1508,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1509 }
1510 for (i=0; i<A->rmap->n; i++) {
1511 a->diag[i] = a->i[i+1];
1512 for (j=a->i[i]; j<a->i[i+1]; j++) {
1513 if (a->j[j] == i) {
1514 a->diag[i] = j;
1515 break;
1516 }
1517 }
1518 }
1519 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1520}
1521
1522PetscErrorCode MatShift_SeqAIJ(Mat A,PetscScalar v)
1523{
1524 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1525 const PetscInt *diag = (const PetscInt*)a->diag;
1526 const PetscInt *ii = (const PetscInt*) a->i;
1527 PetscInt i,*mdiag = NULL((void*)0);
1528 PetscErrorCode ierr;
1529 PetscInt cnt = 0; /* how many diagonals are missing */
1530
1531 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1531; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1532 if (!A->preallocated || !a->nz) {
1533 ierr = MatSeqAIJSetPreallocation(A,1,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1533,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1534 ierr = MatShift_Basic(A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1534,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1535 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1536 }
1537
1538 if (a->diagonaldense) {
1539 cnt = 0;
1540 } else {
1541 ierr = PetscCalloc1(A->rmap->n,&mdiag)PetscMallocA(1,PETSC_TRUE,1541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->rmap->n)*sizeof(**(&mdiag)),(&mdiag
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1542 for (i=0; i<A->rmap->n; i++) {
1543 if (diag[i] >= ii[i+1]) {
1544 cnt++;
1545 mdiag[i] = 1;
1546 }
1547 }
1548 }
1549 if (!cnt) {
1550 ierr = MatShift_Basic(A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1551 } else {
1552 PetscScalar *olda = a->a; /* preserve pointers to current matrix nonzeros structure and values */
1553 PetscInt *oldj = a->j, *oldi = a->i;
1554 PetscBool singlemalloc = a->singlemalloc,free_a = a->free_a,free_ij = a->free_ij;
1555
1556 a->a = NULL((void*)0);
1557 a->j = NULL((void*)0);
1558 a->i = NULL((void*)0);
1559 /* increase the values in imax for each row where a diagonal is being inserted then reallocate the matrix data structures */
1560 for (i=0; i<A->rmap->n; i++) {
1561 a->imax[i] += mdiag[i];
1562 a->imax[i] = PetscMin(a->imax[i],A->cmap->n)(((a->imax[i])<(A->cmap->n)) ? (a->imax[i]) : (
A->cmap->n))
;
1563 }
1564 ierr = MatSeqAIJSetPreallocation_SeqAIJ(A,0,a->imax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1564,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1565
1566 /* copy old values into new matrix data structure */
1567 for (i=0; i<A->rmap->n; i++) {
1568 ierr = MatSetValues(A,1,&i,a->imax[i] - mdiag[i],&oldj[oldi[i]],&olda[oldi[i]],ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1569 if (i < A->cmap->n) {
1570 ierr = MatSetValue(A,i,i,v,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1570,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1571 }
1572 }
1573 ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1573,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1574 ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1574,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1575 if (singlemalloc) {
1576 ierr = PetscFree3(olda,oldj,oldi)PetscFreeA(3,1576,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(olda),&(oldj),&(oldi))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1576,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1577 } else {
1578 if (free_a) {ierr = PetscFree(olda)((*PetscTrFree)((void*)(olda),1578,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((olda) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1578,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1579 if (free_ij) {ierr = PetscFree(oldj)((*PetscTrFree)((void*)(oldj),1579,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((oldj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1579,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1580 if (free_ij) {ierr = PetscFree(oldi)((*PetscTrFree)((void*)(oldi),1580,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((oldi) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1580,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1581 }
1582 }
1583 ierr = PetscFree(mdiag)((*PetscTrFree)((void*)(mdiag),1583,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((mdiag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1583,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1584 a->diagonaldense = PETSC_TRUE;
1585 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1586}
1587
1588/*
1589 Checks for missing diagonals
1590*/
1591PetscErrorCode MatMissingDiagonal_SeqAIJ(Mat A,PetscBool *missing,PetscInt *d)
1592{
1593 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1594 PetscInt *diag,*ii = a->i,i;
1595 PetscErrorCode ierr;
1596
1597 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1597; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1598 *missing = PETSC_FALSE;
1599 if (A->rmap->n > 0 && !ii) {
1600 *missing = PETSC_TRUE;
1601 if (d) *d = 0;
1602 ierr = PetscInfo(A,"Matrix has no entries therefore is missing diagonal\n")PetscInfo_Private(__func__,A,"Matrix has no entries therefore is missing diagonal\n"
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1602,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1603 } else {
1604 PetscInt n;
1605 n = PetscMin(A->rmap->n, A->cmap->n)(((A->rmap->n)<(A->cmap->n)) ? (A->rmap->
n) : (A->cmap->n))
;
1606 diag = a->diag;
1607 for (i=0; i<n; i++) {
1608 if (diag[i] >= ii[i+1]) {
1609 *missing = PETSC_TRUE;
1610 if (d) *d = i;
1611 ierr = PetscInfo1(A,"Matrix is missing diagonal number %D\n",i)PetscInfo_Private(__func__,A,"Matrix is missing diagonal number %D\n"
,i)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1611,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1612 break;
1613 }
1614 }
1615 }
1616 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1617}
1618
1619#include <petscblaslapack.h>
1620#include <petsc/private/kernels/blockinvert.h>
1621
1622/*
1623 Note that values is allocated externally by the PC and then passed into this routine
1624*/
1625PetscErrorCode MatInvertVariableBlockDiagonal_SeqAIJ(Mat A,PetscInt nblocks,const PetscInt *bsizes,PetscScalar *diag)
1626{
1627 PetscErrorCode ierr;
1628 PetscInt n = A->rmap->n, i, ncnt = 0, *indx,j,bsizemax = 0,*v_pivots;
1
'v_pivots' declared without an initial value
1629 PetscBool allowzeropivot,zeropivotdetected=PETSC_FALSE;
1630 const PetscReal shift = 0.0;
1631 PetscInt ipvt[5];
1632 PetscScalar work[25],*v_work;
1633
1634 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1634; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1635 allowzeropivot = PetscNot(A->erroriffailure)((A->erroriffailure) ? PETSC_FALSE : PETSC_TRUE);
1636 for (i=0; i<nblocks; i++) ncnt += bsizes[i];
2
Assuming 'i' is < 'nblocks'
3
Loop condition is true. Entering loop body
4
Assuming 'i' is >= 'nblocks'
5
Loop condition is false. Execution continues on line 1637
1637 if (ncnt != n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Total blocksizes %D doesn't match number matrix rows %D",ncnt,n)do {if (__builtin_expect(!!(60),0)) {PetscError(((MPI_Comm)0x44000001
),1637,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
60);}} while (0)
;
6
Taking false branch
1638 for (i=0; i<nblocks; i++) {
7
Loop condition is true. Entering loop body
8
Loop condition is false. Execution continues on line 1641
1639 bsizemax = PetscMax(bsizemax,bsizes[i])(((bsizemax)<(bsizes[i])) ? (bsizes[i]) : (bsizemax));
1640 }
1641 ierr = PetscMalloc1(bsizemax,&indx)PetscMallocA(1,PETSC_FALSE,1641,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(bsizemax)*sizeof(**(&indx)),(&indx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1641,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1642 if (bsizemax > 7) {
9
Taking false branch
1643 ierr = PetscMalloc2(bsizemax,&v_work,bsizemax,&v_pivots)PetscMallocA(2,PETSC_FALSE,1643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(bsizemax)*sizeof(**(&v_work)),(&v_work),(size_t
)(bsizemax)*sizeof(**(&v_pivots)),(&v_pivots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1644 }
1645 ncnt = 0;
1646 for (i=0; i<nblocks; i++) {
10
Loop condition is true. Entering loop body
1647 for (j=0; j<bsizes[i]; j++) indx[j] = ncnt+j;
11
Loop condition is false. Execution continues on line 1648
1648 ierr = MatGetValues(A,bsizes[i],indx,bsizes[i],indx,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1649 switch (bsizes[i]) {
12
Control jumps to the 'default' case at line 1683
1650 case 1:
1651 *diag = 1.0/(*diag);
1652 break;
1653 case 2:
1654 ierr = PetscKernel_A_gets_inverse_A_2(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1654,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1655 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1656 ierr = PetscKernel_A_gets_transpose_A_2(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1656,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1657 break;
1658 case 3:
1659 ierr = PetscKernel_A_gets_inverse_A_3(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1659,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1660 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1661 ierr = PetscKernel_A_gets_transpose_A_3(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1661,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1662 break;
1663 case 4:
1664 ierr = PetscKernel_A_gets_inverse_A_4(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1664,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1665 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1666 ierr = PetscKernel_A_gets_transpose_A_4(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1666,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1667 break;
1668 case 5:
1669 ierr = PetscKernel_A_gets_inverse_A_5(diag,ipvt,work,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1670 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1671 ierr = PetscKernel_A_gets_transpose_A_5(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1671,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1672 break;
1673 case 6:
1674 ierr = PetscKernel_A_gets_inverse_A_6(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1674,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1675 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1676 ierr = PetscKernel_A_gets_transpose_A_6(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1676,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1677 break;
1678 case 7:
1679 ierr = PetscKernel_A_gets_inverse_A_7(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1679,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1680 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1681 ierr = PetscKernel_A_gets_transpose_A_7(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1681,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1682 break;
1683 default:
1684 ierr = PetscKernel_A_gets_inverse_A(bsizes[i],diag,v_pivots,v_work,allowzeropivot,&zeropivotdetected)(PetscLINPACKgefa((diag),(bsizes[i]),(v_pivots),(allowzeropivot
),(&zeropivotdetected)) || PetscLINPACKgedi((diag),(bsizes
[i]),(v_pivots),(v_work)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1684,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
13
Within the expansion of the macro 'PetscKernel_A_gets_inverse_A':
a
3rd function call argument is an uninitialized value
1685 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1686 ierr = PetscKernel_A_gets_transpose_A_N(diag,bsizes[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1686,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1687 }
1688 ncnt += bsizes[i];
1689 diag += bsizes[i]*bsizes[i];
1690 }
1691 if (bsizemax > 7) {
1692 ierr = PetscFree2(v_work,v_pivots)PetscFreeA(2,1692,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(v_work),&(v_pivots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1692,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1693 }
1694 ierr = PetscFree(indx)((*PetscTrFree)((void*)(indx),1694,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((indx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1694,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1695 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1696}
1697
1698/*
1699 Negative shift indicates do not generate an error if there is a zero diagonal, just invert it anyways
1700*/
1701PetscErrorCode MatInvertDiagonal_SeqAIJ(Mat A,PetscScalar omega,PetscScalar fshift)
1702{
1703 Mat_SeqAIJ *a = (Mat_SeqAIJ*) A->data;
1704 PetscErrorCode ierr;
1705 PetscInt i,*diag,m = A->rmap->n;
1706 MatScalar *v = a->a;
1707 PetscScalar *idiag,*mdiag;
1708
1709 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1709; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1710 if (a->idiagvalid) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1711 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1711,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1712 diag = a->diag;
1713 if (!a->idiag) {
1714 ierr = PetscMalloc3(m,&a->idiag,m,&a->mdiag,m,&a->ssor_work)PetscMallocA(3,PETSC_FALSE,1714,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&a->idiag)),(&a->idiag),
(size_t)(m)*sizeof(**(&a->mdiag)),(&a->mdiag),(
size_t)(m)*sizeof(**(&a->ssor_work)),(&a->ssor_work
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1714,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1715 ierr = PetscLogObjectMemory((PetscObject)A, 3*m*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1715,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1716 v = a->a;
1717 }
1718 mdiag = a->mdiag;
1719 idiag = a->idiag;
1720
1721 if (omega == 1.0 && PetscRealPart(fshift)(fshift) <= 0.0) {
1722 for (i=0; i<m; i++) {
1723 mdiag[i] = v[diag[i]];
1724 if (!PetscAbsScalar(mdiag[i])) { /* zero diagonal */
1725 if (PetscRealPart(fshift)(fshift)) {
1726 ierr = PetscInfo1(A,"Zero diagonal on row %D\n",i)PetscInfo_Private(__func__,A,"Zero diagonal on row %D\n",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1726,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1727 A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1728 A->factorerror_zeropivot_value = 0.0;
1729 A->factorerror_zeropivot_row = i;
1730 } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Zero diagonal on row %D",i)return PetscError(((MPI_Comm)0x44000001),1730,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,75,PETSC_ERROR_INITIAL,"Zero diagonal on row %D",i)
;
1731 }
1732 idiag[i] = 1.0/v[diag[i]];
1733 }
1734 ierr = PetscLogFlops(m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1734,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1735 } else {
1736 for (i=0; i<m; i++) {
1737 mdiag[i] = v[diag[i]];
1738 idiag[i] = omega/(fshift + v[diag[i]]);
1739 }
1740 ierr = PetscLogFlops(2.0*m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1740,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1741 }
1742 a->idiagvalid = PETSC_TRUE;
1743 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1744}
1745
1746#include <../src/mat/impls/aij/seq/ftn-kernels/frelax.h>
1747PetscErrorCode MatSOR_SeqAIJ(Mat A,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx)
1748{
1749 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1750 PetscScalar *x,d,sum,*t,scale;
1751 const MatScalar *v,*idiag=0,*mdiag;
1752 const PetscScalar *b, *bs,*xb, *ts;
1753 PetscErrorCode ierr;
1754 PetscInt n,m = A->rmap->n,i;
1755 const PetscInt *idx,*diag;
1756
1757 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1757; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1758 its = its*lits;
1759
1760 if (fshift != a->fshift || omega != a->omega) a->idiagvalid = PETSC_FALSE; /* must recompute idiag[] */
1761 if (!a->idiagvalid) {ierr = MatInvertDiagonal_SeqAIJ(A,omega,fshift);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1761,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1762 a->fshift = fshift;
1763 a->omega = omega;
1764
1765 diag = a->diag;
1766 t = a->ssor_work;
1767 idiag = a->idiag;
1768 mdiag = a->mdiag;
1769
1770 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1770,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1771 ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1771,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1772 /* We count flops by assuming the upper triangular and lower triangular parts have the same number of nonzeros */
1773 if (flag == SOR_APPLY_UPPER) {
1774 /* apply (U + D/omega) to the vector */
1775 bs = b;
1776 for (i=0; i<m; i++) {
1777 d = fshift + mdiag[i];
1778 n = a->i[i+1] - diag[i] - 1;
1779 idx = a->j + diag[i] + 1;
1780 v = a->a + diag[i] + 1;
1781 sum = b[i]*d/omega;
1782 PetscSparseDensePlusDot(sum,bs,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += v[__i] * bs
[idx[__i]];}
;
1783 x[i] = sum;
1784 }
1785 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1785,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1786 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1786,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1787 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1787,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1788 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1789 }
1790
1791 if (flag == SOR_APPLY_LOWER) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SOR_APPLY_LOWER is not implemented")return PetscError(((MPI_Comm)0x44000001),1791,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"SOR_APPLY_LOWER is not implemented")
;
1792 else if (flag & SOR_EISENSTAT) {
1793 /* Let A = L + U + D; where L is lower trianglar,
1794 U is upper triangular, E = D/omega; This routine applies
1795
1796 (L + E)^{-1} A (U + E)^{-1}
1797
1798 to a vector efficiently using Eisenstat's trick.
1799 */
1800 scale = (2.0/omega) - 1.0;
1801
1802 /* x = (E + U)^{-1} b */
1803 for (i=m-1; i>=0; i--) {
1804 n = a->i[i+1] - diag[i] - 1;
1805 idx = a->j + diag[i] + 1;
1806 v = a->a + diag[i] + 1;
1807 sum = b[i];
1808 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1809 x[i] = sum*idiag[i];
1810 }
1811
1812 /* t = b - (2*E - D)x */
1813 v = a->a;
1814 for (i=0; i<m; i++) t[i] = b[i] - scale*(v[*diag++])*x[i];
1815
1816 /* t = (E + L)^{-1}t */
1817 ts = t;
1818 diag = a->diag;
1819 for (i=0; i<m; i++) {
1820 n = diag[i] - a->i[i];
1821 idx = a->j + a->i[i];
1822 v = a->a + a->i[i];
1823 sum = t[i];
1824 PetscSparseDenseMinusDot(sum,ts,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * ts
[idx[__i]];}
;
1825 t[i] = sum*idiag[i];
1826 /* x = x + t */
1827 x[i] += t[i];
1828 }
1829
1830 ierr = PetscLogFlops(6.0*m-1 + 2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1830,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1831 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1831,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1832 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1832,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1833 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1834 }
1835 if (flag & SOR_ZERO_INITIAL_GUESS) {
1836 if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) {
1837 for (i=0; i<m; i++) {
1838 n = diag[i] - a->i[i];
1839 idx = a->j + a->i[i];
1840 v = a->a + a->i[i];
1841 sum = b[i];
1842 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1843 t[i] = sum;
1844 x[i] = sum*idiag[i];
1845 }
1846 xb = t;
1847 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1847,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1848 } else xb = b;
1849 if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) {
1850 for (i=m-1; i>=0; i--) {
1851 n = a->i[i+1] - diag[i] - 1;
1852 idx = a->j + diag[i] + 1;
1853 v = a->a + diag[i] + 1;
1854 sum = xb[i];
1855 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1856 if (xb == b) {
1857 x[i] = sum*idiag[i];
1858 } else {
1859 x[i] = (1-omega)*x[i] + sum*idiag[i]; /* omega in idiag */
1860 }
1861 }
1862 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1862,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* assumes 1/2 in upper */
1863 }
1864 its--;
1865 }
1866 while (its--) {
1867 if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) {
1868 for (i=0; i<m; i++) {
1869 /* lower */
1870 n = diag[i] - a->i[i];
1871 idx = a->j + a->i[i];
1872 v = a->a + a->i[i];
1873 sum = b[i];
1874 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1875 t[i] = sum; /* save application of the lower-triangular part */
1876 /* upper */
1877 n = a->i[i+1] - diag[i] - 1;
1878 idx = a->j + diag[i] + 1;
1879 v = a->a + diag[i] + 1;
1880 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1881 x[i] = (1. - omega)*x[i] + sum*idiag[i]; /* omega in idiag */
1882 }
1883 xb = t;
1884 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1884,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1885 } else xb = b;
1886 if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) {
1887 for (i=m-1; i>=0; i--) {
1888 sum = xb[i];
1889 if (xb == b) {
1890 /* whole matrix (no checkpointing available) */
1891 n = a->i[i+1] - a->i[i];
1892 idx = a->j + a->i[i];
1893 v = a->a + a->i[i];
1894 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1895 x[i] = (1. - omega)*x[i] + (sum + mdiag[i]*x[i])*idiag[i];
1896 } else { /* lower-triangular part has been saved, so only apply upper-triangular */
1897 n = a->i[i+1] - diag[i] - 1;
1898 idx = a->j + diag[i] + 1;
1899 v = a->a + diag[i] + 1;
1900 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1901 x[i] = (1. - omega)*x[i] + sum*idiag[i]; /* omega in idiag */
1902 }
1903 }
1904 if (xb == b) {
1905 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1905,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1906 } else {
1907 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1907,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* assumes 1/2 in upper */
1908 }
1909 }
1910 }
1911 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1911,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1912 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1912,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1913 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1914}
1915
1916
1917PetscErrorCode MatGetInfo_SeqAIJ(Mat A,MatInfoType flag,MatInfo *info)
1918{
1919 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1920
1921 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1921; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1922 info->block_size = 1.0;
1923 info->nz_allocated = (double)a->maxnz;
1924 info->nz_used = (double)a->nz;
1925 info->nz_unneeded = (double)(a->maxnz - a->nz);
1926 info->assemblies = (double)A->num_ass;
1927 info->mallocs = (double)A->info.mallocs;
1928 info->memory = ((PetscObject)A)->mem;
1929 if (A->factortype) {
1930 info->fill_ratio_given = A->info.fill_ratio_given;
1931 info->fill_ratio_needed = A->info.fill_ratio_needed;
1932 info->factor_mallocs = A->info.factor_mallocs;
1933 } else {
1934 info->fill_ratio_given = 0;
1935 info->fill_ratio_needed = 0;
1936 info->factor_mallocs = 0;
1937 }
1938 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1939}
1940
1941PetscErrorCode MatZeroRows_SeqAIJ(Mat A,PetscInt N,const PetscInt rows[],PetscScalar diag,Vec x,Vec b)
1942{
1943 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1944 PetscInt i,m = A->rmap->n - 1;
1945 PetscErrorCode ierr;
1946 const PetscScalar *xx;
1947 PetscScalar *bb;
1948 PetscInt d = 0;
1949
1950 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1950; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1951 if (x && b) {
1952 ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1952,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1953 ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1953,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1954 for (i=0; i<N; i++) {
1955 if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),1955,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
1956 if (rows[i] >= A->cmap->n) continue;
1957 bb[rows[i]] = diag*xx[rows[i]];
1958 }
1959 ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1959,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1960 ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1960,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1961 }
1962
1963 if (a->keepnonzeropattern) {
1964 for (i=0; i<N; i++) {
1965 if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),1965,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
1966 ierr = PetscMemzero(&a->a[a->i[rows[i]]],a->ilen[rows[i]]*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1966,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1967 }
1968 if (diag != 0.0) {
1969 for (i=0; i<N; i++) {
1970 d = rows[i];
1971 if (rows[i] >= A->cmap->n) continue;
1972 if (a->diag[d] >= a->i[d+1]) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Matrix is missing diagonal entry in the zeroed row %D",d)return PetscError(((MPI_Comm)0x44000001),1972,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Matrix is missing diagonal entry in the zeroed row %D"
,d)
;
1973 }
1974 for (i=0; i<N; i++) {
1975 if (rows[i] >= A->cmap->n) continue;
1976 a->a[a->diag[rows[i]]] = diag;
1977 }
1978 }
1979 } else {
1980 if (diag != 0.0) {
1981 for (i=0; i<N; i++) {
1982 if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),1982,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
1983 if (a->ilen[rows[i]] > 0) {
1984 if (rows[i] >= A->cmap->n) {
1985 a->ilen[rows[i]] = 0;
1986 } else {
1987 a->ilen[rows[i]] = 1;
1988 a->a[a->i[rows[i]]] = diag;
1989 a->j[a->i[rows[i]]] = rows[i];
1990 }
1991 } else if (rows[i] < A->cmap->n) { /* in case row was completely empty */
1992 ierr = MatSetValues_SeqAIJ(A,1,&rows[i],1,&rows[i],&diag,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1992,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1993 }
1994 }
1995 } else {
1996 for (i=0; i<N; i++) {
1997 if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),1997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
1998 a->ilen[rows[i]] = 0;
1999 }
2000 }
2001 A->nonzerostate++;
2002 }
2003 ierr = (*A->ops->assemblyend)(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2003,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2004 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2005}
2006
2007PetscErrorCode MatZeroRowsColumns_SeqAIJ(Mat A,PetscInt N,const PetscInt rows[],PetscScalar diag,Vec x,Vec b)
2008{
2009 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2010 PetscInt i,j,m = A->rmap->n - 1,d = 0;
2011 PetscErrorCode ierr;
2012 PetscBool missing,*zeroed,vecs = PETSC_FALSE;
2013 const PetscScalar *xx;
2014 PetscScalar *bb;
2015
2016 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2016; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2017 if (x && b) {
2018 ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2018,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2019 ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2019,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2020 vecs = PETSC_TRUE;
2021 }
2022 ierr = PetscCalloc1(A->rmap->n,&zeroed)PetscMallocA(1,PETSC_TRUE,2022,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->rmap->n)*sizeof(**(&zeroed)),(&zeroed
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2022,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2023 for (i=0; i<N; i++) {
2024 if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),2024,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
2025 ierr = PetscMemzero(&a->a[a->i[rows[i]]],a->ilen[rows[i]]*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2025,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2026
2027 zeroed[rows[i]] = PETSC_TRUE;
2028 }
2029 for (i=0; i<A->rmap->n; i++) {
2030 if (!zeroed[i]) {
2031 for (j=a->i[i]; j<a->i[i+1]; j++) {
2032 if (a->j[j] < A->rmap->n && zeroed[a->j[j]]) {
2033 if (vecs) bb[i] -= a->a[j]*xx[a->j[j]];
2034 a->a[j] = 0.0;
2035 }
2036 }
2037 } else if (vecs && i < A->cmap->N) bb[i] = diag*xx[i];
2038 }
2039 if (x && b) {
2040 ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2040,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2041 ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2041,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2042 }
2043 ierr = PetscFree(zeroed)((*PetscTrFree)((void*)(zeroed),2043,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((zeroed) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2043,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2044 if (diag != 0.0) {
2045 ierr = MatMissingDiagonal_SeqAIJ(A,&missing,&d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2045,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2046 if (missing) {
2047 for (i=0; i<N; i++) {
2048 if (rows[i] >= A->cmap->N) continue;
2049 if (a->nonew && rows[i] >= d) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Matrix is missing diagonal entry in row %D (%D)",d,rows[i])do {if (__builtin_expect(!!(73),0)) {PetscError(((MPI_Comm)0x44000001
),2049,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
73);}} while (0)
;
2050 ierr = MatSetValues_SeqAIJ(A,1,&rows[i],1,&rows[i],&diag,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2050,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2051 }
2052 } else {
2053 for (i=0; i<N; i++) {
2054 a->a[a->diag[rows[i]]] = diag;
2055 }
2056 }
2057 }
2058 ierr = (*A->ops->assemblyend)(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2058,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2059 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2060}
2061
2062PetscErrorCode MatGetRow_SeqAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
2063{
2064 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2065 PetscInt *itmp;
2066
2067 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2067; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2068 if (row < 0 || row >= A->rmap->n) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row %D out of range",row)return PetscError(((MPI_Comm)0x44000001),2068,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"Row %D out of range",row)
;
2069
2070 *nz = a->i[row+1] - a->i[row];
2071 if (v) *v = a->a + a->i[row];
2072 if (idx) {
2073 itmp = a->j + a->i[row];
2074 if (*nz) *idx = itmp;
2075 else *idx = 0;
2076 }
2077 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2078}
2079
2080/* remove this function? */
2081PetscErrorCode MatRestoreRow_SeqAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
2082{
2083 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2083; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2084 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2085}
2086
2087PetscErrorCode MatNorm_SeqAIJ(Mat A,NormType type,PetscReal *nrm)
2088{
2089 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2090 MatScalar *v = a->a;
2091 PetscReal sum = 0.0;
2092 PetscErrorCode ierr;
2093 PetscInt i,j;
2094
2095 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2095; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2096 if (type == NORM_FROBENIUS) {
2097#if defined(PETSC_USE_REAL___FP16)
2098 PetscBLASInt one = 1,nz = a->nz;
2099 *nrm = BLASnrm2_dnrm2_(&nz,v,&one);
2100#else
2101 for (i=0; i<a->nz; i++) {
2102 sum += PetscRealPart(PetscConj(*v)*(*v))((*v)*(*v)); v++;
2103 }
2104 *nrm = PetscSqrtReal(sum)sqrt(sum);
2105#endif
2106 ierr = PetscLogFlops(2*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2106,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2107 } else if (type == NORM_1) {
2108 PetscReal *tmp;
2109 PetscInt *jj = a->j;
2110 ierr = PetscCalloc1(A->cmap->n+1,&tmp)PetscMallocA(1,PETSC_TRUE,2110,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->cmap->n+1)*sizeof(**(&tmp)),(&tmp)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2110,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2111 *nrm = 0.0;
2112 for (j=0; j<a->nz; j++) {
2113 tmp[*jj++] += PetscAbsScalar(*v); v++;
2114 }
2115 for (j=0; j<A->cmap->n; j++) {
2116 if (tmp[j] > *nrm) *nrm = tmp[j];
2117 }
2118 ierr = PetscFree(tmp)((*PetscTrFree)((void*)(tmp),2118,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((tmp) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2118,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2119 ierr = PetscLogFlops(PetscMax(a->nz-1,0)(((a->nz-1)<(0)) ? (0) : (a->nz-1)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2119,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2120 } else if (type == NORM_INFINITY) {
2121 *nrm = 0.0;
2122 for (j=0; j<A->rmap->n; j++) {
2123 v = a->a + a->i[j];
2124 sum = 0.0;
2125 for (i=0; i<a->i[j+1]-a->i[j]; i++) {
2126 sum += PetscAbsScalar(*v); v++;
2127 }
2128 if (sum > *nrm) *nrm = sum;
2129 }
2130 ierr = PetscLogFlops(PetscMax(a->nz-1,0)(((a->nz-1)<(0)) ? (0) : (a->nz-1)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2130,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2131 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for two norm")return PetscError(((MPI_Comm)0x44000001),2131,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"No support for two norm")
;
2132 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2133}
2134
2135/* Merged from MatGetSymbolicTranspose_SeqAIJ() - replace MatGetSymbolicTranspose_SeqAIJ()? */
2136PetscErrorCode MatTransposeSymbolic_SeqAIJ(Mat A,Mat *B)
2137{
2138 PetscErrorCode ierr;
2139 PetscInt i,j,anzj;
2140 Mat_SeqAIJ *a=(Mat_SeqAIJ*)A->data,*b;
2141 PetscInt an=A->cmap->N,am=A->rmap->N;
2142 PetscInt *ati,*atj,*atfill,*ai=a->i,*aj=a->j;
2143
2144 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2144; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2145 /* Allocate space for symbolic transpose info and work array */
2146 ierr = PetscCalloc1(an+1,&ati)PetscMallocA(1,PETSC_TRUE,2146,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(an+1)*sizeof(**(&ati)),(&ati))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2146,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2147 ierr = PetscMalloc1(ai[am],&atj)PetscMallocA(1,PETSC_FALSE,2147,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(ai[am])*sizeof(**(&atj)),(&atj))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2147,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2148 ierr = PetscMalloc1(an,&atfill)PetscMallocA(1,PETSC_FALSE,2148,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(an)*sizeof(**(&atfill)),(&atfill))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2148,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2149
2150 /* Walk through aj and count ## of non-zeros in each row of A^T. */
2151 /* Note: offset by 1 for fast conversion into csr format. */
2152 for (i=0;i<ai[am];i++) ati[aj[i]+1] += 1;
2153 /* Form ati for csr format of A^T. */
2154 for (i=0;i<an;i++) ati[i+1] += ati[i];
2155
2156 /* Copy ati into atfill so we have locations of the next free space in atj */
2157 ierr = PetscMemcpy(atfill,ati,an*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2157,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2158
2159 /* Walk through A row-wise and mark nonzero entries of A^T. */
2160 for (i=0;i<am;i++) {
2161 anzj = ai[i+1] - ai[i];
2162 for (j=0;j<anzj;j++) {
2163 atj[atfill[*aj]] = i;
2164 atfill[*aj++] += 1;
2165 }
2166 }
2167
2168 /* Clean up temporary space and complete requests. */
2169 ierr = PetscFree(atfill)((*PetscTrFree)((void*)(atfill),2169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((atfill) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2170 ierr = MatCreateSeqAIJWithArrays(PetscObjectComm((PetscObject)A),an,am,ati,atj,NULL((void*)0),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2170,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2171 ierr = MatSetBlockSizes(*B,PetscAbs(A->cmap->bs)(((A->cmap->bs) >= 0) ? (A->cmap->bs) : (-(A->
cmap->bs)))
,PetscAbs(A->rmap->bs)(((A->rmap->bs) >= 0) ? (A->rmap->bs) : (-(A->
rmap->bs)))
);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2171,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2172
2173 b = (Mat_SeqAIJ*)((*B)->data);
2174 b->free_a = PETSC_FALSE;
2175 b->free_ij = PETSC_TRUE;
2176 b->nonew = 0;
2177 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2178}
2179
2180PetscErrorCode MatTranspose_SeqAIJ(Mat A,MatReuse reuse,Mat *B)
2181{
2182 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2183 Mat C;
2184 PetscErrorCode ierr;
2185 PetscInt i,*aj = a->j,*ai = a->i,m = A->rmap->n,len,*col;
2186 MatScalar *array = a->a;
2187
2188 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2188; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2189 if (reuse == MAT_INITIAL_MATRIX || reuse == MAT_INPLACE_MATRIX) {
2190 ierr = PetscCalloc1(1+A->cmap->n,&col)PetscMallocA(1,PETSC_TRUE,2190,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(1+A->cmap->n)*sizeof(**(&col)),(&col)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2190,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2191
2192 for (i=0; i<ai[m]; i++) col[aj[i]] += 1;
2193 ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2194 ierr = MatSetSizes(C,A->cmap->n,m,A->cmap->n,m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2194,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2195 ierr = MatSetBlockSizes(C,PetscAbs(A->cmap->bs)(((A->cmap->bs) >= 0) ? (A->cmap->bs) : (-(A->
cmap->bs)))
,PetscAbs(A->rmap->bs)(((A->rmap->bs) >= 0) ? (A->rmap->bs) : (-(A->
rmap->bs)))
);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2195,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2196 ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2197 ierr = MatSeqAIJSetPreallocation_SeqAIJ(C,0,col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2197,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2198 ierr = PetscFree(col)((*PetscTrFree)((void*)(col),2198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((col) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2199 } else {
2200 C = *B;
2201 }
2202
2203 for (i=0; i<m; i++) {
2204 len = ai[i+1]-ai[i];
2205 ierr = MatSetValues_SeqAIJ(C,len,aj,1,&i,array,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2205,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2206 array += len;
2207 aj += len;
2208 }
2209 ierr = MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2210 ierr = MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2210,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2211
2212 if (reuse == MAT_INITIAL_MATRIX || reuse == MAT_REUSE_MATRIX) {
2213 *B = C;
2214 } else {
2215 ierr = MatHeaderMerge(A,&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2216 }
2217 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2218}
2219
2220PetscErrorCode MatIsTranspose_SeqAIJ(Mat A,Mat B,PetscReal tol,PetscBool *f)
2221{
2222 Mat_SeqAIJ *aij = (Mat_SeqAIJ*) A->data,*bij = (Mat_SeqAIJ*) B->data;
2223 PetscInt *adx,*bdx,*aii,*bii,*aptr,*bptr;
2224 MatScalar *va,*vb;
2225 PetscErrorCode ierr;
2226 PetscInt ma,na,mb,nb, i;
2227
2228 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2228; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2229 ierr = MatGetSize(A,&ma,&na);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2229,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2230 ierr = MatGetSize(B,&mb,&nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2230,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2231 if (ma!=nb || na!=mb) {
2232 *f = PETSC_FALSE;
2233 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2234 }
2235 aii = aij->i; bii = bij->i;
2236 adx = aij->j; bdx = bij->j;
2237 va = aij->a; vb = bij->a;
2238 ierr = PetscMalloc1(ma,&aptr)PetscMallocA(1,PETSC_FALSE,2238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(ma)*sizeof(**(&aptr)),(&aptr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2239 ierr = PetscMalloc1(mb,&bptr)PetscMallocA(1,PETSC_FALSE,2239,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(mb)*sizeof(**(&bptr)),(&bptr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2239,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2240 for (i=0; i<ma; i++) aptr[i] = aii[i];
2241 for (i=0; i<mb; i++) bptr[i] = bii[i];
2242
2243 *f = PETSC_TRUE;
2244 for (i=0; i<ma; i++) {
2245 while (aptr[i]<aii[i+1]) {
2246 PetscInt idc,idr;
2247 PetscScalar vc,vr;
2248 /* column/row index/value */
2249 idc = adx[aptr[i]];
2250 idr = bdx[bptr[idc]];
2251 vc = va[aptr[i]];
2252 vr = vb[bptr[idc]];
2253 if (i!=idr || PetscAbsScalar(vc-vr) > tol) {
2254 *f = PETSC_FALSE;
2255 goto done;
2256 } else {
2257 aptr[i]++;
2258 if (B || i!=idc) bptr[idc]++;
2259 }
2260 }
2261 }
2262done:
2263 ierr = PetscFree(aptr)((*PetscTrFree)((void*)(aptr),2263,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((aptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2263,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2264 ierr = PetscFree(bptr)((*PetscTrFree)((void*)(bptr),2264,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((bptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2264,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2265 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2266}
2267
2268PetscErrorCode MatIsHermitianTranspose_SeqAIJ(Mat A,Mat B,PetscReal tol,PetscBool *f)
2269{
2270 Mat_SeqAIJ *aij = (Mat_SeqAIJ*) A->data,*bij = (Mat_SeqAIJ*) B->data;
2271 PetscInt *adx,*bdx,*aii,*bii,*aptr,*bptr;
2272 MatScalar *va,*vb;
2273 PetscErrorCode ierr;
2274 PetscInt ma,na,mb,nb, i;
2275
2276 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2276; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2277 ierr = MatGetSize(A,&ma,&na);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2277,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2278 ierr = MatGetSize(B,&mb,&nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2278,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2279 if (ma!=nb || na!=mb) {
2280 *f = PETSC_FALSE;
2281 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2282 }
2283 aii = aij->i; bii = bij->i;
2284 adx = aij->j; bdx = bij->j;
2285 va = aij->a; vb = bij->a;
2286 ierr = PetscMalloc1(ma,&aptr)PetscMallocA(1,PETSC_FALSE,2286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(ma)*sizeof(**(&aptr)),(&aptr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2287 ierr = PetscMalloc1(mb,&bptr)PetscMallocA(1,PETSC_FALSE,2287,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(mb)*sizeof(**(&bptr)),(&bptr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2287,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2288 for (i=0; i<ma; i++) aptr[i] = aii[i];
2289 for (i=0; i<mb; i++) bptr[i] = bii[i];
2290
2291 *f = PETSC_TRUE;
2292 for (i=0; i<ma; i++) {
2293 while (aptr[i]<aii[i+1]) {
2294 PetscInt idc,idr;
2295 PetscScalar vc,vr;
2296 /* column/row index/value */
2297 idc = adx[aptr[i]];
2298 idr = bdx[bptr[idc]];
2299 vc = va[aptr[i]];
2300 vr = vb[bptr[idc]];
2301 if (i!=idr || PetscAbsScalar(vc-PetscConj(vr)(vr)) > tol) {
2302 *f = PETSC_FALSE;
2303 goto done;
2304 } else {
2305 aptr[i]++;
2306 if (B || i!=idc) bptr[idc]++;
2307 }
2308 }
2309 }
2310done:
2311 ierr = PetscFree(aptr)((*PetscTrFree)((void*)(aptr),2311,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((aptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2311,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2312 ierr = PetscFree(bptr)((*PetscTrFree)((void*)(bptr),2312,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((bptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2312,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2313 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2314}
2315
2316PetscErrorCode MatIsSymmetric_SeqAIJ(Mat A,PetscReal tol,PetscBool *f)
2317{
2318 PetscErrorCode ierr;
2319
2320 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2320; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2321 ierr = MatIsTranspose_SeqAIJ(A,A,tol,f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2321,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2322 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2323}
2324
2325PetscErrorCode MatIsHermitian_SeqAIJ(Mat A,PetscReal tol,PetscBool *f)
2326{
2327 PetscErrorCode ierr;
2328
2329 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2329; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2330 ierr = MatIsHermitianTranspose_SeqAIJ(A,A,tol,f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2330,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2331 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2332}
2333
2334PetscErrorCode MatDiagonalScale_SeqAIJ(Mat A,Vec ll,Vec rr)
2335{
2336 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2337 const PetscScalar *l,*r;
2338 PetscScalar x;
2339 MatScalar *v;
2340 PetscErrorCode ierr;
2341 PetscInt i,j,m = A->rmap->n,n = A->cmap->n,M,nz = a->nz;
2342 const PetscInt *jj;
2343
2344 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2344; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2345 if (ll) {
2346 /* The local size is used so that VecMPI can be passed to this routine
2347 by MatDiagonalScale_MPIAIJ */
2348 ierr = VecGetLocalSize(ll,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2348,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2349 if (m != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Left scaling vector wrong length")return PetscError(((MPI_Comm)0x44000001),2349,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Left scaling vector wrong length")
;
2350 ierr = VecGetArrayRead(ll,&l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2350,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2351 v = a->a;
2352 for (i=0; i<m; i++) {
2353 x = l[i];
2354 M = a->i[i+1] - a->i[i];
2355 for (j=0; j<M; j++) (*v++) *= x;
2356 }
2357 ierr = VecRestoreArrayRead(ll,&l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2357,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2358 ierr = PetscLogFlops(nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2358,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2359 }
2360 if (rr) {
2361 ierr = VecGetLocalSize(rr,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2362 if (n != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Right scaling vector wrong length")return PetscError(((MPI_Comm)0x44000001),2362,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Right scaling vector wrong length")
;
2363 ierr = VecGetArrayRead(rr,&r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2364 v = a->a; jj = a->j;
2365 for (i=0; i<nz; i++) (*v++) *= r[*jj++];
2366 ierr = VecRestoreArrayRead(rr,&r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2366,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2367 ierr = PetscLogFlops(nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2367,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2368 }
2369 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2369,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2370 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2371}
2372
2373PetscErrorCode MatCreateSubMatrix_SeqAIJ(Mat A,IS isrow,IS iscol,PetscInt csize,MatReuse scall,Mat *B)
2374{
2375 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data,*c;
2376 PetscErrorCode ierr;
2377 PetscInt *smap,i,k,kstart,kend,oldcols = A->cmap->n,*lens;
2378 PetscInt row,mat_i,*mat_j,tcol,first,step,*mat_ilen,sum,lensi;
2379 const PetscInt *irow,*icol;
2380 PetscInt nrows,ncols;
2381 PetscInt *starts,*j_new,*i_new,*aj = a->j,*ai = a->i,ii,*ailen = a->ilen;
2382 MatScalar *a_new,*mat_a;
2383 Mat C;
2384 PetscBool stride;
2385
2386 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2386; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2387
2388 ierr = ISGetIndices(isrow,&irow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2388,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2389 ierr = ISGetLocalSize(isrow,&nrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2390 ierr = ISGetLocalSize(iscol,&ncols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2390,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2391
2392 ierr = PetscObjectTypeCompare((PetscObject)iscol,ISSTRIDE"stride",&stride);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2392,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2393 if (stride) {
2394 ierr = ISStrideGetInfo(iscol,&first,&step);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2394,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2395 } else {
2396 first = 0;
2397 step = 0;
2398 }
2399 if (stride && step == 1) {
2400 /* special case of contiguous rows */
2401 ierr = PetscMalloc2(nrows,&lens,nrows,&starts)PetscMallocA(2,PETSC_FALSE,2401,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nrows)*sizeof(**(&lens)),(&lens),(size_t)(nrows
)*sizeof(**(&starts)),(&starts))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2401,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2402 /* loop over new rows determining lens and starting points */
2403 for (i=0; i<nrows; i++) {
2404 kstart = ai[irow[i]];
2405 kend = kstart + ailen[irow[i]];
2406 starts[i] = kstart;
2407 for (k=kstart; k<kend; k++) {
2408 if (aj[k] >= first) {
2409 starts[i] = k;
2410 break;
2411 }
2412 }
2413 sum = 0;
2414 while (k < kend) {
2415 if (aj[k++] >= first+ncols) break;
2416 sum++;
2417 }
2418 lens[i] = sum;
2419 }
2420 /* create submatrix */
2421 if (scall == MAT_REUSE_MATRIX) {
2422 PetscInt n_cols,n_rows;
2423 ierr = MatGetSize(*B,&n_rows,&n_cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2423,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2424 if (n_rows != nrows || n_cols != ncols) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Reused submatrix wrong size")return PetscError(((MPI_Comm)0x44000001),2424,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Reused submatrix wrong size")
;
2425 ierr = MatZeroEntries(*B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2425,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2426 C = *B;
2427 } else {
2428 PetscInt rbs,cbs;
2429 ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2429,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2430 ierr = MatSetSizes(C,nrows,ncols,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2430,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2431 ierr = ISGetBlockSize(isrow,&rbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2431,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2432 ierr = ISGetBlockSize(iscol,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2432,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2433 ierr = MatSetBlockSizes(C,rbs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2433,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2434 ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2434,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2435 ierr = MatSeqAIJSetPreallocation_SeqAIJ(C,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2435,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2436 }
2437 c = (Mat_SeqAIJ*)C->data;
2438
2439 /* loop over rows inserting into submatrix */
2440 a_new = c->a;
2441 j_new = c->j;
2442 i_new = c->i;
2443
2444 for (i=0; i<nrows; i++) {
2445 ii = starts[i];
2446 lensi = lens[i];
2447 for (k=0; k<lensi; k++) {
2448 *j_new++ = aj[ii+k] - first;
2449 }
2450 ierr = PetscMemcpy(a_new,a->a + starts[i],lensi*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2450,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2451 a_new += lensi;
2452 i_new[i+1] = i_new[i] + lensi;
2453 c->ilen[i] = lensi;
2454 }
2455 ierr = PetscFree2(lens,starts)PetscFreeA(2,2455,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(lens),&(starts))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2455,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2456 } else {
2457 ierr = ISGetIndices(iscol,&icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2457,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2458 ierr = PetscCalloc1(oldcols,&smap)PetscMallocA(1,PETSC_TRUE,2458,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(oldcols)*sizeof(**(&smap)),(&smap))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2458,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2459 ierr = PetscMalloc1(1+nrows,&lens)PetscMallocA(1,PETSC_FALSE,2459,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(1+nrows)*sizeof(**(&lens)),(&lens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2459,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2460 for (i=0; i<ncols; i++) {
2461#if defined(PETSC_USE_DEBUG1)
2462 if (icol[i] >= oldcols) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Requesting column beyond largest column icol[%D] %D <= A->cmap->n %D",i,icol[i],oldcols)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),2462,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
2463#endif
2464 smap[icol[i]] = i+1;
2465 }
2466
2467 /* determine lens of each row */
2468 for (i=0; i<nrows; i++) {
2469 kstart = ai[irow[i]];
2470 kend = kstart + a->ilen[irow[i]];
2471 lens[i] = 0;
2472 for (k=kstart; k<kend; k++) {
2473 if (smap[aj[k]]) {
2474 lens[i]++;
2475 }
2476 }
2477 }
2478 /* Create and fill new matrix */
2479 if (scall == MAT_REUSE_MATRIX) {
2480 PetscBool equal;
2481
2482 c = (Mat_SeqAIJ*)((*B)->data);
2483 if ((*B)->rmap->n != nrows || (*B)->cmap->n != ncols) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Cannot reuse matrix. wrong size")return PetscError(((MPI_Comm)0x44000001),2483,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Cannot reuse matrix. wrong size")
;
2484 ierr = PetscMemcmp(c->ilen,lens,(*B)->rmap->n*sizeof(PetscInt),&equal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2484,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2485 if (!equal) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Cannot reuse matrix. wrong no of nonzeros")return PetscError(((MPI_Comm)0x44000001),2485,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Cannot reuse matrix. wrong no of nonzeros"
)
;
2486 ierr = PetscMemzero(c->ilen,(*B)->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2486,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2487 C = *B;
2488 } else {
2489 PetscInt rbs,cbs;
2490 ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2490,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2491 ierr = MatSetSizes(C,nrows,ncols,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2492 ierr = ISGetBlockSize(isrow,&rbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2492,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2493 ierr = ISGetBlockSize(iscol,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2494 ierr = MatSetBlockSizes(C,rbs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2494,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2495 ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2495,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2496 ierr = MatSeqAIJSetPreallocation_SeqAIJ(C,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2496,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2497 }
2498 c = (Mat_SeqAIJ*)(C->data);
2499 for (i=0; i<nrows; i++) {
2500 row = irow[i];
2501 kstart = ai[row];
2502 kend = kstart + a->ilen[row];
2503 mat_i = c->i[i];
2504 mat_j = c->j + mat_i;
2505 mat_a = c->a + mat_i;
2506 mat_ilen = c->ilen + i;
2507 for (k=kstart; k<kend; k++) {
2508 if ((tcol=smap[a->j[k]])) {
2509 *mat_j++ = tcol - 1;
2510 *mat_a++ = a->a[k];
2511 (*mat_ilen)++;
2512
2513 }
2514 }
2515 }
2516 /* Free work space */
2517 ierr = ISRestoreIndices(iscol,&icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2517,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2518 ierr = PetscFree(smap)((*PetscTrFree)((void*)(smap),2518,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((smap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2518,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2519 ierr = PetscFree(lens)((*PetscTrFree)((void*)(lens),2519,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2519,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2520 /* sort */
2521 for (i = 0; i < nrows; i++) {
2522 PetscInt ilen;
2523
2524 mat_i = c->i[i];
2525 mat_j = c->j + mat_i;
2526 mat_a = c->a + mat_i;
2527 ilen = c->ilen[i];
2528 ierr = PetscSortIntWithScalarArray(ilen,mat_j,mat_a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2528,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2529 }
2530 }
2531 ierr = MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2531,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2532 ierr = MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2532,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2533
2534 ierr = ISRestoreIndices(isrow,&irow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2534,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2535 *B = C;
2536 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2537}
2538
2539PetscErrorCode MatGetMultiProcBlock_SeqAIJ(Mat mat,MPI_Comm subComm,MatReuse scall,Mat *subMat)
2540{
2541 PetscErrorCode ierr;
2542 Mat B;
2543
2544 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2544; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2545 if (scall == MAT_INITIAL_MATRIX) {
2546 ierr = MatCreate(subComm,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2546,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2547 ierr = MatSetSizes(B,mat->rmap->n,mat->cmap->n,mat->rmap->n,mat->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2547,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2548 ierr = MatSetBlockSizesFromMats(B,mat,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2548,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2549 ierr = MatSetType(B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2549,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2550 ierr = MatDuplicateNoCreate_SeqAIJ(B,mat,MAT_COPY_VALUES,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2551 *subMat = B;
2552 } else {
2553 ierr = MatCopy_SeqAIJ(mat,*subMat,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2553,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2554 }
2555 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2556}
2557
2558PetscErrorCode MatILUFactor_SeqAIJ(Mat inA,IS row,IS col,const MatFactorInfo *info)
2559{
2560 Mat_SeqAIJ *a = (Mat_SeqAIJ*)inA->data;
2561 PetscErrorCode ierr;
2562 Mat outA;
2563 PetscBool row_identity,col_identity;
2564
2565 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2565; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2566 if (info->levels != 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only levels=0 supported for in-place ilu")return PetscError(((MPI_Comm)0x44000001),2566,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Only levels=0 supported for in-place ilu"
)
;
2567
2568 ierr = ISIdentity(row,&row_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2569 ierr = ISIdentity(col,&col_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2569,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2570
2571 outA = inA;
2572 outA->factortype = MAT_FACTOR_LU;
2573 ierr = PetscFree(inA->solvertype)((*PetscTrFree)((void*)(inA->solvertype),2573,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((inA->solvertype) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2573,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2574 ierr = PetscStrallocpy(MATSOLVERPETSC"petsc",&inA->solvertype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2574,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2575
2576 ierr = PetscObjectReference((PetscObject)row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2576,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2577 ierr = ISDestroy(&a->row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2577,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2578
2579 a->row = row;
2580
2581 ierr = PetscObjectReference((PetscObject)col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2581,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2582 ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2582,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2583
2584 a->col = col;
2585
2586 /* Create the inverse permutation so that it can be used in MatLUFactorNumeric() */
2587 ierr = ISDestroy(&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2587,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2588 ierr = ISInvertPermutation(col,PETSC_DECIDE-1,&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2588,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2589 ierr = PetscLogObjectParent((PetscObject)inA,(PetscObject)a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2589,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2590
2591 if (!a->solve_work) { /* this matrix may have been factored before */
2592 ierr = PetscMalloc1(inA->rmap->n+1,&a->solve_work)PetscMallocA(1,PETSC_FALSE,2592,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(inA->rmap->n+1)*sizeof(**(&a->solve_work
)),(&a->solve_work))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2592,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2593 ierr = PetscLogObjectMemory((PetscObject)inA, (inA->rmap->n+1)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2593,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2594 }
2595
2596 ierr = MatMarkDiagonal_SeqAIJ(inA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2596,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2597 if (row_identity && col_identity) {
2598 ierr = MatLUFactorNumeric_SeqAIJ_inplace(outA,inA,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2598,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2599 } else {
2600 ierr = MatLUFactorNumeric_SeqAIJ_InplaceWithPerm(outA,inA,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2600,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2601 }
2602 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2603}
2604
2605PetscErrorCode MatScale_SeqAIJ(Mat inA,PetscScalar alpha)
2606{
2607 Mat_SeqAIJ *a = (Mat_SeqAIJ*)inA->data;
2608 PetscScalar oalpha = alpha;
2609 PetscErrorCode ierr;
2610 PetscBLASInt one = 1,bnz;
2611
2612 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2612; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2613 ierr = PetscBLASIntCast(a->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2614 PetscStackCallBLAS("BLASscal",BLASscal_(&bnz,&oalpha,a->a,&one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASscal"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2614; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dscal_(&bnz,&oalpha,a->a,&one); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(2614,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),2614,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} while(0); do { ; if (petscstack &&
petscstack->currentsize > 0) { petscstack->currentsize
--; petscstack->function[petscstack->currentsize] = 0; petscstack
->file[petscstack->currentsize] = 0; petscstack->line
[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); }
while (0); } while(0)
;
2615 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2615,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2616 ierr = MatSeqAIJInvalidateDiagonal(inA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2616,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2617 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2618}
2619
2620PetscErrorCode MatDestroySubMatrix_Private(Mat_SubSppt *submatj)
2621{
2622 PetscErrorCode ierr;
2623 PetscInt i;
2624
2625 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2625; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2626 if (!submatj->id) { /* delete data that are linked only to submats[id=0] */
2627 ierr = PetscFree4(submatj->sbuf1,submatj->ptr,submatj->tmp,submatj->ctr)PetscFreeA(4,2627,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(submatj->sbuf1),&(submatj->ptr),&(submatj
->tmp),&(submatj->ctr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2627,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2628
2629 for (i=0; i<submatj->nrqr; ++i) {
2630 ierr = PetscFree(submatj->sbuf2[i])((*PetscTrFree)((void*)(submatj->sbuf2[i]),2630,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->sbuf2[i]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2630,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2631 }
2632 ierr = PetscFree3(submatj->sbuf2,submatj->req_size,submatj->req_source1)PetscFreeA(3,2632,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(submatj->sbuf2),&(submatj->req_size),&(submatj
->req_source1))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2632,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2633
2634 if (submatj->rbuf1) {
2635 ierr = PetscFree(submatj->rbuf1[0])((*PetscTrFree)((void*)(submatj->rbuf1[0]),2635,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rbuf1[0]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2635,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2636 ierr = PetscFree(submatj->rbuf1)((*PetscTrFree)((void*)(submatj->rbuf1),2636,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rbuf1) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2636,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2637 }
2638
2639 for (i=0; i<submatj->nrqs; ++i) {
2640 ierr = PetscFree(submatj->rbuf3[i])((*PetscTrFree)((void*)(submatj->rbuf3[i]),2640,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rbuf3[i]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2640,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2641 }
2642 ierr = PetscFree3(submatj->req_source2,submatj->rbuf2,submatj->rbuf3)PetscFreeA(3,2642,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(submatj->req_source2),&(submatj->rbuf2),&
(submatj->rbuf3))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2642,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2643 ierr = PetscFree(submatj->pa)((*PetscTrFree)((void*)(submatj->pa),2643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->pa) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2644 }
2645
2646#if defined(PETSC_USE_CTABLE1)
2647 ierr = PetscTableDestroy((PetscTable*)&submatj->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2647,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2648 if (submatj->cmap_loc) {ierr = PetscFree(submatj->cmap_loc)((*PetscTrFree)((void*)(submatj->cmap_loc),2648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->cmap_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
2649 ierr = PetscFree(submatj->rmap_loc)((*PetscTrFree)((void*)(submatj->rmap_loc),2649,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rmap_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2649,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2650#else
2651 ierr = PetscFree(submatj->rmap)((*PetscTrFree)((void*)(submatj->rmap),2651,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2651,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2652#endif
2653
2654 if (!submatj->allcolumns) {
2655#if defined(PETSC_USE_CTABLE1)
2656 ierr = PetscTableDestroy((PetscTable*)&submatj->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2656,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2657#else
2658 ierr = PetscFree(submatj->cmap)((*PetscTrFree)((void*)(submatj->cmap),2658,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->cmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2658,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2659#endif
2660 }
2661 ierr = PetscFree(submatj->row2proc)((*PetscTrFree)((void*)(submatj->row2proc),2661,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->row2proc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2661,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2662
2663 ierr = PetscFree(submatj)((*PetscTrFree)((void*)(submatj),2663,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2663,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2664 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2665}
2666
2667PetscErrorCode MatDestroySubMatrix_SeqAIJ(Mat C)
2668{
2669 PetscErrorCode ierr;
2670 Mat_SeqAIJ *c = (Mat_SeqAIJ*)C->data;
2671 Mat_SubSppt *submatj = c->submatis1;
2672
2673 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2673; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2674 ierr = (*submatj->destroy)(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2674,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2675 ierr = MatDestroySubMatrix_Private(submatj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2675,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2676 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2677}
2678
2679PetscErrorCode MatDestroySubMatrices_SeqAIJ(PetscInt n,Mat *mat[])
2680{
2681 PetscErrorCode ierr;
2682 PetscInt i;
2683 Mat C;
2684 Mat_SeqAIJ *c;
2685 Mat_SubSppt *submatj;
2686
2687 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2687; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2688 for (i=0; i<n; i++) {
2689 C = (*mat)[i];
2690 c = (Mat_SeqAIJ*)C->data;
2691 submatj = c->submatis1;
2692 if (submatj) {
2693 if (--((PetscObject)C)->refct <= 0) {
2694 ierr = (*submatj->destroy)(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2694,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2695 ierr = MatDestroySubMatrix_Private(submatj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2695,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2696 ierr = PetscFree(C->defaultvectype)((*PetscTrFree)((void*)(C->defaultvectype),2696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((C->defaultvectype) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2697 ierr = PetscLayoutDestroy(&C->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2697,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2698 ierr = PetscLayoutDestroy(&C->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2699 ierr = PetscHeaderDestroy(&C)(PetscHeaderDestroy_Private((PetscObject)(*&C)) || ((*PetscTrFree
)((void*)(*&C),2699,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*&C) = 0,0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2699,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2700 }
2701 } else {
2702 ierr = MatDestroy(&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2702,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2703 }
2704 }
2705
2706 /* Destroy Dummy submatrices created for reuse */
2707 ierr = MatDestroySubMatrices_Dummy(n,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2707,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2708
2709 ierr = PetscFree(*mat)((*PetscTrFree)((void*)(*mat),2709,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*mat) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2709,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2710 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2711}
2712
2713PetscErrorCode MatCreateSubMatrices_SeqAIJ(Mat A,PetscInt n,const IS irow[],const IS icol[],MatReuse scall,Mat *B[])
2714{
2715 PetscErrorCode ierr;
2716 PetscInt i;
2717
2718 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2718; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2719 if (scall == MAT_INITIAL_MATRIX) {
2720 ierr = PetscCalloc1(n+1,B)PetscMallocA(1,PETSC_TRUE,2720,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n+1)*sizeof(**(B)),(B))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2720,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2721 }
2722
2723 for (i=0; i<n; i++) {
2724 ierr = MatCreateSubMatrix_SeqAIJ(A,irow[i],icol[i],PETSC_DECIDE-1,scall,&(*B)[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2724,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2725 }
2726 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2727}
2728
2729PetscErrorCode MatIncreaseOverlap_SeqAIJ(Mat A,PetscInt is_max,IS is[],PetscInt ov)
2730{
2731 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2732 PetscErrorCode ierr;
2733 PetscInt row,i,j,k,l,m,n,*nidx,isz,val;
2734 const PetscInt *idx;
2735 PetscInt start,end,*ai,*aj;
2736 PetscBT table;
2737
2738 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2738; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2739 m = A->rmap->n;
2740 ai = a->i;
2741 aj = a->j;
2742
2743 if (ov < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"illegal negative overlap value used")return PetscError(((MPI_Comm)0x44000001),2743,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"illegal negative overlap value used"
)
;
2744
2745 ierr = PetscMalloc1(m+1,&nidx)PetscMallocA(1,PETSC_FALSE,2745,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m+1)*sizeof(**(&nidx)),(&nidx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2745,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2746 ierr = PetscBTCreate(m,&table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2746,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2747
2748 for (i=0; i<is_max; i++) {
2749 /* Initialize the two local arrays */
2750 isz = 0;
2751 ierr = PetscBTMemzero(m,table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2751,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2752
2753 /* Extract the indices, assume there can be duplicate entries */
2754 ierr = ISGetIndices(is[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2754,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2755 ierr = ISGetLocalSize(is[i],&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2755,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2756
2757 /* Enter these into the temp arrays. I.e., mark table[row], enter row into new index */
2758 for (j=0; j<n; ++j) {
2759 if (!PetscBTLookupSet(table,idx[j])) nidx[isz++] = idx[j];
2760 }
2761 ierr = ISRestoreIndices(is[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2761,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2762 ierr = ISDestroy(&is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2762,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2763
2764 k = 0;
2765 for (j=0; j<ov; j++) { /* for each overlap */
2766 n = isz;
2767 for (; k<n; k++) { /* do only those rows in nidx[k], which are not done yet */
2768 row = nidx[k];
2769 start = ai[row];
2770 end = ai[row+1];
2771 for (l = start; l<end; l++) {
2772 val = aj[l];
2773 if (!PetscBTLookupSet(table,val)) nidx[isz++] = val;
2774 }
2775 }
2776 }
2777 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),isz,nidx,PETSC_COPY_VALUES,(is+i));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2777,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2778 }
2779 ierr = PetscBTDestroy(&table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2779,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2780 ierr = PetscFree(nidx)((*PetscTrFree)((void*)(nidx),2780,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((nidx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2780,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2781 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2782}
2783
2784/* -------------------------------------------------------------- */
2785PetscErrorCode MatPermute_SeqAIJ(Mat A,IS rowp,IS colp,Mat *B)
2786{
2787 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2788 PetscErrorCode ierr;
2789 PetscInt i,nz = 0,m = A->rmap->n,n = A->cmap->n;
2790 const PetscInt *row,*col;
2791 PetscInt *cnew,j,*lens;
2792 IS icolp,irowp;
2793 PetscInt *cwork = NULL((void*)0);
2794 PetscScalar *vwork = NULL((void*)0);
2795
2796 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2796; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2797 ierr = ISInvertPermutation(rowp,PETSC_DECIDE-1,&irowp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2797,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2798 ierr = ISGetIndices(irowp,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2798,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2799 ierr = ISInvertPermutation(colp,PETSC_DECIDE-1,&icolp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2799,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2800 ierr = ISGetIndices(icolp,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2800,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2801
2802 /* determine lengths of permuted rows */
2803 ierr = PetscMalloc1(m+1,&lens)PetscMallocA(1,PETSC_FALSE,2803,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m+1)*sizeof(**(&lens)),(&lens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2803,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2804 for (i=0; i<m; i++) lens[row[i]] = a->i[i+1] - a->i[i];
2805 ierr = MatCreate(PetscObjectComm((PetscObject)A),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2805,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2806 ierr = MatSetSizes(*B,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2806,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2807 ierr = MatSetBlockSizesFromMats(*B,A,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2807,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2808 ierr = MatSetType(*B,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2808,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2809 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*B,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2809,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2810 ierr = PetscFree(lens)((*PetscTrFree)((void*)(lens),2810,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2810,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2811
2812 ierr = PetscMalloc1(n,&cnew)PetscMallocA(1,PETSC_FALSE,2812,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n)*sizeof(**(&cnew)),(&cnew))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2812,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2813 for (i=0; i<m; i++) {
2814 ierr = MatGetRow_SeqAIJ(A,i,&nz,&cwork,&vwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2814,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2815 for (j=0; j<nz; j++) cnew[j] = col[cwork[j]];
2816 ierr = MatSetValues_SeqAIJ(*B,1,&row[i],nz,cnew,vwork,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2816,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2817 ierr = MatRestoreRow_SeqAIJ(A,i,&nz,&cwork,&vwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2817,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2818 }
2819 ierr = PetscFree(cnew)((*PetscTrFree)((void*)(cnew),2819,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((cnew) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2819,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2820
2821 (*B)->assembled = PETSC_FALSE;
2822
2823 ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2823,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2824 ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2824,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2825 ierr = ISRestoreIndices(irowp,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2825,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2826 ierr = ISRestoreIndices(icolp,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2826,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2827 ierr = ISDestroy(&irowp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2827,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2828 ierr = ISDestroy(&icolp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2828,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2829 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2830}
2831
2832PetscErrorCode MatCopy_SeqAIJ(Mat A,Mat B,MatStructure str)
2833{
2834 PetscErrorCode ierr;
2835
2836 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2836; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2837 /* If the two matrices have the same copy implementation, use fast copy. */
2838 if (str == SAME_NONZERO_PATTERN && (A->ops->copy == B->ops->copy)) {
2839 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2840 Mat_SeqAIJ *b = (Mat_SeqAIJ*)B->data;
2841
2842 if (a->i[A->rmap->n] != b->i[B->rmap->n]) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Number of nonzeros in two matrices are different")return PetscError(((MPI_Comm)0x44000001),2842,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,75,PETSC_ERROR_INITIAL,"Number of nonzeros in two matrices are different"
)
;
2843 ierr = PetscMemcpy(b->a,a->a,(a->i[A->rmap->n])*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2843,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2844 ierr = PetscObjectStateIncrease((PetscObject)B)(((PetscObject)B)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2844,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2845 } else {
2846 ierr = MatCopy_Basic(A,B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2846,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2847 }
2848 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2849}
2850
2851PetscErrorCode MatSetUp_SeqAIJ(Mat A)
2852{
2853 PetscErrorCode ierr;
2854
2855 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2855; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2856 ierr = MatSeqAIJSetPreallocation_SeqAIJ(A,PETSC_DEFAULT-2,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2856,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2857 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2858}
2859
2860PetscErrorCode MatSeqAIJGetArray_SeqAIJ(Mat A,PetscScalar *array[])
2861{
2862 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2863
2864 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2864; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2865 *array = a->a;
2866 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2867}
2868
2869PetscErrorCode MatSeqAIJRestoreArray_SeqAIJ(Mat A,PetscScalar *array[])
2870{
2871 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2871; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2872 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2873}
2874
2875/*
2876 Computes the number of nonzeros per row needed for preallocation when X and Y
2877 have different nonzero structure.
2878*/
2879PetscErrorCode MatAXPYGetPreallocation_SeqX_private(PetscInt m,const PetscInt *xi,const PetscInt *xj,const PetscInt *yi,const PetscInt *yj,PetscInt *nnz)
2880{
2881 PetscInt i,j,k,nzx,nzy;
2882
2883 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2883; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2884 /* Set the number of nonzeros in the new matrix */
2885 for (i=0; i<m; i++) {
2886 const PetscInt *xjj = xj+xi[i],*yjj = yj+yi[i];
2887 nzx = xi[i+1] - xi[i];
2888 nzy = yi[i+1] - yi[i];
2889 nnz[i] = 0;
2890 for (j=0,k=0; j<nzx; j++) { /* Point in X */
2891 for (; k<nzy && yjj[k]<xjj[j]; k++) nnz[i]++; /* Catch up to X */
2892 if (k<nzy && yjj[k]==xjj[j]) k++; /* Skip duplicate */
2893 nnz[i]++;
2894 }
2895 for (; k<nzy; k++) nnz[i]++;
2896 }
2897 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2898}
2899
2900PetscErrorCode MatAXPYGetPreallocation_SeqAIJ(Mat Y,Mat X,PetscInt *nnz)
2901{
2902 PetscInt m = Y->rmap->N;
2903 Mat_SeqAIJ *x = (Mat_SeqAIJ*)X->data;
2904 Mat_SeqAIJ *y = (Mat_SeqAIJ*)Y->data;
2905 PetscErrorCode ierr;
2906
2907 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2907; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2908 /* Set the number of nonzeros in the new matrix */
2909 ierr = MatAXPYGetPreallocation_SeqX_private(m,x->i,x->j,y->i,y->j,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2909,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2910 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2911}
2912
2913PetscErrorCode MatAXPY_SeqAIJ(Mat Y,PetscScalar a,Mat X,MatStructure str)
2914{
2915 PetscErrorCode ierr;
2916 Mat_SeqAIJ *x = (Mat_SeqAIJ*)X->data,*y = (Mat_SeqAIJ*)Y->data;
2917 PetscBLASInt one=1,bnz;
2918
2919 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2919; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2920 ierr = PetscBLASIntCast(x->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2920,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2921 if (str == SAME_NONZERO_PATTERN) {
2922 PetscScalar alpha = a;
2923 PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&bnz,&alpha,x->a,&one,y->a,&one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASaxpy"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2923; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
daxpy_(&bnz,&alpha,x->a,&one,y->a,&one
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(2923
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),2923,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} while(0); do { ; if (petscstack &&
petscstack->currentsize > 0) { petscstack->currentsize
--; petscstack->function[petscstack->currentsize] = 0; petscstack
->file[petscstack->currentsize] = 0; petscstack->line
[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); }
while (0); } while(0)
;
2924 ierr = MatSeqAIJInvalidateDiagonal(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2924,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2925 ierr = PetscObjectStateIncrease((PetscObject)Y)(((PetscObject)Y)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2925,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2926 } else if (str == SUBSET_NONZERO_PATTERN) { /* nonzeros of X is a subset of Y's */
2927 ierr = MatAXPY_Basic(Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2927,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2928 } else {
2929 Mat B;
2930 PetscInt *nnz;
2931 ierr = PetscMalloc1(Y->rmap->N,&nnz)PetscMallocA(1,PETSC_FALSE,2931,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(Y->rmap->N)*sizeof(**(&nnz)),(&nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2931,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2932 ierr = MatCreate(PetscObjectComm((PetscObject)Y),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2932,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2933 ierr = PetscObjectSetName((PetscObject)B,((PetscObject)Y)->name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2933,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2934 ierr = MatSetSizes(B,Y->rmap->n,Y->cmap->n,Y->rmap->N,Y->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2934,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2935 ierr = MatSetBlockSizesFromMats(B,Y,Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2935,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2936 ierr = MatSetType(B,(MatType) ((PetscObject)Y)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2936,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2937 ierr = MatAXPYGetPreallocation_SeqAIJ(Y,X,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2937,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2938 ierr = MatSeqAIJSetPreallocation(B,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2938,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2939 ierr = MatAXPY_BasicWithPreallocation(B,Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2939,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2940 ierr = MatHeaderReplace(Y,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2940,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2941 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),2941,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2941,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2942 }
2943 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2944}
2945
2946PetscErrorCode MatConjugate_SeqAIJ(Mat mat)
2947{
2948#if defined(PETSC_USE_COMPLEX)
2949 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
2950 PetscInt i,nz;
2951 PetscScalar *a;
2952
2953 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2953; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2954 nz = aij->nz;
2955 a = aij->a;
2956 for (i=0; i<nz; i++) a[i] = PetscConj(a[i])(a[i]);
2957#else
2958 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2958; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2959#endif
2960 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2961}
2962
2963PetscErrorCode MatGetRowMaxAbs_SeqAIJ(Mat A,Vec v,PetscInt idx[])
2964{
2965 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2966 PetscErrorCode ierr;
2967 PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n;
2968 PetscReal atmp;
2969 PetscScalar *x;
2970 MatScalar *aa;
2971
2972 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2972; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2973 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),2973,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
2974 aa = a->a;
2975 ai = a->i;
2976 aj = a->j;
2977
2978 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2978,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2979 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2979,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2980 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2980,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2981 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),2981,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
2982 for (i=0; i<m; i++) {
2983 ncols = ai[1] - ai[0]; ai++;
2984 x[i] = 0.0;
2985 for (j=0; j<ncols; j++) {
2986 atmp = PetscAbsScalar(*aa);
2987 if (PetscAbsScalar(x[i]) < atmp) {x[i] = atmp; if (idx) idx[i] = *aj;}
2988 aa++; aj++;
2989 }
2990 }
2991 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2991,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2992 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2993}
2994
2995PetscErrorCode MatGetRowMax_SeqAIJ(Mat A,Vec v,PetscInt idx[])
2996{
2997 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2998 PetscErrorCode ierr;
2999 PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n;
3000 PetscScalar *x;
3001 MatScalar *aa;
3002
3003 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3003; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3004 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3004,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3005 aa = a->a;
3006 ai = a->i;
3007 aj = a->j;
3008
3009 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3009,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3010 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3010,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3011 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3011,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3012 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),3012,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
3013 for (i=0; i<m; i++) {
3014 ncols = ai[1] - ai[0]; ai++;
3015 if (ncols == A->cmap->n) { /* row is dense */
3016 x[i] = *aa; if (idx) idx[i] = 0;
3017 } else { /* row is sparse so already KNOW maximum is 0.0 or higher */
3018 x[i] = 0.0;
3019 if (idx) {
3020 idx[i] = 0; /* in case ncols is zero */
3021 for (j=0;j<ncols;j++) { /* find first implicit 0.0 in the row */
3022 if (aj[j] > j) {
3023 idx[i] = j;
3024 break;
3025 }
3026 }
3027 }
3028 }
3029 for (j=0; j<ncols; j++) {
3030 if (PetscRealPart(x[i])(x[i]) < PetscRealPart(*aa)(*aa)) {x[i] = *aa; if (idx) idx[i] = *aj;}
3031 aa++; aj++;
3032 }
3033 }
3034 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3034,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3035 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3036}
3037
3038PetscErrorCode MatGetRowMinAbs_SeqAIJ(Mat A,Vec v,PetscInt idx[])
3039{
3040 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
3041 PetscErrorCode ierr;
3042 PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n;
3043 PetscReal atmp;
3044 PetscScalar *x;
3045 MatScalar *aa;
3046
3047 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3047; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3048 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3049 aa = a->a;
3050 ai = a->i;
3051 aj = a->j;
3052
3053 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3053,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3054 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3054,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3055 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3055,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3056 if (n != A->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector, %D vs. %D rows", A->rmap->n, n)do {if (__builtin_expect(!!(60),0)) {PetscError(((MPI_Comm)0x44000001
),3056,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
60);}} while (0)
;
3057 for (i=0; i<m; i++) {
3058 ncols = ai[1] - ai[0]; ai++;
3059 if (ncols) {
3060 /* Get first nonzero */
3061 for (j = 0; j < ncols; j++) {
3062 atmp = PetscAbsScalar(aa[j]);
3063 if (atmp > 1.0e-12) {
3064 x[i] = atmp;
3065 if (idx) idx[i] = aj[j];
3066 break;
3067 }
3068 }
3069 if (j == ncols) {x[i] = PetscAbsScalar(*aa); if (idx) idx[i] = *aj;}
3070 } else {
3071 x[i] = 0.0; if (idx) idx[i] = 0;
3072 }
3073 for (j = 0; j < ncols; j++) {
3074 atmp = PetscAbsScalar(*aa);
3075 if (atmp > 1.0e-12 && PetscAbsScalar(x[i]) > atmp) {x[i] = atmp; if (idx) idx[i] = *aj;}
3076 aa++; aj++;
3077 }
3078 }
3079 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3079,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3080 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3081}
3082
3083PetscErrorCode MatGetRowMin_SeqAIJ(Mat A,Vec v,PetscInt idx[])
3084{
3085 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
3086 PetscErrorCode ierr;
3087 PetscInt i,j,m = A->rmap->n,ncols,n;
3088 const PetscInt *ai,*aj;
3089 PetscScalar *x;
3090 const MatScalar *aa;
3091
3092 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3092; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3093 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3093,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3094 aa = a->a;
3095 ai = a->i;
3096 aj = a->j;
3097
3098 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3098,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3099 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3099,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3100 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3100,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3101 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),3101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
3102 for (i=0; i<m; i++) {
3103 ncols = ai[1] - ai[0]; ai++;
3104 if (ncols == A->cmap->n) { /* row is dense */
3105 x[i] = *aa; if (idx) idx[i] = 0;
3106 } else { /* row is sparse so already KNOW minimum is 0.0 or lower */
3107 x[i] = 0.0;
3108 if (idx) { /* find first implicit 0.0 in the row */
3109 idx[i] = 0; /* in case ncols is zero */
3110 for (j=0; j<ncols; j++) {
3111 if (aj[j] > j) {
3112 idx[i] = j;
3113 break;
3114 }
3115 }
3116 }
3117 }
3118 for (j=0; j<ncols; j++) {
3119 if (PetscRealPart(x[i])(x[i]) > PetscRealPart(*aa)(*aa)) {x[i] = *aa; if (idx) idx[i] = *aj;}
3120 aa++; aj++;
3121 }
3122 }
3123 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3123,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3124 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3125}
3126
3127PetscErrorCode MatInvertBlockDiagonal_SeqAIJ(Mat A,const PetscScalar **values)
3128{
3129 Mat_SeqAIJ *a = (Mat_SeqAIJ*) A->data;
3130 PetscErrorCode ierr;
3131 PetscInt i,bs = PetscAbs(A->rmap->bs)(((A->rmap->bs) >= 0) ? (A->rmap->bs) : (-(A->
rmap->bs)))
,mbs = A->rmap->n/bs,ipvt[5],bs2 = bs*bs,*v_pivots,ij[7],*IJ,j;
3132 MatScalar *diag,work[25],*v_work;
3133 const PetscReal shift = 0.0;
3134 PetscBool allowzeropivot,zeropivotdetected=PETSC_FALSE;
3135
3136 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3136; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3137 allowzeropivot = PetscNot(A->erroriffailure)((A->erroriffailure) ? PETSC_FALSE : PETSC_TRUE);
3138 if (a->ibdiagvalid) {
3139 if (values) *values = a->ibdiag;
3140 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3141 }
3142 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3142,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3143 if (!a->ibdiag) {
3144 ierr = PetscMalloc1(bs2*mbs,&a->ibdiag)PetscMallocA(1,PETSC_FALSE,3144,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(bs2*mbs)*sizeof(**(&a->ibdiag)),(&a->
ibdiag))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3144,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3145 ierr = PetscLogObjectMemory((PetscObject)A,bs2*mbs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3145,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3146 }
3147 diag = a->ibdiag;
3148 if (values) *values = a->ibdiag;
3149 /* factor and invert each block */
3150 switch (bs) {
3151 case 1:
3152 for (i=0; i<mbs; i++) {
3153 ierr = MatGetValues(A,1,&i,1,&i,diag+i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3153,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3154 if (PetscAbsScalar(diag[i] + shift) < PETSC_MACHINE_EPSILON2.2204460492503131e-16) {
3155 if (allowzeropivot) {
3156 A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3157 A->factorerror_zeropivot_value = PetscAbsScalar(diag[i]);
3158 A->factorerror_zeropivot_row = i;
3159 ierr = PetscInfo3(A,"Zero pivot, row %D pivot %g tolerance %g\n",i,(double)PetscAbsScalar(diag[i]),(double)PETSC_MACHINE_EPSILON)PetscInfo_Private(__func__,A,"Zero pivot, row %D pivot %g tolerance %g\n"
,i,(double)PetscAbsScalar(diag[i]),(double)2.2204460492503131e-16
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3160 } else SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_MAT_LU_ZRPVT,"Zero pivot, row %D pivot %g tolerance %g",i,(double)PetscAbsScalar(diag[i]),(double)PETSC_MACHINE_EPSILON)do {if (__builtin_expect(!!(71),0)) {PetscError(((MPI_Comm)0x44000001
),3160,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,71,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
71);}} while (0)
;
3161 }
3162 diag[i] = (PetscScalar)1.0 / (diag[i] + shift);
3163 }
3164 break;
3165 case 2:
3166 for (i=0; i<mbs; i++) {
3167 ij[0] = 2*i; ij[1] = 2*i + 1;
3168 ierr = MatGetValues(A,2,ij,2,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3168,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3169 ierr = PetscKernel_A_gets_inverse_A_2(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3170 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3171 ierr = PetscKernel_A_gets_transpose_A_2(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3171,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3172 diag += 4;
3173 }
3174 break;
3175 case 3:
3176 for (i=0; i<mbs; i++) {
3177 ij[0] = 3*i; ij[1] = 3*i + 1; ij[2] = 3*i + 2;
3178 ierr = MatGetValues(A,3,ij,3,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3179 ierr = PetscKernel_A_gets_inverse_A_3(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3180 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3181 ierr = PetscKernel_A_gets_transpose_A_3(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3181,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3182 diag += 9;
3183 }
3184 break;
3185 case 4:
3186 for (i=0; i<mbs; i++) {
3187 ij[0] = 4*i; ij[1] = 4*i + 1; ij[2] = 4*i + 2; ij[3] = 4*i + 3;
3188 ierr = MatGetValues(A,4,ij,4,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3188,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3189 ierr = PetscKernel_A_gets_inverse_A_4(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3189,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3190 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3191 ierr = PetscKernel_A_gets_transpose_A_4(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3192 diag += 16;
3193 }
3194 break;
3195 case 5:
3196 for (i=0; i<mbs; i++) {
3197 ij[0] = 5*i; ij[1] = 5*i + 1; ij[2] = 5*i + 2; ij[3] = 5*i + 3; ij[4] = 5*i + 4;
3198 ierr = MatGetValues(A,5,ij,5,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3199 ierr = PetscKernel_A_gets_inverse_A_5(diag,ipvt,work,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3199,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3200 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3201 ierr = PetscKernel_A_gets_transpose_A_5(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3202 diag += 25;
3203 }
3204 break;
3205 case 6:
3206 for (i=0; i<mbs; i++) {
3207 ij[0] = 6*i; ij[1] = 6*i + 1; ij[2] = 6*i + 2; ij[3] = 6*i + 3; ij[4] = 6*i + 4; ij[5] = 6*i + 5;
3208 ierr = MatGetValues(A,6,ij,6,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3209 ierr = PetscKernel_A_gets_inverse_A_6(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3210 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3211 ierr = PetscKernel_A_gets_transpose_A_6(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3212 diag += 36;
3213 }
3214 break;
3215 case 7:
3216 for (i=0; i<mbs; i++) {
3217 ij[0] = 7*i; ij[1] = 7*i + 1; ij[2] = 7*i + 2; ij[3] = 7*i + 3; ij[4] = 7*i + 4; ij[5] = 7*i + 5; ij[5] = 7*i + 6;
3218 ierr = MatGetValues(A,7,ij,7,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3219 ierr = PetscKernel_A_gets_inverse_A_7(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3219,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3220 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3221 ierr = PetscKernel_A_gets_transpose_A_7(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3222 diag += 49;
3223 }
3224 break;
3225 default:
3226 ierr = PetscMalloc3(bs,&v_work,bs,&v_pivots,bs,&IJ)PetscMallocA(3,PETSC_FALSE,3226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(bs)*sizeof(**(&v_work)),(&v_work),(size_t)(
bs)*sizeof(**(&v_pivots)),(&v_pivots),(size_t)(bs)*sizeof
(**(&IJ)),(&IJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3227 for (i=0; i<mbs; i++) {
3228 for (j=0; j<bs; j++) {
3229 IJ[j] = bs*i + j;
3230 }
3231 ierr = MatGetValues(A,bs,IJ,bs,IJ,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3231,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3232 ierr = PetscKernel_A_gets_inverse_A(bs,diag,v_pivots,v_work,allowzeropivot,&zeropivotdetected)(PetscLINPACKgefa((diag),(bs),(v_pivots),(allowzeropivot),(&
zeropivotdetected)) || PetscLINPACKgedi((diag),(bs),(v_pivots
),(v_work)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3232,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3233 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3234 ierr = PetscKernel_A_gets_transpose_A_N(diag,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3235 diag += bs2;
3236 }
3237 ierr = PetscFree3(v_work,v_pivots,IJ)PetscFreeA(3,3237,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(v_work),&(v_pivots),&(IJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3237,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3238 }
3239 a->ibdiagvalid = PETSC_TRUE;
3240 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3241}
3242
3243static PetscErrorCode MatSetRandom_SeqAIJ(Mat x,PetscRandom rctx)
3244{
3245 PetscErrorCode ierr;
3246 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)x->data;
3247 PetscScalar a;
3248 PetscInt m,n,i,j,col;
3249
3250 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3250; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3251 if (!x->assembled) {
3252 ierr = MatGetSize(x,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3252,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3253 for (i=0; i<m; i++) {
3254 for (j=0; j<aij->imax[i]; j++) {
3255 ierr = PetscRandomGetValue(rctx,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3255,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3256 col = (PetscInt)(n*PetscRealPart(a)(a));
3257 ierr = MatSetValues(x,1,&i,1,&col,&a,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3257,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3258 }
3259 }
3260 } else {
3261 for (i=0; i<aij->nz; i++) {ierr = PetscRandomGetValue(rctx,aij->a+i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
3262 }
3263 ierr = MatAssemblyBegin(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3263,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3264 ierr = MatAssemblyEnd(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3264,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3265 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3266}
3267
3268/* Like MatSetRandom_SeqAIJ, but do not set values on columns in range of [low, high) */
3269PetscErrorCode MatSetRandomSkipColumnRange_SeqAIJ_Private(Mat x,PetscInt low,PetscInt high,PetscRandom rctx)
3270{
3271 PetscErrorCode ierr;
3272 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)x->data;
3273 PetscScalar a;
3274 PetscInt m,n,i,j,col,nskip;
3275
3276 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3276; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3277 nskip = high - low;
3278 ierr = MatGetSize(x,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3278,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3279 n -= nskip; /* shrink number of columns where nonzeros can be set */
3280 for (i=0; i<m; i++) {
3281 for (j=0; j<aij->imax[i]; j++) {
3282 ierr = PetscRandomGetValue(rctx,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3282,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3283 col = (PetscInt)(n*PetscRealPart(a)(a));
3284 if (col >= low) col += nskip; /* shift col rightward to skip the hole */
3285 ierr = MatSetValues(x,1,&i,1,&col,&a,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3285,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3286 }
3287 }
3288 ierr = MatAssemblyBegin(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3288,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3289 ierr = MatAssemblyEnd(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3289,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3290 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3291}
3292
3293
3294/* -------------------------------------------------------------------*/
3295static struct _MatOps MatOps_Values = { MatSetValues_SeqAIJ,
3296 MatGetRow_SeqAIJ,
3297 MatRestoreRow_SeqAIJ,
3298 MatMult_SeqAIJ,
3299 /* 4*/ MatMultAdd_SeqAIJ,
3300 MatMultTranspose_SeqAIJ,
3301 MatMultTransposeAdd_SeqAIJ,
3302 0,
3303 0,
3304 0,
3305 /* 10*/ 0,
3306 MatLUFactor_SeqAIJ,
3307 0,
3308 MatSOR_SeqAIJ,
3309 MatTranspose_SeqAIJ_FAST,
3310 /*1 5*/ MatGetInfo_SeqAIJ,
3311 MatEqual_SeqAIJ,
3312 MatGetDiagonal_SeqAIJ,
3313 MatDiagonalScale_SeqAIJ,
3314 MatNorm_SeqAIJ,
3315 /* 20*/ 0,
3316 MatAssemblyEnd_SeqAIJ,
3317 MatSetOption_SeqAIJ,
3318 MatZeroEntries_SeqAIJ,
3319 /* 24*/ MatZeroRows_SeqAIJ,
3320 0,
3321 0,
3322 0,
3323 0,
3324 /* 29*/ MatSetUp_SeqAIJ,
3325 0,
3326 0,
3327 0,
3328 0,
3329 /* 34*/ MatDuplicate_SeqAIJ,
3330 0,
3331 0,
3332 MatILUFactor_SeqAIJ,
3333 0,
3334 /* 39*/ MatAXPY_SeqAIJ,
3335 MatCreateSubMatrices_SeqAIJ,
3336 MatIncreaseOverlap_SeqAIJ,
3337 MatGetValues_SeqAIJ,
3338 MatCopy_SeqAIJ,
3339 /* 44*/ MatGetRowMax_SeqAIJ,
3340 MatScale_SeqAIJ,
3341 MatShift_SeqAIJ,
3342 MatDiagonalSet_SeqAIJ,
3343 MatZeroRowsColumns_SeqAIJ,
3344 /* 49*/ MatSetRandom_SeqAIJ,
3345 MatGetRowIJ_SeqAIJ,
3346 MatRestoreRowIJ_SeqAIJ,
3347 MatGetColumnIJ_SeqAIJ,
3348 MatRestoreColumnIJ_SeqAIJ,
3349 /* 54*/ MatFDColoringCreate_SeqXAIJ,
3350 0,
3351 0,
3352 MatPermute_SeqAIJ,
3353 0,
3354 /* 59*/ 0,
3355 MatDestroy_SeqAIJ,
3356 MatView_SeqAIJ,
3357 0,
3358 MatMatMatMult_SeqAIJ_SeqAIJ_SeqAIJ,
3359 /* 64*/ MatMatMatMultSymbolic_SeqAIJ_SeqAIJ_SeqAIJ,
3360 MatMatMatMultNumeric_SeqAIJ_SeqAIJ_SeqAIJ,
3361 0,
3362 0,
3363 0,
3364 /* 69*/ MatGetRowMaxAbs_SeqAIJ,
3365 MatGetRowMinAbs_SeqAIJ,
3366 0,
3367 0,
3368 0,
3369 /* 74*/ 0,
3370 MatFDColoringApply_AIJ,
3371 0,
3372 0,
3373 0,
3374 /* 79*/ MatFindZeroDiagonals_SeqAIJ,
3375 0,
3376 0,
3377 0,
3378 MatLoad_SeqAIJ,
3379 /* 84*/ MatIsSymmetric_SeqAIJ,
3380 MatIsHermitian_SeqAIJ,
3381 0,
3382 0,
3383 0,
3384 /* 89*/ MatMatMult_SeqAIJ_SeqAIJ,
3385 MatMatMultSymbolic_SeqAIJ_SeqAIJ,
3386 MatMatMultNumeric_SeqAIJ_SeqAIJ,
3387 MatPtAP_SeqAIJ_SeqAIJ,
3388 MatPtAPSymbolic_SeqAIJ_SeqAIJ_SparseAxpy,
3389 /* 94*/ MatPtAPNumeric_SeqAIJ_SeqAIJ_SparseAxpy,
3390 MatMatTransposeMult_SeqAIJ_SeqAIJ,
3391 MatMatTransposeMultSymbolic_SeqAIJ_SeqAIJ,
3392 MatMatTransposeMultNumeric_SeqAIJ_SeqAIJ,
3393 0,
3394 /* 99*/ 0,
3395 0,
3396 0,
3397 MatConjugate_SeqAIJ,
3398 0,
3399 /*104*/ MatSetValuesRow_SeqAIJ,
3400 MatRealPart_SeqAIJ,
3401 MatImaginaryPart_SeqAIJ,
3402 0,
3403 0,
3404 /*109*/ MatMatSolve_SeqAIJ,
3405 0,
3406 MatGetRowMin_SeqAIJ,
3407 0,
3408 MatMissingDiagonal_SeqAIJ,
3409 /*114*/ 0,
3410 0,
3411 0,
3412 0,
3413 0,
3414 /*119*/ 0,
3415 0,
3416 0,
3417 0,
3418 MatGetMultiProcBlock_SeqAIJ,
3419 /*124*/ MatFindNonzeroRows_SeqAIJ,
3420 MatGetColumnNorms_SeqAIJ,
3421 MatInvertBlockDiagonal_SeqAIJ,
3422 MatInvertVariableBlockDiagonal_SeqAIJ,
3423 0,
3424 /*129*/ 0,
3425 MatTransposeMatMult_SeqAIJ_SeqAIJ,
3426 MatTransposeMatMultSymbolic_SeqAIJ_SeqAIJ,
3427 MatTransposeMatMultNumeric_SeqAIJ_SeqAIJ,
3428 MatTransposeColoringCreate_SeqAIJ,
3429 /*134*/ MatTransColoringApplySpToDen_SeqAIJ,
3430 MatTransColoringApplyDenToSp_SeqAIJ,
3431 MatRARt_SeqAIJ_SeqAIJ,
3432 MatRARtSymbolic_SeqAIJ_SeqAIJ,
3433 MatRARtNumeric_SeqAIJ_SeqAIJ,
3434 /*139*/0,
3435 0,
3436 0,
3437 MatFDColoringSetUp_SeqXAIJ,
3438 MatFindOffBlockDiagonalEntries_SeqAIJ,
3439 /*144*/MatCreateMPIMatConcatenateSeqMat_SeqAIJ,
3440 MatDestroySubMatrices_SeqAIJ
3441};
3442
3443PetscErrorCode MatSeqAIJSetColumnIndices_SeqAIJ(Mat mat,PetscInt *indices)
3444{
3445 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3446 PetscInt i,nz,n;
3447
3448 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3448; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3449 nz = aij->maxnz;
3450 n = mat->rmap->n;
3451 for (i=0; i<nz; i++) {
3452 aij->j[i] = indices[i];
3453 }
3454 aij->nz = nz;
3455 for (i=0; i<n; i++) {
3456 aij->ilen[i] = aij->imax[i];
3457 }
3458 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3459}
3460
3461/*
3462 * When a sparse matrix has many zero columns, we should compact them out to save the space
3463 * This happens in MatPtAPSymbolic_MPIAIJ_MPIAIJ_scalable()
3464 * */
3465PetscErrorCode MatSeqAIJCompactOutExtraColumns_SeqAIJ(Mat mat, ISLocalToGlobalMapping *mapping)
3466{
3467 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3468 PetscTable gid1_lid1;
3469 PetscTablePosition tpos;
3470 PetscInt gid,lid,i,j,ncols,ec;
3471 PetscInt *garray;
3472 PetscErrorCode ierr;
3473
3474 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3474; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3475 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3475,
__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3475,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),3475,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3475,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3476 PetscValidPointer(mapping,2)do { if (!mapping) return PetscError(((MPI_Comm)0x44000001),3476
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(mapping,PETSC_CHAR)) return PetscError((
(MPI_Comm)0x44000001),3476,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
3477 /* use a table */
3478 ierr = PetscTableCreate(mat->rmap->n,mat->cmap->N+1,&gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3478,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3479 ec = 0;
3480 for (i=0; i<mat->rmap->n; i++) {
3481 ncols = aij->i[i+1] - aij->i[i];
3482 for (j=0; j<ncols; j++) {
3483 PetscInt data,gid1 = aij->j[aij->i[i] + j] + 1;
3484 ierr = PetscTableFind(gid1_lid1,gid1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3484,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3485 if (!data) {
3486 /* one based table */
3487 ierr = PetscTableAdd(gid1_lid1,gid1,++ec,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3488 }
3489 }
3490 }
3491 /* form array of columns we need */
3492 ierr = PetscMalloc1(ec+1,&garray)PetscMallocA(1,PETSC_FALSE,3492,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(ec+1)*sizeof(**(&garray)),(&garray))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3492,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3493 ierr = PetscTableGetHeadPosition(gid1_lid1,&tpos);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3494 while (tpos) {
3495 ierr = PetscTableGetNext(gid1_lid1,&tpos,&gid,&lid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3495,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3496 gid--;
3497 lid--;
3498 garray[lid] = gid;
3499 }
3500 ierr = PetscSortInt(ec,garray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3500,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* sort, and rebuild */
3501 ierr = PetscTableRemoveAll(gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3501,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3502 for (i=0; i<ec; i++) {
3503 ierr = PetscTableAdd(gid1_lid1,garray[i]+1,i+1,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3503,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3504 }
3505 /* compact out the extra columns in B */
3506 for (i=0; i<mat->rmap->n; i++) {
3507 ncols = aij->i[i+1] - aij->i[i];
3508 for (j=0; j<ncols; j++) {
3509 PetscInt gid1 = aij->j[aij->i[i] + j] + 1;
3510 ierr = PetscTableFind(gid1_lid1,gid1,&lid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3510,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3511 lid--;
3512 aij->j[aij->i[i] + j] = lid;
3513 }
3514 }
3515 mat->cmap->n = mat->cmap->N = ec;
3516 mat->cmap->bs = 1;
3517
3518 ierr = PetscTableDestroy(&gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3518,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3519 ierr = PetscLayoutSetUp((mat->cmap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3519,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3520 ierr = ISLocalToGlobalMappingCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),mat->cmap->bs,mat->cmap->n,garray,PETSC_OWN_POINTER,mapping);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3520,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3521 ierr = ISLocalToGlobalMappingSetType(*mapping,ISLOCALTOGLOBALMAPPINGHASH"hash");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3521,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3522 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3523}
3524
3525/*@
3526 MatSeqAIJSetColumnIndices - Set the column indices for all the rows
3527 in the matrix.
3528
3529 Input Parameters:
3530+ mat - the SeqAIJ matrix
3531- indices - the column indices
3532
3533 Level: advanced
3534
3535 Notes:
3536 This can be called if you have precomputed the nonzero structure of the
3537 matrix and want to provide it to the matrix object to improve the performance
3538 of the MatSetValues() operation.
3539
3540 You MUST have set the correct numbers of nonzeros per row in the call to
3541 MatCreateSeqAIJ(), and the columns indices MUST be sorted.
3542
3543 MUST be called before any calls to MatSetValues();
3544
3545 The indices should start with zero, not one.
3546
3547@*/
3548PetscErrorCode MatSeqAIJSetColumnIndices(Mat mat,PetscInt *indices)
3549{
3550 PetscErrorCode ierr;
3551
3552 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3552; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3553 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3553,
__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3553,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),3553,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3553,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3554 PetscValidPointer(indices,2)do { if (!indices) return PetscError(((MPI_Comm)0x44000001),3554
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(indices,PETSC_CHAR)) return PetscError((
(MPI_Comm)0x44000001),3554,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
3555 ierr = PetscUseMethod(mat,"MatSeqAIJSetColumnIndices_C",(Mat,PetscInt*),(mat,indices))0;{ PetscErrorCode (*f)(Mat,PetscInt*), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)mat),("MatSeqAIJSetColumnIndices_C"),(PetscVoidFunction
*)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError
(((MPI_Comm)0x44000001),3555,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(mat,indices);
do {if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm
)0x44000001),3555,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)mat),3555,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatSeqAIJSetColumnIndices_C"); }
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3555,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3556 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3557}
3558
3559/* ----------------------------------------------------------------------------------------*/
3560
3561PetscErrorCode MatStoreValues_SeqAIJ(Mat mat)
3562{
3563 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3564 PetscErrorCode ierr;
3565 size_t nz = aij->i[mat->rmap->n];
3566
3567 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3567; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3568 if (!aij->nonew) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first")return PetscError(((MPI_Comm)0x44000001),3568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,58,PETSC_ERROR_INITIAL,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first"
)
;
3569
3570 /* allocate space for values if not already there */
3571 if (!aij->saved_values) {
3572 ierr = PetscMalloc1(nz+1,&aij->saved_values)PetscMallocA(1,PETSC_FALSE,3572,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz+1)*sizeof(**(&aij->saved_values)),(&aij
->saved_values))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3572,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3573 ierr = PetscLogObjectMemory((PetscObject)mat,(nz+1)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3573,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3574 }
3575
3576 /* copy values over */
3577 ierr = PetscMemcpy(aij->saved_values,aij->a,nz*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3577,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3578 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3579}
3580
3581/*@
3582 MatStoreValues - Stashes a copy of the matrix values; this allows, for
3583 example, reuse of the linear part of a Jacobian, while recomputing the
3584 nonlinear portion.
3585
3586 Collect on Mat
3587
3588 Input Parameters:
3589. mat - the matrix (currently only AIJ matrices support this option)
3590
3591 Level: advanced
3592
3593 Common Usage, with SNESSolve():
3594$ Create Jacobian matrix
3595$ Set linear terms into matrix
3596$ Apply boundary conditions to matrix, at this time matrix must have
3597$ final nonzero structure (i.e. setting the nonlinear terms and applying
3598$ boundary conditions again will not change the nonzero structure
3599$ ierr = MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);
3600$ ierr = MatStoreValues(mat);
3601$ Call SNESSetJacobian() with matrix
3602$ In your Jacobian routine
3603$ ierr = MatRetrieveValues(mat);
3604$ Set nonlinear terms in matrix
3605
3606 Common Usage without SNESSolve(), i.e. when you handle nonlinear solve yourself:
3607$ // build linear portion of Jacobian
3608$ ierr = MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);
3609$ ierr = MatStoreValues(mat);
3610$ loop over nonlinear iterations
3611$ ierr = MatRetrieveValues(mat);
3612$ // call MatSetValues(mat,...) to set nonliner portion of Jacobian
3613$ // call MatAssemblyBegin/End() on matrix
3614$ Solve linear system with Jacobian
3615$ endloop
3616
3617 Notes:
3618 Matrix must already be assemblied before calling this routine
3619 Must set the matrix option MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE); before
3620 calling this routine.
3621
3622 When this is called multiple times it overwrites the previous set of stored values
3623 and does not allocated additional space.
3624
3625.seealso: MatRetrieveValues()
3626
3627@*/
3628PetscErrorCode MatStoreValues(Mat mat)
3629{
3630 PetscErrorCode ierr;
3631
3632 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3632; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3633 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3633,
__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3633,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),3633,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3633,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3634 if (!mat->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for unassembled matrix")return PetscError(((MPI_Comm)0x44000001),3634,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for unassembled matrix")
;
3635 if (mat->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3635,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3636 ierr = PetscUseMethod(mat,"MatStoreValues_C",(Mat),(mat))0;{ PetscErrorCode (*f)(Mat), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)mat),("MatStoreValues_C"),(PetscVoidFunction*)
(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError
(((MPI_Comm)0x44000001),3636,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(mat);do {if (
__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),3636,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)mat),3636,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatStoreValues_C"); }
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3636,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3637 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3638}
3639
3640PetscErrorCode MatRetrieveValues_SeqAIJ(Mat mat)
3641{
3642 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3643 PetscErrorCode ierr;
3644 PetscInt nz = aij->i[mat->rmap->n];
3645
3646 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3646; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3647 if (!aij->nonew) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first")return PetscError(((MPI_Comm)0x44000001),3647,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,58,PETSC_ERROR_INITIAL,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first"
)
;
3648 if (!aij->saved_values) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatStoreValues(A);first")return PetscError(((MPI_Comm)0x44000001),3648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,58,PETSC_ERROR_INITIAL,"Must call MatStoreValues(A);first")
;
3649 /* copy values over */
3650 ierr = PetscMemcpy(aij->a,aij->saved_values,nz*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3650,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3651 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3652}
3653
3654/*@
3655 MatRetrieveValues - Retrieves the copy of the matrix values; this allows, for
3656 example, reuse of the linear part of a Jacobian, while recomputing the
3657 nonlinear portion.
3658
3659 Collect on Mat
3660
3661 Input Parameters:
3662. mat - the matrix (currently only AIJ matrices support this option)
3663
3664 Level: advanced
3665
3666.seealso: MatStoreValues()
3667
3668@*/
3669PetscErrorCode MatRetrieveValues(Mat mat)
3670{
3671 PetscErrorCode ierr;
3672
3673 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3673; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3674 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3674,
__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3674,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),3674,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3674,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3675 if (!mat->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for unassembled matrix")return PetscError(((MPI_Comm)0x44000001),3675,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for unassembled matrix")
;
3676 if (mat->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3676,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3677 ierr = PetscUseMethod(mat,"MatRetrieveValues_C",(Mat),(mat))0;{ PetscErrorCode (*f)(Mat), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)mat),("MatRetrieveValues_C"),(PetscVoidFunction
*)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError
(((MPI_Comm)0x44000001),3677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(mat);do {if (
__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),3677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)mat),3677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatRetrieveValues_C"); }
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3678 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3679}
3680
3681
3682/* --------------------------------------------------------------------------------*/
3683/*@C
3684 MatCreateSeqAIJ - Creates a sparse matrix in AIJ (compressed row) format
3685 (the default parallel PETSc format). For good matrix assembly performance
3686 the user should preallocate the matrix storage by setting the parameter nz
3687 (or the array nnz). By setting these parameters accurately, performance
3688 during matrix assembly can be increased by more than a factor of 50.
3689
3690 Collective on MPI_Comm
3691
3692 Input Parameters:
3693+ comm - MPI communicator, set to PETSC_COMM_SELF
3694. m - number of rows
3695. n - number of columns
3696. nz - number of nonzeros per row (same for all rows)
3697- nnz - array containing the number of nonzeros in the various rows
3698 (possibly different for each row) or NULL
3699
3700 Output Parameter:
3701. A - the matrix
3702
3703 It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(),
3704 MatXXXXSetPreallocation() paradigm instead of this routine directly.
3705 [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation]
3706
3707 Notes:
3708 If nnz is given then nz is ignored
3709
3710 The AIJ format (also called the Yale sparse matrix format or
3711 compressed row storage), is fully compatible with standard Fortran 77
3712 storage. That is, the stored row and column indices can begin at
3713 either one (as in Fortran) or zero. See the users' manual for details.
3714
3715 Specify the preallocated storage with either nz or nnz (not both).
3716 Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory
3717 allocation. For large problems you MUST preallocate memory or you
3718 will get TERRIBLE performance, see the users' manual chapter on matrices.
3719
3720 By default, this format uses inodes (identical nodes) when possible, to
3721 improve numerical efficiency of matrix-vector products and solves. We
3722 search for consecutive rows with the same nonzero structure, thereby
3723 reusing matrix information to achieve increased efficiency.
3724
3725 Options Database Keys:
3726+ -mat_no_inode - Do not use inodes
3727- -mat_inode_limit <limit> - Sets inode limit (max limit=5)
3728
3729 Level: intermediate
3730
3731.seealso: MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays()
3732
3733@*/
3734PetscErrorCode MatCreateSeqAIJ(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[],Mat *A)
3735{
3736 PetscErrorCode ierr;
3737
3738 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3738; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3739 ierr = MatCreate(comm,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3739,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3740 ierr = MatSetSizes(*A,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3740,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3741 ierr = MatSetType(*A,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3741,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3742 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*A,nz,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3742,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3743 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3744}
3745
3746/*@C
3747 MatSeqAIJSetPreallocation - For good matrix assembly performance
3748 the user should preallocate the matrix storage by setting the parameter nz
3749 (or the array nnz). By setting these parameters accurately, performance
3750 during matrix assembly can be increased by more than a factor of 50.
3751
3752 Collective on MPI_Comm
3753
3754 Input Parameters:
3755+ B - The matrix
3756. nz - number of nonzeros per row (same for all rows)
3757- nnz - array containing the number of nonzeros in the various rows
3758 (possibly different for each row) or NULL
3759
3760 Notes:
3761 If nnz is given then nz is ignored
3762
3763 The AIJ format (also called the Yale sparse matrix format or
3764 compressed row storage), is fully compatible with standard Fortran 77
3765 storage. That is, the stored row and column indices can begin at
3766 either one (as in Fortran) or zero. See the users' manual for details.
3767
3768 Specify the preallocated storage with either nz or nnz (not both).
3769 Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory
3770 allocation. For large problems you MUST preallocate memory or you
3771 will get TERRIBLE performance, see the users' manual chapter on matrices.
3772
3773 You can call MatGetInfo() to get information on how effective the preallocation was;
3774 for example the fields mallocs,nz_allocated,nz_used,nz_unneeded;
3775 You can also run with the option -info and look for messages with the string
3776 malloc in them to see if additional memory allocation was needed.
3777
3778 Developers: Use nz of MAT_SKIP_ALLOCATION to not allocate any space for the matrix
3779 entries or columns indices
3780
3781 By default, this format uses inodes (identical nodes) when possible, to
3782 improve numerical efficiency of matrix-vector products and solves. We
3783 search for consecutive rows with the same nonzero structure, thereby
3784 reusing matrix information to achieve increased efficiency.
3785
3786 Options Database Keys:
3787+ -mat_no_inode - Do not use inodes
3788- -mat_inode_limit <limit> - Sets inode limit (max limit=5)
3789
3790 Level: intermediate
3791
3792.seealso: MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays(), MatGetInfo()
3793
3794@*/
3795PetscErrorCode MatSeqAIJSetPreallocation(Mat B,PetscInt nz,const PetscInt nnz[])
3796{
3797 PetscErrorCode ierr;
3798
3799 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3799; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3800 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3800,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3800,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if (
((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3800,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3800,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3801 PetscValidType(B,1)if (!((PetscObject)B)->type_name) do {if (__builtin_expect
(!!(73),0)) {PetscError(((MPI_Comm)0x44000001),3801,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",73
,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),73)
;}} while (0);
;
3802 ierr = PetscTryMethod(B,"MatSeqAIJSetPreallocation_C",(Mat,PetscInt,const PetscInt[]),(B,nz,nnz))0;{ PetscErrorCode (*f)(Mat,PetscInt,const PetscInt[]), __ierr
; __ierr = PetscObjectQueryFunction_Private(((PetscObject)B),
("MatSeqAIJSetPreallocation_C"),(PetscVoidFunction*)(&f))
;do {if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm
)0x44000001),3802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(B,nz,nnz);do {
if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),3802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} }
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3803 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3804}
3805
3806PetscErrorCode MatSeqAIJSetPreallocation_SeqAIJ(Mat B,PetscInt nz,const PetscInt *nnz)
3807{
3808 Mat_SeqAIJ *b;
3809 PetscBool skipallocation = PETSC_FALSE,realalloc = PETSC_FALSE;
3810 PetscErrorCode ierr;
3811 PetscInt i;
3812
3813 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3813; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3814 if (nz >= 0 || nnz) realalloc = PETSC_TRUE;
3815 if (nz == MAT_SKIP_ALLOCATION-4) {
3816 skipallocation = PETSC_TRUE;
3817 nz = 0;
3818 }
3819 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3819,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3820 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3820,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3821
3822 if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 5;
3823 if (nz < 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"nz cannot be less than 0: value %D",nz)return PetscError(((MPI_Comm)0x44000001),3823,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"nz cannot be less than 0: value %D",
nz)
;
3824 if (nnz) {
3825 for (i=0; i<B->rmap->n; i++) {
3826 if (nnz[i] < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"nnz cannot be less than 0: local row %D value %D",i,nnz[i])do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),3826,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
3827 if (nnz[i] > B->cmap->n) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"nnz cannot be greater than row length: local row %D value %d rowlength %D",i,nnz[i],B->cmap->n)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),3827,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
3828 }
3829 }
3830
3831 B->preallocated = PETSC_TRUE;
3832
3833 b = (Mat_SeqAIJ*)B->data;
3834
3835 if (!skipallocation) {
3836 if (!b->imax) {
3837 ierr = PetscMalloc2(B->rmap->n,&b->imax,B->rmap->n,&b->ilen)PetscMallocA(2,PETSC_FALSE,3837,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(B->rmap->n)*sizeof(**(&b->imax)),(&
b->imax),(size_t)(B->rmap->n)*sizeof(**(&b->ilen
)),(&b->ilen))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3837,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3838 ierr = PetscLogObjectMemory((PetscObject)B,2*B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3838,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3839 }
3840 if (!b->ipre) {
3841 ierr = PetscMalloc1(B->rmap->n,&b->ipre)PetscMallocA(1,PETSC_FALSE,3841,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(B->rmap->n)*sizeof(**(&b->ipre)),(&
b->ipre))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3841,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3842 ierr = PetscLogObjectMemory((PetscObject)B,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3842,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3843 }
3844 if (!nnz) {
3845 if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 10;
3846 else if (nz < 0) nz = 1;
3847 nz = PetscMin(nz,B->cmap->n)(((nz)<(B->cmap->n)) ? (nz) : (B->cmap->n));
3848 for (i=0; i<B->rmap->n; i++) b->imax[i] = nz;
3849 nz = nz*B->rmap->n;
3850 } else {
3851 nz = 0;
3852 for (i=0; i<B->rmap->n; i++) {b->imax[i] = nnz[i]; nz += nnz[i];}
3853 }
3854 /* b->ilen will count nonzeros in each row so far. */
3855 for (i=0; i<B->rmap->n; i++) b->ilen[i] = 0;
3856
3857 /* allocate the matrix space */
3858 /* FIXME: should B's old memory be unlogged? */
3859 ierr = MatSeqXAIJFreeAIJ(B,&b->a,&b->j,&b->i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3859,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3860 if (B->structure_only) {
3861 ierr = PetscMalloc1(nz,&b->j)PetscMallocA(1,PETSC_FALSE,3861,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz)*sizeof(**(&b->j)),(&b->j))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3861,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3862 ierr = PetscMalloc1(B->rmap->n+1,&b->i)PetscMallocA(1,PETSC_FALSE,3862,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(B->rmap->n+1)*sizeof(**(&b->i)),(&
b->i))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3862,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3863 ierr = PetscLogObjectMemory((PetscObject)B,(B->rmap->n+1)*sizeof(PetscInt)+nz*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3863,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3864 } else {
3865 ierr = PetscMalloc3(nz,&b->a,nz,&b->j,B->rmap->n+1,&b->i)PetscMallocA(3,PETSC_FALSE,3865,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz)*sizeof(**(&b->a)),(&b->a),(size_t
)(nz)*sizeof(**(&b->j)),(&b->j),(size_t)(B->
rmap->n+1)*sizeof(**(&b->i)),(&b->i))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3865,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3866 ierr = PetscLogObjectMemory((PetscObject)B,(B->rmap->n+1)*sizeof(PetscInt)+nz*(sizeof(PetscScalar)+sizeof(PetscInt)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3866,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3867 }
3868 b->i[0] = 0;
3869 for (i=1; i<B->rmap->n+1; i++) {
3870 b->i[i] = b->i[i-1] + b->imax[i-1];
3871 }
3872 if (B->structure_only) {
3873 b->singlemalloc = PETSC_FALSE;
3874 b->free_a = PETSC_FALSE;
3875 } else {
3876 b->singlemalloc = PETSC_TRUE;
3877 b->free_a = PETSC_TRUE;
3878 }
3879 b->free_ij = PETSC_TRUE;
3880 } else {
3881 b->free_a = PETSC_FALSE;
3882 b->free_ij = PETSC_FALSE;
3883 }
3884
3885 if (b->ipre && nnz != b->ipre && b->imax) {
3886 /* reserve user-requested sparsity */
3887 ierr = PetscMemcpy(b->ipre,b->imax,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3887,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3888 }
3889
3890
3891 b->nz = 0;
3892 b->maxnz = nz;
3893 B->info.nz_unneeded = (double)b->maxnz;
3894 if (realalloc) {
3895 ierr = MatSetOption(B,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3895,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3896 }
3897 B->was_assembled = PETSC_FALSE;
3898 B->assembled = PETSC_FALSE;
3899 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3900}
3901
3902
3903PetscErrorCode MatResetPreallocation_SeqAIJ(Mat A)
3904{
3905 Mat_SeqAIJ *a;
3906 PetscInt i;
3907 PetscErrorCode ierr;
3908
3909 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3909; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3910 PetscValidHeaderSpecific(A,MAT_CLASSID,1)do { if (!A) return PetscError(((MPI_Comm)0x44000001),3910,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(A,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3910,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(A))->classid != MAT_CLASSID) { if (
((PetscObject)(A))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3910,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3910,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3911 a = (Mat_SeqAIJ*)A->data;
3912 /* if no saved info, we error out */
3913 if (!a->ipre) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_ARG_NULL,"No saved preallocation info \n")return PetscError(PETSC_COMM_WORLD,3913,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"No saved preallocation info \n")
;
3914
3915 if (!a->i || !a->j || !a->a || !a->imax || !a->ilen) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_ARG_NULL,"Memory info is incomplete, and can not reset preallocation \n")return PetscError(PETSC_COMM_WORLD,3915,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Memory info is incomplete, and can not reset preallocation \n"
)
;
3916
3917 ierr = PetscMemcpy(a->imax,a->ipre,A->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3917,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3918 ierr = PetscMemzero(a->ilen,A->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3918,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3919 a->i[0] = 0;
3920 for (i=1; i<A->rmap->n+1; i++) {
3921 a->i[i] = a->i[i-1] + a->imax[i-1];
3922 }
3923 A->preallocated = PETSC_TRUE;
3924 a->nz = 0;
3925 a->maxnz = a->i[A->rmap->n];
3926 A->info.nz_unneeded = (double)a->maxnz;
3927 A->was_assembled = PETSC_FALSE;
3928 A->assembled = PETSC_FALSE;
3929 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3930}
3931
3932/*@
3933 MatSeqAIJSetPreallocationCSR - Allocates memory for a sparse sequential matrix in AIJ format.
3934
3935 Input Parameters:
3936+ B - the matrix
3937. i - the indices into j for the start of each row (starts with zero)
3938. j - the column indices for each row (starts with zero) these must be sorted for each row
3939- v - optional values in the matrix
3940
3941 Level: developer
3942
3943 The i,j,v values are COPIED with this routine; to avoid the copy use MatCreateSeqAIJWithArrays()
3944
3945.keywords: matrix, aij, compressed row, sparse, sequential
3946
3947.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatSeqAIJSetPreallocation(), MatCreateSeqAIJ(), MATSEQAIJ
3948@*/
3949PetscErrorCode MatSeqAIJSetPreallocationCSR(Mat B,const PetscInt i[],const PetscInt j[],const PetscScalar v[])
3950{
3951 PetscErrorCode ierr;
3952
3953 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3953; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3954 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3954,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3954,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if (
((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3954,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3954,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3955 PetscValidType(B,1)if (!((PetscObject)B)->type_name) do {if (__builtin_expect
(!!(73),0)) {PetscError(((MPI_Comm)0x44000001),3955,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",73
,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),73)
;}} while (0);
;
3956 ierr = PetscTryMethod(B,"MatSeqAIJSetPreallocationCSR_C",(Mat,const PetscInt[],const PetscInt[],const PetscScalar[]),(B,i,j,v))0;{ PetscErrorCode (*f)(Mat,const PetscInt[],const PetscInt[]
,const PetscScalar[]), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)B),("MatSeqAIJSetPreallocationCSR_C"),(PetscVoidFunction
*)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError
(((MPI_Comm)0x44000001),3956,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(B,i,j,v);do {
if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),3956,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} }
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3956,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3957 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3958}
3959
3960PetscErrorCode MatSeqAIJSetPreallocationCSR_SeqAIJ(Mat B,const PetscInt Ii[],const PetscInt J[],const PetscScalar v[])
3961{
3962 PetscInt i;
3963 PetscInt m,n;
3964 PetscInt nz;
3965 PetscInt *nnz, nz_max = 0;
3966 PetscScalar *values;
3967 PetscErrorCode ierr;
3968
3969 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3969; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3970 if (Ii[0]) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE, "Ii[0] must be 0 it is %D", Ii[0])return PetscError(((MPI_Comm)0x44000001),3970,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"Ii[0] must be 0 it is %D",Ii[0])
;
3971
3972 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3972,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3973 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3973,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3974
3975 ierr = MatGetSize(B, &m, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3975,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3976 ierr = PetscMalloc1(m+1, &nnz)PetscMallocA(1,PETSC_FALSE,3976,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m+1)*sizeof(**(&nnz)),(&nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3976,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3977 for (i = 0; i < m; i++) {
3978 nz = Ii[i+1]- Ii[i];
3979 nz_max = PetscMax(nz_max, nz)(((nz_max)<(nz)) ? (nz) : (nz_max));
3980 if (nz < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE, "Local row %D has a negative number of columns %D", i, nnz)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),3980,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
3981 nnz[i] = nz;
3982 }
3983 ierr = MatSeqAIJSetPreallocation(B, 0, nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3983,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3984 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),3984,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3984,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3985
3986 if (v) {
3987 values = (PetscScalar*) v;
3988 } else {
3989 ierr = PetscCalloc1(nz_max, &values)PetscMallocA(1,PETSC_TRUE,3989,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz_max)*sizeof(**(&values)),(&values))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3989,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3990 }
3991
3992 for (i = 0; i < m; i++) {
3993 nz = Ii[i+1] - Ii[i];
3994 ierr = MatSetValues_SeqAIJ(B, 1, &i, nz, J+Ii[i], values + (v ? Ii[i] : 0), INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3994,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3995 }
3996
3997 ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3998 ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3998,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3999
4000 if (!v) {
4001 ierr = PetscFree(values)((*PetscTrFree)((void*)(values),4001,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((values) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4001,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4002 }
4003 ierr = MatSetOption(B,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4003,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4004 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4005}
4006
4007#include <../src/mat/impls/dense/seq/dense.h>
4008#include <petsc/private/kernels/petscaxpy.h>
4009
4010/*
4011 Computes (B'*A')' since computing B*A directly is untenable
4012
4013 n p p
4014 ( ) ( ) ( )
4015 m ( A ) * n ( B ) = m ( C )
4016 ( ) ( ) ( )
4017
4018*/
4019PetscErrorCode MatMatMultNumeric_SeqDense_SeqAIJ(Mat A,Mat B,Mat C)
4020{
4021 PetscErrorCode ierr;
4022 Mat_SeqDense *sub_a = (Mat_SeqDense*)A->data;
4023 Mat_SeqAIJ *sub_b = (Mat_SeqAIJ*)B->data;
4024 Mat_SeqDense *sub_c = (Mat_SeqDense*)C->data;
4025 PetscInt i,n,m,q,p;
4026 const PetscInt *ii,*idx;
4027 const PetscScalar *b,*a,*a_q;
4028 PetscScalar *c,*c_q;
4029
4030 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4030; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4031 m = A->rmap->n;
4032 n = A->cmap->n;
4033 p = B->cmap->n;
4034 a = sub_a->v;
4035 b = sub_b->a;
4036 c = sub_c->v;
4037 ierr = PetscMemzero(c,m*p*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4037,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4038
4039 ii = sub_b->i;
4040 idx = sub_b->j;
4041 for (i=0; i<n; i++) {
4042 q = ii[i+1] - ii[i];
4043 while (q-->0) {
4044 c_q = c + m*(*idx);
4045 a_q = a + m*i;
4046 PetscKernelAXPY(c_q,*b,a_q,m){PetscInt __i;PetscScalar _a1=*b; for (__i=0;__i<m;__i++)c_q
[__i]+=_a1 * a_q[__i];}
;
4047 idx++;
4048 b++;
4049 }
4050 }
4051 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4052}
4053
4054PetscErrorCode MatMatMultSymbolic_SeqDense_SeqAIJ(Mat A,Mat B,PetscReal fill,Mat *C)
4055{
4056 PetscErrorCode ierr;
4057 PetscInt m=A->rmap->n,n=B->cmap->n;
4058 Mat Cmat;
4059
4060 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4060; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4061 if (A->cmap->n != B->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"A->cmap->n %D != B->rmap->n %D\n",A->cmap->n,B->rmap->n)do {if (__builtin_expect(!!(60),0)) {PetscError(((MPI_Comm)0x44000001
),4061,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
60);}} while (0)
;
4062 ierr = MatCreate(PetscObjectComm((PetscObject)A),&Cmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4062,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4063 ierr = MatSetSizes(Cmat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4063,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4064 ierr = MatSetBlockSizesFromMats(Cmat,A,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4064,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4065 ierr = MatSetType(Cmat,MATSEQDENSE"seqdense");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4065,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4066 ierr = MatSeqDenseSetPreallocation(Cmat,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4066,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4067
4068 Cmat->ops->matmultnumeric = MatMatMultNumeric_SeqDense_SeqAIJ;
4069
4070 *C = Cmat;
4071 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4072}
4073
4074/* ----------------------------------------------------------------*/
4075PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatMatMult_SeqDense_SeqAIJ(Mat A,Mat B,MatReuse scall,PetscReal fill,Mat *C)
4076{
4077 PetscErrorCode ierr;
4078
4079 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4079; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4080 if (scall == MAT_INITIAL_MATRIX) {
4081 ierr = PetscLogEventBegin(MAT_MatMultSymbolic,A,B,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[MAT_MatMultSymbolic].active) ? (*PetscLogPLB)((MAT_MatMultSymbolic
),0,(PetscObject)(A),(PetscObject)(B),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4081,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4082 ierr = MatMatMultSymbolic_SeqDense_SeqAIJ(A,B,fill,C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4082,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4083 ierr = PetscLogEventEnd(MAT_MatMultSymbolic,A,B,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[MAT_MatMultSymbolic].active) ? (*PetscLogPLE)((MAT_MatMultSymbolic
),0,(PetscObject)(A),(PetscObject)(B),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4083,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4084 }
4085 ierr = PetscLogEventBegin(MAT_MatMultNumeric,A,B,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[MAT_MatMultNumeric].active) ? (*PetscLogPLB)((MAT_MatMultNumeric
),0,(PetscObject)(A),(PetscObject)(B),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4085,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4086 ierr = MatMatMultNumeric_SeqDense_SeqAIJ(A,B,*C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4086,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4087 ierr = PetscLogEventEnd(MAT_MatMultNumeric,A,B,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[MAT_MatMultNumeric].active) ? (*PetscLogPLE)((MAT_MatMultNumeric
),0,(PetscObject)(A),(PetscObject)(B),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4087,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4088 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4089}
4090
4091
4092/*MC
4093 MATSEQAIJ - MATSEQAIJ = "seqaij" - A matrix type to be used for sequential sparse matrices,
4094 based on compressed sparse row format.
4095
4096 Options Database Keys:
4097. -mat_type seqaij - sets the matrix type to "seqaij" during a call to MatSetFromOptions()
4098
4099 Level: beginner
4100
4101.seealso: MatCreateSeqAIJ(), MatSetFromOptions(), MatSetType(), MatCreate(), MatType
4102M*/
4103
4104/*MC
4105 MATAIJ - MATAIJ = "aij" - A matrix type to be used for sparse matrices.
4106
4107 This matrix type is identical to MATSEQAIJ when constructed with a single process communicator,
4108 and MATMPIAIJ otherwise. As a result, for single process communicators,
4109 MatSeqAIJSetPreallocation is supported, and similarly MatMPIAIJSetPreallocation is supported
4110 for communicators controlling multiple processes. It is recommended that you call both of
4111 the above preallocation routines for simplicity.
4112
4113 Options Database Keys:
4114. -mat_type aij - sets the matrix type to "aij" during a call to MatSetFromOptions()
4115
4116 Developer Notes:
4117 Subclasses include MATAIJCUSPARSE, MATAIJPERM, MATAIJSELL, MATAIJMKL, MATAIJCRL, and also automatically switches over to use inodes when
4118 enough exist.
4119
4120 Level: beginner
4121
4122.seealso: MatCreateAIJ(), MatCreateSeqAIJ(), MATSEQAIJ,MATMPIAIJ
4123M*/
4124
4125/*MC
4126 MATAIJCRL - MATAIJCRL = "aijcrl" - A matrix type to be used for sparse matrices.
4127
4128 This matrix type is identical to MATSEQAIJCRL when constructed with a single process communicator,
4129 and MATMPIAIJCRL otherwise. As a result, for single process communicators,
4130 MatSeqAIJSetPreallocation() is supported, and similarly MatMPIAIJSetPreallocation() is supported
4131 for communicators controlling multiple processes. It is recommended that you call both of
4132 the above preallocation routines for simplicity.
4133
4134 Options Database Keys:
4135. -mat_type aijcrl - sets the matrix type to "aijcrl" during a call to MatSetFromOptions()
4136
4137 Level: beginner
4138
4139.seealso: MatCreateMPIAIJCRL,MATSEQAIJCRL,MATMPIAIJCRL, MATSEQAIJCRL, MATMPIAIJCRL
4140M*/
4141
4142PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_SeqAIJCRL(Mat,MatType,MatReuse,Mat*);
4143#if defined(PETSC_HAVE_ELEMENTAL)
4144PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_Elemental(Mat,MatType,MatReuse,Mat*);
4145#endif
4146#if defined(PETSC_HAVE_HYPRE)
4147PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_AIJ_HYPRE(Mat A,MatType,MatReuse,Mat*);
4148PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatMatMatMult_Transpose_AIJ_AIJ(Mat,Mat,Mat,MatReuse,PetscReal,Mat*);
4149#endif
4150PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_SeqDense(Mat,MatType,MatReuse,Mat*);
4151
4152PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatConvert_SeqAIJ_SeqSELL(Mat,MatType,MatReuse,Mat*);
4153PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_XAIJ_IS(Mat,MatType,MatReuse,Mat*);
4154PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatPtAP_IS_XAIJ(Mat,Mat,MatReuse,PetscReal,Mat*);
4155
4156/*@C
4157 MatSeqAIJGetArray - gives access to the array where the data for a MATSEQAIJ matrix is stored
4158
4159 Not Collective
4160
4161 Input Parameter:
4162. mat - a MATSEQAIJ matrix
4163
4164 Output Parameter:
4165. array - pointer to the data
4166
4167 Level: intermediate
4168
4169.seealso: MatSeqAIJRestoreArray(), MatSeqAIJGetArrayF90()
4170@*/
4171PetscErrorCode MatSeqAIJGetArray(Mat A,PetscScalar **array)
4172{
4173 PetscErrorCode ierr;
4174
4175 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4175; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4176 ierr = PetscUseMethod(A,"MatSeqAIJGetArray_C",(Mat,PetscScalar**),(A,array))0;{ PetscErrorCode (*f)(Mat,PetscScalar**), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)A),("MatSeqAIJGetArray_C"),(PetscVoidFunction*
)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError
(((MPI_Comm)0x44000001),4176,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(A,array);do {
if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),4176,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)A),4176,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatSeqAIJGetArray_C"); }
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4176,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4177 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4178}
4179
4180/*@C
4181 MatSeqAIJGetMaxRowNonzeros - returns the maximum number of nonzeros in any row
4182
4183 Not Collective
4184
4185 Input Parameter:
4186. mat - a MATSEQAIJ matrix
4187
4188 Output Parameter:
4189. nz - the maximum number of nonzeros in any row
4190
4191 Level: intermediate
4192
4193.seealso: MatSeqAIJRestoreArray(), MatSeqAIJGetArrayF90()
4194@*/
4195PetscErrorCode MatSeqAIJGetMaxRowNonzeros(Mat A,PetscInt *nz)
4196{
4197 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)A->data;
4198
4199 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4199; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4200 *nz = aij->rmax;
4201 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4202}
4203
4204/*@C
4205 MatSeqAIJRestoreArray - returns access to the array where the data for a MATSEQAIJ matrix is stored obtained by MatSeqAIJGetArray()
4206
4207 Not Collective
4208
4209 Input Parameters:
4210. mat - a MATSEQAIJ matrix
4211. array - pointer to the data
4212
4213 Level: intermediate
4214
4215.seealso: MatSeqAIJGetArray(), MatSeqAIJRestoreArrayF90()
4216@*/
4217PetscErrorCode MatSeqAIJRestoreArray(Mat A,PetscScalar **array)
4218{
4219 PetscErrorCode ierr;
4220
4221 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4221; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4222 ierr = PetscUseMethod(A,"MatSeqAIJRestoreArray_C",(Mat,PetscScalar**),(A,array))0;{ PetscErrorCode (*f)(Mat,PetscScalar**), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)A),("MatSeqAIJRestoreArray_C"),(PetscVoidFunction
*)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError
(((MPI_Comm)0x44000001),4222,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(A,array);do {
if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),4222,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)A),4222,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatSeqAIJRestoreArray_C"); }
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4222,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4223 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4224}
4225
4226#if defined(PETSC_HAVE_CUDA)
4227PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatConvert_SeqAIJ_SeqAIJCUSPARSE(Mat);
4228#endif
4229
4230PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_SeqAIJ(Mat B)
4231{
4232 Mat_SeqAIJ *b;
4233 PetscErrorCode ierr;
4234 PetscMPIInt size;
4235
4236 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4236; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4237 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4237,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4238 if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Comm must be of size 1")return PetscError(((MPI_Comm)0x44000001),4238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"Comm must be of size 1")
;
4239
4240 ierr = PetscNewLog(B,&b)(PetscMallocA(1,PETSC_TRUE,4240,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(1)*sizeof(**(((&b)))),(((&b)))) || PetscLogObjectMemory
((PetscObject)B,sizeof(**(&b))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4240,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4241
4242 B->data = (void*)b;
4243
4244 ierr = PetscMemcpy(B->ops,&MatOps_Values,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4244,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4245
4246 b->row = 0;
4247 b->col = 0;
4248 b->icol = 0;
4249 b->reallocs = 0;
4250 b->ignorezeroentries = PETSC_FALSE;
4251 b->roworiented = PETSC_TRUE;
4252 b->nonew = 0;
4253 b->diag = 0;
4254 b->solve_work = 0;
4255 B->spptr = 0;
4256 b->saved_values = 0;
4257 b->idiag = 0;
4258 b->mdiag = 0;
4259 b->ssor_work = 0;
4260 b->omega = 1.0;
4261 b->fshift = 0.0;
4262 b->idiagvalid = PETSC_FALSE;
4263 b->ibdiagvalid = PETSC_FALSE;
4264 b->keepnonzeropattern = PETSC_FALSE;
4265
4266 ierr = PetscObjectChangeTypeName((PetscObject)B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4266,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4267 ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqAIJGetArray_C",MatSeqAIJGetArray_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqAIJGetArray_C"
,(PetscVoidFunction)(MatSeqAIJGetArray_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4268 ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqAIJRestoreArray_C",MatSeqAIJRestoreArray_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqAIJRestoreArray_C"
,(PetscVoidFunction)(MatSeqAIJRestoreArray_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4268,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4269
4270#if defined(PETSC_HAVE_MATLAB_ENGINE)
4271 ierr = PetscObjectComposeFunction((PetscObject)B,"PetscMatlabEnginePut_C",MatlabEnginePut_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"PetscMatlabEnginePut_C"
,(PetscVoidFunction)(MatlabEnginePut_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4271,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4272 ierr = PetscObjectComposeFunction((PetscObject)B,"PetscMatlabEngineGet_C",MatlabEngineGet_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"PetscMatlabEngineGet_C"
,(PetscVoidFunction)(MatlabEngineGet_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4272,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4273#endif
4274
4275 ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqAIJSetColumnIndices_C",MatSeqAIJSetColumnIndices_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqAIJSetColumnIndices_C"
,(PetscVoidFunction)(MatSeqAIJSetColumnIndices_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4275,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4276 ierr = PetscObjectComposeFunction((PetscObject)B,"MatStoreValues_C",MatStoreValues_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatStoreValues_C"
,(PetscVoidFunction)(MatStoreValues_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4276,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4277 ierr = PetscObjectComposeFunction((PetscObject)B,"MatRetrieveValues_C",MatRetrieveValues_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatRetrieveValues_C"
,(PetscVoidFunction)(MatRetrieveValues_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4277,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4278 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqsbaij_C",MatConvert_SeqAIJ_SeqSBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqsbaij_C"
,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqSBAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4278,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4279 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqbaij_C",MatConvert_SeqAIJ_SeqBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqbaij_C"
,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqBAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4279,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4280 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqaijperm_C",MatConvert_SeqAIJ_SeqAIJPERM)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqaijperm_C"
,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqAIJPERM))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4280,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4281 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqaijsell_C",MatConvert_SeqAIJ_SeqAIJSELL)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqaijsell_C"
,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqAIJSELL))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4282#if defined(PETSC_HAVE_MKL_SPARSE)
4283 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqaijmkl_C",MatConvert_SeqAIJ_SeqAIJMKL)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqaijmkl_C"
,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqAIJMKL))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4283,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4284#endif
4285#if defined(PETSC_HAVE_CUDA)
4286 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqaijcusparse_C",MatConvert_SeqAIJ_SeqAIJCUSPARSE)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqaijcusparse_C"
,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqAIJCUSPARSE))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4287#endif
4288 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqaijcrl_C",MatConvert_SeqAIJ_SeqAIJCRL)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqaijcrl_C"
,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqAIJCRL))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4288,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4289#if defined(PETSC_HAVE_ELEMENTAL)
4290 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_elemental_C",MatConvert_SeqAIJ_Elemental)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_elemental_C"
,(PetscVoidFunction)(MatConvert_SeqAIJ_Elemental))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4290,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4291#endif
4292#if defined(PETSC_HAVE_HYPRE)
4293 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_hypre_C",MatConvert_AIJ_HYPRE)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_hypre_C"
,(PetscVoidFunction)(MatConvert_AIJ_HYPRE))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4293,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4294 ierr = PetscObjectComposeFunction((PetscObject)B,"MatMatMatMult_transpose_seqaij_seqaij_C",MatMatMatMult_Transpose_AIJ_AIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMatMatMult_transpose_seqaij_seqaij_C"
,(PetscVoidFunction)(MatMatMatMult_Transpose_AIJ_AIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4295#endif
4296 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqdense_C",MatConvert_SeqAIJ_SeqDense)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqdense_C"
,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqDense))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4297 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqsell_C",MatConvert_SeqAIJ_SeqSELL)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqsell_C"
,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqSELL))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4297,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4298 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_is_C",MatConvert_XAIJ_IS)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_is_C"
,(PetscVoidFunction)(MatConvert_XAIJ_IS))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4298,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4299 ierr = PetscObjectComposeFunction((PetscObject)B,"MatIsTranspose_C",MatIsTranspose_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatIsTranspose_C"
,(PetscVoidFunction)(MatIsTranspose_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4299,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4300 ierr = PetscObjectComposeFunction((PetscObject)B,"MatIsHermitianTranspose_C",MatIsTranspose_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatIsHermitianTranspose_C"
,(PetscVoidFunction)(MatIsTranspose_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4300,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4301 ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqAIJSetPreallocation_C",MatSeqAIJSetPreallocation_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqAIJSetPreallocation_C"
,(PetscVoidFunction)(MatSeqAIJSetPreallocation_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4302 ierr = PetscObjectComposeFunction((PetscObject)B,"MatResetPreallocation_C",MatResetPreallocation_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatResetPreallocation_C"
,(PetscVoidFunction)(MatResetPreallocation_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4302,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4303 ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqAIJSetPreallocationCSR_C",MatSeqAIJSetPreallocationCSR_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqAIJSetPreallocationCSR_C"
,(PetscVoidFunction)(MatSeqAIJSetPreallocationCSR_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4303,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4304 ierr = PetscObjectComposeFunction((PetscObject)B,"MatReorderForNonzeroDiagonal_C",MatReorderForNonzeroDiagonal_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatReorderForNonzeroDiagonal_C"
,(PetscVoidFunction)(MatReorderForNonzeroDiagonal_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4305 ierr = PetscObjectComposeFunction((PetscObject)B,"MatMatMult_seqdense_seqaij_C",MatMatMult_SeqDense_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMatMult_seqdense_seqaij_C"
,(PetscVoidFunction)(MatMatMult_SeqDense_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4305,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4306 ierr = PetscObjectComposeFunction((PetscObject)B,"MatMatMultSymbolic_seqdense_seqaij_C",MatMatMultSymbolic_SeqDense_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMatMultSymbolic_seqdense_seqaij_C"
,(PetscVoidFunction)(MatMatMultSymbolic_SeqDense_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4306,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4307 ierr = PetscObjectComposeFunction((PetscObject)B,"MatMatMultNumeric_seqdense_seqaij_C",MatMatMultNumeric_SeqDense_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMatMultNumeric_seqdense_seqaij_C"
,(PetscVoidFunction)(MatMatMultNumeric_SeqDense_SeqAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4307,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4308 ierr = PetscObjectComposeFunction((PetscObject)B,"MatPtAP_is_seqaij_C",MatPtAP_IS_XAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatPtAP_is_seqaij_C"
,(PetscVoidFunction)(MatPtAP_IS_XAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4308,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4309 ierr = MatCreate_SeqAIJ_Inode(B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4309,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4310 ierr = PetscObjectChangeTypeName((PetscObject)B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4310,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4311 ierr = MatSeqAIJSetTypeFromOptions(B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4311,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* this allows changing the matrix subtype to say MATSEQAIJPERM */
4312 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4313}
4314
4315/*
4316 Given a matrix generated with MatGetFactor() duplicates all the information in A into B
4317*/
4318PetscErrorCode MatDuplicateNoCreate_SeqAIJ(Mat C,Mat A,MatDuplicateOption cpvalues,PetscBool mallocmatspace)
4319{
4320 Mat_SeqAIJ *c,*a = (Mat_SeqAIJ*)A->data;
4321 PetscErrorCode ierr;
4322 PetscInt i,m = A->rmap->n;
4323
4324 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4324; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4325 c = (Mat_SeqAIJ*)C->data;
4326
4327 C->factortype = A->factortype;
4328 c->row = 0;
4329 c->col = 0;
4330 c->icol = 0;
4331 c->reallocs = 0;
4332
4333 C->assembled = PETSC_TRUE;
4334
4335 ierr = PetscLayoutReference(A->rmap,&C->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4335,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4336 ierr = PetscLayoutReference(A->cmap,&C->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4337
4338 ierr = PetscMalloc2(m,&c->imax,m,&c->ilen)PetscMallocA(2,PETSC_FALSE,4338,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&c->imax)),(&c->imax),(size_t
)(m)*sizeof(**(&c->ilen)),(&c->ilen))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4338,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4339 ierr = PetscLogObjectMemory((PetscObject)C, 2*m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4339,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4340 for (i=0; i<m; i++) {
4341 c->imax[i] = a->imax[i];
4342 c->ilen[i] = a->ilen[i];
4343 }
4344
4345 /* allocate the matrix space */
4346 if (mallocmatspace) {
4347 ierr = PetscMalloc3(a->i[m],&c->a,a->i[m],&c->j,m+1,&c->i)PetscMallocA(3,PETSC_FALSE,4347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(a->i[m])*sizeof(**(&c->a)),(&c->a)
,(size_t)(a->i[m])*sizeof(**(&c->j)),(&c->j)
,(size_t)(m+1)*sizeof(**(&c->i)),(&c->i))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4348 ierr = PetscLogObjectMemory((PetscObject)C, a->i[m]*(sizeof(PetscScalar)+sizeof(PetscInt))+(m+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4348,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4349
4350 c->singlemalloc = PETSC_TRUE;
4351
4352 ierr = PetscMemcpy(c->i,a->i,(m+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4352,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4353 if (m > 0) {
4354 ierr = PetscMemcpy(c->j,a->j,(a->i[m])*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4354,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4355 if (cpvalues == MAT_COPY_VALUES) {
4356 ierr = PetscMemcpy(c->a,a->a,(a->i[m])*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4356,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4357 } else {
4358 ierr = PetscMemzero(c->a,(a->i[m])*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4358,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4359 }
4360 }
4361 }
4362
4363 c->ignorezeroentries = a->ignorezeroentries;
4364 c->roworiented = a->roworiented;
4365 c->nonew = a->nonew;
4366 if (a->diag) {
4367 ierr = PetscMalloc1(m+1,&c->diag)PetscMallocA(1,PETSC_FALSE,4367,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m+1)*sizeof(**(&c->diag)),(&c->diag))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4367,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4368 ierr = PetscLogObjectMemory((PetscObject)C,(m+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4368,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4369 for (i=0; i<m; i++) {
4370 c->diag[i] = a->diag[i];
4371 }
4372 } else c->diag = 0;
4373
4374 c->solve_work = 0;
4375 c->saved_values = 0;
4376 c->idiag = 0;
4377 c->ssor_work = 0;
4378 c->keepnonzeropattern = a->keepnonzeropattern;
4379 c->free_a = PETSC_TRUE;
4380 c->free_ij = PETSC_TRUE;
4381
4382 c->rmax = a->rmax;
4383 c->nz = a->nz;
4384 c->maxnz = a->nz; /* Since we allocate exactly the right amount */
4385 C->preallocated = PETSC_TRUE;
4386
4387 c->compressedrow.use = a->compressedrow.use;
4388 c->compressedrow.nrows = a->compressedrow.nrows;
4389 if (a->compressedrow.use) {
4390 i = a->compressedrow.nrows;
4391 ierr = PetscMalloc2(i+1,&c->compressedrow.i,i,&c->compressedrow.rindex)PetscMallocA(2,PETSC_FALSE,4391,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(i+1)*sizeof(**(&c->compressedrow.i)),(&c
->compressedrow.i),(size_t)(i)*sizeof(**(&c->compressedrow
.rindex)),(&c->compressedrow.rindex))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4391,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4392 ierr = PetscMemcpy(c->compressedrow.i,a->compressedrow.i,(i+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4392,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4393 ierr = PetscMemcpy(c->compressedrow.rindex,a->compressedrow.rindex,i*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4393,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4394 } else {
4395 c->compressedrow.use = PETSC_FALSE;
4396 c->compressedrow.i = NULL((void*)0);
4397 c->compressedrow.rindex = NULL((void*)0);
4398 }
4399 c->nonzerorowcnt = a->nonzerorowcnt;
4400 C->nonzerostate = A->nonzerostate;
4401
4402 ierr = MatDuplicate_SeqAIJ_Inode(A,cpvalues,&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4402,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4403 ierr = PetscFunctionListDuplicate(((PetscObject)A)->qlist,&((PetscObject)C)->qlist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4403,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4404 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4405}
4406
4407PetscErrorCode MatDuplicate_SeqAIJ(Mat A,MatDuplicateOption cpvalues,Mat *B)
4408{
4409 PetscErrorCode ierr;
4410
4411 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4411; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4412 ierr = MatCreate(PetscObjectComm((PetscObject)A),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4412,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4413 ierr = MatSetSizes(*B,A->rmap->n,A->cmap->n,A->rmap->n,A->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4413,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4414 if (!(A->rmap->n % A->rmap->bs) && !(A->cmap->n % A->cmap->bs)) {
4415 ierr = MatSetBlockSizesFromMats(*B,A,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4415,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4416 }
4417 ierr = MatSetType(*B,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4417,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4418 ierr = MatDuplicateNoCreate_SeqAIJ(*B,A,cpvalues,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4418,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4419 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4420}
4421
4422PetscErrorCode MatLoad_SeqAIJ(Mat newMat, PetscViewer viewer)
4423{
4424 PetscBool isbinary, ishdf5;
4425 PetscErrorCode ierr;
4426
4427 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4427; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4428 PetscValidHeaderSpecific(newMat,MAT_CLASSID,1)do { if (!newMat) return PetscError(((MPI_Comm)0x44000001),4428
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(newMat,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),4428,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(newMat))->classid != MAT_CLASSID) {
if (((PetscObject)(newMat))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),4428,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),4428,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
4429 PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),4429
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),4429,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(viewer))->classid != PETSC_VIEWER_CLASSID
) { if (((PetscObject)(viewer))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),4429,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),4429,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,2); } } while (0)
;
4430 /* force binary viewer to load .info file if it has not yet done so */
4431 ierr = PetscViewerSetUp(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4431,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4432 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4432,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4433 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4433,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4434 if (isbinary) {
4435 ierr = MatLoad_SeqAIJ_Binary(newMat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4435,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4436 } else if (ishdf5) {
4437#if defined(PETSC_HAVE_HDF5)
4438 ierr = MatLoad_AIJ_HDF5(newMat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4438,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4439#else
4440 SETERRQ(PetscObjectComm((PetscObject)newMat),PETSC_ERR_SUP,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject)newMat),4440,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
56,PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"
)
;
4441#endif
4442 } else {
4443 SETERRQ2(PetscObjectComm((PetscObject)newMat),PETSC_ERR_SUP,"Viewer type %s not yet supported for reading %s matrices",((PetscObject)viewer)->type_name,((PetscObject)newMat)->type_name)do {if (__builtin_expect(!!(56),0)) {PetscError(((MPI_Comm)0x44000001
),4443,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)newMat),56);}} while (0)
;
4444 }
4445 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4446}
4447
4448PetscErrorCode MatLoad_SeqAIJ_Binary(Mat newMat, PetscViewer viewer)
4449{
4450 Mat_SeqAIJ *a;
4451 PetscErrorCode ierr;
4452 PetscInt i,sum,nz,header[4],*rowlengths = 0,M,N,rows,cols;
4453 int fd;
4454 PetscMPIInt size;
4455 MPI_Comm comm;
4456 PetscInt bs = newMat->rmap->bs;
4457
4458 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4458; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4459 ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4459,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4460 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4460,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4461 if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"view must have one processor")return PetscError(((MPI_Comm)0x44000001),4461,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"view must have one processor")
;
4462
4463 ierr = PetscOptionsBegin(comm,NULL,"Options for loading SEQAIJ matrix","Mat")0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems
*PetscOptionsObject = &PetscOptionsObjectBase; PetscMemzero
(PetscOptionsObject,sizeof(PetscOptionItems)); for (PetscOptionsObject
->count=(PetscOptionsPublish?-1:1); PetscOptionsObject->
count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr
= PetscOptionsBegin_Private(PetscOptionsObject,comm,((void*)
0),"Options for loading SEQAIJ matrix","Mat");do {if (__builtin_expect
(!!(_5_ierr),0)) {PetscError(((MPI_Comm)0x44000001),4463,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_5_ierr);}} while (0);
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4463,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4464 ierr = PetscOptionsInt("-matload_block_size","Set the blocksize used to store the matrix","MatLoad",bs,&bs,NULL)PetscOptionsInt_Private(PetscOptionsObject,"-matload_block_size"
,"Set the blocksize used to store the matrix","MatLoad",bs,&
bs,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4464,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4465 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) {PetscError(((MPI_Comm)0x44000001
),4465,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_5_ierr);}} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4465,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4466 if (bs < 0) bs = 1;
4467 ierr = MatSetBlockSize(newMat,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4467,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4468
4469 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4469,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4470 ierr = PetscBinaryRead(fd,header,4,PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4471 if (header[0] != MAT_FILE_CLASSID1211216) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"not matrix object in file")return PetscError(((MPI_Comm)0x44000001),4471,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,79,PETSC_ERROR_INITIAL,"not matrix object in file")
;
4472 M = header[1]; N = header[2]; nz = header[3];
4473
4474 if (nz < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"Matrix stored in special format on disk,cannot load as SeqAIJ")return PetscError(((MPI_Comm)0x44000001),4474,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,79,PETSC_ERROR_INITIAL,"Matrix stored in special format on disk,cannot load as SeqAIJ"
)
;
4475
4476 /* read in row lengths */
4477 ierr = PetscMalloc1(M,&rowlengths)PetscMallocA(1,PETSC_FALSE,4477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(M)*sizeof(**(&rowlengths)),(&rowlengths))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4478 ierr = PetscBinaryRead(fd,rowlengths,M,PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4478,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4479
4480 /* check if sum of rowlengths is same as nz */
4481 for (i=0,sum=0; i< M; i++) sum +=rowlengths[i];
4482 if (sum != nz) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_FILE_READ,"Inconsistant matrix data in file. no-nonzeros = %dD, sum-row-lengths = %D\n",nz,sum)do {if (__builtin_expect(!!(66),0)) {PetscError(((MPI_Comm)0x44000001
),4482,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,66,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
66);}} while (0)
;
4483
4484 /* set global size if not set already*/
4485 if (newMat->rmap->n < 0 && newMat->rmap->N < 0 && newMat->cmap->n < 0 && newMat->cmap->N < 0) {
4486 ierr = MatSetSizes(newMat,PETSC_DECIDE-1,PETSC_DECIDE-1,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4486,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4487 } else {
4488 /* if sizes and type are already set, check if the matrix global sizes are correct */
4489 ierr = MatGetSize(newMat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4489,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4490 if (rows < 0 && cols < 0) { /* user might provide local size instead of global size */
4491 ierr = MatGetLocalSize(newMat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4492 }
4493 if (M != rows || N != cols) SETERRQ4(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED, "Matrix in file of different length (%D, %D) than the input matrix (%D, %D)",M,N,rows,cols)return PetscError(((MPI_Comm)0x44000001),4493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,79,PETSC_ERROR_INITIAL,"Matrix in file of different length (%D, %D) than the input matrix (%D, %D)"
,M,N,rows,cols)
;
4494 }
4495 ierr = MatSeqAIJSetPreallocation_SeqAIJ(newMat,0,rowlengths);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4495,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4496 a = (Mat_SeqAIJ*)newMat->data;
4497
4498 ierr = PetscBinaryRead(fd,a->j,nz,PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4498,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4499
4500 /* read in nonzero values */
4501 ierr = PetscBinaryRead(fd,a->a,nz,PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4501,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4502
4503 /* set matrix "i" values */
4504 a->i[0] = 0;
4505 for (i=1; i<= M; i++) {
4506 a->i[i] = a->i[i-1] + rowlengths[i-1];
4507 a->ilen[i-1] = rowlengths[i-1];
4508 }
4509 ierr = PetscFree(rowlengths)((*PetscTrFree)((void*)(rowlengths),4509,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((rowlengths) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4509,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4510
4511 ierr = MatAssemblyBegin(newMat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4511,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4512 ierr = MatAssemblyEnd(newMat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4512,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4513 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4514}
4515
4516PetscErrorCode MatEqual_SeqAIJ(Mat A,Mat B,PetscBool * flg)
4517{
4518 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data,*b = (Mat_SeqAIJ*)B->data;
4519 PetscErrorCode ierr;
4520#if defined(PETSC_USE_COMPLEX)
4521 PetscInt k;
4522#endif
4523
4524 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4524; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4525 /* If the matrix dimensions are not equal,or no of nonzeros */
4526 if ((A->rmap->n != B->rmap->n) || (A->cmap->n != B->cmap->n) ||(a->nz != b->nz)) {
4527 *flg = PETSC_FALSE;
4528 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4529 }
4530
4531 /* if the a->i are the same */
4532 ierr = PetscMemcmp(a->i,b->i,(A->rmap->n+1)*sizeof(PetscInt),flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4532,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4533 if (!*flg) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4534
4535 /* if a->j are the same */
4536 ierr = PetscMemcmp(a->j,b->j,(a->nz)*sizeof(PetscInt),flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4536,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4537 if (!*flg) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4538
4539 /* if a->a are the same */
4540#if defined(PETSC_USE_COMPLEX)
4541 for (k=0; k<a->nz; k++) {
4542 if (PetscRealPart(a->a[k])(a->a[k]) != PetscRealPart(b->a[k])(b->a[k]) || PetscImaginaryPart(a->a[k])((PetscReal)0.) != PetscImaginaryPart(b->a[k])((PetscReal)0.)) {
4543 *flg = PETSC_FALSE;
4544 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4545 }
4546 }
4547#else
4548 ierr = PetscMemcmp(a->a,b->a,(a->nz)*sizeof(PetscScalar),flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4548,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4549#endif
4550 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4551}
4552
4553/*@
4554 MatCreateSeqAIJWithArrays - Creates an sequential AIJ matrix using matrix elements (in CSR format)
4555 provided by the user.
4556
4557 Collective on MPI_Comm
4558
4559 Input Parameters:
4560+ comm - must be an MPI communicator of size 1
4561. m - number of rows
4562. n - number of columns
4563. i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row of the matrix
4564. j - column indices
4565- a - matrix values
4566
4567 Output Parameter:
4568. mat - the matrix
4569
4570 Level: intermediate
4571
4572 Notes:
4573 The i, j, and a arrays are not copied by this routine, the user must free these arrays
4574 once the matrix is destroyed and not before
4575
4576 You cannot set new nonzero locations into this matrix, that will generate an error.
4577
4578 The i and j indices are 0 based
4579
4580 The format which is used for the sparse matrix input, is equivalent to a
4581 row-major ordering.. i.e for the following matrix, the input data expected is
4582 as shown
4583
4584$ 1 0 0
4585$ 2 0 3
4586$ 4 5 6
4587$
4588$ i = {0,1,3,6} [size = nrow+1 = 3+1]
4589$ j = {0,0,2,0,1,2} [size = 6]; values must be sorted for each row
4590$ v = {1,2,3,4,5,6} [size = 6]
4591
4592
4593.seealso: MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateMPIAIJWithArrays(), MatMPIAIJSetPreallocationCSR()
4594
4595@*/
4596PetscErrorCode MatCreateSeqAIJWithArrays(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt i[],PetscInt j[],PetscScalar a[],Mat *mat)
4597{
4598 PetscErrorCode ierr;
4599 PetscInt ii;
4600 Mat_SeqAIJ *aij;
4601#if defined(PETSC_USE_DEBUG1)
4602 PetscInt jj;
4603#endif
4604
4605 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4605; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4606 if (m > 0 && i[0]) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"i (row indices) must start with 0")return PetscError(((MPI_Comm)0x44000001),4606,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"i (row indices) must start with 0")
;
4607 ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4607,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4608 ierr = MatSetSizes(*mat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4608,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4609 /* ierr = MatSetBlockSizes(*mat,,);CHKERRQ(ierr); */
4610 ierr = MatSetType(*mat,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4610,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4611 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*mat,MAT_SKIP_ALLOCATION-4,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4611,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4612 aij = (Mat_SeqAIJ*)(*mat)->data;
4613 ierr = PetscMalloc2(m,&aij->imax,m,&aij->ilen)PetscMallocA(2,PETSC_FALSE,4613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&aij->imax)),(&aij->imax
),(size_t)(m)*sizeof(**(&aij->ilen)),(&aij->ilen
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4614
4615 aij->i = i;
4616 aij->j = j;
4617 aij->a = a;
4618 aij->singlemalloc = PETSC_FALSE;
4619 aij->nonew = -1; /*this indicates that inserting a new value in the matrix that generates a new nonzero is an error*/
4620 aij->free_a = PETSC_FALSE;
4621 aij->free_ij = PETSC_FALSE;
4622
4623 for (ii=0; ii<m; ii++) {
4624 aij->ilen[ii] = aij->imax[ii] = i[ii+1] - i[ii];
4625#if defined(PETSC_USE_DEBUG1)
4626 if (i[ii+1] - i[ii] < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row length in i (row indices) row = %D length = %D",ii,i[ii+1] - i[ii])do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),4626,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4627 for (jj=i[ii]+1; jj<i[ii+1]; jj++) {
4628 if (j[jj] < j[jj-1]) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column entry number %D (actual column %D) in row %D is not sorted",jj-i[ii],j[jj],ii)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),4628,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4629 if (j[jj] == j[jj-1]) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column entry number %D (actual column %D) in row %D is identical to previous entry",jj-i[ii],j[jj],ii)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),4629,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4630 }
4631#endif
4632 }
4633#if defined(PETSC_USE_DEBUG1)
4634 for (ii=0; ii<aij->i[m]; ii++) {
4635 if (j[ii] < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column index at location = %D index = %D",ii,j[ii])do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),4635,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4636 if (j[ii] > n - 1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column index to large at location = %D index = %D",ii,j[ii])do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),4636,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4637 }
4638#endif
4639
4640 ierr = MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4640,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4641 ierr = MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4641,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4642 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4643}
4644/*@C
4645 MatCreateSeqAIJFromTriple - Creates an sequential AIJ matrix using matrix elements (in COO format)
4646 provided by the user.
4647
4648 Collective on MPI_Comm
4649
4650 Input Parameters:
4651+ comm - must be an MPI communicator of size 1
4652. m - number of rows
4653. n - number of columns
4654. i - row indices
4655. j - column indices
4656. a - matrix values
4657. nz - number of nonzeros
4658- idx - 0 or 1 based
4659
4660 Output Parameter:
4661. mat - the matrix
4662
4663 Level: intermediate
4664
4665 Notes:
4666 The i and j indices are 0 based
4667
4668 The format which is used for the sparse matrix input, is equivalent to a
4669 row-major ordering.. i.e for the following matrix, the input data expected is
4670 as shown:
4671
4672 1 0 0
4673 2 0 3
4674 4 5 6
4675
4676 i = {0,1,1,2,2,2}
4677 j = {0,0,2,0,1,2}
4678 v = {1,2,3,4,5,6}
4679
4680
4681.seealso: MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateSeqAIJWithArrays(), MatMPIAIJSetPreallocationCSR()
4682
4683@*/
4684PetscErrorCode MatCreateSeqAIJFromTriple(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt i[],PetscInt j[],PetscScalar a[],Mat *mat,PetscInt nz,PetscBool idx)
4685{
4686 PetscErrorCode ierr;
4687 PetscInt ii, *nnz, one = 1,row,col;
4688
4689
4690 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4690; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4691 ierr = PetscCalloc1(m,&nnz)PetscMallocA(1,PETSC_TRUE,4691,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&nnz)),(&nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4691,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4692 for (ii = 0; ii < nz; ii++) {
4693 nnz[i[ii] - !!idx] += 1;
4694 }
4695 ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4695,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4696 ierr = MatSetSizes(*mat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4697 ierr = MatSetType(*mat,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4697,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4698 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*mat,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4699 for (ii = 0; ii < nz; ii++) {
4700 if (idx) {
4701 row = i[ii] - 1;
4702 col = j[ii] - 1;
4703 } else {
4704 row = i[ii];
4705 col = j[ii];
4706 }
4707 ierr = MatSetValues(*mat,one,&row,one,&col,&a[ii],ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4707,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4708 }
4709 ierr = MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4709,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4710 ierr = MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4710,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4711 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),4711,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4711,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4712 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4713}
4714
4715PetscErrorCode MatSeqAIJInvalidateDiagonal(Mat A)
4716{
4717 Mat_SeqAIJ *a=(Mat_SeqAIJ*)A->data;
4718 PetscErrorCode ierr;
4719
4720 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4720; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4721 a->idiagvalid = PETSC_FALSE;
4722 a->ibdiagvalid = PETSC_FALSE;
4723
4724 ierr = MatSeqAIJInvalidateDiagonal_Inode(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4724,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4725 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4726}
4727
4728PetscErrorCode MatCreateMPIMatConcatenateSeqMat_SeqAIJ(MPI_Comm comm,Mat inmat,PetscInt n,MatReuse scall,Mat *outmat)
4729{
4730 PetscErrorCode ierr;
4731 PetscMPIInt size;
4732
4733 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4733; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4734 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4734,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4735 if (size == 1) {
4736 if (scall == MAT_INITIAL_MATRIX) {
4737 ierr = MatDuplicate(inmat,MAT_COPY_VALUES,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4737,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4738 } else {
4739 ierr = MatCopy(inmat,*outmat,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4739,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4740 }
4741 } else {
4742 ierr = MatCreateMPIMatConcatenateSeqMat_MPIAIJ(comm,inmat,n,scall,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4742,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4743 }
4744 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4745}
4746
4747/*
4748 Permute A into C's *local* index space using rowemb,colemb.
4749 The embedding are supposed to be injections and the above implies that the range of rowemb is a subset
4750 of [0,m), colemb is in [0,n).
4751 If pattern == DIFFERENT_NONZERO_PATTERN, C is preallocated according to A.
4752 */
4753PetscErrorCode MatSetSeqMat_SeqAIJ(Mat C,IS rowemb,IS colemb,MatStructure pattern,Mat B)
4754{
4755 /* If making this function public, change the error returned in this function away from _PLIB. */
4756 PetscErrorCode ierr;
4757 Mat_SeqAIJ *Baij;
4758 PetscBool seqaij;
4759 PetscInt m,n,*nz,i,j,count;
4760 PetscScalar v;
4761 const PetscInt *rowindices,*colindices;
4762
4763 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4763; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4764 if (!B) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4765 /* Check to make sure the target matrix (and embeddings) are compatible with C and each other. */
4766 ierr = PetscObjectBaseTypeCompare((PetscObject)B,MATSEQAIJ"seqaij",&seqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4766,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4767 if (!seqaij) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Input matrix is of wrong type")return PetscError(((MPI_Comm)0x44000001),4767,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_INITIAL,"Input matrix is of wrong type")
;
4768 if (rowemb) {
4769 ierr = ISGetLocalSize(rowemb,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4769,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4770 if (m != B->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Row IS of size %D is incompatible with matrix row size %D",m,B->rmap->n)do {if (__builtin_expect(!!(77),0)) {PetscError(((MPI_Comm)0x44000001
),4770,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
77);}} while (0)
;
4771 } else {
4772 if (C->rmap->n != B->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Input matrix is row-incompatible with the target matrix")return PetscError(((MPI_Comm)0x44000001),4772,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_INITIAL,"Input matrix is row-incompatible with the target matrix"
)
;
4773 }
4774 if (colemb) {
4775 ierr = ISGetLocalSize(colemb,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4775,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4776 if (n != B->cmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Diag col IS of size %D is incompatible with input matrix col size %D",n,B->cmap->n)do {if (__builtin_expect(!!(77),0)) {PetscError(((MPI_Comm)0x44000001
),4776,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
77);}} while (0)
;
4777 } else {
4778 if (C->cmap->n != B->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Input matrix is col-incompatible with the target matrix")return PetscError(((MPI_Comm)0x44000001),4778,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_INITIAL,"Input matrix is col-incompatible with the target matrix"
)
;
4779 }
4780
4781 Baij = (Mat_SeqAIJ*)(B->data);
4782 if (pattern == DIFFERENT_NONZERO_PATTERN) {
4783 ierr = PetscMalloc1(B->rmap->n,&nz)PetscMallocA(1,PETSC_FALSE,4783,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(B->rmap->n)*sizeof(**(&nz)),(&nz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4783,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4784 for (i=0; i<B->rmap->n; i++) {
4785 nz[i] = Baij->i[i+1] - Baij->i[i];
4786 }
4787 ierr = MatSeqAIJSetPreallocation(C,0,nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4787,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4788 ierr = PetscFree(nz)((*PetscTrFree)((void*)(nz),4788,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((nz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4788,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4789 }
4790 if (pattern == SUBSET_NONZERO_PATTERN) {
4791 ierr = MatZeroEntries(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4791,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4792 }
4793 count = 0;
4794 rowindices = NULL((void*)0);
4795 colindices = NULL((void*)0);
4796 if (rowemb) {
4797 ierr = ISGetIndices(rowemb,&rowindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4797,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4798 }
4799 if (colemb) {
4800 ierr = ISGetIndices(colemb,&colindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4800,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4801 }
4802 for (i=0; i<B->rmap->n; i++) {
4803 PetscInt row;
4804 row = i;
4805 if (rowindices) row = rowindices[i];
4806 for (j=Baij->i[i]; j<Baij->i[i+1]; j++) {
4807 PetscInt col;
4808 col = Baij->j[count];
4809 if (colindices) col = colindices[col];
4810 v = Baij->a[count];
4811 ierr = MatSetValues(C,1,&row,1,&col,&v,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4811,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4812 ++count;
4813 }
4814 }
4815 /* FIXME: set C's nonzerostate correctly. */
4816 /* Assembly for C is necessary. */
4817 C->preallocated = PETSC_TRUE;
4818 C->assembled = PETSC_TRUE;
4819 C->was_assembled = PETSC_FALSE;
4820 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4821}
4822
4823PetscFunctionList MatSeqAIJList = NULL((void*)0);
4824
4825/*@C
4826 MatSeqAIJSetType - Converts a MATSEQAIJ matrix to a subtype
4827
4828 Collective on Mat
4829
4830 Input Parameters:
4831+ mat - the matrix object
4832- matype - matrix type
4833
4834 Options Database Key:
4835. -mat_seqai_type <method> - for example seqaijcrl
4836
4837
4838 Level: intermediate
4839
4840.keywords: Mat, MatType, set, method
4841
4842.seealso: PCSetType(), VecSetType(), MatCreate(), MatType, Mat
4843@*/
4844PetscErrorCode MatSeqAIJSetType(Mat mat, MatType matype)
4845{
4846 PetscErrorCode ierr,(*r)(Mat,MatType,MatReuse,Mat*);
4847 PetscBool sametype;
4848
4849 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4849; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4850 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),4850,
__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),4850,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),4850,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),4850,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
4851 ierr = PetscObjectTypeCompare((PetscObject)mat,matype,&sametype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4851,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4852 if (sametype) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4853
4854 ierr = PetscFunctionListFind(MatSeqAIJList,matype,&r)PetscFunctionListFind_Private((MatSeqAIJList),(matype),(PetscVoidFunction
*)(&r))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4854,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4855 if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown Mat type given: %s",matype)return PetscError(((MPI_Comm)0x44000001),4855,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,86,PETSC_ERROR_INITIAL,"Unknown Mat type given: %s",matype)
;
4856 ierr = (*r)(mat,matype,MAT_INPLACE_MATRIX,&mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4856,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4857 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4858}
4859
4860
4861/*@C
4862 MatSeqAIJRegister - - Adds a new sub-matrix type for sequential AIJ matrices
4863
4864 Not Collective
4865
4866 Input Parameters:
4867+ name - name of a new user-defined matrix type, for example MATSEQAIJCRL
4868- function - routine to convert to subtype
4869
4870 Notes:
4871 MatSeqAIJRegister() may be called multiple times to add several user-defined solvers.
4872
4873
4874 Then, your matrix can be chosen with the procedural interface at runtime via the option
4875$ -mat_seqaij_type my_mat
4876
4877 Level: advanced
4878
4879.keywords: Mat, register
4880
4881.seealso: MatSeqAIJRegisterAll()
4882
4883
4884 Level: advanced
4885@*/
4886PetscErrorCode MatSeqAIJRegister(const char sname[],PetscErrorCode (*function)(Mat,MatType,MatReuse,Mat *))
4887{
4888 PetscErrorCode ierr;
4889
4890 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4890; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4891 ierr = MatInitializePackage();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4891,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4892 ierr = PetscFunctionListAdd(&MatSeqAIJList,sname,function)PetscFunctionListAdd_Private((&MatSeqAIJList),(sname),(PetscVoidFunction
)(function))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4892,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4893 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4894}
4895
4896PetscBool MatSeqAIJRegisterAllCalled = PETSC_FALSE;
4897
4898/*@C
4899 MatSeqAIJRegisterAll - Registers all of the matrix subtypes of SeqAIJ
4900
4901 Not Collective
4902
4903 Level: advanced
4904
4905 Developers Note: CUSP and CUSPARSE do not yet support the MatConvert_SeqAIJ..() paradigm and thus cannot be registered here
4906
4907.keywords: KSP, register, all
4908
4909.seealso: MatRegisterAll(), MatSeqAIJRegister()
4910@*/
4911PetscErrorCode MatSeqAIJRegisterAll(void)
4912{
4913 PetscErrorCode ierr;
4914
4915 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4915; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4916 if (MatSeqAIJRegisterAllCalled) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4917 MatSeqAIJRegisterAllCalled = PETSC_TRUE;
4918
4919 ierr = MatSeqAIJRegister(MATSEQAIJCRL"seqaijcrl", MatConvert_SeqAIJ_SeqAIJCRL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4919,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4920 ierr = MatSeqAIJRegister(MATSEQAIJPERM"seqaijperm", MatConvert_SeqAIJ_SeqAIJPERM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4920,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4921 ierr = MatSeqAIJRegister(MATSEQAIJSELL"seqaijsell", MatConvert_SeqAIJ_SeqAIJSELL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4922#if defined(PETSC_HAVE_MKL_SPARSE)
4923 ierr = MatSeqAIJRegister(MATSEQAIJMKL"seqaijmkl", MatConvert_SeqAIJ_SeqAIJMKL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4923,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4924#endif
4925#if defined(PETSC_HAVE_VIENNACL) && defined(PETSC_HAVE_VIENNACL_NO_CUDA)
4926 ierr = MatSeqAIJRegister(MATMPIAIJVIENNACL"mpiaijviennacl", MatConvert_SeqAIJ_SeqAIJViennaCL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4926,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4927#endif
4928 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4929}
4930
4931/*
4932 Special version for direct calls from Fortran
4933*/
4934#include <petsc/private/fortranimpl.h>
4935#if defined(PETSC_HAVE_FORTRAN_CAPS)
4936#define matsetvaluesseqaij_ MATSETVALUESSEQAIJ
4937#elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE1)
4938#define matsetvaluesseqaij_ matsetvaluesseqaij
4939#endif
4940
4941/* Change these macros so can be used in void function */
4942#undef CHKERRQ
4943#define CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4943,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
CHKERRABORT(PetscObjectComm((PetscObject)A),ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4943,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
4944#undef SETERRQ2
4945#define SETERRQ2(comm,ierr,b,c,d)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4945,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (
0)
CHKERRABORT(comm,ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4945,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (
0)
4946#undef SETERRQ3
4947#define SETERRQ3(comm,ierr,b,c,d,e)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4947,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (
0)
CHKERRABORT(comm,ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4947,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (
0)
4948
4949PETSC_EXTERNextern __attribute__((visibility ("default"))) void PETSC_STDCALL matsetvaluesseqaij_(Mat *AA,PetscInt *mm,const PetscInt im[],PetscInt *nn,const PetscInt in[],const PetscScalar v[],InsertMode *isis, PetscErrorCode *_ierr)
4950{
4951 Mat A = *AA;
4952 PetscInt m = *mm, n = *nn;
4953 InsertMode is = *isis;
4954 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
4955 PetscInt *rp,k,low,high,t,ii,row,nrow,i,col,l,rmax,N;
4956 PetscInt *imax,*ai,*ailen;
4957 PetscErrorCode ierr;
4958 PetscInt *aj,nonew = a->nonew,lastcol = -1;
4959 MatScalar *ap,value,*aa;
4960 PetscBool ignorezeroentries = a->ignorezeroentries;
4961 PetscBool roworiented = a->roworiented;
4962
4963 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4963; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4964 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) do {if
(__builtin_expect(!!(73),0)) {PetscError(((MPI_Comm)0x44000001
),4964,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
73);}} while (0); } while (0)
;
4965 imax = a->imax;
4966 ai = a->i;
4967 ailen = a->ilen;
4968 aj = a->j;
4969 aa = a->a;
4970
4971 for (k=0; k<m; k++) { /* loop over added rows */
4972 row = im[k];
4973 if (row < 0) continue;
4974#if defined(PETSC_USE_DEBUG1)
4975 if (row >= A->rmap->n) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Row too large")do {PetscError(PetscObjectComm((PetscObject)A),4975,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",63
,PETSC_ERROR_INITIAL,"Row too large");MPI_Abort(PetscObjectComm
((PetscObject)A),63);} while (0)
;
4976#endif
4977 rp = aj + ai[row]; ap = aa + ai[row];
4978 rmax = imax[row]; nrow = ailen[row];
4979 low = 0;
4980 high = nrow;
4981 for (l=0; l<n; l++) { /* loop over added columns */
4982 if (in[l] < 0) continue;
4983#if defined(PETSC_USE_DEBUG1)
4984 if (in[l] >= A->cmap->n) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Column too large")do {PetscError(PetscObjectComm((PetscObject)A),4984,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",63
,PETSC_ERROR_INITIAL,"Column too large");MPI_Abort(PetscObjectComm
((PetscObject)A),63);} while (0)
;
4985#endif
4986 col = in[l];
4987 if (roworiented) value = v[l + k*n];
4988 else value = v[k + l*m];
4989
4990 if (value == 0.0 && ignorezeroentries && (is == ADD_VALUES)) continue;
4991
4992 if (col <= lastcol) low = 0;
4993 else high = nrow;
4994 lastcol = col;
4995 while (high-low > 5) {
4996 t = (low+high)/2;
4997 if (rp[t] > col) high = t;
4998 else low = t;
4999 }
5000 for (i=low; i<high; i++) {
5001 if (rp[i] > col) break;
5002 if (rp[i] == col) {
5003 if (is == ADD_VALUES) ap[i] += value;
5004 else ap[i] = value;
5005 goto noinsert;
5006 }
5007 }
5008 if (value == 0.0 && ignorezeroentries) goto noinsert;
5009 if (nonew == 1) goto noinsert;
5010 if (nonew == -1) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero in the matrix")do {PetscError(PetscObjectComm((PetscObject)A),5010,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",63
,PETSC_ERROR_INITIAL,"Inserting a new nonzero in the matrix")
;MPI_Abort(PetscObjectComm((PetscObject)A),63);} while (0)
;
5011 MatSeqXAIJReallocateAIJ(A,A->rmap->n,1,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data
; PetscInt CHUNKSIZE = 15,new_nz = ai[A->rmap->n] + CHUNKSIZE
,len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) do
{if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001
),5011,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0); ierr = PetscMallocA(3,PETSC_FALSE,5011,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
(size_t)(1*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(A->
rmap->n+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),5011,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); for (ii=0; ii<row+1; ii++) {new_i[
ii] = ai[ii];} for (ii=row+1; ii<A->rmap->n+1; ii++)
{new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = PetscMemcpy(new_j,aj,
(ai[row]+nrow)*sizeof(PetscInt));do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),5011,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); len = (new_nz - CHUNKSIZE - ai[row] -
nrow); ierr = PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE,aj+ai
[row]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),5011,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = PetscMemcpy(new_a,aa,1*(ai[row
]+nrow)*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),
0)) {PetscError(((MPI_Comm)0x44000001),5011,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = PetscMemzero(new_a+1*(ai[row]+
nrow),1*CHUNKSIZE*sizeof(MatScalar));do {if (__builtin_expect
(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),5011,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = PetscMemcpy(new_a+1*(ai[row]+nrow
+CHUNKSIZE),aa+1*(ai[row]+nrow),1*len*sizeof(MatScalar));do {
if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001
),5011,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = MatSeqXAIJFreeAIJ(A,&Ain->
a,&Ain->j,&Ain->i);do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),5011,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); aa = new_a; Ain->a = (MatScalar*) new_a
; ai = Ain->i = new_i; aj = Ain->j = new_j; Ain->singlemalloc
= PETSC_TRUE; rp = aj + ai[row]; ap = aa + 1*ai[row]; rmax =
imax[row] = imax[row] + CHUNKSIZE; Ain->maxnz += 1*CHUNKSIZE
; Ain->reallocs++; }
;
5012 N = nrow++ - 1; a->nz++; high++;
5013 /* shift up all the later entries in this row */
5014 for (ii=N; ii>=i; ii--) {
5015 rp[ii+1] = rp[ii];
5016 ap[ii+1] = ap[ii];
5017 }
5018 rp[i] = col;
5019 ap[i] = value;
5020 A->nonzerostate++;
5021noinsert:;
5022 low = i + 1;
5023 }
5024 ailen[row] = nrow;
5025 }
5026 PetscFunctionReturnVoid()do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return;} while (0)
;
5027}