Bug Summary

File:mat/impls/aij/seq/aij.c
Warning:line 1748, 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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
37 ierr = PetscArrayzero(norms,n)PetscMemzero(norms,(n)*sizeof(*(norms)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),37,__func__,"/sandbox/petsc/petsc.master/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])fabs(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])fabs(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]])(((fabs(aij->a[i]))<(norms[aij->j[i]])) ? (norms[aij
->j[i]]) : (fabs(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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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,&collengths)PetscMallocA(1,PETSC_TRUE,260,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(n)*sizeof(**(&collengths)),(&collengths))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),260,__func__,"/sandbox/petsc/petsc.master/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.master/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.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
262 ierr = PetscMalloc1(nz,&cja)PetscMallocA(1,PETSC_FALSE,262,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz)*sizeof(**(&cja)),(&cja))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),262,__func__,"/sandbox/petsc/petsc.master/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 = PetscArrayzero(collengths,n)PetscMemzero(collengths,(n)*sizeof(*(collengths)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),271,__func__,"/sandbox/petsc/petsc.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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,mr,col,tmp;
310 PetscInt *cspidx;
311 const PetscInt *jj;
312
313 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 313; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
314 *nn = n;
315 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)
;
316
317 ierr = PetscCalloc1(n,&collengths)PetscMallocA(1,PETSC_TRUE,317,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(n)*sizeof(**(&collengths)),(&collengths))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),317,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
318 ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,318,__func__,"/sandbox/petsc/petsc.master/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),318,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
319 ierr = PetscMalloc1(nz,&cja)PetscMallocA(1,PETSC_FALSE,319,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz)*sizeof(**(&cja)),(&cja))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),319,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
320 ierr = PetscMalloc1(nz,&cspidx)PetscMallocA(1,PETSC_FALSE,320,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz)*sizeof(**(&cspidx)),(&cspidx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),320,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
321 jj = a->j;
322 for (i=0; i<nz; i++) {
323 collengths[jj[i]]++;
324 }
325 cia[0] = oshift;
326 for (i=0; i<n; i++) {
327 cia[i+1] = cia[i] + collengths[i];
328 }
329 ierr = PetscArrayzero(collengths,n)PetscMemzero(collengths,(n)*sizeof(*(collengths)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),329,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
330 jj = a->j;
331 for (row=0; row<m; row++) {
332 mr = a->i[row+1] - a->i[row];
333 for (i=0; i<mr; i++) {
334 col = *jj++;
335 tmp = cia[col] + collengths[col]++ - oshift;
336 cspidx[tmp] = a->i[row] + i; /* index of a->j */
337 cja[tmp] = row + oshift;
338 }
339 }
340 ierr = PetscFree(collengths)((*PetscTrFree)((void*)(collengths),340,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((collengths) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),340,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
341 *ia = cia;
342 *ja = cja;
343 *spidx = cspidx;
344 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)
;
345}
346
347PetscErrorCode MatRestoreColumnIJ_SeqAIJ_Color(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscInt *spidx[],PetscBool *done)
348{
349 PetscErrorCode ierr;
350
351 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 351; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
352 ierr = MatRestoreColumnIJ_SeqAIJ(A,oshift,symmetric,inodecompressed,n,ia,ja,done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),352,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
353 ierr = PetscFree(*spidx)((*PetscTrFree)((void*)(*spidx),353,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((*spidx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),353,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
354 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)
;
355}
356
357PetscErrorCode MatSetValuesRow_SeqAIJ(Mat A,PetscInt row,const PetscScalar v[])
358{
359 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
360 PetscInt *ai = a->i;
361 PetscErrorCode ierr;
362
363 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 363; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
364 ierr = PetscArraycpy(a->a+ai[row],v,ai[row+1]-ai[row])((sizeof(*(a->a+ai[row])) != sizeof(*(v))) || PetscMemcpy(
a->a+ai[row],v,(ai[row+1]-ai[row])*sizeof(*(a->a+ai[row
]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),364,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
365#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
366 if (A->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED && ai[row+1]-ai[row]) A->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
367#endif
368 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)
;
369}
370
371/*
372 MatSeqAIJSetValuesLocalFast - An optimized version of MatSetValuesLocal() for SeqAIJ matrices with several assumptions
373
374 - a single row of values is set with each call
375 - no row or column indices are negative or (in error) larger than the number of rows or columns
376 - the values are always added to the matrix, not set
377 - no new locations are introduced in the nonzero structure of the matrix
378
379 This does NOT assume the global column indices are sorted
380
381*/
382
383#include <petsc/private/isimpl.h>
384PetscErrorCode MatSeqAIJSetValuesLocalFast(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is)
385{
386 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
387 PetscInt low,high,t,row,nrow,i,col,l;
388 const PetscInt *rp,*ai = a->i,*ailen = a->ilen,*aj = a->j;
389 PetscInt lastcol = -1;
390 MatScalar *ap,value,*aa = a->a;
391 const PetscInt *ridx = A->rmap->mapping->indices,*cidx = A->cmap->mapping->indices;
392
393 row = ridx[im[0]];
394 rp = aj + ai[row];
395 ap = aa + ai[row];
396 nrow = ailen[row];
397 low = 0;
398 high = nrow;
399 for (l=0; l<n; l++) { /* loop over added columns */
400 col = cidx[in[l]];
401 value = v[l];
402
403 if (col <= lastcol) low = 0;
404 else high = nrow;
405 lastcol = col;
406 while (high-low > 5) {
407 t = (low+high)/2;
408 if (rp[t] > col) high = t;
409 else low = t;
410 }
411 for (i=low; i<high; i++) {
412 if (rp[i] == col) {
413 ap[i] += value;
414 low = i + 1;
415 break;
416 }
417 }
418 }
419#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
420 if (A->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED && m*n) A->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
421#endif
422 return 0;
423}
424
425PetscErrorCode MatSetValues_SeqAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is)
426{
427 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
428 PetscInt *rp,k,low,high,t,ii,row,nrow,i,col,l,rmax,N;
429 PetscInt *imax = a->imax,*ai = a->i,*ailen = a->ilen;
430 PetscErrorCode ierr;
431 PetscInt *aj = a->j,nonew = a->nonew,lastcol = -1;
432 MatScalar *ap=NULL((void*)0),value=0.0,*aa = a->a;
433 PetscBool ignorezeroentries = a->ignorezeroentries;
434 PetscBool roworiented = a->roworiented;
435#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
436 PetscBool inserted = PETSC_FALSE;
437#endif
438
439 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 439; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
440 for (k=0; k<m; k++) { /* loop over added rows */
441 row = im[k];
442 if (row < 0) continue;
443#if defined(PETSC_USE_DEBUG1)
444 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
),444,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
445#endif
446 rp = aj + ai[row];
447 if (!A->structure_only) ap = aa + ai[row];
448 rmax = imax[row]; nrow = ailen[row];
449 low = 0;
450 high = nrow;
451 for (l=0; l<n; l++) { /* loop over added columns */
452 if (in[l] < 0) continue;
453#if defined(PETSC_USE_DEBUG1)
454 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
),454,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
455#endif
456 col = in[l];
457 if (v && !A->structure_only) value = roworiented ? v[l + k*n] : v[k + l*m];
458 if (!A->structure_only && value == 0.0 && ignorezeroentries && is == ADD_VALUES && row != col) continue;
459
460 if (col <= lastcol) low = 0;
461 else high = nrow;
462 lastcol = col;
463 while (high-low > 5) {
464 t = (low+high)/2;
465 if (rp[t] > col) high = t;
466 else low = t;
467 }
468 for (i=low; i<high; i++) {
469 if (rp[i] > col) break;
470 if (rp[i] == col) {
471 if (!A->structure_only) {
472 if (is == ADD_VALUES) {
473 ap[i] += value;
474 (void)PetscLogFlops(1.0);
475 }
476 else ap[i] = value;
477#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
478 inserted = PETSC_TRUE;
479#endif
480 }
481 low = i + 1;
482 goto noinsert;
483 }
484 }
485 if (value == 0.0 && ignorezeroentries && row != col) goto noinsert;
486 if (nonew == 1) goto noinsert;
487 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
),487,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
488 if (A->structure_only) {
489 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),489,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0); ierr = PetscMallocA(1,PETSC_FALSE,489,__func__
,"/sandbox/petsc/petsc.master/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),489,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",ierr
,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = PetscMallocA(1,PETSC_FALSE,489
,__func__,"/sandbox/petsc/petsc.master/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),489,__func__,"/sandbox/petsc/petsc.master/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 = ((sizeof(*(new_j)) !=
sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof
(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) {PetscError
(((MPI_Comm)0x44000001),489,__func__,"/sandbox/petsc/petsc.master/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 = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE)) != sizeof
(*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE
,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE)
)));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm
)0x44000001),489,__func__,"/sandbox/petsc/petsc.master/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),489,__func__,"/sandbox/petsc/petsc.master/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++; }
;
490 } else {
491 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
),491,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0); ierr = PetscMallocA(3,PETSC_FALSE,491,__func__
,"/sandbox/petsc/petsc.master/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),491,__func__
,"/sandbox/petsc/petsc.master/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 = ((sizeof(*(new_j)) !=
sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof
(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) {PetscError
(((MPI_Comm)0x44000001),491,__func__,"/sandbox/petsc/petsc.master/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 = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE)) != sizeof
(*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE
,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE)
)));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm
)0x44000001),491,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = ((sizeof(*(new_a)) != sizeof(*
(aa))) || PetscMemcpy(new_a,aa,(1*(ai[row]+nrow))*sizeof(*(new_a
))));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm
)0x44000001),491,__func__,"/sandbox/petsc/petsc.master/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(*(new_a+1*(ai[row]+nrow))));do {if
(__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001
),491,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = ((sizeof(*(new_a+1*(ai[row]+nrow
+CHUNKSIZE))) != sizeof(*(aa+1*(ai[row]+nrow)))) || PetscMemcpy
(new_a+1*(ai[row]+nrow+CHUNKSIZE),aa+1*(ai[row]+nrow),(1*len)
*sizeof(*(new_a+1*(ai[row]+nrow+CHUNKSIZE)))));do {if (__builtin_expect
(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),491,__func__
,"/sandbox/petsc/petsc.master/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),491,__func__,"/sandbox/petsc/petsc.master/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++; }
;
492 }
493 N = nrow++ - 1; a->nz++; high++;
494 /* shift up all the later entries in this row */
495 ierr = PetscArraymove(rp+i+1,rp+i,N-i+1)((sizeof(*(rp+i+1)) != sizeof(*(rp+i))) || PetscMemmove(rp+i+
1,rp+i,(N-i+1)*sizeof(*(rp+i+1))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),495,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
496 rp[i] = col;
497 if (!A->structure_only){
498 ierr = PetscArraymove(ap+i+1,ap+i,N-i+1)((sizeof(*(ap+i+1)) != sizeof(*(ap+i))) || PetscMemmove(ap+i+
1,ap+i,(N-i+1)*sizeof(*(ap+i+1))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),498,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
499 ap[i] = value;
500 }
501 low = i + 1;
502 A->nonzerostate++;
503#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
504 inserted = PETSC_TRUE;
505#endif
506noinsert:;
507 }
508 ailen[row] = nrow;
509 }
510#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
511 if (A->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED && inserted) A->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
512#endif
513 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)
;
514}
515
516PetscErrorCode MatSetValues_SeqAIJ_SortedFull(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is)
517{
518 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
519 PetscInt *rp,k,row;
520 PetscInt *ai = a->i,*ailen = a->ilen;
521 PetscErrorCode ierr;
522 PetscInt *aj = a->j;
523 MatScalar *aa = a->a,*ap;
524
525 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 525; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
526 for (k=0; k<m; k++) { /* loop over added rows */
527 row = im[k];
528 rp = aj + ai[row];
529 ap = aa + ai[row];
530 if (!A->was_assembled) {
531 ierr = PetscMemcpy(rp,in,n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),531,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
532 }
533 if (!A->structure_only) {
534 if (v) {
535 ierr = PetscMemcpy(ap,v,n*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),535,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
536 v += n;
537 } else {
538 ierr = PetscMemzero(ap,n*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),538,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
539 }
540 }
541 ailen[row] = n;
542 a->nz += n;
543 }
544#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
545 if (A->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED && m*n) A->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
546#endif
547 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)
;
548}
549
550
551PetscErrorCode MatGetValues_SeqAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],PetscScalar v[])
552{
553 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
554 PetscInt *rp,k,low,high,t,row,nrow,i,col,l,*aj = a->j;
555 PetscInt *ai = a->i,*ailen = a->ilen;
556 MatScalar *ap,*aa = a->a;
557
558 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 558; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
559 for (k=0; k<m; k++) { /* loop over rows */
560 row = im[k];
561 if (row < 0) {v += n; continue;} /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row: %D",row); */
562 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
),562,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
563 rp = aj + ai[row]; ap = aa + ai[row];
564 nrow = ailen[row];
565 for (l=0; l<n; l++) { /* loop over columns */
566 if (in[l] < 0) {v++; continue;} /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column: %D",in[l]); */
567 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
),567,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
568 col = in[l];
569 high = nrow; low = 0; /* assume unsorted */
570 while (high-low > 5) {
571 t = (low+high)/2;
572 if (rp[t] > col) high = t;
573 else low = t;
574 }
575 for (i=low; i<high; i++) {
576 if (rp[i] > col) break;
577 if (rp[i] == col) {
578 *v++ = ap[i];
579 goto finished;
580 }
581 }
582 *v++ = 0.0;
583finished:;
584 }
585 }
586 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)
;
587}
588
589
590PetscErrorCode MatView_SeqAIJ_Binary(Mat A,PetscViewer viewer)
591{
592 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
593 PetscErrorCode ierr;
594 PetscInt i,*col_lens;
595 int fd;
596 FILE *file;
597
598 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 598; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
599 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),599,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
600 ierr = PetscMalloc1(4+A->rmap->n,&col_lens)PetscMallocA(1,PETSC_FALSE,600,__func__,"/sandbox/petsc/petsc.master/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),600,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
601
602 col_lens[0] = MAT_FILE_CLASSID1211216;
603 col_lens[1] = A->rmap->n;
604 col_lens[2] = A->cmap->n;
605 col_lens[3] = a->nz;
606
607 /* store lengths of each row and write (including header) to file */
608 for (i=0; i<A->rmap->n; i++) {
609 col_lens[4+i] = a->i[i+1] - a->i[i];
610 }
611 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),611,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
612 ierr = PetscFree(col_lens)((*PetscTrFree)((void*)(col_lens),612,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((col_lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),612,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
613
614 /* store column indices (zero start index) */
615 ierr = PetscBinaryWrite(fd,a->j,a->nz,PETSC_INT,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),615,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
616
617 /* store nonzero values */
618 ierr = PetscBinaryWrite(fd,a->a,a->nz,PETSC_SCALARPETSC_DOUBLE,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),618,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
619
620 ierr = PetscViewerBinaryGetInfoPointer(viewer,&file);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),620,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
621 if (file) {
622 fprintf(file,"-matload_block_size %d\n",(int)PetscAbs(A->rmap->bs)(((A->rmap->bs) >= 0) ? (A->rmap->bs) : (-(A->
rmap->bs)))
);
623 }
624 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)
;
625}
626
627static PetscErrorCode MatView_SeqAIJ_ASCII_structonly(Mat A,PetscViewer viewer)
628{
629 PetscErrorCode ierr;
630 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
631 PetscInt i,k,m=A->rmap->N;
632
633 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 633; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
634 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),634,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
635 for (i=0; i<m; i++) {
636 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),636,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
637 for (k=a->i[i]; k<a->i[i+1]; k++) {
638 ierr = PetscViewerASCIIPrintf(viewer," (%D) ",a->j[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),638,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
639 }
640 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),640,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
641 }
642 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),642,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
643 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)
;
644}
645
646extern PetscErrorCode MatSeqAIJFactorInfo_Matlab(Mat,PetscViewer);
647
648PetscErrorCode MatView_SeqAIJ_ASCII(Mat A,PetscViewer viewer)
649{
650 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
651 PetscErrorCode ierr;
652 PetscInt i,j,m = A->rmap->n;
653 const char *name;
654 PetscViewerFormat format;
655
656 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 656; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
657 if (A->structure_only) {
658 ierr = MatView_SeqAIJ_ASCII_structonly(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),658,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
659 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)
;
660 }
661
662 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),662,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
663 if (format == PETSC_VIEWER_ASCII_MATLAB) {
664 PetscInt nofinalvalue = 0;
665 if (m && ((a->i[m] == a->i[m-1]) || (a->j[a->nz-1] != A->cmap->n-1))) {
666 /* Need a dummy value to ensure the dimension of the matrix. */
667 nofinalvalue = 1;
668 }
669 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),669,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
670 ierr = PetscViewerASCIIPrintf(viewer,"%% Size = %D %D \n",m,A->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),670,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
671 ierr = PetscViewerASCIIPrintf(viewer,"%% Nonzeros = %D \n",a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),671,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
672#if defined(PETSC_USE_COMPLEX)
673 ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,4);\n",a->nz+nofinalvalue);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),673,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
674#else
675 ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,3);\n",a->nz+nofinalvalue);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),675,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
676#endif
677 ierr = PetscViewerASCIIPrintf(viewer,"zzz = [\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),677,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
678
679 for (i=0; i<m; i++) {
680 for (j=a->i[i]; j<a->i[i+1]; j++) {
681#if defined(PETSC_USE_COMPLEX)
682 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),682,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
683#else
684 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),684,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
685#endif
686 }
687 }
688 if (nofinalvalue) {
689#if defined(PETSC_USE_COMPLEX)
690 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),690,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
691#else
692 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),692,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
693#endif
694 }
695 ierr = PetscObjectGetName((PetscObject)A,&name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),695,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
696 ierr = PetscViewerASCIIPrintf(viewer,"];\n %s = spconvert(zzz);\n",name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),696,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
697 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),697,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
698 } else if (format == PETSC_VIEWER_ASCII_FACTOR_INFO || format == PETSC_VIEWER_ASCII_INFO) {
699 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)
;
700 } else if (format == PETSC_VIEWER_ASCII_COMMON) {
701 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),701,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
702 for (i=0; i<m; i++) {
703 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),703,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
704 for (j=a->i[i]; j<a->i[i+1]; j++) {
705#if defined(PETSC_USE_COMPLEX)
706 if (PetscImaginaryPart(a->a[j])((PetscReal)0) > 0.0 && PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
707 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),707,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
708 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0) < 0.0 && PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
709 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),709,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
710 } else if (PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
711 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),711,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
712 }
713#else
714 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),714,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
715#endif
716 }
717 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),717,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
718 }
719 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),719,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
720 } else if (format == PETSC_VIEWER_ASCII_SYMMODU) {
721 PetscInt nzd=0,fshift=1,*sptr;
722 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),722,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
723 ierr = PetscMalloc1(m+1,&sptr)PetscMallocA(1,PETSC_FALSE,723,__func__,"/sandbox/petsc/petsc.master/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),723,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
724 for (i=0; i<m; i++) {
725 sptr[i] = nzd+1;
726 for (j=a->i[i]; j<a->i[i+1]; j++) {
727 if (a->j[j] >= i) {
728#if defined(PETSC_USE_COMPLEX)
729 if (PetscImaginaryPart(a->a[j])((PetscReal)0) != 0.0 || PetscRealPart(a->a[j])(a->a[j]) != 0.0) nzd++;
730#else
731 if (a->a[j] != 0.0) nzd++;
732#endif
733 }
734 }
735 }
736 sptr[m] = nzd+1;
737 ierr = PetscViewerASCIIPrintf(viewer," %D %D\n\n",m,nzd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),737,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
738 for (i=0; i<m+1; i+=6) {
739 if (i+4<m) {
740 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),740,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
741 } else if (i+3<m) {
742 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),742,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
743 } else if (i+2<m) {
744 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),744,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
745 } else if (i+1<m) {
746 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),746,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
747 } else if (i<m) {
748 ierr = PetscViewerASCIIPrintf(viewer," %D %D\n",sptr[i],sptr[i+1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),748,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
749 } else {
750 ierr = PetscViewerASCIIPrintf(viewer," %D\n",sptr[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),750,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
751 }
752 }
753 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),753,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
754 ierr = PetscFree(sptr)((*PetscTrFree)((void*)(sptr),754,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((sptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),754,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
755 for (i=0; i<m; i++) {
756 for (j=a->i[i]; j<a->i[i+1]; j++) {
757 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),757,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
758 }
759 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),759,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
760 }
761 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),761,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
762 for (i=0; i<m; i++) {
763 for (j=a->i[i]; j<a->i[i+1]; j++) {
764 if (a->j[j] >= i) {
765#if defined(PETSC_USE_COMPLEX)
766 if (PetscImaginaryPart(a->a[j])((PetscReal)0) != 0.0 || PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
767 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),767,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
768 }
769#else
770 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),770,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
771#endif
772 }
773 }
774 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),774,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
775 }
776 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),776,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
777 } else if (format == PETSC_VIEWER_ASCII_DENSE) {
778 PetscInt cnt = 0,jcnt;
779 PetscScalar value;
780#if defined(PETSC_USE_COMPLEX)
781 PetscBool realonly = PETSC_TRUE;
782
783 for (i=0; i<a->i[m]; i++) {
784 if (PetscImaginaryPart(a->a[i])((PetscReal)0) != 0.0) {
785 realonly = PETSC_FALSE;
786 break;
787 }
788 }
789#endif
790
791 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),791,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
792 for (i=0; i<m; i++) {
793 jcnt = 0;
794 for (j=0; j<A->cmap->n; j++) {
795 if (jcnt < a->i[i+1]-a->i[i] && j == a->j[cnt]) {
796 value = a->a[cnt++];
797 jcnt++;
798 } else {
799 value = 0.0;
800 }
801#if defined(PETSC_USE_COMPLEX)
802 if (realonly) {
803 ierr = PetscViewerASCIIPrintf(viewer," %7.5e ",(double)PetscRealPart(value)(value));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),803,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
804 } else {
805 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),805,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
806 }
807#else
808 ierr = PetscViewerASCIIPrintf(viewer," %7.5e ",(double)value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),808,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
809#endif
810 }
811 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),811,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
812 }
813 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),813,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
814 } else if (format == PETSC_VIEWER_ASCII_MATRIXMARKET) {
815 PetscInt fshift=1;
816 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),816,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
817#if defined(PETSC_USE_COMPLEX)
818 ierr = PetscViewerASCIIPrintf(viewer,"%%%%MatrixMarket matrix coordinate complex general\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),818,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
819#else
820 ierr = PetscViewerASCIIPrintf(viewer,"%%%%MatrixMarket matrix coordinate real general\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),820,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
821#endif
822 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),822,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
823 for (i=0; i<m; i++) {
824 for (j=a->i[i]; j<a->i[i+1]; j++) {
825#if defined(PETSC_USE_COMPLEX)
826 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),826,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
827#else
828 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),828,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
829#endif
830 }
831 }
832 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),832,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
833 } else {
834 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),834,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
835 if (A->factortype) {
836 for (i=0; i<m; i++) {
837 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),837,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
838 /* L part */
839 for (j=a->i[i]; j<a->i[i+1]; j++) {
840#if defined(PETSC_USE_COMPLEX)
841 if (PetscImaginaryPart(a->a[j])((PetscReal)0) > 0.0) {
842 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),842,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
843 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0) < 0.0) {
844 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),844,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
845 } else {
846 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),846,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
847 }
848#else
849 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),849,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
850#endif
851 }
852 /* diagonal */
853 j = a->diag[i];
854#if defined(PETSC_USE_COMPLEX)
855 if (PetscImaginaryPart(a->a[j])((PetscReal)0) > 0.0) {
856 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),856,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
857 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0) < 0.0) {
858 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),858,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
859 } else {
860 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),860,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
861 }
862#else
863 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),863,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
864#endif
865
866 /* U part */
867 for (j=a->diag[i+1]+1; j<a->diag[i]; j++) {
868#if defined(PETSC_USE_COMPLEX)
869 if (PetscImaginaryPart(a->a[j])((PetscReal)0) > 0.0) {
870 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),870,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
871 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0) < 0.0) {
872 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),872,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
873 } else {
874 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),874,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
875 }
876#else
877 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),877,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
878#endif
879 }
880 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),880,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
881 }
882 } else {
883 for (i=0; i<m; i++) {
884 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),884,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
885 for (j=a->i[i]; j<a->i[i+1]; j++) {
886#if defined(PETSC_USE_COMPLEX)
887 if (PetscImaginaryPart(a->a[j])((PetscReal)0) > 0.0) {
888 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),888,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
889 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0) < 0.0) {
890 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),890,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
891 } else {
892 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),892,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
893 }
894#else
895 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),895,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
896#endif
897 }
898 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),898,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
899 }
900 }
901 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),901,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
902 }
903 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),903,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
904 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)
;
905}
906
907#include <petscdraw.h>
908PetscErrorCode MatView_SeqAIJ_Draw_Zoom(PetscDraw draw,void *Aa)
909{
910 Mat A = (Mat) Aa;
911 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
912 PetscErrorCode ierr;
913 PetscInt i,j,m = A->rmap->n;
914 int color;
915 PetscReal xl,yl,xr,yr,x_l,x_r,y_l,y_r;
916 PetscViewer viewer;
917 PetscViewerFormat format;
918
919 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 919; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
920 ierr = PetscObjectQuery((PetscObject)A,"Zoomviewer",(PetscObject*)&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),920,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
921 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),921,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
922 ierr = PetscDrawGetCoordinates(draw,&xl,&yl,&xr,&yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),922,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
923
924 /* loop over matrix elements drawing boxes */
925
926 if (format != PETSC_VIEWER_DRAW_CONTOUR) {
927 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),927,__func__,"/sandbox/petsc/petsc.master/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),927,__func__,"/sandbox/petsc/petsc.master/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),927,__func__,"/sandbox/petsc/petsc.master/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),927,__func__,"/sandbox/petsc/petsc.master/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),927,__func__
,"/sandbox/petsc/petsc.master/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),927,__func__,"/sandbox/petsc/petsc.master/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),927,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
928 /* Blue for negative, Cyan for zero and Red for positive */
929 color = PETSC_DRAW_BLUE5;
930 for (i=0; i<m; i++) {
931 y_l = m - i - 1.0; y_r = y_l + 1.0;
932 for (j=a->i[i]; j<a->i[i+1]; j++) {
933 x_l = a->j[j]; x_r = x_l + 1.0;
934 if (PetscRealPart(a->a[j])(a->a[j]) >= 0.) continue;
935 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),935,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
936 }
937 }
938 color = PETSC_DRAW_CYAN4;
939 for (i=0; i<m; i++) {
940 y_l = m - i - 1.0; y_r = y_l + 1.0;
941 for (j=a->i[i]; j<a->i[i+1]; j++) {
942 x_l = a->j[j]; x_r = x_l + 1.0;
943 if (a->a[j] != 0.) continue;
944 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),944,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
945 }
946 }
947 color = PETSC_DRAW_RED2;
948 for (i=0; i<m; i++) {
949 y_l = m - i - 1.0; y_r = y_l + 1.0;
950 for (j=a->i[i]; j<a->i[i+1]; j++) {
951 x_l = a->j[j]; x_r = x_l + 1.0;
952 if (PetscRealPart(a->a[j])(a->a[j]) <= 0.) continue;
953 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),953,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
954 }
955 }
956 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),956,__func__,"/sandbox/petsc/petsc.master/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),956,__func__,"/sandbox/petsc/petsc.master/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),956,__func__
,"/sandbox/petsc/petsc.master/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),956,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
957 } else {
958 /* use contour shading to indicate magnitude of values */
959 /* first determine max of all nonzero values */
960 PetscReal minv = 0.0, maxv = 0.0;
961 PetscInt nz = a->nz, count = 0;
962 PetscDraw popup;
963
964 for (i=0; i<nz; i++) {
965 if (PetscAbsScalar(a->a[i])fabs(a->a[i]) > maxv) maxv = PetscAbsScalar(a->a[i])fabs(a->a[i]);
966 }
967 if (minv >= maxv) maxv = minv + PETSC_SMALL1.e-10;
968 ierr = PetscDrawGetPopup(draw,&popup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),968,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
969 ierr = PetscDrawScalePopup(popup,minv,maxv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),969,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
970
971 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),971,__func__,"/sandbox/petsc/petsc.master/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),971,__func__,"/sandbox/petsc/petsc.master/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),971,__func__,"/sandbox/petsc/petsc.master/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),971,__func__,"/sandbox/petsc/petsc.master/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),971,__func__
,"/sandbox/petsc/petsc.master/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),971,__func__,"/sandbox/petsc/petsc.master/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),971,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
972 for (i=0; i<m; i++) {
973 y_l = m - i - 1.0;
974 y_r = y_l + 1.0;
975 for (j=a->i[i]; j<a->i[i+1]; j++) {
976 x_l = a->j[j];
977 x_r = x_l + 1.0;
978 color = PetscDrawRealToColor(PetscAbsScalar(a->a[count])fabs(a->a[count]),minv,maxv);
979 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),979,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
980 count++;
981 }
982 }
983 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),983,__func__,"/sandbox/petsc/petsc.master/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),983,__func__,"/sandbox/petsc/petsc.master/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),983,__func__
,"/sandbox/petsc/petsc.master/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),983,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
984 }
985 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)
;
986}
987
988#include <petscdraw.h>
989PetscErrorCode MatView_SeqAIJ_Draw(Mat A,PetscViewer viewer)
990{
991 PetscErrorCode ierr;
992 PetscDraw draw;
993 PetscReal xr,yr,xl,yl,h,w;
994 PetscBool isnull;
995
996 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 996; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
997 ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),997,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
998 ierr = PetscDrawIsNull(draw,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),998,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
999 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)
;
1000
1001 xr = A->cmap->n; yr = A->rmap->n; h = yr/10.0; w = xr/10.0;
1002 xr += w; yr += h; xl = -w; yl = -h;
1003 ierr = PetscDrawSetCoordinates(draw,xl,yl,xr,yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1003,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1004 ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",(PetscObject)viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1004,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1005 ierr = PetscDrawZoom(draw,MatView_SeqAIJ_Draw_Zoom,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1005,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1006 ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1006,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1007 ierr = PetscDrawSave(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1007,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1008 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)
;
1009}
1010
1011PetscErrorCode MatView_SeqAIJ(Mat A,PetscViewer viewer)
1012{
1013 PetscErrorCode ierr;
1014 PetscBool iascii,isbinary,isdraw;
1015
1016 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1016; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1017 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1017,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1018 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1018,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1019 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1019,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1020 if (iascii) {
1021 ierr = MatView_SeqAIJ_ASCII(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1021,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1022 } else if (isbinary) {
1023 ierr = MatView_SeqAIJ_Binary(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1023,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1024 } else if (isdraw) {
1025 ierr = MatView_SeqAIJ_Draw(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1025,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1026 }
1027 ierr = MatView_SeqAIJ_Inode(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1027,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1028 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)
;
1029}
1030
1031PetscErrorCode MatAssemblyEnd_SeqAIJ(Mat A,MatAssemblyType mode)
1032{
1033 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1034 PetscErrorCode ierr;
1035 PetscInt fshift = 0,i,*ai = a->i,*aj = a->j,*imax = a->imax;
1036 PetscInt m = A->rmap->n,*ip,N,*ailen = a->ilen,rmax = 0;
1037 MatScalar *aa = a->a,*ap;
1038 PetscReal ratio = 0.6;
1039
1040 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1040; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1041 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)
;
1042 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1042,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1043 if (A->was_assembled && A->ass_nonzerostate == A->nonzerostate) 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)
;
1044
1045 if (m) rmax = ailen[0]; /* determine row with most nonzeros */
1046 for (i=1; i<m; i++) {
1047 /* move each row back by the amount of empty slots (fshift) before it*/
1048 fshift += imax[i-1] - ailen[i-1];
1049 rmax = PetscMax(rmax,ailen[i])(((rmax)<(ailen[i])) ? (ailen[i]) : (rmax));
1050 if (fshift) {
1051 ip = aj + ai[i];
1052 ap = aa + ai[i];
1053 N = ailen[i];
1054 ierr = PetscArraymove(ip-fshift,ip,N)((sizeof(*(ip-fshift)) != sizeof(*(ip))) || PetscMemmove(ip-fshift
,ip,(N)*sizeof(*(ip-fshift))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1054,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1055 if (!A->structure_only) {
1056 ierr = PetscArraymove(ap-fshift,ap,N)((sizeof(*(ap-fshift)) != sizeof(*(ap))) || PetscMemmove(ap-fshift
,ap,(N)*sizeof(*(ap-fshift))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1056,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1057 }
1058 }
1059 ai[i] = ai[i-1] + ailen[i-1];
1060 }
1061 if (m) {
1062 fshift += imax[m-1] - ailen[m-1];
1063 ai[m] = ai[m-1] + ailen[m-1];
1064 }
1065
1066 /* reset ilen and imax for each row */
1067 a->nonzerorowcnt = 0;
1068 if (A->structure_only) {
1069 ierr = PetscFree(a->imax)((*PetscTrFree)((void*)(a->imax),1069,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((a->imax) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1069,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1070 ierr = PetscFree(a->ilen)((*PetscTrFree)((void*)(a->ilen),1070,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((a->ilen) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1070,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1071 } else { /* !A->structure_only */
1072 for (i=0; i<m; i++) {
1073 ailen[i] = imax[i] = ai[i+1] - ai[i];
1074 a->nonzerorowcnt += ((ai[i+1] - ai[i]) > 0);
1075 }
1076 }
1077 a->nz = ai[m];
1078 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
),1078,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
77);}} while (0)
;
1079
1080 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1080,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1081 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),1081,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1082 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),1082,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1083 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),1083,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1084
1085 A->info.mallocs += a->reallocs;
1086 a->reallocs = 0;
1087 A->info.nz_unneeded = (PetscReal)fshift;
1088 a->rmax = rmax;
1089
1090 if (!A->structure_only) {
1091 ierr = MatCheckCompressedRow(A,a->nonzerorowcnt,&a->compressedrow,a->i,m,ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1091,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1092 }
1093 ierr = MatAssemblyEnd_SeqAIJ_Inode(A,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1093,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1094 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)
;
1095}
1096
1097PetscErrorCode MatRealPart_SeqAIJ(Mat A)
1098{
1099 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1100 PetscInt i,nz = a->nz;
1101 MatScalar *aa = a->a;
1102 PetscErrorCode ierr;
1103
1104 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1104; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1105 for (i=0; i<nz; i++) aa[i] = PetscRealPart(aa[i])(aa[i]);
1106 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1106,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1107#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
1108 if (A->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED) A->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
1109#endif
1110 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)
;
1111}
1112
1113PetscErrorCode MatImaginaryPart_SeqAIJ(Mat A)
1114{
1115 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1116 PetscInt i,nz = a->nz;
1117 MatScalar *aa = a->a;
1118 PetscErrorCode ierr;
1119
1120 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1120; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1121 for (i=0; i<nz; i++) aa[i] = PetscImaginaryPart(aa[i])((PetscReal)0);
1122 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1122,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1123#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
1124 if (A->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED) A->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
1125#endif
1126 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)
;
1127}
1128
1129PetscErrorCode MatZeroEntries_SeqAIJ(Mat A)
1130{
1131 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1132 PetscErrorCode ierr;
1133
1134 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1134; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1135 ierr = PetscArrayzero(a->a,a->i[A->rmap->n])PetscMemzero(a->a,(a->i[A->rmap->n])*sizeof(*(a->
a)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1135,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1136 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1136,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1137#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
1138 if (A->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED) A->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
1139#endif
1140 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)
;
1141}
1142
1143PetscErrorCode MatDestroy_SeqAIJ(Mat A)
1144{
1145 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1146 PetscErrorCode ierr;
1147
1148 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1148; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1149#if defined(PETSC_USE_LOG1)
1150 PetscLogObjectState((PetscObject)A,"Rows=%D, Cols=%D, NZ=%D",A->rmap->n,A->cmap->n,a->nz);
1151#endif
1152 ierr = MatSeqXAIJFreeAIJ(A,&a->a,&a->j,&a->i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1152,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1153 ierr = ISDestroy(&a->row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1153,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1154 ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1154,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1155 ierr = PetscFree(a->diag)((*PetscTrFree)((void*)(a->diag),1155,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((a->diag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1155,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1156 ierr = PetscFree(a->ibdiag)((*PetscTrFree)((void*)(a->ibdiag),1156,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((a->ibdiag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1156,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1157 ierr = PetscFree(a->imax)((*PetscTrFree)((void*)(a->imax),1157,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((a->imax) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1157,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1158 ierr = PetscFree(a->ilen)((*PetscTrFree)((void*)(a->ilen),1158,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((a->ilen) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1158,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1159 ierr = PetscFree(a->ipre)((*PetscTrFree)((void*)(a->ipre),1159,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((a->ipre) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1159,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1160 ierr = PetscFree3(a->idiag,a->mdiag,a->ssor_work)PetscFreeA(3,1160,__func__,"/sandbox/petsc/petsc.master/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),1160,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1161 ierr = PetscFree(a->solve_work)((*PetscTrFree)((void*)(a->solve_work),1161,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((a->solve_work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1161,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1162 ierr = ISDestroy(&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1162,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1163 ierr = PetscFree(a->saved_values)((*PetscTrFree)((void*)(a->saved_values),1163,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((a->saved_values) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1163,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1164 ierr = ISColoringDestroy(&a->coloring);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1164,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1165 ierr = PetscFree2(a->compressedrow.i,a->compressedrow.rindex)PetscFreeA(2,1165,__func__,"/sandbox/petsc/petsc.master/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),1165,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1166 ierr = PetscFree(a->matmult_abdense)((*PetscTrFree)((void*)(a->matmult_abdense),1166,__func__,
"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c") ||
((a->matmult_abdense) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1166,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1167
1168 ierr = MatDestroy_SeqAIJ_Inode(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1168,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1169 ierr = PetscFree(A->data)((*PetscTrFree)((void*)(A->data),1169,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((A->data) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1169,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1170
1171 ierr = PetscObjectChangeTypeName((PetscObject)A,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1171,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1172 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),1172,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1173 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),1173,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1174 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),1174,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1175 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),1175,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1176 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),1176,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1177 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),1177,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1178#if defined(PETSC_HAVE_ELEMENTAL)
1179 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),1179,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1180#endif
1181#if defined(PETSC_HAVE_HYPRE)
1182 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),1182,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1183 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),1183,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1184#endif
1185 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),1185,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1186 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),1186,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1187 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),1187,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1188 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),1188,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1189 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),1189,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1190 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),1190,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1191 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),1191,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1192 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),1192,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1193 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),1193,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1194 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)
;
1195}
1196
1197PetscErrorCode MatSetOption_SeqAIJ(Mat A,MatOption op,PetscBool flg)
1198{
1199 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1200 PetscErrorCode ierr;
1201
1202 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1202; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1203 switch (op) {
1204 case MAT_ROW_ORIENTED:
1205 a->roworiented = flg;
1206 break;
1207 case MAT_KEEP_NONZERO_PATTERN:
1208 a->keepnonzeropattern = flg;
1209 break;
1210 case MAT_NEW_NONZERO_LOCATIONS:
1211 a->nonew = (flg ? 0 : 1);
1212 break;
1213 case MAT_NEW_NONZERO_LOCATION_ERR:
1214 a->nonew = (flg ? -1 : 0);
1215 break;
1216 case MAT_NEW_NONZERO_ALLOCATION_ERR:
1217 a->nonew = (flg ? -2 : 0);
1218 break;
1219 case MAT_UNUSED_NONZERO_LOCATION_ERR:
1220 a->nounused = (flg ? -1 : 0);
1221 break;
1222 case MAT_IGNORE_ZERO_ENTRIES:
1223 a->ignorezeroentries = flg;
1224 break;
1225 case MAT_SPD:
1226 case MAT_SYMMETRIC:
1227 case MAT_STRUCTURALLY_SYMMETRIC:
1228 case MAT_HERMITIAN:
1229 case MAT_SYMMETRY_ETERNAL:
1230 case MAT_STRUCTURE_ONLY:
1231 /* These options are handled directly by MatSetOption() */
1232 break;
1233 case MAT_NEW_DIAGONALS:
1234 case MAT_IGNORE_OFF_PROC_ENTRIES:
1235 case MAT_USE_HASH_TABLE:
1236 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),1236,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1237 break;
1238 case MAT_USE_INODES:
1239 /* Not an error because MatSetOption_SeqAIJ_Inode handles this one */
1240 break;
1241 case MAT_SUBMAT_SINGLEIS:
1242 A->submat_singleis = flg;
1243 break;
1244 case MAT_SORTED_FULL:
1245 if (flg) A->ops->setvalues = MatSetValues_SeqAIJ_SortedFull;
1246 else A->ops->setvalues = MatSetValues_SeqAIJ;
1247 break;
1248 default:
1249 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unknown option %d",op)return PetscError(((MPI_Comm)0x44000001),1249,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"unknown option %d",op)
;
1250 }
1251 ierr = MatSetOption_SeqAIJ_Inode(A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1251,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1252 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)
;
1253}
1254
1255PetscErrorCode MatGetDiagonal_SeqAIJ(Mat A,Vec v)
1256{
1257 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1258 PetscErrorCode ierr;
1259 PetscInt i,j,n,*ai=a->i,*aj=a->j;
1260 PetscScalar *aa=a->a,*x;
1261
1262 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1262; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1263 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1263,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1264 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),1264,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
1265
1266 if (A->factortype == MAT_FACTOR_ILU || A->factortype == MAT_FACTOR_LU) {
1267 PetscInt *diag=a->diag;
1268 ierr = VecGetArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1268,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1269 for (i=0; i<n; i++) x[i] = 1.0/aa[diag[i]];
1270 ierr = VecRestoreArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1270,__func__,"/sandbox/petsc/petsc.master/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
1274 ierr = VecGetArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1274,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1275 for (i=0; i<n; i++) {
1276 x[i] = 0.0;
1277 for (j=ai[i]; j<ai[i+1]; j++) {
1278 if (aj[j] == i) {
1279 x[i] = aa[j];
1280 break;
1281 }
1282 }
1283 }
1284 ierr = VecRestoreArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1284,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1285 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)
;
1286}
1287
1288#include <../src/mat/impls/aij/seq/ftn-kernels/fmult.h>
1289PetscErrorCode MatMultTransposeAdd_SeqAIJ(Mat A,Vec xx,Vec zz,Vec yy)
1290{
1291 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1292 PetscScalar *y;
1293 const PetscScalar *x;
1294 PetscErrorCode ierr;
1295 PetscInt m = A->rmap->n;
1296#if !defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ)
1297 const MatScalar *v;
1298 PetscScalar alpha;
1299 PetscInt n,i,j;
1300 const PetscInt *idx,*ii,*ridx=NULL((void*)0);
1301 Mat_CompressedRow cprow = a->compressedrow;
1302 PetscBool usecprow = cprow.use;
1303#endif
1304
1305 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1305; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1306 if (zz != yy) {ierr = VecCopy(zz,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1306,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1307 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1307,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1308 ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1308,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1309
1310#if defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ)
1311 fortranmulttransposeaddaij_(&m,x,a->i,a->j,a->a,y);
1312#else
1313 if (usecprow) {
1314 m = cprow.nrows;
1315 ii = cprow.i;
1316 ridx = cprow.rindex;
1317 } else {
1318 ii = a->i;
1319 }
1320 for (i=0; i<m; i++) {
1321 idx = a->j + ii[i];
1322 v = a->a + ii[i];
1323 n = ii[i+1] - ii[i];
1324 if (usecprow) {
1325 alpha = x[ridx[i]];
1326 } else {
1327 alpha = x[i];
1328 }
1329 for (j=0; j<n; j++) y[idx[j]] += alpha*v[j];
1330 }
1331#endif
1332 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1332,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1333 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1333,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1334 ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1334,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1335 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)
;
1336}
1337
1338PetscErrorCode MatMultTranspose_SeqAIJ(Mat A,Vec xx,Vec yy)
1339{
1340 PetscErrorCode ierr;
1341
1342 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1342; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1343 ierr = VecSet(yy,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1343,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1344 ierr = MatMultTransposeAdd_SeqAIJ(A,xx,yy,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1344,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1345 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)
;
1346}
1347
1348#include <../src/mat/impls/aij/seq/ftn-kernels/fmult.h>
1349
1350PetscErrorCode MatMult_SeqAIJ(Mat A,Vec xx,Vec yy)
1351{
1352 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1353 PetscScalar *y;
1354 const PetscScalar *x;
1355 const MatScalar *aa;
1356 PetscErrorCode ierr;
1357 PetscInt m=A->rmap->n;
1358 const PetscInt *aj,*ii,*ridx=NULL((void*)0);
1359 PetscInt n,i;
1360 PetscScalar sum;
1361 PetscBool usecprow=a->compressedrow.use;
1362
1363#if defined(PETSC_HAVE_PRAGMA_DISJOINT)
1364#pragma disjoint(*x,*y,*aa)
1365#endif
1366
1367 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1367; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1368 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1368,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1369 ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1369,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1370 ii = a->i;
1371 if (usecprow) { /* use compressed row format */
1372 ierr = PetscArrayzero(y,m)PetscMemzero(y,(m)*sizeof(*(y)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1372,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1373 m = a->compressedrow.nrows;
1374 ii = a->compressedrow.i;
1375 ridx = a->compressedrow.rindex;
1376 for (i=0; i<m; i++) {
1377 n = ii[i+1] - ii[i];
1378 aj = a->j + ii[i];
1379 aa = a->a + ii[i];
1380 sum = 0.0;
1381 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1382 /* for (j=0; j<n; j++) sum += (*aa++)*x[*aj++]; */
1383 y[*ridx++] = sum;
1384 }
1385 } else { /* do not use compressed row format */
1386#if defined(PETSC_USE_FORTRAN_KERNEL_MULTAIJ)
1387 aj = a->j;
1388 aa = a->a;
1389 fortranmultaij_(&m,x,ii,aj,aa,y);
1390#else
1391 for (i=0; i<m; i++) {
1392 n = ii[i+1] - ii[i];
1393 aj = a->j + ii[i];
1394 aa = a->a + ii[i];
1395 sum = 0.0;
1396 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1397 y[i] = sum;
1398 }
1399#endif
1400 }
1401 ierr = PetscLogFlops(2.0*a->nz - a->nonzerorowcnt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1401,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1402 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1402,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1403 ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1403,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1404 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)
;
1405}
1406
1407PetscErrorCode MatMultMax_SeqAIJ(Mat A,Vec xx,Vec yy)
1408{
1409 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1410 PetscScalar *y;
1411 const PetscScalar *x;
1412 const MatScalar *aa;
1413 PetscErrorCode ierr;
1414 PetscInt m=A->rmap->n;
1415 const PetscInt *aj,*ii,*ridx=NULL((void*)0);
1416 PetscInt n,i,nonzerorow=0;
1417 PetscScalar sum;
1418 PetscBool usecprow=a->compressedrow.use;
1419
1420#if defined(PETSC_HAVE_PRAGMA_DISJOINT)
1421#pragma disjoint(*x,*y,*aa)
1422#endif
1423
1424 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1424; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1425 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1425,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1426 ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1426,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1427 if (usecprow) { /* use compressed row format */
1428 m = a->compressedrow.nrows;
1429 ii = a->compressedrow.i;
1430 ridx = a->compressedrow.rindex;
1431 for (i=0; i<m; i++) {
1432 n = ii[i+1] - ii[i];
1433 aj = a->j + ii[i];
1434 aa = a->a + ii[i];
1435 sum = 0.0;
1436 nonzerorow += (n>0);
1437 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)
));}
;
1438 /* for (j=0; j<n; j++) sum += (*aa++)*x[*aj++]; */
1439 y[*ridx++] = sum;
1440 }
1441 } else { /* do not use compressed row format */
1442 ii = a->i;
1443 for (i=0; i<m; i++) {
1444 n = ii[i+1] - ii[i];
1445 aj = a->j + ii[i];
1446 aa = a->a + ii[i];
1447 sum = 0.0;
1448 nonzerorow += (n>0);
1449 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)
));}
;
1450 y[i] = sum;
1451 }
1452 }
1453 ierr = PetscLogFlops(2.0*a->nz - nonzerorow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1453,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1454 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1454,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1455 ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1455,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1456 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)
;
1457}
1458
1459PetscErrorCode MatMultAddMax_SeqAIJ(Mat A,Vec xx,Vec yy,Vec zz)
1460{
1461 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1462 PetscScalar *y,*z;
1463 const PetscScalar *x;
1464 const MatScalar *aa;
1465 PetscErrorCode ierr;
1466 PetscInt m = A->rmap->n,*aj,*ii;
1467 PetscInt n,i,*ridx=NULL((void*)0);
1468 PetscScalar sum;
1469 PetscBool usecprow=a->compressedrow.use;
1470
1471 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1471; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1472 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1472,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1473 ierr = VecGetArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1473,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1474 if (usecprow) { /* use compressed row format */
1475 if (zz != yy) {
1476 ierr = PetscArraycpy(z,y,m)((sizeof(*(z)) != sizeof(*(y))) || PetscMemcpy(z,y,(m)*sizeof
(*(z))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1476,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1477 }
1478 m = a->compressedrow.nrows;
1479 ii = a->compressedrow.i;
1480 ridx = a->compressedrow.rindex;
1481 for (i=0; i<m; i++) {
1482 n = ii[i+1] - ii[i];
1483 aj = a->j + ii[i];
1484 aa = a->a + ii[i];
1485 sum = y[*ridx];
1486 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)
));}
;
1487 z[*ridx++] = sum;
1488 }
1489 } else { /* do not use compressed row format */
1490 ii = a->i;
1491 for (i=0; i<m; i++) {
1492 n = ii[i+1] - ii[i];
1493 aj = a->j + ii[i];
1494 aa = a->a + ii[i];
1495 sum = y[i];
1496 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)
));}
;
1497 z[i] = sum;
1498 }
1499 }
1500 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1500,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1501 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1501,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1502 ierr = VecRestoreArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1502,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1503 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)
;
1504}
1505
1506#include <../src/mat/impls/aij/seq/ftn-kernels/fmultadd.h>
1507PetscErrorCode MatMultAdd_SeqAIJ(Mat A,Vec xx,Vec yy,Vec zz)
1508{
1509 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1510 PetscScalar *y,*z;
1511 const PetscScalar *x;
1512 const MatScalar *aa;
1513 PetscErrorCode ierr;
1514 const PetscInt *aj,*ii,*ridx=NULL((void*)0);
1515 PetscInt m = A->rmap->n,n,i;
1516 PetscScalar sum;
1517 PetscBool usecprow=a->compressedrow.use;
1518
1519 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1519; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1520 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1520,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1521 ierr = VecGetArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1521,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1522 if (usecprow) { /* use compressed row format */
1523 if (zz != yy) {
1524 ierr = PetscArraycpy(z,y,m)((sizeof(*(z)) != sizeof(*(y))) || PetscMemcpy(z,y,(m)*sizeof
(*(z))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1524,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1525 }
1526 m = a->compressedrow.nrows;
1527 ii = a->compressedrow.i;
1528 ridx = a->compressedrow.rindex;
1529 for (i=0; i<m; i++) {
1530 n = ii[i+1] - ii[i];
1531 aj = a->j + ii[i];
1532 aa = a->a + ii[i];
1533 sum = y[*ridx];
1534 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1535 z[*ridx++] = sum;
1536 }
1537 } else { /* do not use compressed row format */
1538 ii = a->i;
1539#if defined(PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ)
1540 aj = a->j;
1541 aa = a->a;
1542 fortranmultaddaij_(&m,x,ii,aj,aa,y,z);
1543#else
1544 for (i=0; i<m; i++) {
1545 n = ii[i+1] - ii[i];
1546 aj = a->j + ii[i];
1547 aa = a->a + ii[i];
1548 sum = y[i];
1549 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1550 z[i] = sum;
1551 }
1552#endif
1553 }
1554 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1554,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1555 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1555,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1556 ierr = VecRestoreArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1556,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1557 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)
;
1558}
1559
1560/*
1561 Adds diagonal pointers to sparse matrix structure.
1562*/
1563PetscErrorCode MatMarkDiagonal_SeqAIJ(Mat A)
1564{
1565 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1566 PetscErrorCode ierr;
1567 PetscInt i,j,m = A->rmap->n;
1568
1569 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1569; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1570 if (!a->diag) {
1571 ierr = PetscMalloc1(m,&a->diag)PetscMallocA(1,PETSC_FALSE,1571,__func__,"/sandbox/petsc/petsc.master/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),1571,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1572 ierr = PetscLogObjectMemory((PetscObject)A, m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1572,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1573 }
1574 for (i=0; i<A->rmap->n; i++) {
1575 a->diag[i] = a->i[i+1];
1576 for (j=a->i[i]; j<a->i[i+1]; j++) {
1577 if (a->j[j] == i) {
1578 a->diag[i] = j;
1579 break;
1580 }
1581 }
1582 }
1583 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)
;
1584}
1585
1586PetscErrorCode MatShift_SeqAIJ(Mat A,PetscScalar v)
1587{
1588 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1589 const PetscInt *diag = (const PetscInt*)a->diag;
1590 const PetscInt *ii = (const PetscInt*) a->i;
1591 PetscInt i,*mdiag = NULL((void*)0);
1592 PetscErrorCode ierr;
1593 PetscInt cnt = 0; /* how many diagonals are missing */
1594
1595 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1595; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1596 if (!A->preallocated || !a->nz) {
1597 ierr = MatSeqAIJSetPreallocation(A,1,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1597,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1598 ierr = MatShift_Basic(A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1598,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1599 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)
;
1600 }
1601
1602 if (a->diagonaldense) {
1603 cnt = 0;
1604 } else {
1605 ierr = PetscCalloc1(A->rmap->n,&mdiag)PetscMallocA(1,PETSC_TRUE,1605,__func__,"/sandbox/petsc/petsc.master/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),1605,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1606 for (i=0; i<A->rmap->n; i++) {
1607 if (diag[i] >= ii[i+1]) {
1608 cnt++;
1609 mdiag[i] = 1;
1610 }
1611 }
1612 }
1613 if (!cnt) {
1614 ierr = MatShift_Basic(A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1614,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1615 } else {
1616 PetscScalar *olda = a->a; /* preserve pointers to current matrix nonzeros structure and values */
1617 PetscInt *oldj = a->j, *oldi = a->i;
1618 PetscBool singlemalloc = a->singlemalloc,free_a = a->free_a,free_ij = a->free_ij;
1619
1620 a->a = NULL((void*)0);
1621 a->j = NULL((void*)0);
1622 a->i = NULL((void*)0);
1623 /* increase the values in imax for each row where a diagonal is being inserted then reallocate the matrix data structures */
1624 for (i=0; i<A->rmap->n; i++) {
1625 a->imax[i] += mdiag[i];
1626 a->imax[i] = PetscMin(a->imax[i],A->cmap->n)(((a->imax[i])<(A->cmap->n)) ? (a->imax[i]) : (
A->cmap->n))
;
1627 }
1628 ierr = MatSeqAIJSetPreallocation_SeqAIJ(A,0,a->imax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1628,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1629
1630 /* copy old values into new matrix data structure */
1631 for (i=0; i<A->rmap->n; i++) {
1632 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),1632,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1633 if (i < A->cmap->n) {
1634 ierr = MatSetValue(A,i,i,v,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1634,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1635 }
1636 }
1637 ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1637,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1638 ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1638,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1639 if (singlemalloc) {
1640 ierr = PetscFree3(olda,oldj,oldi)PetscFreeA(3,1640,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,&(olda),&(oldj),&(oldi))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1640,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1641 } else {
1642 if (free_a) {ierr = PetscFree(olda)((*PetscTrFree)((void*)(olda),1642,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((olda) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1642,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1643 if (free_ij) {ierr = PetscFree(oldj)((*PetscTrFree)((void*)(oldj),1643,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((oldj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1643,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1644 if (free_ij) {ierr = PetscFree(oldi)((*PetscTrFree)((void*)(oldi),1644,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((oldi) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1644,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1645 }
1646 }
1647 ierr = PetscFree(mdiag)((*PetscTrFree)((void*)(mdiag),1647,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((mdiag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1647,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1648 a->diagonaldense = PETSC_TRUE;
1649 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)
;
1650}
1651
1652/*
1653 Checks for missing diagonals
1654*/
1655PetscErrorCode MatMissingDiagonal_SeqAIJ(Mat A,PetscBool *missing,PetscInt *d)
1656{
1657 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1658 PetscInt *diag,*ii = a->i,i;
1659 PetscErrorCode ierr;
1660
1661 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1661; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1662 *missing = PETSC_FALSE;
1663 if (A->rmap->n > 0 && !ii) {
1664 *missing = PETSC_TRUE;
1665 if (d) *d = 0;
1666 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),1666,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1667 } else {
1668 PetscInt n;
1669 n = PetscMin(A->rmap->n, A->cmap->n)(((A->rmap->n)<(A->cmap->n)) ? (A->rmap->
n) : (A->cmap->n))
;
1670 diag = a->diag;
1671 for (i=0; i<n; i++) {
1672 if (diag[i] >= ii[i+1]) {
1673 *missing = PETSC_TRUE;
1674 if (d) *d = i;
1675 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),1675,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1676 break;
1677 }
1678 }
1679 }
1680 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)
;
1681}
1682
1683#include <petscblaslapack.h>
1684#include <petsc/private/kernels/blockinvert.h>
1685
1686/*
1687 Note that values is allocated externally by the PC and then passed into this routine
1688*/
1689PetscErrorCode MatInvertVariableBlockDiagonal_SeqAIJ(Mat A,PetscInt nblocks,const PetscInt *bsizes,PetscScalar *diag)
1690{
1691 PetscErrorCode ierr;
1692 PetscInt n = A->rmap->n, i, ncnt = 0, *indx,j,bsizemax = 0,*v_pivots;
1
'v_pivots' declared without an initial value
1693 PetscBool allowzeropivot,zeropivotdetected=PETSC_FALSE;
1694 const PetscReal shift = 0.0;
1695 PetscInt ipvt[5];
1696 PetscScalar work[25],*v_work;
1697
1698 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1698; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1699 allowzeropivot = PetscNot(A->erroriffailure)((A->erroriffailure) ? PETSC_FALSE : PETSC_TRUE);
1700 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 1701
1701 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
),1701,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
60);}} while (0)
;
6
Taking false branch
1702 for (i=0; i<nblocks; i++) {
7
Loop condition is true. Entering loop body
8
Loop condition is false. Execution continues on line 1705
1703 bsizemax = PetscMax(bsizemax,bsizes[i])(((bsizemax)<(bsizes[i])) ? (bsizes[i]) : (bsizemax));
1704 }
1705 ierr = PetscMalloc1(bsizemax,&indx)PetscMallocA(1,PETSC_FALSE,1705,__func__,"/sandbox/petsc/petsc.master/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),1705,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1706 if (bsizemax > 7) {
9
Taking false branch
1707 ierr = PetscMalloc2(bsizemax,&v_work,bsizemax,&v_pivots)PetscMallocA(2,PETSC_FALSE,1707,__func__,"/sandbox/petsc/petsc.master/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),1707,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1708 }
1709 ncnt = 0;
1710 for (i=0; i<nblocks; i++) {
10
Loop condition is true. Entering loop body
1711 for (j=0; j<bsizes[i]; j++) indx[j] = ncnt+j;
11
Loop condition is false. Execution continues on line 1712
1712 ierr = MatGetValues(A,bsizes[i],indx,bsizes[i],indx,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1712,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1713 switch (bsizes[i]) {
12
Control jumps to the 'default' case at line 1747
1714 case 1:
1715 *diag = 1.0/(*diag);
1716 break;
1717 case 2:
1718 ierr = PetscKernel_A_gets_inverse_A_2(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1718,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1719 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1720 ierr = PetscKernel_A_gets_transpose_A_2(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1720,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1721 break;
1722 case 3:
1723 ierr = PetscKernel_A_gets_inverse_A_3(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1723,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1724 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1725 ierr = PetscKernel_A_gets_transpose_A_3(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1725,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1726 break;
1727 case 4:
1728 ierr = PetscKernel_A_gets_inverse_A_4(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1728,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1729 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1730 ierr = PetscKernel_A_gets_transpose_A_4(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1730,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1731 break;
1732 case 5:
1733 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),1733,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1734 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1735 ierr = PetscKernel_A_gets_transpose_A_5(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1735,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1736 break;
1737 case 6:
1738 ierr = PetscKernel_A_gets_inverse_A_6(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1738,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1739 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1740 ierr = PetscKernel_A_gets_transpose_A_6(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1740,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1741 break;
1742 case 7:
1743 ierr = PetscKernel_A_gets_inverse_A_7(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1743,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1744 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1745 ierr = PetscKernel_A_gets_transpose_A_7(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1745,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1746 break;
1747 default:
1748 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),1748,__func__,"/sandbox/petsc/petsc.master/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
1749 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1750 ierr = PetscKernel_A_gets_transpose_A_N(diag,bsizes[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1750,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1751 }
1752 ncnt += bsizes[i];
1753 diag += bsizes[i]*bsizes[i];
1754 }
1755 if (bsizemax > 7) {
1756 ierr = PetscFree2(v_work,v_pivots)PetscFreeA(2,1756,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,&(v_work),&(v_pivots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1756,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1757 }
1758 ierr = PetscFree(indx)((*PetscTrFree)((void*)(indx),1758,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((indx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1758,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1759 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)
;
1760}
1761
1762/*
1763 Negative shift indicates do not generate an error if there is a zero diagonal, just invert it anyways
1764*/
1765PetscErrorCode MatInvertDiagonal_SeqAIJ(Mat A,PetscScalar omega,PetscScalar fshift)
1766{
1767 Mat_SeqAIJ *a = (Mat_SeqAIJ*) A->data;
1768 PetscErrorCode ierr;
1769 PetscInt i,*diag,m = A->rmap->n;
1770 MatScalar *v = a->a;
1771 PetscScalar *idiag,*mdiag;
1772
1773 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1773; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1774 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)
;
1775 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1775,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1776 diag = a->diag;
1777 if (!a->idiag) {
1778 ierr = PetscMalloc3(m,&a->idiag,m,&a->mdiag,m,&a->ssor_work)PetscMallocA(3,PETSC_FALSE,1778,__func__,"/sandbox/petsc/petsc.master/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),1778,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1779 ierr = PetscLogObjectMemory((PetscObject)A, 3*m*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1779,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1780 v = a->a;
1781 }
1782 mdiag = a->mdiag;
1783 idiag = a->idiag;
1784
1785 if (omega == 1.0 && PetscRealPart(fshift)(fshift) <= 0.0) {
1786 for (i=0; i<m; i++) {
1787 mdiag[i] = v[diag[i]];
1788 if (!PetscAbsScalar(mdiag[i])fabs(mdiag[i])) { /* zero diagonal */
1789 if (PetscRealPart(fshift)(fshift)) {
1790 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),1790,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1791 A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1792 A->factorerror_zeropivot_value = 0.0;
1793 A->factorerror_zeropivot_row = i;
1794 } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Zero diagonal on row %D",i)return PetscError(((MPI_Comm)0x44000001),1794,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,75,PETSC_ERROR_INITIAL,"Zero diagonal on row %D",i)
;
1795 }
1796 idiag[i] = 1.0/v[diag[i]];
1797 }
1798 ierr = PetscLogFlops(m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1798,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1799 } else {
1800 for (i=0; i<m; i++) {
1801 mdiag[i] = v[diag[i]];
1802 idiag[i] = omega/(fshift + v[diag[i]]);
1803 }
1804 ierr = PetscLogFlops(2.0*m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1804,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1805 }
1806 a->idiagvalid = PETSC_TRUE;
1807 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)
;
1808}
1809
1810#include <../src/mat/impls/aij/seq/ftn-kernels/frelax.h>
1811PetscErrorCode MatSOR_SeqAIJ(Mat A,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx)
1812{
1813 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1814 PetscScalar *x,d,sum,*t,scale;
1815 const MatScalar *v,*idiag=0,*mdiag;
1816 const PetscScalar *b, *bs,*xb, *ts;
1817 PetscErrorCode ierr;
1818 PetscInt n,m = A->rmap->n,i;
1819 const PetscInt *idx,*diag;
1820
1821 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1821; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1822 its = its*lits;
1823
1824 if (fshift != a->fshift || omega != a->omega) a->idiagvalid = PETSC_FALSE; /* must recompute idiag[] */
1825 if (!a->idiagvalid) {ierr = MatInvertDiagonal_SeqAIJ(A,omega,fshift);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1825,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1826 a->fshift = fshift;
1827 a->omega = omega;
1828
1829 diag = a->diag;
1830 t = a->ssor_work;
1831 idiag = a->idiag;
1832 mdiag = a->mdiag;
1833
1834 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1834,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1835 ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1835,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1836 /* We count flops by assuming the upper triangular and lower triangular parts have the same number of nonzeros */
1837 if (flag == SOR_APPLY_UPPER) {
1838 /* apply (U + D/omega) to the vector */
1839 bs = b;
1840 for (i=0; i<m; i++) {
1841 d = fshift + mdiag[i];
1842 n = a->i[i+1] - diag[i] - 1;
1843 idx = a->j + diag[i] + 1;
1844 v = a->a + diag[i] + 1;
1845 sum = b[i]*d/omega;
1846 PetscSparseDensePlusDot(sum,bs,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += v[__i] * bs
[idx[__i]];}
;
1847 x[i] = sum;
1848 }
1849 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1849,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1850 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1850,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1851 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1851,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1852 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)
;
1853 }
1854
1855 if (flag == SOR_APPLY_LOWER) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SOR_APPLY_LOWER is not implemented")return PetscError(((MPI_Comm)0x44000001),1855,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"SOR_APPLY_LOWER is not implemented")
;
1856 else if (flag & SOR_EISENSTAT) {
1857 /* Let A = L + U + D; where L is lower triangular,
1858 U is upper triangular, E = D/omega; This routine applies
1859
1860 (L + E)^{-1} A (U + E)^{-1}
1861
1862 to a vector efficiently using Eisenstat's trick.
1863 */
1864 scale = (2.0/omega) - 1.0;
1865
1866 /* x = (E + U)^{-1} b */
1867 for (i=m-1; i>=0; i--) {
1868 n = a->i[i+1] - diag[i] - 1;
1869 idx = a->j + diag[i] + 1;
1870 v = a->a + diag[i] + 1;
1871 sum = b[i];
1872 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1873 x[i] = sum*idiag[i];
1874 }
1875
1876 /* t = b - (2*E - D)x */
1877 v = a->a;
1878 for (i=0; i<m; i++) t[i] = b[i] - scale*(v[*diag++])*x[i];
1879
1880 /* t = (E + L)^{-1}t */
1881 ts = t;
1882 diag = a->diag;
1883 for (i=0; i<m; i++) {
1884 n = diag[i] - a->i[i];
1885 idx = a->j + a->i[i];
1886 v = a->a + a->i[i];
1887 sum = t[i];
1888 PetscSparseDenseMinusDot(sum,ts,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * ts
[idx[__i]];}
;
1889 t[i] = sum*idiag[i];
1890 /* x = x + t */
1891 x[i] += t[i];
1892 }
1893
1894 ierr = PetscLogFlops(6.0*m-1 + 2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1894,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1895 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1895,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1896 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1896,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1897 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)
;
1898 }
1899 if (flag & SOR_ZERO_INITIAL_GUESS) {
1900 if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) {
1901 for (i=0; i<m; i++) {
1902 n = diag[i] - a->i[i];
1903 idx = a->j + a->i[i];
1904 v = a->a + a->i[i];
1905 sum = b[i];
1906 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1907 t[i] = sum;
1908 x[i] = sum*idiag[i];
1909 }
1910 xb = t;
1911 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1911,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1912 } else xb = b;
1913 if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) {
1914 for (i=m-1; i>=0; i--) {
1915 n = a->i[i+1] - diag[i] - 1;
1916 idx = a->j + diag[i] + 1;
1917 v = a->a + diag[i] + 1;
1918 sum = xb[i];
1919 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1920 if (xb == b) {
1921 x[i] = sum*idiag[i];
1922 } else {
1923 x[i] = (1-omega)*x[i] + sum*idiag[i]; /* omega in idiag */
1924 }
1925 }
1926 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1926,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* assumes 1/2 in upper */
1927 }
1928 its--;
1929 }
1930 while (its--) {
1931 if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) {
1932 for (i=0; i<m; i++) {
1933 /* lower */
1934 n = diag[i] - a->i[i];
1935 idx = a->j + a->i[i];
1936 v = a->a + a->i[i];
1937 sum = b[i];
1938 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1939 t[i] = sum; /* save application of the lower-triangular part */
1940 /* upper */
1941 n = a->i[i+1] - diag[i] - 1;
1942 idx = a->j + diag[i] + 1;
1943 v = a->a + diag[i] + 1;
1944 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1945 x[i] = (1. - omega)*x[i] + sum*idiag[i]; /* omega in idiag */
1946 }
1947 xb = t;
1948 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1948,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1949 } else xb = b;
1950 if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) {
1951 for (i=m-1; i>=0; i--) {
1952 sum = xb[i];
1953 if (xb == b) {
1954 /* whole matrix (no checkpointing available) */
1955 n = a->i[i+1] - a->i[i];
1956 idx = a->j + a->i[i];
1957 v = a->a + a->i[i];
1958 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1959 x[i] = (1. - omega)*x[i] + (sum + mdiag[i]*x[i])*idiag[i];
1960 } else { /* lower-triangular part has been saved, so only apply upper-triangular */
1961 n = a->i[i+1] - diag[i] - 1;
1962 idx = a->j + diag[i] + 1;
1963 v = a->a + diag[i] + 1;
1964 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1965 x[i] = (1. - omega)*x[i] + sum*idiag[i]; /* omega in idiag */
1966 }
1967 }
1968 if (xb == b) {
1969 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1969,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1970 } else {
1971 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1971,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* assumes 1/2 in upper */
1972 }
1973 }
1974 }
1975 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1975,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1976 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1976,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1977 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)
;
1978}
1979
1980
1981PetscErrorCode MatGetInfo_SeqAIJ(Mat A,MatInfoType flag,MatInfo *info)
1982{
1983 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1984
1985 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 1985; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1986 info->block_size = 1.0;
1987 info->nz_allocated = (double)a->maxnz;
1988 info->nz_used = (double)a->nz;
1989 info->nz_unneeded = (double)(a->maxnz - a->nz);
1990 info->assemblies = (double)A->num_ass;
1991 info->mallocs = (double)A->info.mallocs;
1992 info->memory = ((PetscObject)A)->mem;
1993 if (A->factortype) {
1994 info->fill_ratio_given = A->info.fill_ratio_given;
1995 info->fill_ratio_needed = A->info.fill_ratio_needed;
1996 info->factor_mallocs = A->info.factor_mallocs;
1997 } else {
1998 info->fill_ratio_given = 0;
1999 info->fill_ratio_needed = 0;
2000 info->factor_mallocs = 0;
2001 }
2002 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)
;
2003}
2004
2005PetscErrorCode MatZeroRows_SeqAIJ(Mat A,PetscInt N,const PetscInt rows[],PetscScalar diag,Vec x,Vec b)
2006{
2007 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2008 PetscInt i,m = A->rmap->n - 1;
2009 PetscErrorCode ierr;
2010 const PetscScalar *xx;
2011 PetscScalar *bb;
2012 PetscInt d = 0;
2013
2014 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2014; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2015 if (x && b) {
2016 ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2016,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2017 ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2017,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2018 for (i=0; i<N; i++) {
2019 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),2019,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
2020 if (rows[i] >= A->cmap->n) continue;
2021 bb[rows[i]] = diag*xx[rows[i]];
2022 }
2023 ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2023,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2024 ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2024,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2025 }
2026
2027 if (a->keepnonzeropattern) {
2028 for (i=0; i<N; i++) {
2029 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),2029,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
2030 ierr = PetscArrayzero(&a->a[a->i[rows[i]]],a->ilen[rows[i]])PetscMemzero(&a->a[a->i[rows[i]]],(a->ilen[rows[
i]])*sizeof(*(&a->a[a->i[rows[i]]])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2030,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2031 }
2032 if (diag != 0.0) {
2033 for (i=0; i<N; i++) {
2034 d = rows[i];
2035 if (rows[i] >= A->cmap->n) continue;
2036 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),2036,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Matrix is missing diagonal entry in the zeroed row %D"
,d)
;
2037 }
2038 for (i=0; i<N; i++) {
2039 if (rows[i] >= A->cmap->n) continue;
2040 a->a[a->diag[rows[i]]] = diag;
2041 }
2042 }
2043 } else {
2044 if (diag != 0.0) {
2045 for (i=0; i<N; i++) {
2046 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),2046,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
2047 if (a->ilen[rows[i]] > 0) {
2048 if (rows[i] >= A->cmap->n) {
2049 a->ilen[rows[i]] = 0;
2050 } else {
2051 a->ilen[rows[i]] = 1;
2052 a->a[a->i[rows[i]]] = diag;
2053 a->j[a->i[rows[i]]] = rows[i];
2054 }
2055 } else if (rows[i] < A->cmap->n) { /* in case row was completely empty */
2056 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),2056,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2057 }
2058 }
2059 } else {
2060 for (i=0; i<N; i++) {
2061 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),2061,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
2062 a->ilen[rows[i]] = 0;
2063 }
2064 }
2065 A->nonzerostate++;
2066 }
2067#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
2068 if (A->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED) A->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
2069#endif
2070 ierr = (*A->ops->assemblyend)(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2070,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2071 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)
;
2072}
2073
2074PetscErrorCode MatZeroRowsColumns_SeqAIJ(Mat A,PetscInt N,const PetscInt rows[],PetscScalar diag,Vec x,Vec b)
2075{
2076 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2077 PetscInt i,j,m = A->rmap->n - 1,d = 0;
2078 PetscErrorCode ierr;
2079 PetscBool missing,*zeroed,vecs = PETSC_FALSE;
2080 const PetscScalar *xx;
2081 PetscScalar *bb;
2082
2083 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/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 if (x && b) {
2085 ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2085,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2086 ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2086,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2087 vecs = PETSC_TRUE;
2088 }
2089 ierr = PetscCalloc1(A->rmap->n,&zeroed)PetscMallocA(1,PETSC_TRUE,2089,__func__,"/sandbox/petsc/petsc.master/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),2089,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2090 for (i=0; i<N; i++) {
2091 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),2091,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
2092 ierr = PetscArrayzero(&a->a[a->i[rows[i]]],a->ilen[rows[i]])PetscMemzero(&a->a[a->i[rows[i]]],(a->ilen[rows[
i]])*sizeof(*(&a->a[a->i[rows[i]]])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2092,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2093
2094 zeroed[rows[i]] = PETSC_TRUE;
2095 }
2096 for (i=0; i<A->rmap->n; i++) {
2097 if (!zeroed[i]) {
2098 for (j=a->i[i]; j<a->i[i+1]; j++) {
2099 if (a->j[j] < A->rmap->n && zeroed[a->j[j]]) {
2100 if (vecs) bb[i] -= a->a[j]*xx[a->j[j]];
2101 a->a[j] = 0.0;
2102 }
2103 }
2104 } else if (vecs && i < A->cmap->N) bb[i] = diag*xx[i];
2105 }
2106 if (x && b) {
2107 ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2107,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2108 ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2108,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2109 }
2110 ierr = PetscFree(zeroed)((*PetscTrFree)((void*)(zeroed),2110,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((zeroed) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2110,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2111 if (diag != 0.0) {
2112 ierr = MatMissingDiagonal_SeqAIJ(A,&missing,&d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2112,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2113 if (missing) {
2114 for (i=0; i<N; i++) {
2115 if (rows[i] >= A->cmap->N) continue;
2116 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
),2116,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
73);}} while (0)
;
2117 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),2117,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2118 }
2119 } else {
2120 for (i=0; i<N; i++) {
2121 a->a[a->diag[rows[i]]] = diag;
2122 }
2123 }
2124 }
2125#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
2126 if (A->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED) A->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
2127#endif
2128 ierr = (*A->ops->assemblyend)(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2128,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2129 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)
;
2130}
2131
2132PetscErrorCode MatGetRow_SeqAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
2133{
2134 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2135 PetscInt *itmp;
2136
2137 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2137; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2138 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),2138,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"Row %D out of range",row)
;
2139
2140 *nz = a->i[row+1] - a->i[row];
2141 if (v) *v = a->a + a->i[row];
2142 if (idx) {
2143 itmp = a->j + a->i[row];
2144 if (*nz) *idx = itmp;
2145 else *idx = 0;
2146 }
2147 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)
;
2148}
2149
2150/* remove this function? */
2151PetscErrorCode MatRestoreRow_SeqAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
2152{
2153 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2153; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2154 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)
;
2155}
2156
2157PetscErrorCode MatNorm_SeqAIJ(Mat A,NormType type,PetscReal *nrm)
2158{
2159 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2160 MatScalar *v = a->a;
2161 PetscReal sum = 0.0;
2162 PetscErrorCode ierr;
2163 PetscInt i,j;
2164
2165 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2165; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2166 if (type == NORM_FROBENIUS) {
2167#if defined(PETSC_USE_REAL___FP16)
2168 PetscBLASInt one = 1,nz = a->nz;
2169 *nrm = BLASnrm2_dnrm2_(&nz,v,&one);
2170#else
2171 for (i=0; i<a->nz; i++) {
2172 sum += PetscRealPart(PetscConj(*v)*(*v))((*v)*(*v)); v++;
2173 }
2174 *nrm = PetscSqrtReal(sum)sqrt(sum);
2175#endif
2176 ierr = PetscLogFlops(2*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2176,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2177 } else if (type == NORM_1) {
2178 PetscReal *tmp;
2179 PetscInt *jj = a->j;
2180 ierr = PetscCalloc1(A->cmap->n+1,&tmp)PetscMallocA(1,PETSC_TRUE,2180,__func__,"/sandbox/petsc/petsc.master/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),2180,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2181 *nrm = 0.0;
2182 for (j=0; j<a->nz; j++) {
2183 tmp[*jj++] += PetscAbsScalar(*v)fabs(*v); v++;
2184 }
2185 for (j=0; j<A->cmap->n; j++) {
2186 if (tmp[j] > *nrm) *nrm = tmp[j];
2187 }
2188 ierr = PetscFree(tmp)((*PetscTrFree)((void*)(tmp),2188,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((tmp) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2188,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2189 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),2189,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2190 } else if (type == NORM_INFINITY) {
2191 *nrm = 0.0;
2192 for (j=0; j<A->rmap->n; j++) {
2193 v = a->a + a->i[j];
2194 sum = 0.0;
2195 for (i=0; i<a->i[j+1]-a->i[j]; i++) {
2196 sum += PetscAbsScalar(*v)fabs(*v); v++;
2197 }
2198 if (sum > *nrm) *nrm = sum;
2199 }
2200 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),2200,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2201 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for two norm")return PetscError(((MPI_Comm)0x44000001),2201,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"No support for two norm")
;
2202 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)
;
2203}
2204
2205/* Merged from MatGetSymbolicTranspose_SeqAIJ() - replace MatGetSymbolicTranspose_SeqAIJ()? */
2206PetscErrorCode MatTransposeSymbolic_SeqAIJ(Mat A,Mat *B)
2207{
2208 PetscErrorCode ierr;
2209 PetscInt i,j,anzj;
2210 Mat_SeqAIJ *a=(Mat_SeqAIJ*)A->data,*b;
2211 PetscInt an=A->cmap->N,am=A->rmap->N;
2212 PetscInt *ati,*atj,*atfill,*ai=a->i,*aj=a->j;
2213
2214 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2214; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2215 /* Allocate space for symbolic transpose info and work array */
2216 ierr = PetscCalloc1(an+1,&ati)PetscMallocA(1,PETSC_TRUE,2216,__func__,"/sandbox/petsc/petsc.master/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),2216,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2217 ierr = PetscMalloc1(ai[am],&atj)PetscMallocA(1,PETSC_FALSE,2217,__func__,"/sandbox/petsc/petsc.master/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),2217,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2218 ierr = PetscMalloc1(an,&atfill)PetscMallocA(1,PETSC_FALSE,2218,__func__,"/sandbox/petsc/petsc.master/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),2218,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2219
2220 /* Walk through aj and count ## of non-zeros in each row of A^T. */
2221 /* Note: offset by 1 for fast conversion into csr format. */
2222 for (i=0;i<ai[am];i++) ati[aj[i]+1] += 1;
2223 /* Form ati for csr format of A^T. */
2224 for (i=0;i<an;i++) ati[i+1] += ati[i];
2225
2226 /* Copy ati into atfill so we have locations of the next free space in atj */
2227 ierr = PetscArraycpy(atfill,ati,an)((sizeof(*(atfill)) != sizeof(*(ati))) || PetscMemcpy(atfill,
ati,(an)*sizeof(*(atfill))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2227,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2228
2229 /* Walk through A row-wise and mark nonzero entries of A^T. */
2230 for (i=0;i<am;i++) {
2231 anzj = ai[i+1] - ai[i];
2232 for (j=0;j<anzj;j++) {
2233 atj[atfill[*aj]] = i;
2234 atfill[*aj++] += 1;
2235 }
2236 }
2237
2238 /* Clean up temporary space and complete requests. */
2239 ierr = PetscFree(atfill)((*PetscTrFree)((void*)(atfill),2239,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((atfill) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2239,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2240 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),2240,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2241 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),2241,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2242 ierr = MatSetType(*B,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2242,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2243
2244 b = (Mat_SeqAIJ*)((*B)->data);
2245 b->free_a = PETSC_FALSE;
2246 b->free_ij = PETSC_TRUE;
2247 b->nonew = 0;
2248 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)
;
2249}
2250
2251PetscErrorCode MatIsTranspose_SeqAIJ(Mat A,Mat B,PetscReal tol,PetscBool *f)
2252{
2253 Mat_SeqAIJ *aij = (Mat_SeqAIJ*) A->data,*bij = (Mat_SeqAIJ*) B->data;
2254 PetscInt *adx,*bdx,*aii,*bii,*aptr,*bptr;
2255 MatScalar *va,*vb;
2256 PetscErrorCode ierr;
2257 PetscInt ma,na,mb,nb, i;
2258
2259 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2259; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2260 ierr = MatGetSize(A,&ma,&na);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2260,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2261 ierr = MatGetSize(B,&mb,&nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2261,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2262 if (ma!=nb || na!=mb) {
2263 *f = PETSC_FALSE;
2264 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)
;
2265 }
2266 aii = aij->i; bii = bij->i;
2267 adx = aij->j; bdx = bij->j;
2268 va = aij->a; vb = bij->a;
2269 ierr = PetscMalloc1(ma,&aptr)PetscMallocA(1,PETSC_FALSE,2269,__func__,"/sandbox/petsc/petsc.master/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),2269,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2270 ierr = PetscMalloc1(mb,&bptr)PetscMallocA(1,PETSC_FALSE,2270,__func__,"/sandbox/petsc/petsc.master/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),2270,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2271 for (i=0; i<ma; i++) aptr[i] = aii[i];
2272 for (i=0; i<mb; i++) bptr[i] = bii[i];
2273
2274 *f = PETSC_TRUE;
2275 for (i=0; i<ma; i++) {
2276 while (aptr[i]<aii[i+1]) {
2277 PetscInt idc,idr;
2278 PetscScalar vc,vr;
2279 /* column/row index/value */
2280 idc = adx[aptr[i]];
2281 idr = bdx[bptr[idc]];
2282 vc = va[aptr[i]];
2283 vr = vb[bptr[idc]];
2284 if (i!=idr || PetscAbsScalar(vc-vr)fabs(vc-vr) > tol) {
2285 *f = PETSC_FALSE;
2286 goto done;
2287 } else {
2288 aptr[i]++;
2289 if (B || i!=idc) bptr[idc]++;
2290 }
2291 }
2292 }
2293done:
2294 ierr = PetscFree(aptr)((*PetscTrFree)((void*)(aptr),2294,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((aptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2294,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2295 ierr = PetscFree(bptr)((*PetscTrFree)((void*)(bptr),2295,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((bptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2295,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2296 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)
;
2297}
2298
2299PetscErrorCode MatIsHermitianTranspose_SeqAIJ(Mat A,Mat B,PetscReal tol,PetscBool *f)
2300{
2301 Mat_SeqAIJ *aij = (Mat_SeqAIJ*) A->data,*bij = (Mat_SeqAIJ*) B->data;
2302 PetscInt *adx,*bdx,*aii,*bii,*aptr,*bptr;
2303 MatScalar *va,*vb;
2304 PetscErrorCode ierr;
2305 PetscInt ma,na,mb,nb, i;
2306
2307 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2307; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2308 ierr = MatGetSize(A,&ma,&na);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2308,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2309 ierr = MatGetSize(B,&mb,&nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2309,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2310 if (ma!=nb || na!=mb) {
2311 *f = PETSC_FALSE;
2312 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)
;
2313 }
2314 aii = aij->i; bii = bij->i;
2315 adx = aij->j; bdx = bij->j;
2316 va = aij->a; vb = bij->a;
2317 ierr = PetscMalloc1(ma,&aptr)PetscMallocA(1,PETSC_FALSE,2317,__func__,"/sandbox/petsc/petsc.master/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),2317,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2318 ierr = PetscMalloc1(mb,&bptr)PetscMallocA(1,PETSC_FALSE,2318,__func__,"/sandbox/petsc/petsc.master/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),2318,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2319 for (i=0; i<ma; i++) aptr[i] = aii[i];
2320 for (i=0; i<mb; i++) bptr[i] = bii[i];
2321
2322 *f = PETSC_TRUE;
2323 for (i=0; i<ma; i++) {
2324 while (aptr[i]<aii[i+1]) {
2325 PetscInt idc,idr;
2326 PetscScalar vc,vr;
2327 /* column/row index/value */
2328 idc = adx[aptr[i]];
2329 idr = bdx[bptr[idc]];
2330 vc = va[aptr[i]];
2331 vr = vb[bptr[idc]];
2332 if (i!=idr || PetscAbsScalar(vc-PetscConj(vr))fabs(vc-(vr)) > tol) {
2333 *f = PETSC_FALSE;
2334 goto done;
2335 } else {
2336 aptr[i]++;
2337 if (B || i!=idc) bptr[idc]++;
2338 }
2339 }
2340 }
2341done:
2342 ierr = PetscFree(aptr)((*PetscTrFree)((void*)(aptr),2342,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((aptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2342,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2343 ierr = PetscFree(bptr)((*PetscTrFree)((void*)(bptr),2343,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((bptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2343,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2344 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)
;
2345}
2346
2347PetscErrorCode MatIsSymmetric_SeqAIJ(Mat A,PetscReal tol,PetscBool *f)
2348{
2349 PetscErrorCode ierr;
2350
2351 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2351; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2352 ierr = MatIsTranspose_SeqAIJ(A,A,tol,f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2352,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2353 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)
;
2354}
2355
2356PetscErrorCode MatIsHermitian_SeqAIJ(Mat A,PetscReal tol,PetscBool *f)
2357{
2358 PetscErrorCode ierr;
2359
2360 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2360; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2361 ierr = MatIsHermitianTranspose_SeqAIJ(A,A,tol,f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2361,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2362 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)
;
2363}
2364
2365PetscErrorCode MatDiagonalScale_SeqAIJ(Mat A,Vec ll,Vec rr)
2366{
2367 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2368 const PetscScalar *l,*r;
2369 PetscScalar x;
2370 MatScalar *v;
2371 PetscErrorCode ierr;
2372 PetscInt i,j,m = A->rmap->n,n = A->cmap->n,M,nz = a->nz;
2373 const PetscInt *jj;
2374
2375 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2375; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2376 if (ll) {
2377 /* The local size is used so that VecMPI can be passed to this routine
2378 by MatDiagonalScale_MPIAIJ */
2379 ierr = VecGetLocalSize(ll,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2379,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2380 if (m != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Left scaling vector wrong length")return PetscError(((MPI_Comm)0x44000001),2380,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Left scaling vector wrong length")
;
2381 ierr = VecGetArrayRead(ll,&l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2381,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2382 v = a->a;
2383 for (i=0; i<m; i++) {
2384 x = l[i];
2385 M = a->i[i+1] - a->i[i];
2386 for (j=0; j<M; j++) (*v++) *= x;
2387 }
2388 ierr = VecRestoreArrayRead(ll,&l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2388,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2389 ierr = PetscLogFlops(nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2389,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2390 }
2391 if (rr) {
2392 ierr = VecGetLocalSize(rr,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2392,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2393 if (n != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Right scaling vector wrong length")return PetscError(((MPI_Comm)0x44000001),2393,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Right scaling vector wrong length")
;
2394 ierr = VecGetArrayRead(rr,&r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2394,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2395 v = a->a; jj = a->j;
2396 for (i=0; i<nz; i++) (*v++) *= r[*jj++];
2397 ierr = VecRestoreArrayRead(rr,&r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2397,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2398 ierr = PetscLogFlops(nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2398,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2399 }
2400 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2400,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2401#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
2402 if (A->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED) A->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
2403#endif
2404 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)
;
2405}
2406
2407PetscErrorCode MatCreateSubMatrix_SeqAIJ(Mat A,IS isrow,IS iscol,PetscInt csize,MatReuse scall,Mat *B)
2408{
2409 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data,*c;
2410 PetscErrorCode ierr;
2411 PetscInt *smap,i,k,kstart,kend,oldcols = A->cmap->n,*lens;
2412 PetscInt row,mat_i,*mat_j,tcol,first,step,*mat_ilen,sum,lensi;
2413 const PetscInt *irow,*icol;
2414 PetscInt nrows,ncols;
2415 PetscInt *starts,*j_new,*i_new,*aj = a->j,*ai = a->i,ii,*ailen = a->ilen;
2416 MatScalar *a_new,*mat_a;
2417 Mat C;
2418 PetscBool stride;
2419
2420 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2420; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2421
2422 ierr = ISGetIndices(isrow,&irow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2422,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2423 ierr = ISGetLocalSize(isrow,&nrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2423,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2424 ierr = ISGetLocalSize(iscol,&ncols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2424,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2425
2426 ierr = PetscObjectTypeCompare((PetscObject)iscol,ISSTRIDE"stride",&stride);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2426,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2427 if (stride) {
2428 ierr = ISStrideGetInfo(iscol,&first,&step);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2428,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2429 } else {
2430 first = 0;
2431 step = 0;
2432 }
2433 if (stride && step == 1) {
2434 /* special case of contiguous rows */
2435 ierr = PetscMalloc2(nrows,&lens,nrows,&starts)PetscMallocA(2,PETSC_FALSE,2435,__func__,"/sandbox/petsc/petsc.master/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),2435,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2436 /* loop over new rows determining lens and starting points */
2437 for (i=0; i<nrows; i++) {
2438 kstart = ai[irow[i]];
2439 kend = kstart + ailen[irow[i]];
2440 starts[i] = kstart;
2441 for (k=kstart; k<kend; k++) {
2442 if (aj[k] >= first) {
2443 starts[i] = k;
2444 break;
2445 }
2446 }
2447 sum = 0;
2448 while (k < kend) {
2449 if (aj[k++] >= first+ncols) break;
2450 sum++;
2451 }
2452 lens[i] = sum;
2453 }
2454 /* create submatrix */
2455 if (scall == MAT_REUSE_MATRIX) {
2456 PetscInt n_cols,n_rows;
2457 ierr = MatGetSize(*B,&n_rows,&n_cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2457,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2458 if (n_rows != nrows || n_cols != ncols) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Reused submatrix wrong size")return PetscError(((MPI_Comm)0x44000001),2458,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Reused submatrix wrong size")
;
2459 ierr = MatZeroEntries(*B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2459,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2460 C = *B;
2461 } else {
2462 PetscInt rbs,cbs;
2463 ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2463,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2464 ierr = MatSetSizes(C,nrows,ncols,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2464,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2465 ierr = ISGetBlockSize(isrow,&rbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2465,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2466 ierr = ISGetBlockSize(iscol,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2466,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2467 ierr = MatSetBlockSizes(C,rbs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2467,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2468 ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2468,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2469 ierr = MatSeqAIJSetPreallocation_SeqAIJ(C,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2469,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2470 }
2471 c = (Mat_SeqAIJ*)C->data;
2472
2473 /* loop over rows inserting into submatrix */
2474 a_new = c->a;
2475 j_new = c->j;
2476 i_new = c->i;
2477
2478 for (i=0; i<nrows; i++) {
2479 ii = starts[i];
2480 lensi = lens[i];
2481 for (k=0; k<lensi; k++) {
2482 *j_new++ = aj[ii+k] - first;
2483 }
2484 ierr = PetscArraycpy(a_new,a->a + starts[i],lensi)((sizeof(*(a_new)) != sizeof(*(a->a + starts[i]))) || PetscMemcpy
(a_new,a->a + starts[i],(lensi)*sizeof(*(a_new))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2484,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2485 a_new += lensi;
2486 i_new[i+1] = i_new[i] + lensi;
2487 c->ilen[i] = lensi;
2488 }
2489 ierr = PetscFree2(lens,starts)PetscFreeA(2,2489,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,&(lens),&(starts))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2489,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2490 } else {
2491 ierr = ISGetIndices(iscol,&icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2491,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2492 ierr = PetscCalloc1(oldcols,&smap)PetscMallocA(1,PETSC_TRUE,2492,__func__,"/sandbox/petsc/petsc.master/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),2492,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2493 ierr = PetscMalloc1(1+nrows,&lens)PetscMallocA(1,PETSC_FALSE,2493,__func__,"/sandbox/petsc/petsc.master/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),2493,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2494 for (i=0; i<ncols; i++) {
2495#if defined(PETSC_USE_DEBUG1)
2496 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
),2496,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
2497#endif
2498 smap[icol[i]] = i+1;
2499 }
2500
2501 /* determine lens of each row */
2502 for (i=0; i<nrows; i++) {
2503 kstart = ai[irow[i]];
2504 kend = kstart + a->ilen[irow[i]];
2505 lens[i] = 0;
2506 for (k=kstart; k<kend; k++) {
2507 if (smap[aj[k]]) {
2508 lens[i]++;
2509 }
2510 }
2511 }
2512 /* Create and fill new matrix */
2513 if (scall == MAT_REUSE_MATRIX) {
2514 PetscBool equal;
2515
2516 c = (Mat_SeqAIJ*)((*B)->data);
2517 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),2517,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Cannot reuse matrix. wrong size")
;
2518 ierr = PetscArraycmp(c->ilen,lens,(*B)->rmap->n,&equal)((sizeof(*(c->ilen)) != sizeof(*(lens))) || PetscMemcmp(c->
ilen,lens,((*B)->rmap->n)*sizeof(*(c->ilen)),&equal
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2518,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2519 if (!equal) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Cannot reuse matrix. wrong no of nonzeros")return PetscError(((MPI_Comm)0x44000001),2519,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Cannot reuse matrix. wrong no of nonzeros"
)
;
2520 ierr = PetscArrayzero(c->ilen,(*B)->rmap->n)PetscMemzero(c->ilen,((*B)->rmap->n)*sizeof(*(c->
ilen)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2520,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2521 C = *B;
2522 } else {
2523 PetscInt rbs,cbs;
2524 ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2524,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2525 ierr = MatSetSizes(C,nrows,ncols,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2525,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2526 ierr = ISGetBlockSize(isrow,&rbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2526,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2527 ierr = ISGetBlockSize(iscol,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2527,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2528 ierr = MatSetBlockSizes(C,rbs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2528,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2529 ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2529,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2530 ierr = MatSeqAIJSetPreallocation_SeqAIJ(C,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2530,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2531 }
2532 c = (Mat_SeqAIJ*)(C->data);
2533 for (i=0; i<nrows; i++) {
2534 row = irow[i];
2535 kstart = ai[row];
2536 kend = kstart + a->ilen[row];
2537 mat_i = c->i[i];
2538 mat_j = c->j + mat_i;
2539 mat_a = c->a + mat_i;
2540 mat_ilen = c->ilen + i;
2541 for (k=kstart; k<kend; k++) {
2542 if ((tcol=smap[a->j[k]])) {
2543 *mat_j++ = tcol - 1;
2544 *mat_a++ = a->a[k];
2545 (*mat_ilen)++;
2546
2547 }
2548 }
2549 }
2550 /* Free work space */
2551 ierr = ISRestoreIndices(iscol,&icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2551,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2552 ierr = PetscFree(smap)((*PetscTrFree)((void*)(smap),2552,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((smap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2552,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2553 ierr = PetscFree(lens)((*PetscTrFree)((void*)(lens),2553,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2553,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2554 /* sort */
2555 for (i = 0; i < nrows; i++) {
2556 PetscInt ilen;
2557
2558 mat_i = c->i[i];
2559 mat_j = c->j + mat_i;
2560 mat_a = c->a + mat_i;
2561 ilen = c->ilen[i];
2562 ierr = PetscSortIntWithScalarArray(ilen,mat_j,mat_a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2562,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2563 }
2564 }
2565 ierr = MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2565,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2566 ierr = MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2566,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2567
2568 ierr = ISRestoreIndices(isrow,&irow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2568,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2569 *B = C;
2570 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)
;
2571}
2572
2573PetscErrorCode MatGetMultiProcBlock_SeqAIJ(Mat mat,MPI_Comm subComm,MatReuse scall,Mat *subMat)
2574{
2575 PetscErrorCode ierr;
2576 Mat B;
2577
2578 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2578; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2579 if (scall == MAT_INITIAL_MATRIX) {
2580 ierr = MatCreate(subComm,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2580,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2581 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),2581,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2582 ierr = MatSetBlockSizesFromMats(B,mat,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2582,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2583 ierr = MatSetType(B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2583,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2584 ierr = MatDuplicateNoCreate_SeqAIJ(B,mat,MAT_COPY_VALUES,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2584,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2585 *subMat = B;
2586 } else {
2587 ierr = MatCopy_SeqAIJ(mat,*subMat,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2587,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2588 }
2589 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)
;
2590}
2591
2592PetscErrorCode MatILUFactor_SeqAIJ(Mat inA,IS row,IS col,const MatFactorInfo *info)
2593{
2594 Mat_SeqAIJ *a = (Mat_SeqAIJ*)inA->data;
2595 PetscErrorCode ierr;
2596 Mat outA;
2597 PetscBool row_identity,col_identity;
2598
2599 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2599; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2600 if (info->levels != 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only levels=0 supported for in-place ilu")return PetscError(((MPI_Comm)0x44000001),2600,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Only levels=0 supported for in-place ilu"
)
;
2601
2602 ierr = ISIdentity(row,&row_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2602,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2603 ierr = ISIdentity(col,&col_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2603,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2604
2605 outA = inA;
2606 outA->factortype = MAT_FACTOR_LU;
2607 ierr = PetscFree(inA->solvertype)((*PetscTrFree)((void*)(inA->solvertype),2607,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((inA->solvertype) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2607,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2608 ierr = PetscStrallocpy(MATSOLVERPETSC"petsc",&inA->solvertype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2608,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2609
2610 ierr = PetscObjectReference((PetscObject)row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2610,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2611 ierr = ISDestroy(&a->row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2611,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2612
2613 a->row = row;
2614
2615 ierr = PetscObjectReference((PetscObject)col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2615,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2616 ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2616,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2617
2618 a->col = col;
2619
2620 /* Create the inverse permutation so that it can be used in MatLUFactorNumeric() */
2621 ierr = ISDestroy(&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2621,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2622 ierr = ISInvertPermutation(col,PETSC_DECIDE-1,&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2622,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2623 ierr = PetscLogObjectParent((PetscObject)inA,(PetscObject)a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2623,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2624
2625 if (!a->solve_work) { /* this matrix may have been factored before */
2626 ierr = PetscMalloc1(inA->rmap->n+1,&a->solve_work)PetscMallocA(1,PETSC_FALSE,2626,__func__,"/sandbox/petsc/petsc.master/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),2626,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2627 ierr = PetscLogObjectMemory((PetscObject)inA, (inA->rmap->n+1)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2627,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2628 }
2629
2630 ierr = MatMarkDiagonal_SeqAIJ(inA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2630,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2631 if (row_identity && col_identity) {
2632 ierr = MatLUFactorNumeric_SeqAIJ_inplace(outA,inA,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2632,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2633 } else {
2634 ierr = MatLUFactorNumeric_SeqAIJ_InplaceWithPerm(outA,inA,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2634,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2635 }
2636 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)
;
2637}
2638
2639PetscErrorCode MatScale_SeqAIJ(Mat inA,PetscScalar alpha)
2640{
2641 Mat_SeqAIJ *a = (Mat_SeqAIJ*)inA->data;
2642 PetscScalar oalpha = alpha;
2643 PetscErrorCode ierr;
2644 PetscBLASInt one = 1,bnz;
2645
2646 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2646; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2647 ierr = PetscBLASIntCast(a->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2647,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2648 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.master/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2648; 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(2648,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),2648,__func__,"/sandbox/petsc/petsc.master/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)
;
2649 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2649,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2650 ierr = MatSeqAIJInvalidateDiagonal(inA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2650,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2651#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
2652 if (inA->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED) inA->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
2653#endif
2654 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)
;
2655}
2656
2657PetscErrorCode MatDestroySubMatrix_Private(Mat_SubSppt *submatj)
2658{
2659 PetscErrorCode ierr;
2660 PetscInt i;
2661
2662 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2662; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2663 if (!submatj->id) { /* delete data that are linked only to submats[id=0] */
2664 ierr = PetscFree4(submatj->sbuf1,submatj->ptr,submatj->tmp,submatj->ctr)PetscFreeA(4,2664,__func__,"/sandbox/petsc/petsc.master/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),2664,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2665
2666 for (i=0; i<submatj->nrqr; ++i) {
2667 ierr = PetscFree(submatj->sbuf2[i])((*PetscTrFree)((void*)(submatj->sbuf2[i]),2667,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj->sbuf2[i]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2667,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2668 }
2669 ierr = PetscFree3(submatj->sbuf2,submatj->req_size,submatj->req_source1)PetscFreeA(3,2669,__func__,"/sandbox/petsc/petsc.master/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),2669,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2670
2671 if (submatj->rbuf1) {
2672 ierr = PetscFree(submatj->rbuf1[0])((*PetscTrFree)((void*)(submatj->rbuf1[0]),2672,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rbuf1[0]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2672,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2673 ierr = PetscFree(submatj->rbuf1)((*PetscTrFree)((void*)(submatj->rbuf1),2673,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rbuf1) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2673,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2674 }
2675
2676 for (i=0; i<submatj->nrqs; ++i) {
2677 ierr = PetscFree(submatj->rbuf3[i])((*PetscTrFree)((void*)(submatj->rbuf3[i]),2677,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rbuf3[i]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2677,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2678 }
2679 ierr = PetscFree3(submatj->req_source2,submatj->rbuf2,submatj->rbuf3)PetscFreeA(3,2679,__func__,"/sandbox/petsc/petsc.master/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),2679,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2680 ierr = PetscFree(submatj->pa)((*PetscTrFree)((void*)(submatj->pa),2680,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj->pa) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2680,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2681 }
2682
2683#if defined(PETSC_USE_CTABLE1)
2684 ierr = PetscTableDestroy((PetscTable*)&submatj->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2684,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2685 if (submatj->cmap_loc) {ierr = PetscFree(submatj->cmap_loc)((*PetscTrFree)((void*)(submatj->cmap_loc),2685,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj->cmap_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2685,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
2686 ierr = PetscFree(submatj->rmap_loc)((*PetscTrFree)((void*)(submatj->rmap_loc),2686,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rmap_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2686,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2687#else
2688 ierr = PetscFree(submatj->rmap)((*PetscTrFree)((void*)(submatj->rmap),2688,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2688,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2689#endif
2690
2691 if (!submatj->allcolumns) {
2692#if defined(PETSC_USE_CTABLE1)
2693 ierr = PetscTableDestroy((PetscTable*)&submatj->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2693,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2694#else
2695 ierr = PetscFree(submatj->cmap)((*PetscTrFree)((void*)(submatj->cmap),2695,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj->cmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2695,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2696#endif
2697 }
2698 ierr = PetscFree(submatj->row2proc)((*PetscTrFree)((void*)(submatj->row2proc),2698,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj->row2proc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2698,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2699
2700 ierr = PetscFree(submatj)((*PetscTrFree)((void*)(submatj),2700,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((submatj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2700,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2701 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)
;
2702}
2703
2704PetscErrorCode MatDestroySubMatrix_SeqAIJ(Mat C)
2705{
2706 PetscErrorCode ierr;
2707 Mat_SeqAIJ *c = (Mat_SeqAIJ*)C->data;
2708 Mat_SubSppt *submatj = c->submatis1;
2709
2710 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2710; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2711 ierr = (*submatj->destroy)(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2711,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2712 ierr = MatDestroySubMatrix_Private(submatj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2712,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2713 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)
;
2714}
2715
2716PetscErrorCode MatDestroySubMatrices_SeqAIJ(PetscInt n,Mat *mat[])
2717{
2718 PetscErrorCode ierr;
2719 PetscInt i;
2720 Mat C;
2721 Mat_SeqAIJ *c;
2722 Mat_SubSppt *submatj;
2723
2724 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2724; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2725 for (i=0; i<n; i++) {
2726 C = (*mat)[i];
2727 c = (Mat_SeqAIJ*)C->data;
2728 submatj = c->submatis1;
2729 if (submatj) {
2730 if (--((PetscObject)C)->refct <= 0) {
2731 ierr = (*submatj->destroy)(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2731,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2732 ierr = MatDestroySubMatrix_Private(submatj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2732,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2733 ierr = PetscFree(C->defaultvectype)((*PetscTrFree)((void*)(C->defaultvectype),2733,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((C->defaultvectype) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2733,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2734 ierr = PetscLayoutDestroy(&C->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2734,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2735 ierr = PetscLayoutDestroy(&C->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2735,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2736 ierr = PetscHeaderDestroy(&C)(PetscHeaderDestroy_Private((PetscObject)(*&C)) || ((*PetscTrFree
)((void*)(*&C),2736,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((*&C) = 0,0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2736,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2737 }
2738 } else {
2739 ierr = MatDestroy(&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2739,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2740 }
2741 }
2742
2743 /* Destroy Dummy submatrices created for reuse */
2744 ierr = MatDestroySubMatrices_Dummy(n,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2744,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2745
2746 ierr = PetscFree(*mat)((*PetscTrFree)((void*)(*mat),2746,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((*mat) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2746,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2747 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)
;
2748}
2749
2750PetscErrorCode MatCreateSubMatrices_SeqAIJ(Mat A,PetscInt n,const IS irow[],const IS icol[],MatReuse scall,Mat *B[])
2751{
2752 PetscErrorCode ierr;
2753 PetscInt i;
2754
2755 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2755; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2756 if (scall == MAT_INITIAL_MATRIX) {
2757 ierr = PetscCalloc1(n+1,B)PetscMallocA(1,PETSC_TRUE,2757,__func__,"/sandbox/petsc/petsc.master/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),2757,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2758 }
2759
2760 for (i=0; i<n; i++) {
2761 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),2761,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2762 }
2763 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)
;
2764}
2765
2766PetscErrorCode MatIncreaseOverlap_SeqAIJ(Mat A,PetscInt is_max,IS is[],PetscInt ov)
2767{
2768 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2769 PetscErrorCode ierr;
2770 PetscInt row,i,j,k,l,m,n,*nidx,isz,val;
2771 const PetscInt *idx;
2772 PetscInt start,end,*ai,*aj;
2773 PetscBT table;
2774
2775 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2775; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2776 m = A->rmap->n;
2777 ai = a->i;
2778 aj = a->j;
2779
2780 if (ov < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"illegal negative overlap value used")return PetscError(((MPI_Comm)0x44000001),2780,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"illegal negative overlap value used"
)
;
2781
2782 ierr = PetscMalloc1(m+1,&nidx)PetscMallocA(1,PETSC_FALSE,2782,__func__,"/sandbox/petsc/petsc.master/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),2782,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2783 ierr = PetscBTCreate(m,&table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2783,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2784
2785 for (i=0; i<is_max; i++) {
2786 /* Initialize the two local arrays */
2787 isz = 0;
2788 ierr = PetscBTMemzero(m,table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2788,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2789
2790 /* Extract the indices, assume there can be duplicate entries */
2791 ierr = ISGetIndices(is[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2791,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2792 ierr = ISGetLocalSize(is[i],&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2792,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2793
2794 /* Enter these into the temp arrays. I.e., mark table[row], enter row into new index */
2795 for (j=0; j<n; ++j) {
2796 if (!PetscBTLookupSet(table,idx[j])) nidx[isz++] = idx[j];
2797 }
2798 ierr = ISRestoreIndices(is[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2798,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2799 ierr = ISDestroy(&is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2799,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2800
2801 k = 0;
2802 for (j=0; j<ov; j++) { /* for each overlap */
2803 n = isz;
2804 for (; k<n; k++) { /* do only those rows in nidx[k], which are not done yet */
2805 row = nidx[k];
2806 start = ai[row];
2807 end = ai[row+1];
2808 for (l = start; l<end; l++) {
2809 val = aj[l];
2810 if (!PetscBTLookupSet(table,val)) nidx[isz++] = val;
2811 }
2812 }
2813 }
2814 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),2814,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2815 }
2816 ierr = PetscBTDestroy(&table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2816,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2817 ierr = PetscFree(nidx)((*PetscTrFree)((void*)(nidx),2817,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((nidx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2817,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2818 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)
;
2819}
2820
2821/* -------------------------------------------------------------- */
2822PetscErrorCode MatPermute_SeqAIJ(Mat A,IS rowp,IS colp,Mat *B)
2823{
2824 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2825 PetscErrorCode ierr;
2826 PetscInt i,nz = 0,m = A->rmap->n,n = A->cmap->n;
2827 const PetscInt *row,*col;
2828 PetscInt *cnew,j,*lens;
2829 IS icolp,irowp;
2830 PetscInt *cwork = NULL((void*)0);
2831 PetscScalar *vwork = NULL((void*)0);
2832
2833 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2833; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2834 ierr = ISInvertPermutation(rowp,PETSC_DECIDE-1,&irowp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2834,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2835 ierr = ISGetIndices(irowp,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2835,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2836 ierr = ISInvertPermutation(colp,PETSC_DECIDE-1,&icolp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2836,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2837 ierr = ISGetIndices(icolp,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2837,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2838
2839 /* determine lengths of permuted rows */
2840 ierr = PetscMalloc1(m+1,&lens)PetscMallocA(1,PETSC_FALSE,2840,__func__,"/sandbox/petsc/petsc.master/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),2840,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2841 for (i=0; i<m; i++) lens[row[i]] = a->i[i+1] - a->i[i];
2842 ierr = MatCreate(PetscObjectComm((PetscObject)A),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2842,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2843 ierr = MatSetSizes(*B,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2843,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2844 ierr = MatSetBlockSizesFromMats(*B,A,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2844,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2845 ierr = MatSetType(*B,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2845,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2846 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*B,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2846,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2847 ierr = PetscFree(lens)((*PetscTrFree)((void*)(lens),2847,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2847,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2848
2849 ierr = PetscMalloc1(n,&cnew)PetscMallocA(1,PETSC_FALSE,2849,__func__,"/sandbox/petsc/petsc.master/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),2849,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2850 for (i=0; i<m; i++) {
2851 ierr = MatGetRow_SeqAIJ(A,i,&nz,&cwork,&vwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2851,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2852 for (j=0; j<nz; j++) cnew[j] = col[cwork[j]];
2853 ierr = MatSetValues_SeqAIJ(*B,1,&row[i],nz,cnew,vwork,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2853,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2854 ierr = MatRestoreRow_SeqAIJ(A,i,&nz,&cwork,&vwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2854,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2855 }
2856 ierr = PetscFree(cnew)((*PetscTrFree)((void*)(cnew),2856,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((cnew) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2856,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2857
2858 (*B)->assembled = PETSC_FALSE;
2859
2860 ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2860,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2861 ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2861,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2862 ierr = ISRestoreIndices(irowp,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2862,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2863 ierr = ISRestoreIndices(icolp,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2863,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2864 ierr = ISDestroy(&irowp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2864,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2865 ierr = ISDestroy(&icolp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2865,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
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 MatCopy_SeqAIJ(Mat A,Mat B,MatStructure str)
2870{
2871 PetscErrorCode ierr;
2872
2873 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2873; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2874 /* If the two matrices have the same copy implementation, use fast copy. */
2875 if (str == SAME_NONZERO_PATTERN && (A->ops->copy == B->ops->copy)) {
2876 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2877 Mat_SeqAIJ *b = (Mat_SeqAIJ*)B->data;
2878
2879 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),2879,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,75,PETSC_ERROR_INITIAL,"Number of nonzeros in two matrices are different"
)
;
2880 ierr = PetscArraycpy(b->a,a->a,a->i[A->rmap->n])((sizeof(*(b->a)) != sizeof(*(a->a))) || PetscMemcpy(b->
a,a->a,(a->i[A->rmap->n])*sizeof(*(b->a))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2880,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2881 ierr = PetscObjectStateIncrease((PetscObject)B)(((PetscObject)B)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2881,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2882 } else {
2883 ierr = MatCopy_Basic(A,B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2883,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2884 }
2885 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)
;
2886}
2887
2888PetscErrorCode MatSetUp_SeqAIJ(Mat A)
2889{
2890 PetscErrorCode ierr;
2891
2892 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2892; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2893 ierr = MatSeqAIJSetPreallocation_SeqAIJ(A,PETSC_DEFAULT-2,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2893,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2894 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)
;
2895}
2896
2897PetscErrorCode MatSeqAIJGetArray_SeqAIJ(Mat A,PetscScalar *array[])
2898{
2899 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2900
2901 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2901; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2902 *array = a->a;
2903 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)
;
2904}
2905
2906PetscErrorCode MatSeqAIJRestoreArray_SeqAIJ(Mat A,PetscScalar *array[])
2907{
2908 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2908; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2909 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)
;
2910}
2911
2912/*
2913 Computes the number of nonzeros per row needed for preallocation when X and Y
2914 have different nonzero structure.
2915*/
2916PetscErrorCode MatAXPYGetPreallocation_SeqX_private(PetscInt m,const PetscInt *xi,const PetscInt *xj,const PetscInt *yi,const PetscInt *yj,PetscInt *nnz)
2917{
2918 PetscInt i,j,k,nzx,nzy;
2919
2920 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2920; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2921 /* Set the number of nonzeros in the new matrix */
2922 for (i=0; i<m; i++) {
2923 const PetscInt *xjj = xj+xi[i],*yjj = yj+yi[i];
2924 nzx = xi[i+1] - xi[i];
2925 nzy = yi[i+1] - yi[i];
2926 nnz[i] = 0;
2927 for (j=0,k=0; j<nzx; j++) { /* Point in X */
2928 for (; k<nzy && yjj[k]<xjj[j]; k++) nnz[i]++; /* Catch up to X */
2929 if (k<nzy && yjj[k]==xjj[j]) k++; /* Skip duplicate */
2930 nnz[i]++;
2931 }
2932 for (; k<nzy; k++) nnz[i]++;
2933 }
2934 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)
;
2935}
2936
2937PetscErrorCode MatAXPYGetPreallocation_SeqAIJ(Mat Y,Mat X,PetscInt *nnz)
2938{
2939 PetscInt m = Y->rmap->N;
2940 Mat_SeqAIJ *x = (Mat_SeqAIJ*)X->data;
2941 Mat_SeqAIJ *y = (Mat_SeqAIJ*)Y->data;
2942 PetscErrorCode ierr;
2943
2944 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2944; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2945 /* Set the number of nonzeros in the new matrix */
2946 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),2946,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2947 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)
;
2948}
2949
2950PetscErrorCode MatAXPY_SeqAIJ(Mat Y,PetscScalar a,Mat X,MatStructure str)
2951{
2952 PetscErrorCode ierr;
2953 Mat_SeqAIJ *x = (Mat_SeqAIJ*)X->data,*y = (Mat_SeqAIJ*)Y->data;
2954 PetscBLASInt one=1,bnz;
2955
2956 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2956; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2957 ierr = PetscBLASIntCast(x->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2957,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2958 if (str == SAME_NONZERO_PATTERN) {
2959 PetscScalar alpha = a;
2960 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.master/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2960; 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(2960
,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),2960,__func__,"/sandbox/petsc/petsc.master/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)
;
2961 ierr = MatSeqAIJInvalidateDiagonal(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2961,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2962 ierr = PetscObjectStateIncrease((PetscObject)Y)(((PetscObject)Y)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2962,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2963 /* the MatAXPY_Basic* subroutines calls MatAssembly, so the matrix on the GPU
2964 will be updated */
2965#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
2966 if (Y->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED) {
2967 Y->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
2968 }
2969#endif
2970 } else if (str == SUBSET_NONZERO_PATTERN) { /* nonzeros of X is a subset of Y's */
2971 ierr = MatAXPY_Basic(Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2971,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2972 } else {
2973 Mat B;
2974 PetscInt *nnz;
2975 ierr = PetscMalloc1(Y->rmap->N,&nnz)PetscMallocA(1,PETSC_FALSE,2975,__func__,"/sandbox/petsc/petsc.master/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),2975,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2976 ierr = MatCreate(PetscObjectComm((PetscObject)Y),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2976,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2977 ierr = PetscObjectSetName((PetscObject)B,((PetscObject)Y)->name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2977,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2978 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),2978,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2979 ierr = MatSetBlockSizesFromMats(B,Y,Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2979,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2980 ierr = MatSetType(B,(MatType) ((PetscObject)Y)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2980,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2981 ierr = MatAXPYGetPreallocation_SeqAIJ(Y,X,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2981,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2982 ierr = MatSeqAIJSetPreallocation(B,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2982,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2983 ierr = MatAXPY_BasicWithPreallocation(B,Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2983,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2984 ierr = MatHeaderReplace(Y,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2984,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2985 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),2985,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2985,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2986 }
2987 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)
;
2988}
2989
2990PetscErrorCode MatConjugate_SeqAIJ(Mat mat)
2991{
2992#if defined(PETSC_USE_COMPLEX)
2993 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
2994 PetscInt i,nz;
2995 PetscScalar *a;
2996
2997 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 2997; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2998 nz = aij->nz;
2999 a = aij->a;
3000 for (i=0; i<nz; i++) a[i] = PetscConj(a[i])(a[i]);
3001#if defined(PETSC_HAVE_VIENNACL) || defined(PETSC_HAVE_CUDA)
3002 if (mat->valid_GPU_matrix != PETSC_OFFLOAD_UNALLOCATED) mat->valid_GPU_matrix = PETSC_OFFLOAD_CPU;
3003#endif
3004#else
3005 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3005; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3006#endif
3007 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)
;
3008}
3009
3010PetscErrorCode MatGetRowMaxAbs_SeqAIJ(Mat A,Vec v,PetscInt idx[])
3011{
3012 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
3013 PetscErrorCode ierr;
3014 PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n;
3015 PetscReal atmp;
3016 PetscScalar *x;
3017 MatScalar *aa;
3018
3019 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3019; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3020 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3020,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3021 aa = a->a;
3022 ai = a->i;
3023 aj = a->j;
3024
3025 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3025,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3026 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3026,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3027 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3027,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3028 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),3028,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
3029 for (i=0; i<m; i++) {
3030 ncols = ai[1] - ai[0]; ai++;
3031 x[i] = 0.0;
3032 for (j=0; j<ncols; j++) {
3033 atmp = PetscAbsScalar(*aa)fabs(*aa);
3034 if (PetscAbsScalar(x[i])fabs(x[i]) < atmp) {x[i] = atmp; if (idx) idx[i] = *aj;}
3035 aa++; aj++;
3036 }
3037 }
3038 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3038,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3039 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)
;
3040}
3041
3042PetscErrorCode MatGetRowMax_SeqAIJ(Mat A,Vec v,PetscInt idx[])
3043{
3044 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
3045 PetscErrorCode ierr;
3046 PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n;
3047 PetscScalar *x;
3048 MatScalar *aa;
3049
3050 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3050; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3051 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3051,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3052 aa = a->a;
3053 ai = a->i;
3054 aj = a->j;
3055
3056 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3056,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3057 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3057,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3058 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3058,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3059 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),3059,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
3060 for (i=0; i<m; i++) {
3061 ncols = ai[1] - ai[0]; ai++;
3062 if (ncols == A->cmap->n) { /* row is dense */
3063 x[i] = *aa; if (idx) idx[i] = 0;
3064 } else { /* row is sparse so already KNOW maximum is 0.0 or higher */
3065 x[i] = 0.0;
3066 if (idx) {
3067 idx[i] = 0; /* in case ncols is zero */
3068 for (j=0;j<ncols;j++) { /* find first implicit 0.0 in the row */
3069 if (aj[j] > j) {
3070 idx[i] = j;
3071 break;
3072 }
3073 }
3074 }
3075 }
3076 for (j=0; j<ncols; j++) {
3077 if (PetscRealPart(x[i])(x[i]) < PetscRealPart(*aa)(*aa)) {x[i] = *aa; if (idx) idx[i] = *aj;}
3078 aa++; aj++;
3079 }
3080 }
3081 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3081,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3082 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)
;
3083}
3084
3085PetscErrorCode MatGetRowMinAbs_SeqAIJ(Mat A,Vec v,PetscInt idx[])
3086{
3087 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
3088 PetscErrorCode ierr;
3089 PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n;
3090 PetscReal atmp;
3091 PetscScalar *x;
3092 MatScalar *aa;
3093
3094 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3094; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3095 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3095,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3096 aa = a->a;
3097 ai = a->i;
3098 aj = a->j;
3099
3100 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3100,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3101 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3101,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3102 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3102,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3103 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
),3103,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
60);}} while (0)
;
3104 for (i=0; i<m; i++) {
3105 ncols = ai[1] - ai[0]; ai++;
3106 if (ncols) {
3107 /* Get first nonzero */
3108 for (j = 0; j < ncols; j++) {
3109 atmp = PetscAbsScalar(aa[j])fabs(aa[j]);
3110 if (atmp > 1.0e-12) {
3111 x[i] = atmp;
3112 if (idx) idx[i] = aj[j];
3113 break;
3114 }
3115 }
3116 if (j == ncols) {x[i] = PetscAbsScalar(*aa)fabs(*aa); if (idx) idx[i] = *aj;}
3117 } else {
3118 x[i] = 0.0; if (idx) idx[i] = 0;
3119 }
3120 for (j = 0; j < ncols; j++) {
3121 atmp = PetscAbsScalar(*aa)fabs(*aa);
3122 if (atmp > 1.0e-12 && PetscAbsScalar(x[i])fabs(x[i]) > atmp) {x[i] = atmp; if (idx) idx[i] = *aj;}
3123 aa++; aj++;
3124 }
3125 }
3126 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3126,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3127 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)
;
3128}
3129
3130PetscErrorCode MatGetRowMin_SeqAIJ(Mat A,Vec v,PetscInt idx[])
3131{
3132 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
3133 PetscErrorCode ierr;
3134 PetscInt i,j,m = A->rmap->n,ncols,n;
3135 const PetscInt *ai,*aj;
3136 PetscScalar *x;
3137 const MatScalar *aa;
3138
3139 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3139; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3140 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3140,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3141 aa = a->a;
3142 ai = a->i;
3143 aj = a->j;
3144
3145 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3145,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3146 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3146,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3147 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3147,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3148 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),3148,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
3149 for (i=0; i<m; i++) {
3150 ncols = ai[1] - ai[0]; ai++;
3151 if (ncols == A->cmap->n) { /* row is dense */
3152 x[i] = *aa; if (idx) idx[i] = 0;
3153 } else { /* row is sparse so already KNOW minimum is 0.0 or lower */
3154 x[i] = 0.0;
3155 if (idx) { /* find first implicit 0.0 in the row */
3156 idx[i] = 0; /* in case ncols is zero */
3157 for (j=0; j<ncols; j++) {
3158 if (aj[j] > j) {
3159 idx[i] = j;
3160 break;
3161 }
3162 }
3163 }
3164 }
3165 for (j=0; j<ncols; j++) {
3166 if (PetscRealPart(x[i])(x[i]) > PetscRealPart(*aa)(*aa)) {x[i] = *aa; if (idx) idx[i] = *aj;}
3167 aa++; aj++;
3168 }
3169 }
3170 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3170,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3171 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)
;
3172}
3173
3174PetscErrorCode MatInvertBlockDiagonal_SeqAIJ(Mat A,const PetscScalar **values)
3175{
3176 Mat_SeqAIJ *a = (Mat_SeqAIJ*) A->data;
3177 PetscErrorCode ierr;
3178 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;
3179 MatScalar *diag,work[25],*v_work;
3180 const PetscReal shift = 0.0;
3181 PetscBool allowzeropivot,zeropivotdetected=PETSC_FALSE;
3182
3183 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3183; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3184 allowzeropivot = PetscNot(A->erroriffailure)((A->erroriffailure) ? PETSC_FALSE : PETSC_TRUE);
3185 if (a->ibdiagvalid) {
3186 if (values) *values = a->ibdiag;
3187 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)
;
3188 }
3189 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3189,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3190 if (!a->ibdiag) {
3191 ierr = PetscMalloc1(bs2*mbs,&a->ibdiag)PetscMallocA(1,PETSC_FALSE,3191,__func__,"/sandbox/petsc/petsc.master/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),3191,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3192 ierr = PetscLogObjectMemory((PetscObject)A,bs2*mbs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3192,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3193 }
3194 diag = a->ibdiag;
3195 if (values) *values = a->ibdiag;
3196 /* factor and invert each block */
3197 switch (bs) {
3198 case 1:
3199 for (i=0; i<mbs; i++) {
3200 ierr = MatGetValues(A,1,&i,1,&i,diag+i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3200,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3201 if (PetscAbsScalar(diag[i] + shift)fabs(diag[i] + shift) < PETSC_MACHINE_EPSILON2.2204460492503131e-16) {
3202 if (allowzeropivot) {
3203 A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3204 A->factorerror_zeropivot_value = PetscAbsScalar(diag[i])fabs(diag[i]);
3205 A->factorerror_zeropivot_row = i;
3206 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)fabs(diag[i]),(double)2.2204460492503131e-16)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3206,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3207 } 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
),3207,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,71,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
71);}} while (0)
;
3208 }
3209 diag[i] = (PetscScalar)1.0 / (diag[i] + shift);
3210 }
3211 break;
3212 case 2:
3213 for (i=0; i<mbs; i++) {
3214 ij[0] = 2*i; ij[1] = 2*i + 1;
3215 ierr = MatGetValues(A,2,ij,2,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3215,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3216 ierr = PetscKernel_A_gets_inverse_A_2(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3216,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3217 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3218 ierr = PetscKernel_A_gets_transpose_A_2(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3218,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3219 diag += 4;
3220 }
3221 break;
3222 case 3:
3223 for (i=0; i<mbs; i++) {
3224 ij[0] = 3*i; ij[1] = 3*i + 1; ij[2] = 3*i + 2;
3225 ierr = MatGetValues(A,3,ij,3,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3225,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3226 ierr = PetscKernel_A_gets_inverse_A_3(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3226,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3227 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3228 ierr = PetscKernel_A_gets_transpose_A_3(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3228,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3229 diag += 9;
3230 }
3231 break;
3232 case 4:
3233 for (i=0; i<mbs; i++) {
3234 ij[0] = 4*i; ij[1] = 4*i + 1; ij[2] = 4*i + 2; ij[3] = 4*i + 3;
3235 ierr = MatGetValues(A,4,ij,4,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3235,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3236 ierr = PetscKernel_A_gets_inverse_A_4(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3236,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3237 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3238 ierr = PetscKernel_A_gets_transpose_A_4(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3238,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3239 diag += 16;
3240 }
3241 break;
3242 case 5:
3243 for (i=0; i<mbs; i++) {
3244 ij[0] = 5*i; ij[1] = 5*i + 1; ij[2] = 5*i + 2; ij[3] = 5*i + 3; ij[4] = 5*i + 4;
3245 ierr = MatGetValues(A,5,ij,5,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3245,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3246 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),3246,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3247 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3248 ierr = PetscKernel_A_gets_transpose_A_5(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3248,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3249 diag += 25;
3250 }
3251 break;
3252 case 6:
3253 for (i=0; i<mbs; i++) {
3254 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;
3255 ierr = MatGetValues(A,6,ij,6,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3255,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3256 ierr = PetscKernel_A_gets_inverse_A_6(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3256,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3257 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3258 ierr = PetscKernel_A_gets_transpose_A_6(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3258,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3259 diag += 36;
3260 }
3261 break;
3262 case 7:
3263 for (i=0; i<mbs; i++) {
3264 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;
3265 ierr = MatGetValues(A,7,ij,7,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3265,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3266 ierr = PetscKernel_A_gets_inverse_A_7(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3266,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3267 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3268 ierr = PetscKernel_A_gets_transpose_A_7(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3268,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3269 diag += 49;
3270 }
3271 break;
3272 default:
3273 ierr = PetscMalloc3(bs,&v_work,bs,&v_pivots,bs,&IJ)PetscMallocA(3,PETSC_FALSE,3273,__func__,"/sandbox/petsc/petsc.master/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),3273,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3274 for (i=0; i<mbs; i++) {
3275 for (j=0; j<bs; j++) {
3276 IJ[j] = bs*i + j;
3277 }
3278 ierr = MatGetValues(A,bs,IJ,bs,IJ,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3278,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3279 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),3279,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3280 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3281 ierr = PetscKernel_A_gets_transpose_A_N(diag,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3281,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3282 diag += bs2;
3283 }
3284 ierr = PetscFree3(v_work,v_pivots,IJ)PetscFreeA(3,3284,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,&(v_work),&(v_pivots),&(IJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3284,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3285 }
3286 a->ibdiagvalid = PETSC_TRUE;
3287 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)
;
3288}
3289
3290static PetscErrorCode MatSetRandom_SeqAIJ(Mat x,PetscRandom rctx)
3291{
3292 PetscErrorCode ierr;
3293 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)x->data;
3294 PetscScalar a;
3295 PetscInt m,n,i,j,col;
3296
3297 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3297; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3298 if (!x->assembled) {
3299 ierr = MatGetSize(x,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3299,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3300 for (i=0; i<m; i++) {
3301 for (j=0; j<aij->imax[i]; j++) {
3302 ierr = PetscRandomGetValue(rctx,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3302,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3303 col = (PetscInt)(n*PetscRealPart(a)(a));
3304 ierr = MatSetValues(x,1,&i,1,&col,&a,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3304,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3305 }
3306 }
3307 } else {
3308 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),3308,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
3309 }
3310 ierr = MatAssemblyBegin(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3310,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3311 ierr = MatAssemblyEnd(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3311,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3312 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)
;
3313}
3314
3315/* Like MatSetRandom_SeqAIJ, but do not set values on columns in range of [low, high) */
3316PetscErrorCode MatSetRandomSkipColumnRange_SeqAIJ_Private(Mat x,PetscInt low,PetscInt high,PetscRandom rctx)
3317{
3318 PetscErrorCode ierr;
3319 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)x->data;
3320 PetscScalar a;
3321 PetscInt m,n,i,j,col,nskip;
3322
3323 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3323; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3324 nskip = high - low;
3325 ierr = MatGetSize(x,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3325,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3326 n -= nskip; /* shrink number of columns where nonzeros can be set */
3327 for (i=0; i<m; i++) {
3328 for (j=0; j<aij->imax[i]; j++) {
3329 ierr = PetscRandomGetValue(rctx,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3329,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3330 col = (PetscInt)(n*PetscRealPart(a)(a));
3331 if (col >= low) col += nskip; /* shift col rightward to skip the hole */
3332 ierr = MatSetValues(x,1,&i,1,&col,&a,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3332,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3333 }
3334 }
3335 ierr = MatAssemblyBegin(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3335,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3336 ierr = MatAssemblyEnd(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3336,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3337 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)
;
3338}
3339
3340
3341/* -------------------------------------------------------------------*/
3342static struct _MatOps MatOps_Values = { MatSetValues_SeqAIJ,
3343 MatGetRow_SeqAIJ,
3344 MatRestoreRow_SeqAIJ,
3345 MatMult_SeqAIJ,
3346 /* 4*/ MatMultAdd_SeqAIJ,
3347 MatMultTranspose_SeqAIJ,
3348 MatMultTransposeAdd_SeqAIJ,
3349 0,
3350 0,
3351 0,
3352 /* 10*/ 0,
3353 MatLUFactor_SeqAIJ,
3354 0,
3355 MatSOR_SeqAIJ,
3356 MatTranspose_SeqAIJ,
3357 /*1 5*/ MatGetInfo_SeqAIJ,
3358 MatEqual_SeqAIJ,
3359 MatGetDiagonal_SeqAIJ,
3360 MatDiagonalScale_SeqAIJ,
3361 MatNorm_SeqAIJ,
3362 /* 20*/ 0,
3363 MatAssemblyEnd_SeqAIJ,
3364 MatSetOption_SeqAIJ,
3365 MatZeroEntries_SeqAIJ,
3366 /* 24*/ MatZeroRows_SeqAIJ,
3367 0,
3368 0,
3369 0,
3370 0,
3371 /* 29*/ MatSetUp_SeqAIJ,
3372 0,
3373 0,
3374 0,
3375 0,
3376 /* 34*/ MatDuplicate_SeqAIJ,
3377 0,
3378 0,
3379 MatILUFactor_SeqAIJ,
3380 0,
3381 /* 39*/ MatAXPY_SeqAIJ,
3382 MatCreateSubMatrices_SeqAIJ,
3383 MatIncreaseOverlap_SeqAIJ,
3384 MatGetValues_SeqAIJ,
3385 MatCopy_SeqAIJ,
3386 /* 44*/ MatGetRowMax_SeqAIJ,
3387 MatScale_SeqAIJ,
3388 MatShift_SeqAIJ,
3389 MatDiagonalSet_SeqAIJ,
3390 MatZeroRowsColumns_SeqAIJ,
3391 /* 49*/ MatSetRandom_SeqAIJ,
3392 MatGetRowIJ_SeqAIJ,
3393 MatRestoreRowIJ_SeqAIJ,
3394 MatGetColumnIJ_SeqAIJ,
3395 MatRestoreColumnIJ_SeqAIJ,
3396 /* 54*/ MatFDColoringCreate_SeqXAIJ,
3397 0,
3398 0,
3399 MatPermute_SeqAIJ,
3400 0,
3401 /* 59*/ 0,
3402 MatDestroy_SeqAIJ,
3403 MatView_SeqAIJ,
3404 0,
3405 MatMatMatMult_SeqAIJ_SeqAIJ_SeqAIJ,
3406 /* 64*/ MatMatMatMultSymbolic_SeqAIJ_SeqAIJ_SeqAIJ,
3407 MatMatMatMultNumeric_SeqAIJ_SeqAIJ_SeqAIJ,
3408 0,
3409 0,
3410 0,
3411 /* 69*/ MatGetRowMaxAbs_SeqAIJ,
3412 MatGetRowMinAbs_SeqAIJ,
3413 0,
3414 0,
3415 0,
3416 /* 74*/ 0,
3417 MatFDColoringApply_AIJ,
3418 0,
3419 0,
3420 0,
3421 /* 79*/ MatFindZeroDiagonals_SeqAIJ,
3422 0,
3423 0,
3424 0,
3425 MatLoad_SeqAIJ,
3426 /* 84*/ MatIsSymmetric_SeqAIJ,
3427 MatIsHermitian_SeqAIJ,
3428 0,
3429 0,
3430 0,
3431 /* 89*/ MatMatMult_SeqAIJ_SeqAIJ,
3432 MatMatMultSymbolic_SeqAIJ_SeqAIJ,
3433 MatMatMultNumeric_SeqAIJ_SeqAIJ,
3434 MatPtAP_SeqAIJ_SeqAIJ,
3435 MatPtAPSymbolic_SeqAIJ_SeqAIJ_SparseAxpy,
3436 /* 94*/ MatPtAPNumeric_SeqAIJ_SeqAIJ_SparseAxpy,
3437 MatMatTransposeMult_SeqAIJ_SeqAIJ,
3438 MatMatTransposeMultSymbolic_SeqAIJ_SeqAIJ,
3439 MatMatTransposeMultNumeric_SeqAIJ_SeqAIJ,
3440 0,
3441 /* 99*/ 0,
3442 0,
3443 0,
3444 MatConjugate_SeqAIJ,
3445 0,
3446 /*104*/ MatSetValuesRow_SeqAIJ,
3447 MatRealPart_SeqAIJ,
3448 MatImaginaryPart_SeqAIJ,
3449 0,
3450 0,
3451 /*109*/ MatMatSolve_SeqAIJ,
3452 0,
3453 MatGetRowMin_SeqAIJ,
3454 0,
3455 MatMissingDiagonal_SeqAIJ,
3456 /*114*/ 0,
3457 0,
3458 0,
3459 0,
3460 0,
3461 /*119*/ 0,
3462 0,
3463 0,
3464 0,
3465 MatGetMultiProcBlock_SeqAIJ,
3466 /*124*/ MatFindNonzeroRows_SeqAIJ,
3467 MatGetColumnNorms_SeqAIJ,
3468 MatInvertBlockDiagonal_SeqAIJ,
3469 MatInvertVariableBlockDiagonal_SeqAIJ,
3470 0,
3471 /*129*/ 0,
3472 MatTransposeMatMult_SeqAIJ_SeqAIJ,
3473 MatTransposeMatMultSymbolic_SeqAIJ_SeqAIJ,
3474 MatTransposeMatMultNumeric_SeqAIJ_SeqAIJ,
3475 MatTransposeColoringCreate_SeqAIJ,
3476 /*134*/ MatTransColoringApplySpToDen_SeqAIJ,
3477 MatTransColoringApplyDenToSp_SeqAIJ,
3478 MatRARt_SeqAIJ_SeqAIJ,
3479 MatRARtSymbolic_SeqAIJ_SeqAIJ,
3480 MatRARtNumeric_SeqAIJ_SeqAIJ,
3481 /*139*/0,
3482 0,
3483 0,
3484 MatFDColoringSetUp_SeqXAIJ,
3485 MatFindOffBlockDiagonalEntries_SeqAIJ,
3486 /*144*/MatCreateMPIMatConcatenateSeqMat_SeqAIJ,
3487 MatDestroySubMatrices_SeqAIJ
3488};
3489
3490PetscErrorCode MatSeqAIJSetColumnIndices_SeqAIJ(Mat mat,PetscInt *indices)
3491{
3492 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3493 PetscInt i,nz,n;
3494
3495 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3495; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3496 nz = aij->maxnz;
3497 n = mat->rmap->n;
3498 for (i=0; i<nz; i++) {
3499 aij->j[i] = indices[i];
3500 }
3501 aij->nz = nz;
3502 for (i=0; i<n; i++) {
3503 aij->ilen[i] = aij->imax[i];
3504 }
3505 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)
;
3506}
3507
3508/*
3509 * When a sparse matrix has many zero columns, we should compact them out to save the space
3510 * This happens in MatPtAPSymbolic_MPIAIJ_MPIAIJ_scalable()
3511 * */
3512PetscErrorCode MatSeqAIJCompactOutExtraColumns_SeqAIJ(Mat mat, ISLocalToGlobalMapping *mapping)
3513{
3514 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3515 PetscTable gid1_lid1;
3516 PetscTablePosition tpos;
3517 PetscInt gid,lid,i,j,ncols,ec;
3518 PetscInt *garray;
3519 PetscErrorCode ierr;
3520
3521 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3521; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3522 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3522,
__func__,"/sandbox/petsc/petsc.master/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),3522,__func__,"/sandbox/petsc/petsc.master/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),3522,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3522,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",62
,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1
); } } while (0)
;
3523 PetscValidPointer(mapping,2)do { if (!mapping) return PetscError(((MPI_Comm)0x44000001),3523
,__func__,"/sandbox/petsc/petsc.master/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),3523,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
3524 /* use a table */
3525 ierr = PetscTableCreate(mat->rmap->n,mat->cmap->N+1,&gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3525,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3526 ec = 0;
3527 for (i=0; i<mat->rmap->n; i++) {
3528 ncols = aij->i[i+1] - aij->i[i];
3529 for (j=0; j<ncols; j++) {
3530 PetscInt data,gid1 = aij->j[aij->i[i] + j] + 1;
3531 ierr = PetscTableFind(gid1_lid1,gid1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3531,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3532 if (!data) {
3533 /* one based table */
3534 ierr = PetscTableAdd(gid1_lid1,gid1,++ec,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3534,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3535 }
3536 }
3537 }
3538 /* form array of columns we need */
3539 ierr = PetscMalloc1(ec+1,&garray)PetscMallocA(1,PETSC_FALSE,3539,__func__,"/sandbox/petsc/petsc.master/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),3539,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3540 ierr = PetscTableGetHeadPosition(gid1_lid1,&tpos);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3540,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3541 while (tpos) {
3542 ierr = PetscTableGetNext(gid1_lid1,&tpos,&gid,&lid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3542,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3543 gid--;
3544 lid--;
3545 garray[lid] = gid;
3546 }
3547 ierr = PetscSortInt(ec,garray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3547,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* sort, and rebuild */
3548 ierr = PetscTableRemoveAll(gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3548,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3549 for (i=0; i<ec; i++) {
3550 ierr = PetscTableAdd(gid1_lid1,garray[i]+1,i+1,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3550,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3551 }
3552 /* compact out the extra columns in B */
3553 for (i=0; i<mat->rmap->n; i++) {
3554 ncols = aij->i[i+1] - aij->i[i];
3555 for (j=0; j<ncols; j++) {
3556 PetscInt gid1 = aij->j[aij->i[i] + j] + 1;
3557 ierr = PetscTableFind(gid1_lid1,gid1,&lid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3557,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3558 lid--;
3559 aij->j[aij->i[i] + j] = lid;
3560 }
3561 }
3562 mat->cmap->n = mat->cmap->N = ec;
3563 mat->cmap->bs = 1;
3564
3565 ierr = PetscTableDestroy(&gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3565,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3566 ierr = PetscLayoutSetUp((mat->cmap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3566,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3567 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),3567,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3568 ierr = ISLocalToGlobalMappingSetType(*mapping,ISLOCALTOGLOBALMAPPINGHASH"hash");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3568,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3569 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)
;
3570}
3571
3572/*@
3573 MatSeqAIJSetColumnIndices - Set the column indices for all the rows
3574 in the matrix.
3575
3576 Input Parameters:
3577+ mat - the SeqAIJ matrix
3578- indices - the column indices
3579
3580 Level: advanced
3581
3582 Notes:
3583 This can be called if you have precomputed the nonzero structure of the
3584 matrix and want to provide it to the matrix object to improve the performance
3585 of the MatSetValues() operation.
3586
3587 You MUST have set the correct numbers of nonzeros per row in the call to
3588 MatCreateSeqAIJ(), and the columns indices MUST be sorted.
3589
3590 MUST be called before any calls to MatSetValues();
3591
3592 The indices should start with zero, not one.
3593
3594@*/
3595PetscErrorCode MatSeqAIJSetColumnIndices(Mat mat,PetscInt *indices)
3596{
3597 PetscErrorCode ierr;
3598
3599 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3599; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3600 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3600,
__func__,"/sandbox/petsc/petsc.master/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),3600,__func__,"/sandbox/petsc/petsc.master/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),3600,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3600,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",62
,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1
); } } while (0)
;
3601 PetscValidPointer(indices,2)do { if (!indices) return PetscError(((MPI_Comm)0x44000001),3601
,__func__,"/sandbox/petsc/petsc.master/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),3601,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
3602 ierr = PetscUseMethod(mat,"MatSeqAIJSetColumnIndices_C",(Mat,PetscInt*),(mat,indices))0; do { PetscErrorCode (*_7_f)(Mat,PetscInt*), _7_ierr; _7_ierr
= PetscObjectQueryFunction_Private(((PetscObject)(mat)),("MatSeqAIJSetColumnIndices_C"
),(PetscVoidFunction*)(&_7_f));do {if (__builtin_expect(!
!(_7_ierr),0)) {PetscError(((MPI_Comm)0x44000001),3602,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",_7_ierr
,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0); if (_7_f) {_7_ierr = (*_7_f)(mat,indices
);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),3602,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)(mat)),3602,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatSeqAIJSetColumnIndices_C"); } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3602,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3603 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)
;
3604}
3605
3606/* ----------------------------------------------------------------------------------------*/
3607
3608PetscErrorCode MatStoreValues_SeqAIJ(Mat mat)
3609{
3610 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3611 PetscErrorCode ierr;
3612 size_t nz = aij->i[mat->rmap->n];
3613
3614 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3614; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3615 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),3615,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,58,PETSC_ERROR_INITIAL,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first"
)
;
3616
3617 /* allocate space for values if not already there */
3618 if (!aij->saved_values) {
3619 ierr = PetscMalloc1(nz+1,&aij->saved_values)PetscMallocA(1,PETSC_FALSE,3619,__func__,"/sandbox/petsc/petsc.master/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),3619,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3620 ierr = PetscLogObjectMemory((PetscObject)mat,(nz+1)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3620,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3621 }
3622
3623 /* copy values over */
3624 ierr = PetscArraycpy(aij->saved_values,aij->a,nz)((sizeof(*(aij->saved_values)) != sizeof(*(aij->a))) ||
PetscMemcpy(aij->saved_values,aij->a,(nz)*sizeof(*(aij
->saved_values))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3624,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3625 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)
;
3626}
3627
3628/*@
3629 MatStoreValues - Stashes a copy of the matrix values; this allows, for
3630 example, reuse of the linear part of a Jacobian, while recomputing the
3631 nonlinear portion.
3632
3633 Collect on Mat
3634
3635 Input Parameters:
3636. mat - the matrix (currently only AIJ matrices support this option)
3637
3638 Level: advanced
3639
3640 Common Usage, with SNESSolve():
3641$ Create Jacobian matrix
3642$ Set linear terms into matrix
3643$ Apply boundary conditions to matrix, at this time matrix must have
3644$ final nonzero structure (i.e. setting the nonlinear terms and applying
3645$ boundary conditions again will not change the nonzero structure
3646$ ierr = MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);
3647$ ierr = MatStoreValues(mat);
3648$ Call SNESSetJacobian() with matrix
3649$ In your Jacobian routine
3650$ ierr = MatRetrieveValues(mat);
3651$ Set nonlinear terms in matrix
3652
3653 Common Usage without SNESSolve(), i.e. when you handle nonlinear solve yourself:
3654$ // build linear portion of Jacobian
3655$ ierr = MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);
3656$ ierr = MatStoreValues(mat);
3657$ loop over nonlinear iterations
3658$ ierr = MatRetrieveValues(mat);
3659$ // call MatSetValues(mat,...) to set nonliner portion of Jacobian
3660$ // call MatAssemblyBegin/End() on matrix
3661$ Solve linear system with Jacobian
3662$ endloop
3663
3664 Notes:
3665 Matrix must already be assemblied before calling this routine
3666 Must set the matrix option MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE); before
3667 calling this routine.
3668
3669 When this is called multiple times it overwrites the previous set of stored values
3670 and does not allocated additional space.
3671
3672.seealso: MatRetrieveValues()
3673
3674@*/
3675PetscErrorCode MatStoreValues(Mat mat)
3676{
3677 PetscErrorCode ierr;
3678
3679 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3679; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3680 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3680,
__func__,"/sandbox/petsc/petsc.master/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),3680,__func__,"/sandbox/petsc/petsc.master/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),3680,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3680,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",62
,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1
); } } while (0)
;
3681 if (!mat->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for unassembled matrix")return PetscError(((MPI_Comm)0x44000001),3681,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for unassembled matrix")
;
3682 if (mat->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3682,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3683 ierr = PetscUseMethod(mat,"MatStoreValues_C",(Mat),(mat))0; do { PetscErrorCode (*_7_f)(Mat), _7_ierr; _7_ierr = PetscObjectQueryFunction_Private
(((PetscObject)(mat)),("MatStoreValues_C"),(PetscVoidFunction
*)(&_7_f));do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),3683,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0); if (_7_f) {_7_ierr = (*_7_f)(mat);
do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),3683,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)(mat)),3683,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatStoreValues_C"); } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3683,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3684 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)
;
3685}
3686
3687PetscErrorCode MatRetrieveValues_SeqAIJ(Mat mat)
3688{
3689 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3690 PetscErrorCode ierr;
3691 PetscInt nz = aij->i[mat->rmap->n];
3692
3693 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3693; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3694 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),3694,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,58,PETSC_ERROR_INITIAL,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first"
)
;
3695 if (!aij->saved_values) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatStoreValues(A);first")return PetscError(((MPI_Comm)0x44000001),3695,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,58,PETSC_ERROR_INITIAL,"Must call MatStoreValues(A);first")
;
3696 /* copy values over */
3697 ierr = PetscArraycpy(aij->a,aij->saved_values,nz)((sizeof(*(aij->a)) != sizeof(*(aij->saved_values))) ||
PetscMemcpy(aij->a,aij->saved_values,(nz)*sizeof(*(aij
->a))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3697,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3698 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)
;
3699}
3700
3701/*@
3702 MatRetrieveValues - Retrieves the copy of the matrix values; this allows, for
3703 example, reuse of the linear part of a Jacobian, while recomputing the
3704 nonlinear portion.
3705
3706 Collect on Mat
3707
3708 Input Parameters:
3709. mat - the matrix (currently only AIJ matrices support this option)
3710
3711 Level: advanced
3712
3713.seealso: MatStoreValues()
3714
3715@*/
3716PetscErrorCode MatRetrieveValues(Mat mat)
3717{
3718 PetscErrorCode ierr;
3719
3720 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3720; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3721 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3721,
__func__,"/sandbox/petsc/petsc.master/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),3721,__func__,"/sandbox/petsc/petsc.master/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),3721,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3721,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",62
,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1
); } } while (0)
;
3722 if (!mat->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for unassembled matrix")return PetscError(((MPI_Comm)0x44000001),3722,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for unassembled matrix")
;
3723 if (mat->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3723,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3724 ierr = PetscUseMethod(mat,"MatRetrieveValues_C",(Mat),(mat))0; do { PetscErrorCode (*_7_f)(Mat), _7_ierr; _7_ierr = PetscObjectQueryFunction_Private
(((PetscObject)(mat)),("MatRetrieveValues_C"),(PetscVoidFunction
*)(&_7_f));do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),3724,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0); if (_7_f) {_7_ierr = (*_7_f)(mat);
do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),3724,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)(mat)),3724,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatRetrieveValues_C"); } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3724,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3725 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)
;
3726}
3727
3728
3729/* --------------------------------------------------------------------------------*/
3730/*@C
3731 MatCreateSeqAIJ - Creates a sparse matrix in AIJ (compressed row) format
3732 (the default parallel PETSc format). For good matrix assembly performance
3733 the user should preallocate the matrix storage by setting the parameter nz
3734 (or the array nnz). By setting these parameters accurately, performance
3735 during matrix assembly can be increased by more than a factor of 50.
3736
3737 Collective
3738
3739 Input Parameters:
3740+ comm - MPI communicator, set to PETSC_COMM_SELF
3741. m - number of rows
3742. n - number of columns
3743. nz - number of nonzeros per row (same for all rows)
3744- nnz - array containing the number of nonzeros in the various rows
3745 (possibly different for each row) or NULL
3746
3747 Output Parameter:
3748. A - the matrix
3749
3750 It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(),
3751 MatXXXXSetPreallocation() paradigm instead of this routine directly.
3752 [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation]
3753
3754 Notes:
3755 If nnz is given then nz is ignored
3756
3757 The AIJ format (also called the Yale sparse matrix format or
3758 compressed row storage), is fully compatible with standard Fortran 77
3759 storage. That is, the stored row and column indices can begin at
3760 either one (as in Fortran) or zero. See the users' manual for details.
3761
3762 Specify the preallocated storage with either nz or nnz (not both).
3763 Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory
3764 allocation. For large problems you MUST preallocate memory or you
3765 will get TERRIBLE performance, see the users' manual chapter on matrices.
3766
3767 By default, this format uses inodes (identical nodes) when possible, to
3768 improve numerical efficiency of matrix-vector products and solves. We
3769 search for consecutive rows with the same nonzero structure, thereby
3770 reusing matrix information to achieve increased efficiency.
3771
3772 Options Database Keys:
3773+ -mat_no_inode - Do not use inodes
3774- -mat_inode_limit <limit> - Sets inode limit (max limit=5)
3775
3776 Level: intermediate
3777
3778.seealso: MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays()
3779
3780@*/
3781PetscErrorCode MatCreateSeqAIJ(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[],Mat *A)
3782{
3783 PetscErrorCode ierr;
3784
3785 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3785; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3786 ierr = MatCreate(comm,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3786,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3787 ierr = MatSetSizes(*A,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3787,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3788 ierr = MatSetType(*A,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3788,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3789 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*A,nz,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3789,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3790 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)
;
3791}
3792
3793/*@C
3794 MatSeqAIJSetPreallocation - For good matrix assembly performance
3795 the user should preallocate the matrix storage by setting the parameter nz
3796 (or the array nnz). By setting these parameters accurately, performance
3797 during matrix assembly can be increased by more than a factor of 50.
3798
3799 Collective
3800
3801 Input Parameters:
3802+ B - The matrix
3803. nz - number of nonzeros per row (same for all rows)
3804- nnz - array containing the number of nonzeros in the various rows
3805 (possibly different for each row) or NULL
3806
3807 Notes:
3808 If nnz is given then nz is ignored
3809
3810 The AIJ format (also called the Yale sparse matrix format or
3811 compressed row storage), is fully compatible with standard Fortran 77
3812 storage. That is, the stored row and column indices can begin at
3813 either one (as in Fortran) or zero. See the users' manual for details.
3814
3815 Specify the preallocated storage with either nz or nnz (not both).
3816 Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory
3817 allocation. For large problems you MUST preallocate memory or you
3818 will get TERRIBLE performance, see the users' manual chapter on matrices.
3819
3820 You can call MatGetInfo() to get information on how effective the preallocation was;
3821 for example the fields mallocs,nz_allocated,nz_used,nz_unneeded;
3822 You can also run with the option -info and look for messages with the string
3823 malloc in them to see if additional memory allocation was needed.
3824
3825 Developers: Use nz of MAT_SKIP_ALLOCATION to not allocate any space for the matrix
3826 entries or columns indices
3827
3828 By default, this format uses inodes (identical nodes) when possible, to
3829 improve numerical efficiency of matrix-vector products and solves. We
3830 search for consecutive rows with the same nonzero structure, thereby
3831 reusing matrix information to achieve increased efficiency.
3832
3833 Options Database Keys:
3834+ -mat_no_inode - Do not use inodes
3835- -mat_inode_limit <limit> - Sets inode limit (max limit=5)
3836
3837 Level: intermediate
3838
3839.seealso: MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays(), MatGetInfo()
3840
3841@*/
3842PetscErrorCode MatSeqAIJSetPreallocation(Mat B,PetscInt nz,const PetscInt nnz[])
3843{
3844 PetscErrorCode ierr;
3845
3846 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3846; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3847 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3847,__func__
,"/sandbox/petsc/petsc.master/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),3847
,__func__,"/sandbox/petsc/petsc.master/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),3847,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3847,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",62
,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1
); } } while (0)
;
3848 PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) do {if (__builtin_expect
(!!(73),0)) {PetscError(((MPI_Comm)0x44000001),3848,__func__,
"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",73,
PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),73);
}} while (0); } while (0)
;
3849 ierr = PetscTryMethod(B,"MatSeqAIJSetPreallocation_C",(Mat,PetscInt,const PetscInt[]),(B,nz,nnz))0; do { PetscErrorCode (*_7_f)(Mat,PetscInt,const PetscInt[])
, _7_ierr; _7_ierr = PetscObjectQueryFunction_Private(((PetscObject
)(B)),("MatSeqAIJSetPreallocation_C"),(PetscVoidFunction*)(&
_7_f));do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError((
(MPI_Comm)0x44000001),3849,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0); if (_7_f) {_7_ierr = (*_7_f)(B,nz,
nnz);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),3849,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3849,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3850 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)
;
3851}
3852
3853PetscErrorCode MatSeqAIJSetPreallocation_SeqAIJ(Mat B,PetscInt nz,const PetscInt *nnz)
3854{
3855 Mat_SeqAIJ *b;
3856 PetscBool skipallocation = PETSC_FALSE,realalloc = PETSC_FALSE;
3857 PetscErrorCode ierr;
3858 PetscInt i;
3859
3860 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3860; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3861 if (nz >= 0 || nnz) realalloc = PETSC_TRUE;
3862 if (nz == MAT_SKIP_ALLOCATION-4) {
3863 skipallocation = PETSC_TRUE;
3864 nz = 0;
3865 }
3866 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3866,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3867 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3867,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3868
3869 if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 5;
3870 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),3870,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"nz cannot be less than 0: value %D",
nz)
;
3871#if defined(PETSC_USE_DEBUG1)
3872 if (nnz) {
3873 for (i=0; i<B->rmap->n; i++) {
3874 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
),3874,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
3875 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
),3875,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
3876 }
3877 }
3878#endif
3879
3880 B->preallocated = PETSC_TRUE;
3881
3882 b = (Mat_SeqAIJ*)B->data;
3883
3884 if (!skipallocation) {
3885 if (!b->imax) {
3886 ierr = PetscMalloc1(B->rmap->n,&b->imax)PetscMallocA(1,PETSC_FALSE,3886,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(B->rmap->n)*sizeof(**(&b->imax)),(&
b->imax))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3886,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3887 ierr = PetscLogObjectMemory((PetscObject)B,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3887,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3888 }
3889 if (!b->ilen) {
3890 /* b->ilen will count nonzeros in each row so far. */
3891 ierr = PetscCalloc1(B->rmap->n,&b->ilen)PetscMallocA(1,PETSC_TRUE,3891,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(B->rmap->n)*sizeof(**(&b->ilen)),(&
b->ilen))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3891,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3892 ierr = PetscLogObjectMemory((PetscObject)B,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3892,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3893 } else {
3894 ierr = PetscMemzero(b->ilen,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3894,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3895 }
3896 if (!b->ipre) {
3897 ierr = PetscMalloc1(B->rmap->n,&b->ipre)PetscMallocA(1,PETSC_FALSE,3897,__func__,"/sandbox/petsc/petsc.master/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),3897,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3898 ierr = PetscLogObjectMemory((PetscObject)B,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3898,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3899 }
3900 if (!nnz) {
3901 if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 10;
3902 else if (nz < 0) nz = 1;
3903 nz = PetscMin(nz,B->cmap->n)(((nz)<(B->cmap->n)) ? (nz) : (B->cmap->n));
3904 for (i=0; i<B->rmap->n; i++) b->imax[i] = nz;
3905 nz = nz*B->rmap->n;
3906 } else {
3907 PetscInt64 nz64 = 0;
3908 for (i=0; i<B->rmap->n; i++) {b->imax[i] = nnz[i]; nz64 += nnz[i];}
3909 ierr = PetscIntCast(nz64,&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3909,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3910 }
3911
3912 /* allocate the matrix space */
3913 /* FIXME: should B's old memory be unlogged? */
3914 ierr = MatSeqXAIJFreeAIJ(B,&b->a,&b->j,&b->i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3914,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3915 if (B->structure_only) {
3916 ierr = PetscMalloc1(nz,&b->j)PetscMallocA(1,PETSC_FALSE,3916,__func__,"/sandbox/petsc/petsc.master/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),3916,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3917 ierr = PetscMalloc1(B->rmap->n+1,&b->i)PetscMallocA(1,PETSC_FALSE,3917,__func__,"/sandbox/petsc/petsc.master/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),3917,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3918 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),3918,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3919 } else {
3920 ierr = PetscMalloc3(nz,&b->a,nz,&b->j,B->rmap->n+1,&b->i)PetscMallocA(3,PETSC_FALSE,3920,__func__,"/sandbox/petsc/petsc.master/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),3920,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3921 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),3921,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3922 }
3923 b->i[0] = 0;
3924 for (i=1; i<B->rmap->n+1; i++) {
3925 b->i[i] = b->i[i-1] + b->imax[i-1];
3926 }
3927 if (B->structure_only) {
3928 b->singlemalloc = PETSC_FALSE;
3929 b->free_a = PETSC_FALSE;
3930 } else {
3931 b->singlemalloc = PETSC_TRUE;
3932 b->free_a = PETSC_TRUE;
3933 }
3934 b->free_ij = PETSC_TRUE;
3935 } else {
3936 b->free_a = PETSC_FALSE;
3937 b->free_ij = PETSC_FALSE;
3938 }
3939
3940 if (b->ipre && nnz != b->ipre && b->imax) {
3941 /* reserve user-requested sparsity */
3942 ierr = PetscArraycpy(b->ipre,b->imax,B->rmap->n)((sizeof(*(b->ipre)) != sizeof(*(b->imax))) || PetscMemcpy
(b->ipre,b->imax,(B->rmap->n)*sizeof(*(b->ipre
))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3942,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3943 }
3944
3945
3946 b->nz = 0;
3947 b->maxnz = nz;
3948 B->info.nz_unneeded = (double)b->maxnz;
3949 if (realalloc) {
3950 ierr = MatSetOption(B,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3950,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3951 }
3952 B->was_assembled = PETSC_FALSE;
3953 B->assembled = PETSC_FALSE;
3954 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)
;
3955}
3956
3957
3958PetscErrorCode MatResetPreallocation_SeqAIJ(Mat A)
3959{
3960 Mat_SeqAIJ *a;
3961 PetscInt i;
3962 PetscErrorCode ierr;
3963
3964 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 3964; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3965 PetscValidHeaderSpecific(A,MAT_CLASSID,1)do { if (!A) return PetscError(((MPI_Comm)0x44000001),3965,__func__
,"/sandbox/petsc/petsc.master/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),3965
,__func__,"/sandbox/petsc/petsc.master/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),3965,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3965,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",62
,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1
); } } while (0)
;
3966
3967 /* Check local size. If zero, then return */
3968 if (!A->rmap->n) 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)
;
3969
3970 a = (Mat_SeqAIJ*)A->data;
3971 /* if no saved info, we error out */
3972 if (!a->ipre) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NULL,"No saved preallocation info \n")return PetscError(((MPI_Comm)0x44000001),3972,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"No saved preallocation info \n")
;
3973
3974 if (!a->i || !a->j || !a->a || !a->imax || !a->ilen) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NULL,"Memory info is incomplete, and can not reset preallocation \n")return PetscError(((MPI_Comm)0x44000001),3974,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Memory info is incomplete, and can not reset preallocation \n"
)
;
3975
3976 ierr = PetscArraycpy(a->imax,a->ipre,A->rmap->n)((sizeof(*(a->imax)) != sizeof(*(a->ipre))) || PetscMemcpy
(a->imax,a->ipre,(A->rmap->n)*sizeof(*(a->imax
))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3976,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3977 ierr = PetscArrayzero(a->ilen,A->rmap->n)PetscMemzero(a->ilen,(A->rmap->n)*sizeof(*(a->ilen
)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3977,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3978 a->i[0] = 0;
3979 for (i=1; i<A->rmap->n+1; i++) {
3980 a->i[i] = a->i[i-1] + a->imax[i-1];
3981 }
3982 A->preallocated = PETSC_TRUE;
3983 a->nz = 0;
3984 a->maxnz = a->i[A->rmap->n];
3985 A->info.nz_unneeded = (double)a->maxnz;
3986 A->was_assembled = PETSC_FALSE;
3987 A->assembled = PETSC_FALSE;
3988 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)
;
3989}
3990
3991/*@
3992 MatSeqAIJSetPreallocationCSR - Allocates memory for a sparse sequential matrix in AIJ format.
3993
3994 Input Parameters:
3995+ B - the matrix
3996. i - the indices into j for the start of each row (starts with zero)
3997. j - the column indices for each row (starts with zero) these must be sorted for each row
3998- v - optional values in the matrix
3999
4000 Level: developer
4001
4002 The i,j,v values are COPIED with this routine; to avoid the copy use MatCreateSeqAIJWithArrays()
4003
4004.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatSeqAIJSetPreallocation(), MatCreateSeqAIJ(), MATSEQAIJ
4005@*/
4006PetscErrorCode MatSeqAIJSetPreallocationCSR(Mat B,const PetscInt i[],const PetscInt j[],const PetscScalar v[])
4007{
4008 PetscErrorCode ierr;
4009
4010 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4010; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4011 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),4011,__func__
,"/sandbox/petsc/petsc.master/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),4011
,__func__,"/sandbox/petsc/petsc.master/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),4011,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),4011,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",62
,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1
); } } while (0)
;
4012 PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) do {if (__builtin_expect
(!!(73),0)) {PetscError(((MPI_Comm)0x44000001),4012,__func__,
"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",73,
PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),73);
}} while (0); } while (0)
;
4013 ierr = PetscTryMethod(B,"MatSeqAIJSetPreallocationCSR_C",(Mat,const PetscInt[],const PetscInt[],const PetscScalar[]),(B,i,j,v))0; do { PetscErrorCode (*_7_f)(Mat,const PetscInt[],const PetscInt
[],const PetscScalar[]), _7_ierr; _7_ierr = PetscObjectQueryFunction_Private
(((PetscObject)(B)),("MatSeqAIJSetPreallocationCSR_C"),(PetscVoidFunction
*)(&_7_f));do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),4013,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0); if (_7_f) {_7_ierr = (*_7_f)(B,i,j
,v);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),4013,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4013,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4014 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)
;
4015}
4016
4017PetscErrorCode MatSeqAIJSetPreallocationCSR_SeqAIJ(Mat B,const PetscInt Ii[],const PetscInt J[],const PetscScalar v[])
4018{
4019 PetscInt i;
4020 PetscInt m,n;
4021 PetscInt nz;
4022 PetscInt *nnz, nz_max = 0;
4023 PetscErrorCode ierr;
4024
4025 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4025; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4026 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),4026,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"Ii[0] must be 0 it is %D",Ii[0])
;
4027
4028 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4028,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4029 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4029,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4030
4031 ierr = MatGetSize(B, &m, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4031,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4032 ierr = PetscMalloc1(m+1, &nnz)PetscMallocA(1,PETSC_FALSE,4032,__func__,"/sandbox/petsc/petsc.master/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),4032,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4033 for (i = 0; i < m; i++) {
4034 nz = Ii[i+1]- Ii[i];
4035 nz_max = PetscMax(nz_max, nz)(((nz_max)<(nz)) ? (nz) : (nz_max));
4036 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
),4036,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4037 nnz[i] = nz;
4038 }
4039 ierr = MatSeqAIJSetPreallocation(B, 0, nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4039,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4040 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),4040,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4040,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4041
4042 for (i = 0; i < m; i++) {
4043 ierr = MatSetValues_SeqAIJ(B, 1, &i, Ii[i+1] - Ii[i], J+Ii[i], v ? v + Ii[i] : NULL((void*)0), INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4043,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4044 }
4045
4046 ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4046,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4047 ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4047,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4048
4049 ierr = MatSetOption(B,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4049,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4050 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)
;
4051}
4052
4053#include <../src/mat/impls/dense/seq/dense.h>
4054#include <petsc/private/kernels/petscaxpy.h>
4055
4056/*
4057 Computes (B'*A')' since computing B*A directly is untenable
4058
4059 n p p
4060 ( ) ( ) ( )
4061 m ( A ) * n ( B ) = m ( C )
4062 ( ) ( ) ( )
4063
4064*/
4065PetscErrorCode MatMatMultNumeric_SeqDense_SeqAIJ(Mat A,Mat B,Mat C)
4066{
4067 PetscErrorCode ierr;
4068 Mat_SeqDense *sub_a = (Mat_SeqDense*)A->data;
4069 Mat_SeqAIJ *sub_b = (Mat_SeqAIJ*)B->data;
4070 Mat_SeqDense *sub_c = (Mat_SeqDense*)C->data;
4071 PetscInt i,n,m,q,p;
4072 const PetscInt *ii,*idx;
4073 const PetscScalar *b,*a,*a_q;
4074 PetscScalar *c,*c_q;
4075
4076 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4076; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4077 m = A->rmap->n;
4078 n = A->cmap->n;
4079 p = B->cmap->n;
4080 a = sub_a->v;
4081 b = sub_b->a;
4082 c = sub_c->v;
4083 ierr = PetscArrayzero(c,m*p)PetscMemzero(c,(m*p)*sizeof(*(c)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4083,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4084
4085 ii = sub_b->i;
4086 idx = sub_b->j;
4087 for (i=0; i<n; i++) {
4088 q = ii[i+1] - ii[i];
4089 while (q-->0) {
4090 c_q = c + m*(*idx);
4091 a_q = a + m*i;
4092 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];}
;
4093 idx++;
4094 b++;
4095 }
4096 }
4097 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)
;
4098}
4099
4100PetscErrorCode MatMatMultSymbolic_SeqDense_SeqAIJ(Mat A,Mat B,PetscReal fill,Mat *C)
4101{
4102 PetscErrorCode ierr;
4103 PetscInt m=A->rmap->n,n=B->cmap->n;
4104 Mat Cmat;
4105
4106 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4106; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4107 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
),4107,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
60);}} while (0)
;
4108 ierr = MatCreate(PetscObjectComm((PetscObject)A),&Cmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4108,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4109 ierr = MatSetSizes(Cmat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4109,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4110 ierr = MatSetBlockSizesFromMats(Cmat,A,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4110,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4111 ierr = MatSetType(Cmat,MATSEQDENSE"seqdense");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4111,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4112 ierr = MatSeqDenseSetPreallocation(Cmat,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4112,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4113
4114 Cmat->ops->matmultnumeric = MatMatMultNumeric_SeqDense_SeqAIJ;
4115
4116 *C = Cmat;
4117 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)
;
4118}
4119
4120/* ----------------------------------------------------------------*/
4121PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatMatMult_SeqDense_SeqAIJ(Mat A,Mat B,MatReuse scall,PetscReal fill,Mat *C)
4122{
4123 PetscErrorCode ierr;
4124
4125 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4125; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4126 if (scall == MAT_INITIAL_MATRIX) {
4127 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),4127,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4128 ierr = MatMatMultSymbolic_SeqDense_SeqAIJ(A,B,fill,C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4128,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4129 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),4129,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4130 }
4131 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),4131,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4132 ierr = MatMatMultNumeric_SeqDense_SeqAIJ(A,B,*C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4132,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4133 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),4133,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4134 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)
;
4135}
4136
4137
4138/*MC
4139 MATSEQAIJ - MATSEQAIJ = "seqaij" - A matrix type to be used for sequential sparse matrices,
4140 based on compressed sparse row format.
4141
4142 Options Database Keys:
4143. -mat_type seqaij - sets the matrix type to "seqaij" during a call to MatSetFromOptions()
4144
4145 Level: beginner
4146
4147 Notes:
4148 MatSetValues() may be called for this matrix type with a NULL argument for the numerical values,
4149 in this case the values associated with the rows and columns one passes in are set to zero
4150 in the matrix
4151
4152 MatSetOptions(,MAT_STRUCTURE_ONLY,PETSC_TRUE) may be called for this matrix type. In this no
4153 space is allocated for the nonzero entries and any entries passed with MatSetValues() are ignored
4154
4155 Developer Notes:
4156 It would be nice if all matrix formats supported passing NULL in for the numerical values
4157
4158.seealso: MatCreateSeqAIJ(), MatSetFromOptions(), MatSetType(), MatCreate(), MatType
4159M*/
4160
4161/*MC
4162 MATAIJ - MATAIJ = "aij" - A matrix type to be used for sparse matrices.
4163
4164 This matrix type is identical to MATSEQAIJ when constructed with a single process communicator,
4165 and MATMPIAIJ otherwise. As a result, for single process communicators,
4166 MatSeqAIJSetPreallocation is supported, and similarly MatMPIAIJSetPreallocation() is supported
4167 for communicators controlling multiple processes. It is recommended that you call both of
4168 the above preallocation routines for simplicity.
4169
4170 Options Database Keys:
4171. -mat_type aij - sets the matrix type to "aij" during a call to MatSetFromOptions()
4172
4173 Developer Notes:
4174 Subclasses include MATAIJCUSPARSE, MATAIJPERM, MATAIJSELL, MATAIJMKL, MATAIJCRL, and also automatically switches over to use inodes when
4175 enough exist.
4176
4177 Level: beginner
4178
4179.seealso: MatCreateAIJ(), MatCreateSeqAIJ(), MATSEQAIJ,MATMPIAIJ
4180M*/
4181
4182/*MC
4183 MATAIJCRL - MATAIJCRL = "aijcrl" - A matrix type to be used for sparse matrices.
4184
4185 This matrix type is identical to MATSEQAIJCRL when constructed with a single process communicator,
4186 and MATMPIAIJCRL otherwise. As a result, for single process communicators,
4187 MatSeqAIJSetPreallocation() is supported, and similarly MatMPIAIJSetPreallocation() is supported
4188 for communicators controlling multiple processes. It is recommended that you call both of
4189 the above preallocation routines for simplicity.
4190
4191 Options Database Keys:
4192. -mat_type aijcrl - sets the matrix type to "aijcrl" during a call to MatSetFromOptions()
4193
4194 Level: beginner
4195
4196.seealso: MatCreateMPIAIJCRL,MATSEQAIJCRL,MATMPIAIJCRL, MATSEQAIJCRL, MATMPIAIJCRL
4197M*/
4198
4199PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_SeqAIJCRL(Mat,MatType,MatReuse,Mat*);
4200#if defined(PETSC_HAVE_ELEMENTAL)
4201PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_Elemental(Mat,MatType,MatReuse,Mat*);
4202#endif
4203#if defined(PETSC_HAVE_HYPRE)
4204PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_AIJ_HYPRE(Mat A,MatType,MatReuse,Mat*);
4205PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatMatMatMult_Transpose_AIJ_AIJ(Mat,Mat,Mat,MatReuse,PetscReal,Mat*);
4206#endif
4207PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_SeqDense(Mat,MatType,MatReuse,Mat*);
4208
4209PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatConvert_SeqAIJ_SeqSELL(Mat,MatType,MatReuse,Mat*);
4210PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_XAIJ_IS(Mat,MatType,MatReuse,Mat*);
4211PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatPtAP_IS_XAIJ(Mat,Mat,MatReuse,PetscReal,Mat*);
4212
4213/*@C
4214 MatSeqAIJGetArray - gives access to the array where the data for a MATSEQAIJ matrix is stored
4215
4216 Not Collective
4217
4218 Input Parameter:
4219. mat - a MATSEQAIJ matrix
4220
4221 Output Parameter:
4222. array - pointer to the data
4223
4224 Level: intermediate
4225
4226.seealso: MatSeqAIJRestoreArray(), MatSeqAIJGetArrayF90()
4227@*/
4228PetscErrorCode MatSeqAIJGetArray(Mat A,PetscScalar **array)
4229{
4230 PetscErrorCode ierr;
4231
4232 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4232; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4233 ierr = PetscUseMethod(A,"MatSeqAIJGetArray_C",(Mat,PetscScalar**),(A,array))0; do { PetscErrorCode (*_7_f)(Mat,PetscScalar**), _7_ierr; _7_ierr
= PetscObjectQueryFunction_Private(((PetscObject)(A)),("MatSeqAIJGetArray_C"
),(PetscVoidFunction*)(&_7_f));do {if (__builtin_expect(!
!(_7_ierr),0)) {PetscError(((MPI_Comm)0x44000001),4233,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",_7_ierr
,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0); if (_7_f) {_7_ierr = (*_7_f)(A,array
);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),4233,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)(A)),4233,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatSeqAIJGetArray_C"); } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4233,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4234 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)
;
4235}
4236
4237/*@C
4238 MatSeqAIJGetMaxRowNonzeros - returns the maximum number of nonzeros in any row
4239
4240 Not Collective
4241
4242 Input Parameter:
4243. mat - a MATSEQAIJ matrix
4244
4245 Output Parameter:
4246. nz - the maximum number of nonzeros in any row
4247
4248 Level: intermediate
4249
4250.seealso: MatSeqAIJRestoreArray(), MatSeqAIJGetArrayF90()
4251@*/
4252PetscErrorCode MatSeqAIJGetMaxRowNonzeros(Mat A,PetscInt *nz)
4253{
4254 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)A->data;
4255
4256 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4256; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4257 *nz = aij->rmax;
4258 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)
;
4259}
4260
4261/*@C
4262 MatSeqAIJRestoreArray - returns access to the array where the data for a MATSEQAIJ matrix is stored obtained by MatSeqAIJGetArray()
4263
4264 Not Collective
4265
4266 Input Parameters:
4267+ mat - a MATSEQAIJ matrix
4268- array - pointer to the data
4269
4270 Level: intermediate
4271
4272.seealso: MatSeqAIJGetArray(), MatSeqAIJRestoreArrayF90()
4273@*/
4274PetscErrorCode MatSeqAIJRestoreArray(Mat A,PetscScalar **array)
4275{
4276 PetscErrorCode ierr;
4277
4278 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4278; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4279 ierr = PetscUseMethod(A,"MatSeqAIJRestoreArray_C",(Mat,PetscScalar**),(A,array))0; do { PetscErrorCode (*_7_f)(Mat,PetscScalar**), _7_ierr; _7_ierr
= PetscObjectQueryFunction_Private(((PetscObject)(A)),("MatSeqAIJRestoreArray_C"
),(PetscVoidFunction*)(&_7_f));do {if (__builtin_expect(!
!(_7_ierr),0)) {PetscError(((MPI_Comm)0x44000001),4279,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",_7_ierr
,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0); if (_7_f) {_7_ierr = (*_7_f)(A,array
);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),4279,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)(A)),4279,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatSeqAIJRestoreArray_C"); } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4279,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4280 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)
;
4281}
4282
4283#if defined(PETSC_HAVE_CUDA)
4284PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatConvert_SeqAIJ_SeqAIJCUSPARSE(Mat);
4285#endif
4286
4287PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_SeqAIJ(Mat B)
4288{
4289 Mat_SeqAIJ *b;
4290 PetscErrorCode ierr;
4291 PetscMPIInt size;
4292
4293 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4293; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4294 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4294,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4295 if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Comm must be of size 1")return PetscError(((MPI_Comm)0x44000001),4295,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"Comm must be of size 1")
;
4296
4297 ierr = PetscNewLog(B,&b)(PetscMallocA(1,PETSC_TRUE,4297,__func__,"/sandbox/petsc/petsc.master/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),4297,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4298
4299 B->data = (void*)b;
4300
4301 ierr = PetscMemcpy(B->ops,&MatOps_Values,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4301,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4302 if (B->sortedfull) B->ops->setvalues = MatSetValues_SeqAIJ_SortedFull;
4303
4304 b->row = 0;
4305 b->col = 0;
4306 b->icol = 0;
4307 b->reallocs = 0;
4308 b->ignorezeroentries = PETSC_FALSE;
4309 b->roworiented = PETSC_TRUE;
4310 b->nonew = 0;
4311 b->diag = 0;
4312 b->solve_work = 0;
4313 B->spptr = 0;
4314 b->saved_values = 0;
4315 b->idiag = 0;
4316 b->mdiag = 0;
4317 b->ssor_work = 0;
4318 b->omega = 1.0;
4319 b->fshift = 0.0;
4320 b->idiagvalid = PETSC_FALSE;
4321 b->ibdiagvalid = PETSC_FALSE;
4322 b->keepnonzeropattern = PETSC_FALSE;
4323
4324 ierr = PetscObjectChangeTypeName((PetscObject)B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4324,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4325 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),4325,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4326 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),4326,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4327
4328#if defined(PETSC_HAVE_MATLAB_ENGINE)
4329 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),4329,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4330 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),4330,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4331#endif
4332
4333 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),4333,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4334 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),4334,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4335 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),4335,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4336 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),4336,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4337 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),4337,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4338 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),4338,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4339 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),4339,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4340#if defined(PETSC_HAVE_MKL_SPARSE)
4341 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),4341,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4342#endif
4343#if defined(PETSC_HAVE_CUDA)
4344 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),4344,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4345#endif
4346 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),4346,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4347#if defined(PETSC_HAVE_ELEMENTAL)
4348 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),4348,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4349#endif
4350#if defined(PETSC_HAVE_HYPRE)
4351 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),4351,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4352 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),4352,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4353#endif
4354 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),4354,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4355 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),4355,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4356 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),4356,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4357 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),4357,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4358 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),4358,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4359 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),4359,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4360 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),4360,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4361 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),4361,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4362 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),4362,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4363 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),4363,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4364 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),4364,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4365 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),4365,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4366 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),4366,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4367 ierr = MatCreate_SeqAIJ_Inode(B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4367,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4368 ierr = PetscObjectChangeTypeName((PetscObject)B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4368,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4369 ierr = MatSeqAIJSetTypeFromOptions(B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4369,__func__,"/sandbox/petsc/petsc.master/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 */
4370 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)
;
4371}
4372
4373/*
4374 Given a matrix generated with MatGetFactor() duplicates all the information in A into B
4375*/
4376PetscErrorCode MatDuplicateNoCreate_SeqAIJ(Mat C,Mat A,MatDuplicateOption cpvalues,PetscBool mallocmatspace)
4377{
4378 Mat_SeqAIJ *c,*a = (Mat_SeqAIJ*)A->data;
4379 PetscErrorCode ierr;
4380 PetscInt m = A->rmap->n,i;
4381
4382 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4382; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4383 c = (Mat_SeqAIJ*)C->data;
4384
4385 C->factortype = A->factortype;
4386 c->row = 0;
4387 c->col = 0;
4388 c->icol = 0;
4389 c->reallocs = 0;
4390
4391 C->assembled = PETSC_TRUE;
4392
4393 ierr = PetscLayoutReference(A->rmap,&C->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4393,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4394 ierr = PetscLayoutReference(A->cmap,&C->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4394,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4395
4396 ierr = PetscMalloc1(m,&c->imax)PetscMallocA(1,PETSC_FALSE,4396,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&c->imax)),(&c->imax))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4396,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4397 ierr = PetscMemcpy(c->imax,a->imax,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4397,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4398 ierr = PetscMalloc1(m,&c->ilen)PetscMallocA(1,PETSC_FALSE,4398,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&c->ilen)),(&c->ilen))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4398,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4399 ierr = PetscMemcpy(c->ilen,a->ilen,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4399,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4400 ierr = PetscLogObjectMemory((PetscObject)C, 2*m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4400,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4401
4402 /* allocate the matrix space */
4403 if (mallocmatspace) {
4404 ierr = PetscMalloc3(a->i[m],&c->a,a->i[m],&c->j,m+1,&c->i)PetscMallocA(3,PETSC_FALSE,4404,__func__,"/sandbox/petsc/petsc.master/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),4404,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4405 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),4405,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4406
4407 c->singlemalloc = PETSC_TRUE;
4408
4409 ierr = PetscArraycpy(c->i,a->i,m+1)((sizeof(*(c->i)) != sizeof(*(a->i))) || PetscMemcpy(c->
i,a->i,(m+1)*sizeof(*(c->i))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4409,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4410 if (m > 0) {
4411 ierr = PetscArraycpy(c->j,a->j,a->i[m])((sizeof(*(c->j)) != sizeof(*(a->j))) || PetscMemcpy(c->
j,a->j,(a->i[m])*sizeof(*(c->j))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4411,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4412 if (cpvalues == MAT_COPY_VALUES) {
4413 ierr = PetscArraycpy(c->a,a->a,a->i[m])((sizeof(*(c->a)) != sizeof(*(a->a))) || PetscMemcpy(c->
a,a->a,(a->i[m])*sizeof(*(c->a))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4413,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4414 } else {
4415 ierr = PetscArrayzero(c->a,a->i[m])PetscMemzero(c->a,(a->i[m])*sizeof(*(c->a)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4415,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4416 }
4417 }
4418 }
4419
4420 c->ignorezeroentries = a->ignorezeroentries;
4421 c->roworiented = a->roworiented;
4422 c->nonew = a->nonew;
4423 if (a->diag) {
4424 ierr = PetscMalloc1(m+1,&c->diag)PetscMallocA(1,PETSC_FALSE,4424,__func__,"/sandbox/petsc/petsc.master/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),4424,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4425 ierr = PetscMemcpy(c->diag,a->diag,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4425,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4426 ierr = PetscLogObjectMemory((PetscObject)C,(m+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4426,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4427 } else c->diag = NULL((void*)0);
4428
4429 c->solve_work = 0;
4430 c->saved_values = 0;
4431 c->idiag = 0;
4432 c->ssor_work = 0;
4433 c->keepnonzeropattern = a->keepnonzeropattern;
4434 c->free_a = PETSC_TRUE;
4435 c->free_ij = PETSC_TRUE;
4436
4437 c->rmax = a->rmax;
4438 c->nz = a->nz;
4439 c->maxnz = a->nz; /* Since we allocate exactly the right amount */
4440 C->preallocated = PETSC_TRUE;
4441
4442 c->compressedrow.use = a->compressedrow.use;
4443 c->compressedrow.nrows = a->compressedrow.nrows;
4444 if (a->compressedrow.use) {
4445 i = a->compressedrow.nrows;
4446 ierr = PetscMalloc2(i+1,&c->compressedrow.i,i,&c->compressedrow.rindex)PetscMallocA(2,PETSC_FALSE,4446,__func__,"/sandbox/petsc/petsc.master/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),4446,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4447 ierr = PetscArraycpy(c->compressedrow.i,a->compressedrow.i,i+1)((sizeof(*(c->compressedrow.i)) != sizeof(*(a->compressedrow
.i))) || PetscMemcpy(c->compressedrow.i,a->compressedrow
.i,(i+1)*sizeof(*(c->compressedrow.i))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4447,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4448 ierr = PetscArraycpy(c->compressedrow.rindex,a->compressedrow.rindex,i)((sizeof(*(c->compressedrow.rindex)) != sizeof(*(a->compressedrow
.rindex))) || PetscMemcpy(c->compressedrow.rindex,a->compressedrow
.rindex,(i)*sizeof(*(c->compressedrow.rindex))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4448,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4449 } else {
4450 c->compressedrow.use = PETSC_FALSE;
4451 c->compressedrow.i = NULL((void*)0);
4452 c->compressedrow.rindex = NULL((void*)0);
4453 }
4454 c->nonzerorowcnt = a->nonzerorowcnt;
4455 C->nonzerostate = A->nonzerostate;
4456
4457 ierr = MatDuplicate_SeqAIJ_Inode(A,cpvalues,&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4457,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4458 ierr = PetscFunctionListDuplicate(((PetscObject)A)->qlist,&((PetscObject)C)->qlist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4458,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4459 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)
;
4460}
4461
4462PetscErrorCode MatDuplicate_SeqAIJ(Mat A,MatDuplicateOption cpvalues,Mat *B)
4463{
4464 PetscErrorCode ierr;
4465
4466 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4466; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4467 ierr = MatCreate(PetscObjectComm((PetscObject)A),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4467,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4468 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),4468,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4469 if (!(A->rmap->n % A->rmap->bs) && !(A->cmap->n % A->cmap->bs)) {
4470 ierr = MatSetBlockSizesFromMats(*B,A,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4470,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4471 }
4472 ierr = MatSetType(*B,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4472,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4473 ierr = MatDuplicateNoCreate_SeqAIJ(*B,A,cpvalues,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4473,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4474 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)
;
4475}
4476
4477PetscErrorCode MatLoad_SeqAIJ(Mat newMat, PetscViewer viewer)
4478{
4479 PetscBool isbinary, ishdf5;
4480 PetscErrorCode ierr;
4481
4482 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4482; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4483 PetscValidHeaderSpecific(newMat,MAT_CLASSID,1)do { if (!newMat) return PetscError(((MPI_Comm)0x44000001),4483
,__func__,"/sandbox/petsc/petsc.master/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),4483,__func__,"/sandbox/petsc/petsc.master/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),4483,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),4483,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",62
,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1
); } } while (0)
;
4484 PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),4484
,__func__,"/sandbox/petsc/petsc.master/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),4484,__func__,"/sandbox/petsc/petsc.master/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),4484,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),4484,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",62
,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2
); } } while (0)
;
4485 /* force binary viewer to load .info file if it has not yet done so */
4486 ierr = PetscViewerSetUp(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4486,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4487 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4487,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4488 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4488,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4489 if (isbinary) {
4490 ierr = MatLoad_SeqAIJ_Binary(newMat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4490,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4491 } else if (ishdf5) {
4492#if defined(PETSC_HAVE_HDF5)
4493 ierr = MatLoad_AIJ_HDF5(newMat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4493,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4494#else
4495 SETERRQ(PetscObjectComm((PetscObject)newMat),PETSC_ERR_SUP,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject)newMat),4495,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",56
,PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"
)
;
4496#endif
4497 } else {
4498 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
),4498,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)newMat),56);}} while (0)
;
4499 }
4500 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)
;
4501}
4502
4503PetscErrorCode MatLoad_SeqAIJ_Binary(Mat newMat, PetscViewer viewer)
4504{
4505 Mat_SeqAIJ *a;
4506 PetscErrorCode ierr;
4507 PetscInt i,sum,nz,header[4],*rowlengths = 0,M,N,rows,cols;
4508 int fd;
4509 PetscMPIInt size;
4510 MPI_Comm comm;
4511 PetscInt bs = newMat->rmap->bs;
4512
4513 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4513; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4514 ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4514,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4515 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4515,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4516 if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"view must have one processor")return PetscError(((MPI_Comm)0x44000001),4516,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"view must have one processor")
;
4517
4518 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),4518,__func__
,"/sandbox/petsc/petsc.master/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),4518,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4519 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),(-2147483647 - 1),2147483647)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4519,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4520 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) {PetscError(((MPI_Comm)0x44000001
),4520,__func__,"/sandbox/petsc/petsc.master/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),4520,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4521 if (bs < 0) bs = 1;
4522 ierr = MatSetBlockSize(newMat,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4522,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4523
4524 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4524,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4525 ierr = PetscBinaryRead(fd,header,4,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4525,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4526 if (header[0] != MAT_FILE_CLASSID1211216) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"not matrix object in file")return PetscError(((MPI_Comm)0x44000001),4526,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,79,PETSC_ERROR_INITIAL,"not matrix object in file")
;
4527 M = header[1]; N = header[2]; nz = header[3];
4528
4529 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),4529,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,79,PETSC_ERROR_INITIAL,"Matrix stored in special format on disk,cannot load as SeqAIJ"
)
;
4530
4531 /* read in row lengths */
4532 ierr = PetscMalloc1(M,&rowlengths)PetscMallocA(1,PETSC_FALSE,4532,__func__,"/sandbox/petsc/petsc.master/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),4532,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4533 ierr = PetscBinaryRead(fd,rowlengths,M,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4533,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4534
4535 /* check if sum of rowlengths is same as nz */
4536 for (i=0,sum=0; i< M; i++) sum +=rowlengths[i];
4537 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
),4537,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,66,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
66);}} while (0)
;
4538
4539 /* set global size if not set already*/
4540 if (newMat->rmap->n < 0 && newMat->rmap->N < 0 && newMat->cmap->n < 0 && newMat->cmap->N < 0) {
4541 ierr = MatSetSizes(newMat,PETSC_DECIDE-1,PETSC_DECIDE-1,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4541,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4542 } else {
4543 /* if sizes and type are already set, check if the matrix global sizes are correct */
4544 ierr = MatGetSize(newMat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4544,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4545 if (rows < 0 && cols < 0) { /* user might provide local size instead of global size */
4546 ierr = MatGetLocalSize(newMat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4546,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4547 }
4548 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),4548,__func__,"/sandbox/petsc/petsc.master/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)
;
4549 }
4550 ierr = MatSeqAIJSetPreallocation_SeqAIJ(newMat,0,rowlengths);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4550,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4551 a = (Mat_SeqAIJ*)newMat->data;
4552
4553 ierr = PetscBinaryRead(fd,a->j,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4553,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4554
4555 /* read in nonzero values */
4556 ierr = PetscBinaryRead(fd,a->a,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4556,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4557
4558 /* set matrix "i" values */
4559 a->i[0] = 0;
4560 for (i=1; i<= M; i++) {
4561 a->i[i] = a->i[i-1] + rowlengths[i-1];
4562 a->ilen[i-1] = rowlengths[i-1];
4563 }
4564 ierr = PetscFree(rowlengths)((*PetscTrFree)((void*)(rowlengths),4564,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((rowlengths) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4564,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4565
4566 ierr = MatAssemblyBegin(newMat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4566,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4567 ierr = MatAssemblyEnd(newMat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4567,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4568 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)
;
4569}
4570
4571PetscErrorCode MatEqual_SeqAIJ(Mat A,Mat B,PetscBool * flg)
4572{
4573 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data,*b = (Mat_SeqAIJ*)B->data;
4574 PetscErrorCode ierr;
4575#if defined(PETSC_USE_COMPLEX)
4576 PetscInt k;
4577#endif
4578
4579 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4579; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4580 /* If the matrix dimensions are not equal,or no of nonzeros */
4581 if ((A->rmap->n != B->rmap->n) || (A->cmap->n != B->cmap->n) ||(a->nz != b->nz)) {
4582 *flg = PETSC_FALSE;
4583 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)
;
4584 }
4585
4586 /* if the a->i are the same */
4587 ierr = PetscArraycmp(a->i,b->i,A->rmap->n+1,flg)((sizeof(*(a->i)) != sizeof(*(b->i))) || PetscMemcmp(a->
i,b->i,(A->rmap->n+1)*sizeof(*(a->i)),flg))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4587,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4588 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)
;
4589
4590 /* if a->j are the same */
4591 ierr = PetscArraycmp(a->j,b->j,a->nz,flg)((sizeof(*(a->j)) != sizeof(*(b->j))) || PetscMemcmp(a->
j,b->j,(a->nz)*sizeof(*(a->j)),flg))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4591,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4592 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)
;
4593
4594 /* if a->a are the same */
4595#if defined(PETSC_USE_COMPLEX)
4596 for (k=0; k<a->nz; k++) {
4597 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)) {
4598 *flg = PETSC_FALSE;
4599 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)
;
4600 }
4601 }
4602#else
4603 ierr = PetscArraycmp(a->a,b->a,a->nz,flg)((sizeof(*(a->a)) != sizeof(*(b->a))) || PetscMemcmp(a->
a,b->a,(a->nz)*sizeof(*(a->a)),flg))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4603,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4604#endif
4605 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)
;
4606}
4607
4608/*@
4609 MatCreateSeqAIJWithArrays - Creates an sequential AIJ matrix using matrix elements (in CSR format)
4610 provided by the user.
4611
4612 Collective
4613
4614 Input Parameters:
4615+ comm - must be an MPI communicator of size 1
4616. m - number of rows
4617. n - number of columns
4618. i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row of the matrix
4619. j - column indices
4620- a - matrix values
4621
4622 Output Parameter:
4623. mat - the matrix
4624
4625 Level: intermediate
4626
4627 Notes:
4628 The i, j, and a arrays are not copied by this routine, the user must free these arrays
4629 once the matrix is destroyed and not before
4630
4631 You cannot set new nonzero locations into this matrix, that will generate an error.
4632
4633 The i and j indices are 0 based
4634
4635 The format which is used for the sparse matrix input, is equivalent to a
4636 row-major ordering.. i.e for the following matrix, the input data expected is
4637 as shown
4638
4639$ 1 0 0
4640$ 2 0 3
4641$ 4 5 6
4642$
4643$ i = {0,1,3,6} [size = nrow+1 = 3+1]
4644$ j = {0,0,2,0,1,2} [size = 6]; values must be sorted for each row
4645$ v = {1,2,3,4,5,6} [size = 6]
4646
4647
4648.seealso: MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateMPIAIJWithArrays(), MatMPIAIJSetPreallocationCSR()
4649
4650@*/
4651PetscErrorCode MatCreateSeqAIJWithArrays(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt i[],PetscInt j[],PetscScalar a[],Mat *mat)
4652{
4653 PetscErrorCode ierr;
4654 PetscInt ii;
4655 Mat_SeqAIJ *aij;
4656#if defined(PETSC_USE_DEBUG1)
4657 PetscInt jj;
4658#endif
4659
4660 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4660; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4661 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),4661,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"i (row indices) must start with 0")
;
4662 ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4662,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4663 ierr = MatSetSizes(*mat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4663,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4664 /* ierr = MatSetBlockSizes(*mat,,);CHKERRQ(ierr); */
4665 ierr = MatSetType(*mat,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4665,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4666 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*mat,MAT_SKIP_ALLOCATION-4,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4666,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4667 aij = (Mat_SeqAIJ*)(*mat)->data;
4668 ierr = PetscMalloc1(m,&aij->imax)PetscMallocA(1,PETSC_FALSE,4668,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&aij->imax)),(&aij->imax
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4668,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4669 ierr = PetscMalloc1(m,&aij->ilen)PetscMallocA(1,PETSC_FALSE,4669,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&aij->ilen)),(&aij->ilen
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4669,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4670
4671 aij->i = i;
4672 aij->j = j;
4673 aij->a = a;
4674 aij->singlemalloc = PETSC_FALSE;
4675 aij->nonew = -1; /*this indicates that inserting a new value in the matrix that generates a new nonzero is an error*/
4676 aij->free_a = PETSC_FALSE;
4677 aij->free_ij = PETSC_FALSE;
4678
4679 for (ii=0; ii<m; ii++) {
4680 aij->ilen[ii] = aij->imax[ii] = i[ii+1] - i[ii];
4681#if defined(PETSC_USE_DEBUG1)
4682 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
),4682,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4683 for (jj=i[ii]+1; jj<i[ii+1]; jj++) {
4684 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
),4684,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4685 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
),4685,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4686 }
4687#endif
4688 }
4689#if defined(PETSC_USE_DEBUG1)
4690 for (ii=0; ii<aij->i[m]; ii++) {
4691 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
),4691,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4692 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
),4692,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4693 }
4694#endif
4695
4696 ierr = MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4696,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4697 ierr = MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4697,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4698 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)
;
4699}
4700/*@C
4701 MatCreateSeqAIJFromTriple - Creates an sequential AIJ matrix using matrix elements (in COO format)
4702 provided by the user.
4703
4704 Collective
4705
4706 Input Parameters:
4707+ comm - must be an MPI communicator of size 1
4708. m - number of rows
4709. n - number of columns
4710. i - row indices
4711. j - column indices
4712. a - matrix values
4713. nz - number of nonzeros
4714- idx - 0 or 1 based
4715
4716 Output Parameter:
4717. mat - the matrix
4718
4719 Level: intermediate
4720
4721 Notes:
4722 The i and j indices are 0 based
4723
4724 The format which is used for the sparse matrix input, is equivalent to a
4725 row-major ordering.. i.e for the following matrix, the input data expected is
4726 as shown:
4727
4728 1 0 0
4729 2 0 3
4730 4 5 6
4731
4732 i = {0,1,1,2,2,2}
4733 j = {0,0,2,0,1,2}
4734 v = {1,2,3,4,5,6}
4735
4736
4737.seealso: MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateSeqAIJWithArrays(), MatMPIAIJSetPreallocationCSR()
4738
4739@*/
4740PetscErrorCode MatCreateSeqAIJFromTriple(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt i[],PetscInt j[],PetscScalar a[],Mat *mat,PetscInt nz,PetscBool idx)
4741{
4742 PetscErrorCode ierr;
4743 PetscInt ii, *nnz, one = 1,row,col;
4744
4745
4746 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4746; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4747 ierr = PetscCalloc1(m,&nnz)PetscMallocA(1,PETSC_TRUE,4747,__func__,"/sandbox/petsc/petsc.master/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),4747,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4748 for (ii = 0; ii < nz; ii++) {
4749 nnz[i[ii] - !!idx] += 1;
4750 }
4751 ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4751,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4752 ierr = MatSetSizes(*mat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4752,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4753 ierr = MatSetType(*mat,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4753,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4754 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*mat,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4754,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4755 for (ii = 0; ii < nz; ii++) {
4756 if (idx) {
4757 row = i[ii] - 1;
4758 col = j[ii] - 1;
4759 } else {
4760 row = i[ii];
4761 col = j[ii];
4762 }
4763 ierr = MatSetValues(*mat,one,&row,one,&col,&a[ii],ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4763,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4764 }
4765 ierr = MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4765,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4766 ierr = MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4766,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4767 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),4767,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4767,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4768 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)
;
4769}
4770
4771PetscErrorCode MatSeqAIJInvalidateDiagonal(Mat A)
4772{
4773 Mat_SeqAIJ *a=(Mat_SeqAIJ*)A->data;
4774 PetscErrorCode ierr;
4775
4776 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4776; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4777 a->idiagvalid = PETSC_FALSE;
4778 a->ibdiagvalid = PETSC_FALSE;
4779
4780 ierr = MatSeqAIJInvalidateDiagonal_Inode(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4780,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4781 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)
;
4782}
4783
4784PetscErrorCode MatCreateMPIMatConcatenateSeqMat_SeqAIJ(MPI_Comm comm,Mat inmat,PetscInt n,MatReuse scall,Mat *outmat)
4785{
4786 PetscErrorCode ierr;
4787 PetscMPIInt size;
4788
4789 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4789; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4790 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4790,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4791 if (size == 1) {
4792 if (scall == MAT_INITIAL_MATRIX) {
4793 ierr = MatDuplicate(inmat,MAT_COPY_VALUES,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4793,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4794 } else {
4795 ierr = MatCopy(inmat,*outmat,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4795,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4796 }
4797 } else {
4798 ierr = MatCreateMPIMatConcatenateSeqMat_MPIAIJ(comm,inmat,n,scall,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4798,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4799 }
4800 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)
;
4801}
4802
4803/*
4804 Permute A into C's *local* index space using rowemb,colemb.
4805 The embedding are supposed to be injections and the above implies that the range of rowemb is a subset
4806 of [0,m), colemb is in [0,n).
4807 If pattern == DIFFERENT_NONZERO_PATTERN, C is preallocated according to A.
4808 */
4809PetscErrorCode MatSetSeqMat_SeqAIJ(Mat C,IS rowemb,IS colemb,MatStructure pattern,Mat B)
4810{
4811 /* If making this function public, change the error returned in this function away from _PLIB. */
4812 PetscErrorCode ierr;
4813 Mat_SeqAIJ *Baij;
4814 PetscBool seqaij;
4815 PetscInt m,n,*nz,i,j,count;
4816 PetscScalar v;
4817 const PetscInt *rowindices,*colindices;
4818
4819 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4819; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4820 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)
;
4821 /* Check to make sure the target matrix (and embeddings) are compatible with C and each other. */
4822 ierr = PetscObjectBaseTypeCompare((PetscObject)B,MATSEQAIJ"seqaij",&seqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4822,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4823 if (!seqaij) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Input matrix is of wrong type")return PetscError(((MPI_Comm)0x44000001),4823,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_INITIAL,"Input matrix is of wrong type")
;
4824 if (rowemb) {
4825 ierr = ISGetLocalSize(rowemb,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4825,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4826 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
),4826,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
77);}} while (0)
;
4827 } else {
4828 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),4828,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_INITIAL,"Input matrix is row-incompatible with the target matrix"
)
;
4829 }
4830 if (colemb) {
4831 ierr = ISGetLocalSize(colemb,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4831,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4832 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
),4832,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
77);}} while (0)
;
4833 } else {
4834 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),4834,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_INITIAL,"Input matrix is col-incompatible with the target matrix"
)
;
4835 }
4836
4837 Baij = (Mat_SeqAIJ*)(B->data);
4838 if (pattern == DIFFERENT_NONZERO_PATTERN) {
4839 ierr = PetscMalloc1(B->rmap->n,&nz)PetscMallocA(1,PETSC_FALSE,4839,__func__,"/sandbox/petsc/petsc.master/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),4839,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4840 for (i=0; i<B->rmap->n; i++) {
4841 nz[i] = Baij->i[i+1] - Baij->i[i];
4842 }
4843 ierr = MatSeqAIJSetPreallocation(C,0,nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4843,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4844 ierr = PetscFree(nz)((*PetscTrFree)((void*)(nz),4844,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
) || ((nz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4844,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4845 }
4846 if (pattern == SUBSET_NONZERO_PATTERN) {
4847 ierr = MatZeroEntries(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4847,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4848 }
4849 count = 0;
4850 rowindices = NULL((void*)0);
4851 colindices = NULL((void*)0);
4852 if (rowemb) {
4853 ierr = ISGetIndices(rowemb,&rowindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4853,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4854 }
4855 if (colemb) {
4856 ierr = ISGetIndices(colemb,&colindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4856,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4857 }
4858 for (i=0; i<B->rmap->n; i++) {
4859 PetscInt row;
4860 row = i;
4861 if (rowindices) row = rowindices[i];
4862 for (j=Baij->i[i]; j<Baij->i[i+1]; j++) {
4863 PetscInt col;
4864 col = Baij->j[count];
4865 if (colindices) col = colindices[col];
4866 v = Baij->a[count];
4867 ierr = MatSetValues(C,1,&row,1,&col,&v,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4867,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4868 ++count;
4869 }
4870 }
4871 /* FIXME: set C's nonzerostate correctly. */
4872 /* Assembly for C is necessary. */
4873 C->preallocated = PETSC_TRUE;
4874 C->assembled = PETSC_TRUE;
4875 C->was_assembled = PETSC_FALSE;
4876 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)
;
4877}
4878
4879PetscFunctionList MatSeqAIJList = NULL((void*)0);
4880
4881/*@C
4882 MatSeqAIJSetType - Converts a MATSEQAIJ matrix to a subtype
4883
4884 Collective on Mat
4885
4886 Input Parameters:
4887+ mat - the matrix object
4888- matype - matrix type
4889
4890 Options Database Key:
4891. -mat_seqai_type <method> - for example seqaijcrl
4892
4893
4894 Level: intermediate
4895
4896.seealso: PCSetType(), VecSetType(), MatCreate(), MatType, Mat
4897@*/
4898PetscErrorCode MatSeqAIJSetType(Mat mat, MatType matype)
4899{
4900 PetscErrorCode ierr,(*r)(Mat,MatType,MatReuse,Mat*);
4901 PetscBool sametype;
4902
4903 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4903; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4904 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),4904,
__func__,"/sandbox/petsc/petsc.master/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),4904,__func__,"/sandbox/petsc/petsc.master/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),4904,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),4904,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",62
,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1
); } } while (0)
;
4905 ierr = PetscObjectTypeCompare((PetscObject)mat,matype,&sametype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4905,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4906 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)
;
4907
4908 ierr = PetscFunctionListFind(MatSeqAIJList,matype,&r)PetscFunctionListFind_Private((MatSeqAIJList),(matype),(PetscVoidFunction
*)(&r))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4908,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4909 if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown Mat type given: %s",matype)return PetscError(((MPI_Comm)0x44000001),4909,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,86,PETSC_ERROR_INITIAL,"Unknown Mat type given: %s",matype)
;
4910 ierr = (*r)(mat,matype,MAT_INPLACE_MATRIX,&mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4910,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4911 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)
;
4912}
4913
4914
4915/*@C
4916 MatSeqAIJRegister - - Adds a new sub-matrix type for sequential AIJ matrices
4917
4918 Not Collective
4919
4920 Input Parameters:
4921+ name - name of a new user-defined matrix type, for example MATSEQAIJCRL
4922- function - routine to convert to subtype
4923
4924 Notes:
4925 MatSeqAIJRegister() may be called multiple times to add several user-defined solvers.
4926
4927
4928 Then, your matrix can be chosen with the procedural interface at runtime via the option
4929$ -mat_seqaij_type my_mat
4930
4931 Level: advanced
4932
4933.seealso: MatSeqAIJRegisterAll()
4934
4935
4936 Level: advanced
4937@*/
4938PetscErrorCode MatSeqAIJRegister(const char sname[],PetscErrorCode (*function)(Mat,MatType,MatReuse,Mat *))
4939{
4940 PetscErrorCode ierr;
4941
4942 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4942; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4943 ierr = MatInitializePackage();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4943,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4944 ierr = PetscFunctionListAdd(&MatSeqAIJList,sname,function)PetscFunctionListAdd_Private((&MatSeqAIJList),(sname),(PetscVoidFunction
)(function))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4944,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4945 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)
;
4946}
4947
4948PetscBool MatSeqAIJRegisterAllCalled = PETSC_FALSE;
4949
4950/*@C
4951 MatSeqAIJRegisterAll - Registers all of the matrix subtypes of SeqAIJ
4952
4953 Not Collective
4954
4955 Level: advanced
4956
4957 Developers Note: CUSP and CUSPARSE do not yet support the MatConvert_SeqAIJ..() paradigm and thus cannot be registered here
4958
4959.seealso: MatRegisterAll(), MatSeqAIJRegister()
4960@*/
4961PetscErrorCode MatSeqAIJRegisterAll(void)
4962{
4963 PetscErrorCode ierr;
4964
4965 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 4965; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4966 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)
;
4967 MatSeqAIJRegisterAllCalled = PETSC_TRUE;
4968
4969 ierr = MatSeqAIJRegister(MATSEQAIJCRL"seqaijcrl", MatConvert_SeqAIJ_SeqAIJCRL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4969,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4970 ierr = MatSeqAIJRegister(MATSEQAIJPERM"seqaijperm", MatConvert_SeqAIJ_SeqAIJPERM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4970,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4971 ierr = MatSeqAIJRegister(MATSEQAIJSELL"seqaijsell", MatConvert_SeqAIJ_SeqAIJSELL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4971,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4972#if defined(PETSC_HAVE_MKL_SPARSE)
4973 ierr = MatSeqAIJRegister(MATSEQAIJMKL"seqaijmkl", MatConvert_SeqAIJ_SeqAIJMKL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4973,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4974#endif
4975#if defined(PETSC_HAVE_VIENNACL) && defined(PETSC_HAVE_VIENNACL_NO_CUDA)
4976 ierr = MatSeqAIJRegister(MATMPIAIJVIENNACL"mpiaijviennacl", MatConvert_SeqAIJ_SeqAIJViennaCL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4976,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4977#endif
4978 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)
;
4979}
4980
4981/*
4982 Special version for direct calls from Fortran
4983*/
4984#include <petsc/private/fortranimpl.h>
4985#if defined(PETSC_HAVE_FORTRAN_CAPS)
4986#define matsetvaluesseqaij_ MATSETVALUESSEQAIJ
4987#elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE1)
4988#define matsetvaluesseqaij_ matsetvaluesseqaij
4989#endif
4990
4991/* Change these macros so can be used in void function */
4992#undef CHKERRQ
4993#define CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4993,__func__,"/sandbox/petsc/petsc.master/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),4993,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
4994#undef SETERRQ2
4995#define SETERRQ2(comm,ierr,b,c,d)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4995,__func__,"/sandbox/petsc/petsc.master/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),4995,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (
0)
4996#undef SETERRQ3
4997#define SETERRQ3(comm,ierr,b,c,d,e)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4997,__func__,"/sandbox/petsc/petsc.master/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),4997,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (
0)
4998
4999PETSC_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)
5000{
5001 Mat A = *AA;
5002 PetscInt m = *mm, n = *nn;
5003 InsertMode is = *isis;
5004 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
5005 PetscInt *rp,k,low,high,t,ii,row,nrow,i,col,l,rmax,N;
5006 PetscInt *imax,*ai,*ailen;
5007 PetscErrorCode ierr;
5008 PetscInt *aj,nonew = a->nonew,lastcol = -1;
5009 MatScalar *ap,value,*aa;
5010 PetscBool ignorezeroentries = a->ignorezeroentries;
5011 PetscBool roworiented = a->roworiented;
5012
5013 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c";
petscstack->line[petscstack->currentsize] = 5013; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5014 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) do {if
(__builtin_expect(!!(73),0)) {PetscError(((MPI_Comm)0x44000001
),5014,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
73);}} while (0); } while (0)
;
5015 imax = a->imax;
5016 ai = a->i;
5017 ailen = a->ilen;
5018 aj = a->j;
5019 aa = a->a;
5020
5021 for (k=0; k<m; k++) { /* loop over added rows */
5022 row = im[k];
5023 if (row < 0) continue;
5024#if defined(PETSC_USE_DEBUG1)
5025 if (row >= A->rmap->n) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Row too large")do {PetscError(PetscObjectComm((PetscObject)A),5025,__func__,
"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",63,
PETSC_ERROR_INITIAL,"Row too large");MPI_Abort(PetscObjectComm
((PetscObject)A),63);} while (0)
;
5026#endif
5027 rp = aj + ai[row]; ap = aa + ai[row];
5028 rmax = imax[row]; nrow = ailen[row];
5029 low = 0;
5030 high = nrow;
5031 for (l=0; l<n; l++) { /* loop over added columns */
5032 if (in[l] < 0) continue;
5033#if defined(PETSC_USE_DEBUG1)
5034 if (in[l] >= A->cmap->n) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Column too large")do {PetscError(PetscObjectComm((PetscObject)A),5034,__func__,
"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c",63,
PETSC_ERROR_INITIAL,"Column too large");MPI_Abort(PetscObjectComm
((PetscObject)A),63);} while (0)
;
5035#endif
5036 col = in[l];
5037 if (roworiented) value = v[l + k*n];
5038 else value = v[k + l*m];
5039
5040 if (value == 0.0 && ignorezeroentries && (is == ADD_VALUES)) continue;
5041
5042 if (col <= lastcol) low = 0;
5043 else high = nrow;
5044 lastcol = col;
5045 while (high-low > 5) {
5046 t = (low+high)/2;
5047 if (rp[t] > col) high = t;
5048 else low = t;
5049 }
5050 for (i=low; i<high; i++) {
5051 if (rp[i] > col) break;
5052 if (rp[i] == col) {
5053 if (is == ADD_VALUES) ap[i] += value;
5054 else ap[i] = value;
5055 goto noinsert;
5056 }
5057 }
5058 if (value == 0.0 && ignorezeroentries) goto noinsert;
5059 if (nonew == 1) goto noinsert;
5060 if (nonew == -1) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero in the matrix")do {PetscError(PetscObjectComm((PetscObject)A),5060,__func__,
"/sandbox/petsc/petsc.master/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)
;
5061 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
),5061,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0); ierr = PetscMallocA(3,PETSC_FALSE,5061,__func__
,"/sandbox/petsc/petsc.master/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),5061,__func__
,"/sandbox/petsc/petsc.master/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 = ((sizeof(*(new_j)) !=
sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof
(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) {PetscError
(((MPI_Comm)0x44000001),5061,__func__,"/sandbox/petsc/petsc.master/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 = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE)) != sizeof
(*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE
,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE)
)));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm
)0x44000001),5061,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = ((sizeof(*(new_a)) != sizeof(*
(aa))) || PetscMemcpy(new_a,aa,(1*(ai[row]+nrow))*sizeof(*(new_a
))));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm
)0x44000001),5061,__func__,"/sandbox/petsc/petsc.master/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(*(new_a+1*(ai[row]+nrow))));do {if
(__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001
),5061,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = ((sizeof(*(new_a+1*(ai[row]+nrow
+CHUNKSIZE))) != sizeof(*(aa+1*(ai[row]+nrow)))) || PetscMemcpy
(new_a+1*(ai[row]+nrow+CHUNKSIZE),aa+1*(ai[row]+nrow),(1*len)
*sizeof(*(new_a+1*(ai[row]+nrow+CHUNKSIZE)))));do {if (__builtin_expect
(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),5061,__func__
,"/sandbox/petsc/petsc.master/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),5061,__func__,"/sandbox/petsc/petsc.master/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++; }
;
5062 N = nrow++ - 1; a->nz++; high++;
5063 /* shift up all the later entries in this row */
5064 for (ii=N; ii>=i; ii--) {
5065 rp[ii+1] = rp[ii];
5066 ap[ii+1] = ap[ii];
5067 }
5068 rp[i] = col;
5069 ap[i] = value;
5070 A->nonzerostate++;
5071noinsert:;
5072 low = i + 1;
5073 }
5074 ailen[row] = nrow;
5075 }
5076 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)
;
5077}