Bug Summary

File:mat/impls/aij/seq/aij.c
Warning:line 487, column 15
Array access (from variable 'ap') results in a null pointer dereference

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1
2/*
3 Defines the basic matrix operations for the AIJ (compressed row)
4 matrix storage format.
5*/
6
7
8#include <../src/mat/impls/aij/seq/aij.h> /*I "petscmat.h" I*/
9#include <petscblaslapack.h>
10#include <petscbt.h>
11#include <petsc/private/kernels/blocktranspose.h>
12
13PetscErrorCode MatSeqAIJSetTypeFromOptions(Mat A)
14{
15 PetscErrorCode ierr;
16 PetscBool flg;
17 char type[256];
18
19 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 19; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
20 ierr = PetscObjectOptionsBegin((PetscObject)A)0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems
*PetscOptionsObject = &PetscOptionsObjectBase; PetscOptionsObject
->options = ((PetscObject)(PetscObject)A)->options; for
(PetscOptionsObject->count=(PetscOptionsPublish?-1:1); PetscOptionsObject
->count<2; PetscOptionsObject->count++) { PetscErrorCode
_5_ierr = PetscObjectOptionsBegin_Private(PetscOptionsObject
,(PetscObject)A);do {if (__builtin_expect(!!(_5_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),20,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_5_ierr);}} while (0)
;
21 ierr = PetscOptionsFList("-mat_seqaij_type","Matrix SeqAIJ type","MatSeqAIJSetType",MatSeqAIJList,"seqaij",type,256,&flg)PetscOptionsFList_Private(PetscOptionsObject,"-mat_seqaij_type"
,"Matrix SeqAIJ type","MatSeqAIJSetType",MatSeqAIJList,"seqaij"
,type,256,&flg)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),21,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
22 if (flg) {
23 ierr = MatSeqAIJSetType(A,type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),23,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
24 }
25 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) {PetscError(((MPI_Comm)0x44000001
),25,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_5_ierr);}} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),25,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
26 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
27}
28
29PetscErrorCode MatGetColumnNorms_SeqAIJ(Mat A,NormType type,PetscReal *norms)
30{
31 PetscErrorCode ierr;
32 PetscInt i,m,n;
33 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)A->data;
34
35 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 35; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
36 ierr = MatGetSize(A,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),36,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
37 ierr = 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.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
38 if (type == NORM_2) {
39 for (i=0; i<aij->i[m]; i++) {
40 norms[aij->j[i]] += PetscAbsScalar(aij->a[i]*aij->a[i]);
41 }
42 } else if (type == NORM_1) {
43 for (i=0; i<aij->i[m]; i++) {
44 norms[aij->j[i]] += PetscAbsScalar(aij->a[i]);
45 }
46 } else if (type == NORM_INFINITY) {
47 for (i=0; i<aij->i[m]; i++) {
48 norms[aij->j[i]] = PetscMax(PetscAbsScalar(aij->a[i]),norms[aij->j[i]])(((PetscAbsScalar(aij->a[i]))<(norms[aij->j[i]])) ? (
norms[aij->j[i]]) : (PetscAbsScalar(aij->a[i])))
;
49 }
50 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown NormType")return PetscError(((MPI_Comm)0x44000001),50,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,62,PETSC_ERROR_INITIAL,"Unknown NormType")
;
51
52 if (type == NORM_2) {
53 for (i=0; i<n; i++) norms[i] = PetscSqrtReal(norms[i])sqrt(norms[i]);
54 }
55 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
56}
57
58PetscErrorCode MatFindOffBlockDiagonalEntries_SeqAIJ(Mat A,IS *is)
59{
60 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
61 PetscInt i,m=A->rmap->n,cnt = 0, bs = A->rmap->bs;
62 const PetscInt *jj = a->j,*ii = a->i;
63 PetscInt *rows;
64 PetscErrorCode ierr;
65
66 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 66; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
67 for (i=0; i<m; i++) {
68 if ((ii[i] != ii[i+1]) && ((jj[ii[i]] < bs*(i/bs)) || (jj[ii[i+1]-1] > bs*((i+bs)/bs)-1))) {
69 cnt++;
70 }
71 }
72 ierr = PetscMalloc1(cnt,&rows)PetscMallocA(1,PETSC_FALSE,72,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(cnt)*sizeof(**(&rows)),(&rows))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),72,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
73 cnt = 0;
74 for (i=0; i<m; i++) {
75 if ((ii[i] != ii[i+1]) && ((jj[ii[i]] < bs*(i/bs)) || (jj[ii[i+1]-1] > bs*((i+bs)/bs)-1))) {
76 rows[cnt] = i;
77 cnt++;
78 }
79 }
80 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cnt,rows,PETSC_OWN_POINTER,is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),80,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
81 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
82}
83
84PetscErrorCode MatFindZeroDiagonals_SeqAIJ_Private(Mat A,PetscInt *nrows,PetscInt **zrows)
85{
86 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
87 const MatScalar *aa = a->a;
88 PetscInt i,m=A->rmap->n,cnt = 0;
89 const PetscInt *ii = a->i,*jj = a->j,*diag;
90 PetscInt *rows;
91 PetscErrorCode ierr;
92
93 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 93; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
94 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),94,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
95 diag = a->diag;
96 for (i=0; i<m; i++) {
97 if ((diag[i] >= ii[i+1]) || (jj[diag[i]] != i) || (aa[diag[i]] == 0.0)) {
98 cnt++;
99 }
100 }
101 ierr = PetscMalloc1(cnt,&rows)PetscMallocA(1,PETSC_FALSE,101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(cnt)*sizeof(**(&rows)),(&rows))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
102 cnt = 0;
103 for (i=0; i<m; i++) {
104 if ((diag[i] >= ii[i+1]) || (jj[diag[i]] != i) || (aa[diag[i]] == 0.0)) {
105 rows[cnt++] = i;
106 }
107 }
108 *nrows = cnt;
109 *zrows = rows;
110 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
111}
112
113PetscErrorCode MatFindZeroDiagonals_SeqAIJ(Mat A,IS *zrows)
114{
115 PetscInt nrows,*rows;
116 PetscErrorCode ierr;
117
118 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 118; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
119 *zrows = NULL((void*)0);
120 ierr = MatFindZeroDiagonals_SeqAIJ_Private(A,&nrows,&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),120,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
121 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)A),nrows,rows,PETSC_OWN_POINTER,zrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),121,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
122 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
123}
124
125PetscErrorCode MatFindNonzeroRows_SeqAIJ(Mat A,IS *keptrows)
126{
127 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
128 const MatScalar *aa;
129 PetscInt m=A->rmap->n,cnt = 0;
130 const PetscInt *ii;
131 PetscInt n,i,j,*rows;
132 PetscErrorCode ierr;
133
134 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 134; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
135 *keptrows = 0;
136 ii = a->i;
137 for (i=0; i<m; i++) {
138 n = ii[i+1] - ii[i];
139 if (!n) {
140 cnt++;
141 goto ok1;
142 }
143 aa = a->a + ii[i];
144 for (j=0; j<n; j++) {
145 if (aa[j] != 0.0) goto ok1;
146 }
147 cnt++;
148ok1:;
149 }
150 if (!cnt) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
151 ierr = PetscMalloc1(A->rmap->n-cnt,&rows)PetscMallocA(1,PETSC_FALSE,151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->rmap->n-cnt)*sizeof(**(&rows)),(&rows
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
152 cnt = 0;
153 for (i=0; i<m; i++) {
154 n = ii[i+1] - ii[i];
155 if (!n) continue;
156 aa = a->a + ii[i];
157 for (j=0; j<n; j++) {
158 if (aa[j] != 0.0) {
159 rows[cnt++] = i;
160 break;
161 }
162 }
163 }
164 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cnt,rows,PETSC_OWN_POINTER,keptrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
165 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
166}
167
168PetscErrorCode MatDiagonalSet_SeqAIJ(Mat Y,Vec D,InsertMode is)
169{
170 PetscErrorCode ierr;
171 Mat_SeqAIJ *aij = (Mat_SeqAIJ*) Y->data;
172 PetscInt i,m = Y->rmap->n;
173 const PetscInt *diag;
174 MatScalar *aa = aij->a;
175 const PetscScalar *v;
176 PetscBool missing;
177
178 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 178; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
179 if (Y->assembled) {
180 ierr = MatMissingDiagonal_SeqAIJ(Y,&missing,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
181 if (!missing) {
182 diag = aij->diag;
183 ierr = VecGetArrayRead(D,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),183,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
184 if (is == INSERT_VALUES) {
185 for (i=0; i<m; i++) {
186 aa[diag[i]] = v[i];
187 }
188 } else {
189 for (i=0; i<m; i++) {
190 aa[diag[i]] += v[i];
191 }
192 }
193 ierr = VecRestoreArrayRead(D,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
194 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
195 }
196 ierr = MatSeqAIJInvalidateDiagonal(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
197 }
198 ierr = MatDiagonalSet_Default(Y,D,is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
199 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
200}
201
202PetscErrorCode MatGetRowIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *m,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done)
203{
204 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
205 PetscErrorCode ierr;
206 PetscInt i,ishift;
207
208 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 208; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
209 *m = A->rmap->n;
210 if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
211 ishift = 0;
212 if (symmetric && !A->structurally_symmetric) {
213 ierr = MatToSymmetricIJ_SeqAIJ(A->rmap->n,a->i,a->j,PETSC_TRUE,ishift,oshift,(PetscInt**)ia,(PetscInt**)ja);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
214 } else if (oshift == 1) {
215 PetscInt *tia;
216 PetscInt nz = a->i[A->rmap->n];
217 /* malloc space and add 1 to i and j indices */
218 ierr = PetscMalloc1(A->rmap->n+1,&tia)PetscMallocA(1,PETSC_FALSE,218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->rmap->n+1)*sizeof(**(&tia)),(&tia)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
219 for (i=0; i<A->rmap->n+1; i++) tia[i] = a->i[i] + 1;
220 *ia = tia;
221 if (ja) {
222 PetscInt *tja;
223 ierr = PetscMalloc1(nz+1,&tja)PetscMallocA(1,PETSC_FALSE,223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz+1)*sizeof(**(&tja)),(&tja))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
224 for (i=0; i<nz; i++) tja[i] = a->j[i] + 1;
225 *ja = tja;
226 }
227 } else {
228 *ia = a->i;
229 if (ja) *ja = a->j;
230 }
231 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
232}
233
234PetscErrorCode MatRestoreRowIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done)
235{
236 PetscErrorCode ierr;
237
238 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 238; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
239 if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
240 if ((symmetric && !A->structurally_symmetric) || oshift == 1) {
241 ierr = PetscFree(*ia)((*PetscTrFree)((void*)(*ia),241,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*ia) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),241,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
242 if (ja) {ierr = PetscFree(*ja)((*PetscTrFree)((void*)(*ja),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*ja) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
243 }
244 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
245}
246
247PetscErrorCode MatGetColumnIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done)
248{
249 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
250 PetscErrorCode ierr;
251 PetscInt i,*collengths,*cia,*cja,n = A->cmap->n,m = A->rmap->n;
252 PetscInt nz = a->i[m],row,*jj,mr,col;
253
254 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 254; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
255 *nn = n;
256 if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
257 if (symmetric) {
258 ierr = MatToSymmetricIJ_SeqAIJ(A->rmap->n,a->i,a->j,PETSC_TRUE,0,oshift,(PetscInt**)ia,(PetscInt**)ja);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),258,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
259 } else {
260 ierr = PetscCalloc1(n+1,&collengths)PetscMallocA(1,PETSC_TRUE,260,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n+1)*sizeof(**(&collengths)),(&collengths))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),260,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
261 ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n+1)*sizeof(**(&cia)),(&cia))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
262 ierr = PetscMalloc1(nz+1,&cja)PetscMallocA(1,PETSC_FALSE,262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz+1)*sizeof(**(&cja)),(&cja))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
263 jj = a->j;
264 for (i=0; i<nz; i++) {
265 collengths[jj[i]]++;
266 }
267 cia[0] = oshift;
268 for (i=0; i<n; i++) {
269 cia[i+1] = cia[i] + collengths[i];
270 }
271 ierr = 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.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
272 jj = a->j;
273 for (row=0; row<m; row++) {
274 mr = a->i[row+1] - a->i[row];
275 for (i=0; i<mr; i++) {
276 col = *jj++;
277
278 cja[cia[col] + collengths[col]++ - oshift] = row + oshift;
279 }
280 }
281 ierr = PetscFree(collengths)((*PetscTrFree)((void*)(collengths),281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((collengths) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
282 *ia = cia; *ja = cja;
283 }
284 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
285}
286
287PetscErrorCode MatRestoreColumnIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done)
288{
289 PetscErrorCode ierr;
290
291 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 291; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
292 if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
293
294 ierr = PetscFree(*ia)((*PetscTrFree)((void*)(*ia),294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*ia) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
295 ierr = PetscFree(*ja)((*PetscTrFree)((void*)(*ja),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*ja) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
296 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
297}
298
299/*
300 MatGetColumnIJ_SeqAIJ_Color() and MatRestoreColumnIJ_SeqAIJ_Color() are customized from
301 MatGetColumnIJ_SeqAIJ() and MatRestoreColumnIJ_SeqAIJ() by adding an output
302 spidx[], index of a->a, to be used in MatTransposeColoringCreate_SeqAIJ() and MatFDColoringCreate_SeqXAIJ()
303*/
304PetscErrorCode MatGetColumnIJ_SeqAIJ_Color(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscInt *spidx[],PetscBool *done)
305{
306 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
307 PetscErrorCode ierr;
308 PetscInt i,*collengths,*cia,*cja,n = A->cmap->n,m = A->rmap->n;
309 PetscInt nz = a->i[m],row,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.next-tmp/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+1,&collengths)PetscMallocA(1,PETSC_TRUE,317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n+1)*sizeof(**(&collengths)),(&collengths))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
318 ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,318,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n+1)*sizeof(**(&cia)),(&cia))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),318,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
319 ierr = PetscMalloc1(nz+1,&cja)PetscMallocA(1,PETSC_FALSE,319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz+1)*sizeof(**(&cja)),(&cja))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
320 ierr = PetscMalloc1(nz+1,&cspidx)PetscMallocA(1,PETSC_FALSE,320,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz+1)*sizeof(**(&cspidx)),(&cspidx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),320,__func__,"/sandbox/petsc/petsc.next-tmp/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.next-tmp/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.next-tmp/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.next-tmp/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.next-tmp/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.next-tmp/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.next-tmp/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.next-tmp/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.next-tmp/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.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
365 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
366}
367
368/*
369 MatSeqAIJSetValuesLocalFast - An optimized version of MatSetValuesLocal() for SeqAIJ matrices with several assumptions
370
371 - a single row of values is set with each call
372 - no row or column indices are negative or (in error) larger than the number of rows or columns
373 - the values are always added to the matrix, not set
374 - no new locations are introduced in the nonzero structure of the matrix
375
376 This does NOT assume the global column indices are sorted
377
378*/
379
380#include <petsc/private/isimpl.h>
381PetscErrorCode MatSeqAIJSetValuesLocalFast(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is)
382{
383 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
384 PetscInt low,high,t,row,nrow,i,col,l;
385 const PetscInt *rp,*ai = a->i,*ailen = a->ilen,*aj = a->j;
386 PetscInt lastcol = -1;
387 MatScalar *ap,value,*aa = a->a;
388 const PetscInt *ridx = A->rmap->mapping->indices,*cidx = A->cmap->mapping->indices;
389
390 row = ridx[im[0]];
391 rp = aj + ai[row];
392 ap = aa + ai[row];
393 nrow = ailen[row];
394 low = 0;
395 high = nrow;
396 for (l=0; l<n; l++) { /* loop over added columns */
397 col = cidx[in[l]];
398 value = v[l];
399
400 if (col <= lastcol) low = 0;
401 else high = nrow;
402 lastcol = col;
403 while (high-low > 5) {
404 t = (low+high)/2;
405 if (rp[t] > col) high = t;
406 else low = t;
407 }
408 for (i=low; i<high; i++) {
409 if (rp[i] == col) {
410 ap[i] += value;
411 low = i + 1;
412 break;
413 }
414 }
415 }
416 return 0;
417}
418
419PetscErrorCode MatSetValues_SeqAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is)
420{
421 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
422 PetscInt *rp,k,low,high,t,ii,row,nrow,i,col,l,rmax,N;
423 PetscInt *imax = a->imax,*ai = a->i,*ailen = a->ilen;
424 PetscErrorCode ierr;
425 PetscInt *aj = a->j,nonew = a->nonew,lastcol = -1;
426 MatScalar *ap=NULL((void*)0),value=0.0,*aa = a->a;
1
'ap' initialized to a null pointer value
427 PetscBool ignorezeroentries = a->ignorezeroentries;
428 PetscBool roworiented = a->roworiented;
429
430 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 430; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
431 for (k=0; k<m; k++) { /* loop over added rows */
2
Assuming 'k' is < 'm'
3
Loop condition is true. Entering loop body
28
Assuming 'k' is < 'm'
29
Loop condition is true. Entering loop body
432 row = im[k];
433 if (row < 0) continue;
4
Assuming 'row' is >= 0
5
Taking false branch
30
Assuming 'row' is >= 0
31
Taking false branch
434#if defined(PETSC_USE_DEBUG1)
435 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
),435,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
6
Taking false branch
32
Taking false branch
436#endif
437 rp = aj + ai[row];
438 if (!A->structure_only) ap = aa + ai[row];
7
Assuming the condition is false
8
Taking false branch
33
Taking false branch
439 rmax = imax[row]; nrow = ailen[row];
440 low = 0;
441 high = nrow;
442 for (l=0; l<n; l++) { /* loop over added columns */
9
Assuming 'l' is < 'n'
10
Loop condition is true. Entering loop body
26
Assuming 'l' is >= 'n'
27
Loop condition is false. Execution continues on line 493
34
Loop condition is true. Entering loop body
443 if (in[l] < 0) continue;
11
Assuming the condition is false
12
Taking false branch
35
Taking false branch
444#if defined(PETSC_USE_DEBUG1)
445 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
),445,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
13
Taking false branch
36
Taking false branch
446#endif
447 col = in[l];
448 if (v && !A->structure_only) value = roworiented ? v[l + k*n] : v[k + l*m];
14
Assuming 'v' is null
449 if (!A->structure_only && value == 0.0 && ignorezeroentries && is == ADD_VALUES && row != col) continue;
450
451 if (col <= lastcol) low = 0;
15
Taking false branch
37
Taking true branch
452 else high = nrow;
453 lastcol = col;
454 while (high-low > 5) {
16
Assuming the condition is false
17
Loop condition is false. Execution continues on line 459
38
Assuming the condition is false
39
Loop condition is false. Execution continues on line 459
455 t = (low+high)/2;
456 if (rp[t] > col) high = t;
457 else low = t;
458 }
459 for (i=low; i<high; i++) {
18
Assuming 'i' is >= 'high'
19
Loop condition is false. Execution continues on line 473
40
Assuming 'i' is >= 'high'
41
Loop condition is false. Execution continues on line 473
460 if (rp[i] > col) break;
461 if (rp[i] == col) {
462 if (!A->structure_only) {
463 if (is == ADD_VALUES) {
464 ap[i] += value;
465 (void)PetscLogFlops(1.0);
466 }
467 else ap[i] = value;
468 }
469 low = i + 1;
470 goto noinsert;
471 }
472 }
473 if (value == 0.0 && ignorezeroentries && row != col) goto noinsert;
474 if (nonew == 1) goto noinsert;
20
Assuming 'nonew' is not equal to 1
21
Taking false branch
42
Taking false branch
475 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
),475,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
22
Assuming the condition is false
23
Taking false branch
43
Taking false branch
476 if (A->structure_only) {
24
Taking true branch
44
Taking true branch
477 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),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0); ierr = PetscMallocA(1,PETSC_FALSE,477,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
(size_t)(new_nz)*sizeof(**(&new_j)),(&new_j));do {if (
__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001
),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = PetscMallocA(1,PETSC_FALSE,477
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->rmap->n+1)*sizeof(**(&new_i)),(&new_i
));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm
)0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); for (ii=0; ii<row+1; ii++) {new_i[
ii] = ai[ii];} for (ii=row+1; ii<A->rmap->n+1; ii++)
{new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((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),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); len = (new_nz - CHUNKSIZE - ai[row] -
nrow); ierr = ((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),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = MatSeqXAIJFreeAIJ(A,&Ain->
a,&Ain->j,&Ain->i);do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); Ain->a = ((void*)0); ai = Ain->
i = new_i; aj = Ain->j = new_j; Ain->singlemalloc = PETSC_FALSE
; Ain->free_a = PETSC_FALSE; rp = aj + ai[row]; rmax = imax
[row] = imax[row] + CHUNKSIZE; Ain->maxnz += 1*CHUNKSIZE; Ain
->reallocs++; }
;
478 } else {
479 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
),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0); ierr = PetscMallocA(3,PETSC_FALSE,479,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
(size_t)(1*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(A->
rmap->n+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),479,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); for (ii=0; ii<row+1; ii++) {new_i[
ii] = ai[ii];} for (ii=row+1; ii<A->rmap->n+1; ii++)
{new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((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),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); len = (new_nz - CHUNKSIZE - ai[row] -
nrow); ierr = ((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),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = ((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),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = 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
),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = ((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),479,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = MatSeqXAIJFreeAIJ(A,&Ain->
a,&Ain->j,&Ain->i);do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); 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++; }
;
480 }
481 N = nrow++ - 1; a->nz++; high++;
482 /* shift up all the later entries in this row */
483 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),483,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
484 rp[i] = col;
485 if (!A->structure_only){
25
Taking false branch
45
Assuming the condition is true
46
Taking true branch
486 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),486,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
487 ap[i] = value;
47
Array access (from variable 'ap') results in a null pointer dereference
488 }
489 low = i + 1;
490 A->nonzerostate++;
491noinsert:;
492 }
493 ailen[row] = nrow;
494 }
495 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
496}
497
498PetscErrorCode MatSetValues_SeqAIJ_SortedFull(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is)
499{
500 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
501 PetscInt *rp,k,row;
502 PetscInt *ai = a->i,*ailen = a->ilen;
503 PetscErrorCode ierr;
504 PetscInt *aj = a->j;
505 MatScalar *aa = a->a,*ap;
506
507 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 507; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
508 for (k=0; k<m; k++) { /* loop over added rows */
509 row = im[k];
510 rp = aj + ai[row];
511 ap = aa + ai[row];
512 if (!A->was_assembled) {
513 ierr = PetscMemcpy(rp,in,n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),513,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
514 }
515 if (!A->structure_only) {
516 if (v) {
517 ierr = PetscMemcpy(ap,v,n*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),517,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
518 v += n;
519 } else {
520 ierr = PetscMemzero(ap,n*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),520,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
521 }
522 }
523 ailen[row] = n;
524 a->nz += n;
525 }
526 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
527}
528
529
530PetscErrorCode MatGetValues_SeqAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],PetscScalar v[])
531{
532 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
533 PetscInt *rp,k,low,high,t,row,nrow,i,col,l,*aj = a->j;
534 PetscInt *ai = a->i,*ailen = a->ilen;
535 MatScalar *ap,*aa = a->a;
536
537 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 537; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
538 for (k=0; k<m; k++) { /* loop over rows */
539 row = im[k];
540 if (row < 0) {v += n; continue;} /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row: %D",row); */
541 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
),541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
542 rp = aj + ai[row]; ap = aa + ai[row];
543 nrow = ailen[row];
544 for (l=0; l<n; l++) { /* loop over columns */
545 if (in[l] < 0) {v++; continue;} /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column: %D",in[l]); */
546 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
),546,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
547 col = in[l];
548 high = nrow; low = 0; /* assume unsorted */
549 while (high-low > 5) {
550 t = (low+high)/2;
551 if (rp[t] > col) high = t;
552 else low = t;
553 }
554 for (i=low; i<high; i++) {
555 if (rp[i] > col) break;
556 if (rp[i] == col) {
557 *v++ = ap[i];
558 goto finished;
559 }
560 }
561 *v++ = 0.0;
562finished:;
563 }
564 }
565 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
566}
567
568
569PetscErrorCode MatView_SeqAIJ_Binary(Mat A,PetscViewer viewer)
570{
571 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
572 PetscErrorCode ierr;
573 PetscInt i,*col_lens;
574 int fd;
575 FILE *file;
576
577 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 577; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
578 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),578,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
579 ierr = PetscMalloc1(4+A->rmap->n,&col_lens)PetscMallocA(1,PETSC_FALSE,579,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(4+A->rmap->n)*sizeof(**(&col_lens)),(&
col_lens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),579,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
580
581 col_lens[0] = MAT_FILE_CLASSID1211216;
582 col_lens[1] = A->rmap->n;
583 col_lens[2] = A->cmap->n;
584 col_lens[3] = a->nz;
585
586 /* store lengths of each row and write (including header) to file */
587 for (i=0; i<A->rmap->n; i++) {
588 col_lens[4+i] = a->i[i+1] - a->i[i];
589 }
590 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),590,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
591 ierr = PetscFree(col_lens)((*PetscTrFree)((void*)(col_lens),591,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((col_lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),591,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
592
593 /* store column indices (zero start index) */
594 ierr = PetscBinaryWrite(fd,a->j,a->nz,PETSC_INT,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),594,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
595
596 /* store nonzero values */
597 ierr = PetscBinaryWrite(fd,a->a,a->nz,PETSC_SCALARPETSC_DOUBLE,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),597,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
598
599 ierr = PetscViewerBinaryGetInfoPointer(viewer,&file);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),599,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
600 if (file) {
601 fprintf(file,"-matload_block_size %d\n",(int)PetscAbs(A->rmap->bs)(((A->rmap->bs) >= 0) ? (A->rmap->bs) : (-(A->
rmap->bs)))
);
602 }
603 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
604}
605
606static PetscErrorCode MatView_SeqAIJ_ASCII_structonly(Mat A,PetscViewer viewer)
607{
608 PetscErrorCode ierr;
609 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
610 PetscInt i,k,m=A->rmap->N;
611
612 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 612; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
613 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
614 for (i=0; i<m; i++) {
615 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),615,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
616 for (k=a->i[i]; k<a->i[i+1]; k++) {
617 ierr = PetscViewerASCIIPrintf(viewer," (%D) ",a->j[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),617,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
618 }
619 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),619,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
620 }
621 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),621,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
622 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
623}
624
625extern PetscErrorCode MatSeqAIJFactorInfo_Matlab(Mat,PetscViewer);
626
627PetscErrorCode MatView_SeqAIJ_ASCII(Mat A,PetscViewer viewer)
628{
629 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
630 PetscErrorCode ierr;
631 PetscInt i,j,m = A->rmap->n;
632 const char *name;
633 PetscViewerFormat format;
634
635 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 635; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
636 if (A->structure_only) {
637 ierr = MatView_SeqAIJ_ASCII_structonly(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),637,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
638 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
639 }
640
641 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),641,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
642 if (format == PETSC_VIEWER_ASCII_MATLAB) {
643 PetscInt nofinalvalue = 0;
644 if (m && ((a->i[m] == a->i[m-1]) || (a->j[a->nz-1] != A->cmap->n-1))) {
645 /* Need a dummy value to ensure the dimension of the matrix. */
646 nofinalvalue = 1;
647 }
648 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
649 ierr = PetscViewerASCIIPrintf(viewer,"%% Size = %D %D \n",m,A->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),649,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
650 ierr = PetscViewerASCIIPrintf(viewer,"%% Nonzeros = %D \n",a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),650,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
651#if defined(PETSC_USE_COMPLEX)
652 ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,4);\n",a->nz+nofinalvalue);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),652,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
653#else
654 ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,3);\n",a->nz+nofinalvalue);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),654,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
655#endif
656 ierr = PetscViewerASCIIPrintf(viewer,"zzz = [\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),656,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
657
658 for (i=0; i<m; i++) {
659 for (j=a->i[i]; j<a->i[i+1]; j++) {
660#if defined(PETSC_USE_COMPLEX)
661 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),661,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
662#else
663 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),663,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
664#endif
665 }
666 }
667 if (nofinalvalue) {
668#if defined(PETSC_USE_COMPLEX)
669 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),669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
670#else
671 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),671,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
672#endif
673 }
674 ierr = PetscObjectGetName((PetscObject)A,&name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),674,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
675 ierr = PetscViewerASCIIPrintf(viewer,"];\n %s = spconvert(zzz);\n",name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),675,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
676 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),676,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
677 } else if (format == PETSC_VIEWER_ASCII_FACTOR_INFO || format == PETSC_VIEWER_ASCII_INFO) {
678 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
679 } else if (format == PETSC_VIEWER_ASCII_COMMON) {
680 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),680,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
681 for (i=0; i<m; i++) {
682 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),682,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
683 for (j=a->i[i]; j<a->i[i+1]; j++) {
684#if defined(PETSC_USE_COMPLEX)
685 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0 && PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
686 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),686,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
687 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0 && PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
688 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),688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
689 } else if (PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
690 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),690,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
691 }
692#else
693 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),693,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
694#endif
695 }
696 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
697 }
698 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
699 } else if (format == PETSC_VIEWER_ASCII_SYMMODU) {
700 PetscInt nzd=0,fshift=1,*sptr;
701 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),701,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
702 ierr = PetscMalloc1(m+1,&sptr)PetscMallocA(1,PETSC_FALSE,702,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m+1)*sizeof(**(&sptr)),(&sptr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),702,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
703 for (i=0; i<m; i++) {
704 sptr[i] = nzd+1;
705 for (j=a->i[i]; j<a->i[i+1]; j++) {
706 if (a->j[j] >= i) {
707#if defined(PETSC_USE_COMPLEX)
708 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) != 0.0 || PetscRealPart(a->a[j])(a->a[j]) != 0.0) nzd++;
709#else
710 if (a->a[j] != 0.0) nzd++;
711#endif
712 }
713 }
714 }
715 sptr[m] = nzd+1;
716 ierr = PetscViewerASCIIPrintf(viewer," %D %D\n\n",m,nzd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),716,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
717 for (i=0; i<m+1; i+=6) {
718 if (i+4<m) {
719 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),719,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
720 } else if (i+3<m) {
721 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),721,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
722 } else if (i+2<m) {
723 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),723,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
724 } else if (i+1<m) {
725 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),725,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
726 } else if (i<m) {
727 ierr = PetscViewerASCIIPrintf(viewer," %D %D\n",sptr[i],sptr[i+1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),727,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
728 } else {
729 ierr = PetscViewerASCIIPrintf(viewer," %D\n",sptr[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),729,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
730 }
731 }
732 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),732,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
733 ierr = PetscFree(sptr)((*PetscTrFree)((void*)(sptr),733,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((sptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),733,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
734 for (i=0; i<m; i++) {
735 for (j=a->i[i]; j<a->i[i+1]; j++) {
736 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),736,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
737 }
738 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),738,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
739 }
740 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),740,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
741 for (i=0; i<m; i++) {
742 for (j=a->i[i]; j<a->i[i+1]; j++) {
743 if (a->j[j] >= i) {
744#if defined(PETSC_USE_COMPLEX)
745 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) != 0.0 || PetscRealPart(a->a[j])(a->a[j]) != 0.0) {
746 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),746,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
747 }
748#else
749 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),749,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
750#endif
751 }
752 }
753 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),753,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
754 }
755 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),755,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
756 } else if (format == PETSC_VIEWER_ASCII_DENSE) {
757 PetscInt cnt = 0,jcnt;
758 PetscScalar value;
759#if defined(PETSC_USE_COMPLEX)
760 PetscBool realonly = PETSC_TRUE;
761
762 for (i=0; i<a->i[m]; i++) {
763 if (PetscImaginaryPart(a->a[i])((PetscReal)0.) != 0.0) {
764 realonly = PETSC_FALSE;
765 break;
766 }
767 }
768#endif
769
770 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),770,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
771 for (i=0; i<m; i++) {
772 jcnt = 0;
773 for (j=0; j<A->cmap->n; j++) {
774 if (jcnt < a->i[i+1]-a->i[i] && j == a->j[cnt]) {
775 value = a->a[cnt++];
776 jcnt++;
777 } else {
778 value = 0.0;
779 }
780#if defined(PETSC_USE_COMPLEX)
781 if (realonly) {
782 ierr = PetscViewerASCIIPrintf(viewer," %7.5e ",(double)PetscRealPart(value)(value));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),782,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
783 } else {
784 ierr = 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),784,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
785 }
786#else
787 ierr = PetscViewerASCIIPrintf(viewer," %7.5e ",(double)value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),787,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
788#endif
789 }
790 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),790,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
791 }
792 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
793 } else if (format == PETSC_VIEWER_ASCII_MATRIXMARKET) {
794 PetscInt fshift=1;
795 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),795,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
796#if defined(PETSC_USE_COMPLEX)
797 ierr = PetscViewerASCIIPrintf(viewer,"%%%%MatrixMarket matrix coordinate complex general\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),797,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
798#else
799 ierr = PetscViewerASCIIPrintf(viewer,"%%%%MatrixMarket matrix coordinate real general\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),799,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
800#endif
801 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),801,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
802 for (i=0; i<m; i++) {
803 for (j=a->i[i]; j<a->i[i+1]; j++) {
804#if defined(PETSC_USE_COMPLEX)
805 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),805,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
806#else
807 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),807,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
808#endif
809 }
810 }
811 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),811,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
812 } else {
813 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),813,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
814 if (A->factortype) {
815 for (i=0; i<m; i++) {
816 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),816,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
817 /* L part */
818 for (j=a->i[i]; j<a->i[i+1]; j++) {
819#if defined(PETSC_USE_COMPLEX)
820 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) {
821 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),821,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
822 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) {
823 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),823,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
824 } else {
825 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),825,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
826 }
827#else
828 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),828,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
829#endif
830 }
831 /* diagonal */
832 j = a->diag[i];
833#if defined(PETSC_USE_COMPLEX)
834 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) {
835 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),835,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
836 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) {
837 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),837,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
838 } else {
839 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),839,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
840 }
841#else
842 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),842,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
843#endif
844
845 /* U part */
846 for (j=a->diag[i+1]+1; j<a->diag[i]; j++) {
847#if defined(PETSC_USE_COMPLEX)
848 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) {
849 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),849,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
850 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) {
851 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),851,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
852 } else {
853 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),853,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
854 }
855#else
856 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),856,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
857#endif
858 }
859 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),859,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
860 }
861 } else {
862 for (i=0; i<m; i++) {
863 ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),863,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
864 for (j=a->i[i]; j<a->i[i+1]; j++) {
865#if defined(PETSC_USE_COMPLEX)
866 if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) {
867 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),867,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
868 } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) {
869 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),869,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
870 } else {
871 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),871,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
872 }
873#else
874 ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),874,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
875#endif
876 }
877 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
878 }
879 }
880 ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),880,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
881 }
882 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),882,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
883 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
884}
885
886#include <petscdraw.h>
887PetscErrorCode MatView_SeqAIJ_Draw_Zoom(PetscDraw draw,void *Aa)
888{
889 Mat A = (Mat) Aa;
890 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
891 PetscErrorCode ierr;
892 PetscInt i,j,m = A->rmap->n;
893 int color;
894 PetscReal xl,yl,xr,yr,x_l,x_r,y_l,y_r;
895 PetscViewer viewer;
896 PetscViewerFormat format;
897
898 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 898; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
899 ierr = PetscObjectQuery((PetscObject)A,"Zoomviewer",(PetscObject*)&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),899,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
900 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),900,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
901 ierr = PetscDrawGetCoordinates(draw,&xl,&yl,&xr,&yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),901,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
902
903 /* loop over matrix elements drawing boxes */
904
905 if (format != PETSC_VIEWER_DRAW_CONTOUR) {
906 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),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_isdrawx
) { _Petsc_ierr = PetscMemcpy(&_Petsc_jmpbuf,&PetscXIOErrorHandlerJumpBuf
,sizeof(_Petsc_jmpbuf));do {if (__builtin_expect(!!(_Petsc_ierr
),0)) {PetscError(((MPI_Comm)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_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),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct
+= PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw)
))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr
),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject
)(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr
) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect
(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),906,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack
&& petscstack->currentsize > 0) { petscstack->
currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0); } } } while(0);do {if (__builtin_expect(!!(_Petsc_ierr
),0)) {PetscError(((MPI_Comm)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0);} } do {} while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
907 /* Blue for negative, Cyan for zero and Red for positive */
908 color = PETSC_DRAW_BLUE5;
909 for (i=0; i<m; i++) {
910 y_l = m - i - 1.0; y_r = y_l + 1.0;
911 for (j=a->i[i]; j<a->i[i+1]; j++) {
912 x_l = a->j[j]; x_r = x_l + 1.0;
913 if (PetscRealPart(a->a[j])(a->a[j]) >= 0.) continue;
914 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),914,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
915 }
916 }
917 color = PETSC_DRAW_CYAN4;
918 for (i=0; i<m; i++) {
919 y_l = m - i - 1.0; y_r = y_l + 1.0;
920 for (j=a->i[i]; j<a->i[i+1]; j++) {
921 x_l = a->j[j]; x_r = x_l + 1.0;
922 if (a->a[j] != 0.) continue;
923 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),923,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
924 }
925 }
926 color = PETSC_DRAW_RED2;
927 for (i=0; i<m; i++) {
928 y_l = m - i - 1.0; y_r = y_l + 1.0;
929 for (j=a->i[i]; j<a->i[i+1]; j++) {
930 x_l = a->j[j]; x_r = x_l + 1.0;
931 if (PetscRealPart(a->a[j])(a->a[j]) <= 0.) continue;
932 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),932,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
933 }
934 }
935 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),935,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct
+= PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw)
))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr
),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject
)(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),935,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr
) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect
(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),935,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack
&& petscstack->currentsize > 0) { petscstack->
currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0); } } } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),935,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
936 } else {
937 /* use contour shading to indicate magnitude of values */
938 /* first determine max of all nonzero values */
939 PetscReal minv = 0.0, maxv = 0.0;
940 PetscInt nz = a->nz, count = 0;
941 PetscDraw popup;
942
943 for (i=0; i<nz; i++) {
944 if (PetscAbsScalar(a->a[i]) > maxv) maxv = PetscAbsScalar(a->a[i]);
945 }
946 if (minv >= maxv) maxv = minv + PETSC_SMALL1.e-10;
947 ierr = PetscDrawGetPopup(draw,&popup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),947,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
948 ierr = PetscDrawScalePopup(popup,minv,maxv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),948,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
949
950 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),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_isdrawx
) { _Petsc_ierr = PetscMemcpy(&_Petsc_jmpbuf,&PetscXIOErrorHandlerJumpBuf
,sizeof(_Petsc_jmpbuf));do {if (__builtin_expect(!!(_Petsc_ierr
),0)) {PetscError(((MPI_Comm)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_xioerrhdl =
PetscSetXIOErrorHandler(PetscXIOErrorHandlerJump); if (_setjmp
(PetscXIOErrorHandlerJumpBuf)) {_Petsc_xioerr_local = PETSC_TRUE
; do {_Petsc_ierr = 0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler
(_Petsc_xioerrhdl); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf
,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do {
if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct
+= PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw)
))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr
),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject
)(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr
) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect
(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),950,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack
&& petscstack->currentsize > 0) { petscstack->
currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0); } } } while(0);do {if (__builtin_expect(!!(_Petsc_ierr
),0)) {PetscError(((MPI_Comm)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0);} } do {} while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
951 for (i=0; i<m; i++) {
952 y_l = m - i - 1.0;
953 y_r = y_l + 1.0;
954 for (j=a->i[i]; j<a->i[i+1]; j++) {
955 x_l = a->j[j];
956 x_r = x_l + 1.0;
957 color = PetscDrawRealToColor(PetscAbsScalar(a->a[count]),minv,maxv);
958 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),958,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
959 count++;
960 }
961 }
962 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),962,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct
+= PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw)
))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr
),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject
)(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError
(((MPI_Comm)0x44000001),962,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr
) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect
(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),962,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm
((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack
&& petscstack->currentsize > 0) { petscstack->
currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0); } } } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),962,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
963 }
964 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
965}
966
967#include <petscdraw.h>
968PetscErrorCode MatView_SeqAIJ_Draw(Mat A,PetscViewer viewer)
969{
970 PetscErrorCode ierr;
971 PetscDraw draw;
972 PetscReal xr,yr,xl,yl,h,w;
973 PetscBool isnull;
974
975 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 975; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
976 ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),976,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
977 ierr = PetscDrawIsNull(draw,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),977,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
978 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)
;
979
980 xr = A->cmap->n; yr = A->rmap->n; h = yr/10.0; w = xr/10.0;
981 xr += w; yr += h; xl = -w; yl = -h;
982 ierr = PetscDrawSetCoordinates(draw,xl,yl,xr,yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),982,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
983 ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",(PetscObject)viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),983,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
984 ierr = PetscDrawZoom(draw,MatView_SeqAIJ_Draw_Zoom,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),984,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
985 ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),985,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
986 ierr = PetscDrawSave(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),986,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
987 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
988}
989
990PetscErrorCode MatView_SeqAIJ(Mat A,PetscViewer viewer)
991{
992 PetscErrorCode ierr;
993 PetscBool iascii,isbinary,isdraw;
994
995 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 995; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
996 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
997 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
998 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),998,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
999 if (iascii) {
1000 ierr = MatView_SeqAIJ_ASCII(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1000,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1001 } else if (isbinary) {
1002 ierr = MatView_SeqAIJ_Binary(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1002,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1003 } else if (isdraw) {
1004 ierr = MatView_SeqAIJ_Draw(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1004,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1005 }
1006 ierr = MatView_SeqAIJ_Inode(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1006,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1007 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1008}
1009
1010PetscErrorCode MatAssemblyEnd_SeqAIJ(Mat A,MatAssemblyType mode)
1011{
1012 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1013 PetscErrorCode ierr;
1014 PetscInt fshift = 0,i,*ai = a->i,*aj = a->j,*imax = a->imax;
1015 PetscInt m = A->rmap->n,*ip,N,*ailen = a->ilen,rmax = 0;
1016 MatScalar *aa = a->a,*ap;
1017 PetscReal ratio = 0.6;
1018
1019 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1019; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1020 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)
;
1021 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1021,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1022 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)
;
1023
1024 if (m) rmax = ailen[0]; /* determine row with most nonzeros */
1025 for (i=1; i<m; i++) {
1026 /* move each row back by the amount of empty slots (fshift) before it*/
1027 fshift += imax[i-1] - ailen[i-1];
1028 rmax = PetscMax(rmax,ailen[i])(((rmax)<(ailen[i])) ? (ailen[i]) : (rmax));
1029 if (fshift) {
1030 ip = aj + ai[i];
1031 ap = aa + ai[i];
1032 N = ailen[i];
1033 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),1033,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1034 if (!A->structure_only) {
1035 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),1035,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1036 }
1037 }
1038 ai[i] = ai[i-1] + ailen[i-1];
1039 }
1040 if (m) {
1041 fshift += imax[m-1] - ailen[m-1];
1042 ai[m] = ai[m-1] + ailen[m-1];
1043 }
1044
1045 /* reset ilen and imax for each row */
1046 a->nonzerorowcnt = 0;
1047 if (A->structure_only) {
1048 ierr = PetscFree(a->imax)((*PetscTrFree)((void*)(a->imax),1048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->imax) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1049 ierr = PetscFree(a->ilen)((*PetscTrFree)((void*)(a->ilen),1049,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->ilen) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1049,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1050 } else { /* !A->structure_only */
1051 for (i=0; i<m; i++) {
1052 ailen[i] = imax[i] = ai[i+1] - ai[i];
1053 a->nonzerorowcnt += ((ai[i+1] - ai[i]) > 0);
1054 }
1055 }
1056 a->nz = ai[m];
1057 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
),1057,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
77);}} while (0)
;
1058
1059 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1059,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1060 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),1060,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1061 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),1061,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1062 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),1062,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1063
1064 A->info.mallocs += a->reallocs;
1065 a->reallocs = 0;
1066 A->info.nz_unneeded = (PetscReal)fshift;
1067 a->rmax = rmax;
1068
1069 if (!A->structure_only) {
1070 ierr = MatCheckCompressedRow(A,a->nonzerorowcnt,&a->compressedrow,a->i,m,ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1070,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1071 }
1072 ierr = MatAssemblyEnd_SeqAIJ_Inode(A,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1072,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1073 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1074}
1075
1076PetscErrorCode MatRealPart_SeqAIJ(Mat A)
1077{
1078 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1079 PetscInt i,nz = a->nz;
1080 MatScalar *aa = a->a;
1081 PetscErrorCode ierr;
1082
1083 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1083; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1084 for (i=0; i<nz; i++) aa[i] = PetscRealPart(aa[i])(aa[i]);
1085 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1085,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1086 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1087}
1088
1089PetscErrorCode MatImaginaryPart_SeqAIJ(Mat A)
1090{
1091 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1092 PetscInt i,nz = a->nz;
1093 MatScalar *aa = a->a;
1094 PetscErrorCode ierr;
1095
1096 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1096; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1097 for (i=0; i<nz; i++) aa[i] = PetscImaginaryPart(aa[i])((PetscReal)0.);
1098 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1098,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1099 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1100}
1101
1102PetscErrorCode MatZeroEntries_SeqAIJ(Mat A)
1103{
1104 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1105 PetscErrorCode ierr;
1106
1107 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1107; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1108 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),1108,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1109 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1109,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1110 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; 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 MatDestroy_SeqAIJ(Mat A)
1114{
1115 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1116 PetscErrorCode ierr;
1117
1118 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1118; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1119#if defined(PETSC_USE_LOG1)
1120 PetscLogObjectState((PetscObject)A,"Rows=%D, Cols=%D, NZ=%D",A->rmap->n,A->cmap->n,a->nz);
1121#endif
1122 ierr = MatSeqXAIJFreeAIJ(A,&a->a,&a->j,&a->i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1122,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1123 ierr = ISDestroy(&a->row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1123,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1124 ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1124,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1125 ierr = PetscFree(a->diag)((*PetscTrFree)((void*)(a->diag),1125,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->diag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1125,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1126 ierr = PetscFree(a->ibdiag)((*PetscTrFree)((void*)(a->ibdiag),1126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->ibdiag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1127 ierr = PetscFree(a->imax)((*PetscTrFree)((void*)(a->imax),1127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->imax) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1128 ierr = PetscFree(a->ilen)((*PetscTrFree)((void*)(a->ilen),1128,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->ilen) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1128,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1129 ierr = PetscFree(a->ipre)((*PetscTrFree)((void*)(a->ipre),1129,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->ipre) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1129,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1130 ierr = PetscFree3(a->idiag,a->mdiag,a->ssor_work)PetscFreeA(3,1130,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(a->idiag),&(a->mdiag),&(a->ssor_work)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1130,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1131 ierr = PetscFree(a->solve_work)((*PetscTrFree)((void*)(a->solve_work),1131,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->solve_work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1131,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1132 ierr = ISDestroy(&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1132,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1133 ierr = PetscFree(a->saved_values)((*PetscTrFree)((void*)(a->saved_values),1133,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((a->saved_values) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1133,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1134 ierr = ISColoringDestroy(&a->coloring);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1134,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1135 ierr = PetscFree2(a->compressedrow.i,a->compressedrow.rindex)PetscFreeA(2,1135,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(a->compressedrow.i),&(a->compressedrow.rindex
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1135,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1136 ierr = PetscFree(a->matmult_abdense)((*PetscTrFree)((void*)(a->matmult_abdense),1136,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c") ||
((a->matmult_abdense) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1136,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1137
1138 ierr = MatDestroy_SeqAIJ_Inode(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1138,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1139 ierr = PetscFree(A->data)((*PetscTrFree)((void*)(A->data),1139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((A->data) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1140
1141 ierr = PetscObjectChangeTypeName((PetscObject)A,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1141,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1142 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),1142,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1143 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),1143,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1144 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),1144,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1145 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),1145,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1146 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),1146,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1147 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),1147,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1148#if defined(PETSC_HAVE_ELEMENTAL)
1149 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),1149,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1150#endif
1151#if defined(PETSC_HAVE_HYPRE)
1152 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),1152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1153 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),1153,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1154#endif
1155 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),1155,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1156 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),1156,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1157 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),1157,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1158 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),1158,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1159 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),1159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1160 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),1160,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1161 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),1161,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1162 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),1162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1163 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),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1164 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1165}
1166
1167PetscErrorCode MatSetOption_SeqAIJ(Mat A,MatOption op,PetscBool flg)
1168{
1169 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1170 PetscErrorCode ierr;
1171
1172 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1172; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1173 switch (op) {
1174 case MAT_ROW_ORIENTED:
1175 a->roworiented = flg;
1176 break;
1177 case MAT_KEEP_NONZERO_PATTERN:
1178 a->keepnonzeropattern = flg;
1179 break;
1180 case MAT_NEW_NONZERO_LOCATIONS:
1181 a->nonew = (flg ? 0 : 1);
1182 break;
1183 case MAT_NEW_NONZERO_LOCATION_ERR:
1184 a->nonew = (flg ? -1 : 0);
1185 break;
1186 case MAT_NEW_NONZERO_ALLOCATION_ERR:
1187 a->nonew = (flg ? -2 : 0);
1188 break;
1189 case MAT_UNUSED_NONZERO_LOCATION_ERR:
1190 a->nounused = (flg ? -1 : 0);
1191 break;
1192 case MAT_IGNORE_ZERO_ENTRIES:
1193 a->ignorezeroentries = flg;
1194 break;
1195 case MAT_SPD:
1196 case MAT_SYMMETRIC:
1197 case MAT_STRUCTURALLY_SYMMETRIC:
1198 case MAT_HERMITIAN:
1199 case MAT_SYMMETRY_ETERNAL:
1200 case MAT_STRUCTURE_ONLY:
1201 /* These options are handled directly by MatSetOption() */
1202 break;
1203 case MAT_NEW_DIAGONALS:
1204 case MAT_IGNORE_OFF_PROC_ENTRIES:
1205 case MAT_USE_HASH_TABLE:
1206 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),1206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1207 break;
1208 case MAT_USE_INODES:
1209 /* Not an error because MatSetOption_SeqAIJ_Inode handles this one */
1210 break;
1211 case MAT_SUBMAT_SINGLEIS:
1212 A->submat_singleis = flg;
1213 break;
1214 case MAT_SORTED_FULL:
1215 if (flg) A->ops->setvalues = MatSetValues_SeqAIJ_SortedFull;
1216 else A->ops->setvalues = MatSetValues_SeqAIJ;
1217 break;
1218 default:
1219 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unknown option %d",op)return PetscError(((MPI_Comm)0x44000001),1219,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"unknown option %d",op)
;
1220 }
1221 ierr = MatSetOption_SeqAIJ_Inode(A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1222 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1223}
1224
1225PetscErrorCode MatGetDiagonal_SeqAIJ(Mat A,Vec v)
1226{
1227 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1228 PetscErrorCode ierr;
1229 PetscInt i,j,n,*ai=a->i,*aj=a->j;
1230 PetscScalar *aa=a->a,*x;
1231
1232 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1232; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1233 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1233,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1234 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),1234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
1235
1236 if (A->factortype == MAT_FACTOR_ILU || A->factortype == MAT_FACTOR_LU) {
1237 PetscInt *diag=a->diag;
1238 ierr = VecGetArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1239 for (i=0; i<n; i++) x[i] = 1.0/aa[diag[i]];
1240 ierr = VecRestoreArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1240,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1241 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1242 }
1243
1244 ierr = VecGetArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1244,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1245 for (i=0; i<n; i++) {
1246 x[i] = 0.0;
1247 for (j=ai[i]; j<ai[i+1]; j++) {
1248 if (aj[j] == i) {
1249 x[i] = aa[j];
1250 break;
1251 }
1252 }
1253 }
1254 ierr = VecRestoreArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1254,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1255 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1256}
1257
1258#include <../src/mat/impls/aij/seq/ftn-kernels/fmult.h>
1259PetscErrorCode MatMultTransposeAdd_SeqAIJ(Mat A,Vec xx,Vec zz,Vec yy)
1260{
1261 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1262 PetscScalar *y;
1263 const PetscScalar *x;
1264 PetscErrorCode ierr;
1265 PetscInt m = A->rmap->n;
1266#if !defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ)
1267 const MatScalar *v;
1268 PetscScalar alpha;
1269 PetscInt n,i,j;
1270 const PetscInt *idx,*ii,*ridx=NULL((void*)0);
1271 Mat_CompressedRow cprow = a->compressedrow;
1272 PetscBool usecprow = cprow.use;
1273#endif
1274
1275 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1275; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1276 if (zz != yy) {ierr = VecCopy(zz,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1276,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1277 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1277,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1278 ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1278,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1279
1280#if defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ)
1281 fortranmulttransposeaddaij_(&m,x,a->i,a->j,a->a,y);
1282#else
1283 if (usecprow) {
1284 m = cprow.nrows;
1285 ii = cprow.i;
1286 ridx = cprow.rindex;
1287 } else {
1288 ii = a->i;
1289 }
1290 for (i=0; i<m; i++) {
1291 idx = a->j + ii[i];
1292 v = a->a + ii[i];
1293 n = ii[i+1] - ii[i];
1294 if (usecprow) {
1295 alpha = x[ridx[i]];
1296 } else {
1297 alpha = x[i];
1298 }
1299 for (j=0; j<n; j++) y[idx[j]] += alpha*v[j];
1300 }
1301#endif
1302 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1302,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1303 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1303,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1304 ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1305 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1306}
1307
1308PetscErrorCode MatMultTranspose_SeqAIJ(Mat A,Vec xx,Vec yy)
1309{
1310 PetscErrorCode ierr;
1311
1312 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1312; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1313 ierr = VecSet(yy,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1313,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1314 ierr = MatMultTransposeAdd_SeqAIJ(A,xx,yy,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1314,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1315 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1316}
1317
1318#include <../src/mat/impls/aij/seq/ftn-kernels/fmult.h>
1319
1320PetscErrorCode MatMult_SeqAIJ(Mat A,Vec xx,Vec yy)
1321{
1322 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1323 PetscScalar *y;
1324 const PetscScalar *x;
1325 const MatScalar *aa;
1326 PetscErrorCode ierr;
1327 PetscInt m=A->rmap->n;
1328 const PetscInt *aj,*ii,*ridx=NULL((void*)0);
1329 PetscInt n,i;
1330 PetscScalar sum;
1331 PetscBool usecprow=a->compressedrow.use;
1332
1333#if defined(PETSC_HAVE_PRAGMA_DISJOINT)
1334#pragma disjoint(*x,*y,*aa)
1335#endif
1336
1337 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1337; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1338 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1338,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1339 ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1339,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1340 ii = a->i;
1341 if (usecprow) { /* use compressed row format */
1342 ierr = PetscArrayzero(y,m)PetscMemzero(y,(m)*sizeof(*(y)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1342,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1343 m = a->compressedrow.nrows;
1344 ii = a->compressedrow.i;
1345 ridx = a->compressedrow.rindex;
1346 for (i=0; i<m; i++) {
1347 n = ii[i+1] - ii[i];
1348 aj = a->j + ii[i];
1349 aa = a->a + ii[i];
1350 sum = 0.0;
1351 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1352 /* for (j=0; j<n; j++) sum += (*aa++)*x[*aj++]; */
1353 y[*ridx++] = sum;
1354 }
1355 } else { /* do not use compressed row format */
1356#if defined(PETSC_USE_FORTRAN_KERNEL_MULTAIJ)
1357 aj = a->j;
1358 aa = a->a;
1359 fortranmultaij_(&m,x,ii,aj,aa,y);
1360#else
1361 for (i=0; i<m; i++) {
1362 n = ii[i+1] - ii[i];
1363 aj = a->j + ii[i];
1364 aa = a->a + ii[i];
1365 sum = 0.0;
1366 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1367 y[i] = sum;
1368 }
1369#endif
1370 }
1371 ierr = PetscLogFlops(2.0*a->nz - a->nonzerorowcnt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1371,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1372 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1372,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1373 ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1373,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1374 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1375}
1376
1377PetscErrorCode MatMultMax_SeqAIJ(Mat A,Vec xx,Vec yy)
1378{
1379 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1380 PetscScalar *y;
1381 const PetscScalar *x;
1382 const MatScalar *aa;
1383 PetscErrorCode ierr;
1384 PetscInt m=A->rmap->n;
1385 const PetscInt *aj,*ii,*ridx=NULL((void*)0);
1386 PetscInt n,i,nonzerorow=0;
1387 PetscScalar sum;
1388 PetscBool usecprow=a->compressedrow.use;
1389
1390#if defined(PETSC_HAVE_PRAGMA_DISJOINT)
1391#pragma disjoint(*x,*y,*aa)
1392#endif
1393
1394 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1394; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1395 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1395,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1396 ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1396,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1397 if (usecprow) { /* use compressed row format */
1398 m = a->compressedrow.nrows;
1399 ii = a->compressedrow.i;
1400 ridx = a->compressedrow.rindex;
1401 for (i=0; i<m; i++) {
1402 n = ii[i+1] - ii[i];
1403 aj = a->j + ii[i];
1404 aa = a->a + ii[i];
1405 sum = 0.0;
1406 nonzerorow += (n>0);
1407 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)
));}
;
1408 /* for (j=0; j<n; j++) sum += (*aa++)*x[*aj++]; */
1409 y[*ridx++] = sum;
1410 }
1411 } else { /* do not use compressed row format */
1412 ii = a->i;
1413 for (i=0; i<m; i++) {
1414 n = ii[i+1] - ii[i];
1415 aj = a->j + ii[i];
1416 aa = a->a + ii[i];
1417 sum = 0.0;
1418 nonzerorow += (n>0);
1419 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)
));}
;
1420 y[i] = sum;
1421 }
1422 }
1423 ierr = PetscLogFlops(2.0*a->nz - nonzerorow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1423,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1424 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1424,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1425 ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1425,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1426 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1427}
1428
1429PetscErrorCode MatMultAddMax_SeqAIJ(Mat A,Vec xx,Vec yy,Vec zz)
1430{
1431 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1432 PetscScalar *y,*z;
1433 const PetscScalar *x;
1434 const MatScalar *aa;
1435 PetscErrorCode ierr;
1436 PetscInt m = A->rmap->n,*aj,*ii;
1437 PetscInt n,i,*ridx=NULL((void*)0);
1438 PetscScalar sum;
1439 PetscBool usecprow=a->compressedrow.use;
1440
1441 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1441; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1442 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1442,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1443 ierr = VecGetArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1443,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1444 if (usecprow) { /* use compressed row format */
1445 if (zz != yy) {
1446 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),1446,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1447 }
1448 m = a->compressedrow.nrows;
1449 ii = a->compressedrow.i;
1450 ridx = a->compressedrow.rindex;
1451 for (i=0; i<m; i++) {
1452 n = ii[i+1] - ii[i];
1453 aj = a->j + ii[i];
1454 aa = a->a + ii[i];
1455 sum = y[*ridx];
1456 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)
));}
;
1457 z[*ridx++] = sum;
1458 }
1459 } else { /* do not use compressed row format */
1460 ii = a->i;
1461 for (i=0; i<m; i++) {
1462 n = ii[i+1] - ii[i];
1463 aj = a->j + ii[i];
1464 aa = a->a + ii[i];
1465 sum = y[i];
1466 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)
));}
;
1467 z[i] = sum;
1468 }
1469 }
1470 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1471 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1471,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1472 ierr = VecRestoreArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1472,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1473 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1474}
1475
1476#include <../src/mat/impls/aij/seq/ftn-kernels/fmultadd.h>
1477PetscErrorCode MatMultAdd_SeqAIJ(Mat A,Vec xx,Vec yy,Vec zz)
1478{
1479 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1480 PetscScalar *y,*z;
1481 const PetscScalar *x;
1482 const MatScalar *aa;
1483 PetscErrorCode ierr;
1484 const PetscInt *aj,*ii,*ridx=NULL((void*)0);
1485 PetscInt m = A->rmap->n,n,i;
1486 PetscScalar sum;
1487 PetscBool usecprow=a->compressedrow.use;
1488
1489 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1489; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1490 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1490,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1491 ierr = VecGetArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1492 if (usecprow) { /* use compressed row format */
1493 if (zz != yy) {
1494 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),1494,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1495 }
1496 m = a->compressedrow.nrows;
1497 ii = a->compressedrow.i;
1498 ridx = a->compressedrow.rindex;
1499 for (i=0; i<m; i++) {
1500 n = ii[i+1] - ii[i];
1501 aj = a->j + ii[i];
1502 aa = a->a + ii[i];
1503 sum = y[*ridx];
1504 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1505 z[*ridx++] = sum;
1506 }
1507 } else { /* do not use compressed row format */
1508 ii = a->i;
1509#if defined(PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ)
1510 aj = a->j;
1511 aa = a->a;
1512 fortranmultaddaij_(&m,x,ii,aj,aa,y,z);
1513#else
1514 for (i=0; i<m; i++) {
1515 n = ii[i+1] - ii[i];
1516 aj = a->j + ii[i];
1517 aa = a->a + ii[i];
1518 sum = y[i];
1519 PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] *
x[aj[__i]];}
;
1520 z[i] = sum;
1521 }
1522#endif
1523 }
1524 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1524,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1525 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1525,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1526 ierr = VecRestoreArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1526,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1527 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1528}
1529
1530/*
1531 Adds diagonal pointers to sparse matrix structure.
1532*/
1533PetscErrorCode MatMarkDiagonal_SeqAIJ(Mat A)
1534{
1535 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1536 PetscErrorCode ierr;
1537 PetscInt i,j,m = A->rmap->n;
1538
1539 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1539; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1540 if (!a->diag) {
1541 ierr = PetscMalloc1(m,&a->diag)PetscMallocA(1,PETSC_FALSE,1541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&a->diag)),(&a->diag))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1542 ierr = PetscLogObjectMemory((PetscObject)A, m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1542,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1543 }
1544 for (i=0; i<A->rmap->n; i++) {
1545 a->diag[i] = a->i[i+1];
1546 for (j=a->i[i]; j<a->i[i+1]; j++) {
1547 if (a->j[j] == i) {
1548 a->diag[i] = j;
1549 break;
1550 }
1551 }
1552 }
1553 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1554}
1555
1556PetscErrorCode MatShift_SeqAIJ(Mat A,PetscScalar v)
1557{
1558 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1559 const PetscInt *diag = (const PetscInt*)a->diag;
1560 const PetscInt *ii = (const PetscInt*) a->i;
1561 PetscInt i,*mdiag = NULL((void*)0);
1562 PetscErrorCode ierr;
1563 PetscInt cnt = 0; /* how many diagonals are missing */
1564
1565 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1565; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1566 if (!A->preallocated || !a->nz) {
1567 ierr = MatSeqAIJSetPreallocation(A,1,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1567,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1568 ierr = MatShift_Basic(A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1569 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1570 }
1571
1572 if (a->diagonaldense) {
1573 cnt = 0;
1574 } else {
1575 ierr = PetscCalloc1(A->rmap->n,&mdiag)PetscMallocA(1,PETSC_TRUE,1575,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->rmap->n)*sizeof(**(&mdiag)),(&mdiag
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1575,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1576 for (i=0; i<A->rmap->n; i++) {
1577 if (diag[i] >= ii[i+1]) {
1578 cnt++;
1579 mdiag[i] = 1;
1580 }
1581 }
1582 }
1583 if (!cnt) {
1584 ierr = MatShift_Basic(A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1584,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1585 } else {
1586 PetscScalar *olda = a->a; /* preserve pointers to current matrix nonzeros structure and values */
1587 PetscInt *oldj = a->j, *oldi = a->i;
1588 PetscBool singlemalloc = a->singlemalloc,free_a = a->free_a,free_ij = a->free_ij;
1589
1590 a->a = NULL((void*)0);
1591 a->j = NULL((void*)0);
1592 a->i = NULL((void*)0);
1593 /* increase the values in imax for each row where a diagonal is being inserted then reallocate the matrix data structures */
1594 for (i=0; i<A->rmap->n; i++) {
1595 a->imax[i] += mdiag[i];
1596 a->imax[i] = PetscMin(a->imax[i],A->cmap->n)(((a->imax[i])<(A->cmap->n)) ? (a->imax[i]) : (
A->cmap->n))
;
1597 }
1598 ierr = MatSeqAIJSetPreallocation_SeqAIJ(A,0,a->imax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1598,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1599
1600 /* copy old values into new matrix data structure */
1601 for (i=0; i<A->rmap->n; i++) {
1602 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),1602,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1603 if (i < A->cmap->n) {
1604 ierr = MatSetValue(A,i,i,v,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1605 }
1606 }
1607 ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1607,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1608 ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1608,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1609 if (singlemalloc) {
1610 ierr = PetscFree3(olda,oldj,oldi)PetscFreeA(3,1610,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(olda),&(oldj),&(oldi))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1610,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1611 } else {
1612 if (free_a) {ierr = PetscFree(olda)((*PetscTrFree)((void*)(olda),1612,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((olda) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1612,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1613 if (free_ij) {ierr = PetscFree(oldj)((*PetscTrFree)((void*)(oldj),1613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((oldj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1614 if (free_ij) {ierr = PetscFree(oldi)((*PetscTrFree)((void*)(oldi),1614,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((oldi) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1614,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1615 }
1616 }
1617 ierr = PetscFree(mdiag)((*PetscTrFree)((void*)(mdiag),1617,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((mdiag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1617,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1618 a->diagonaldense = PETSC_TRUE;
1619 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1620}
1621
1622/*
1623 Checks for missing diagonals
1624*/
1625PetscErrorCode MatMissingDiagonal_SeqAIJ(Mat A,PetscBool *missing,PetscInt *d)
1626{
1627 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1628 PetscInt *diag,*ii = a->i,i;
1629 PetscErrorCode ierr;
1630
1631 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1631; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1632 *missing = PETSC_FALSE;
1633 if (A->rmap->n > 0 && !ii) {
1634 *missing = PETSC_TRUE;
1635 if (d) *d = 0;
1636 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),1636,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1637 } else {
1638 diag = a->diag;
1639 for (i=0; i<A->rmap->n; i++) {
1640 if (diag[i] >= ii[i+1]) {
1641 *missing = PETSC_TRUE;
1642 if (d) *d = i;
1643 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),1643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1644 break;
1645 }
1646 }
1647 }
1648 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1649}
1650
1651#include <petscblaslapack.h>
1652#include <petsc/private/kernels/blockinvert.h>
1653
1654/*
1655 Note that values is allocated externally by the PC and then passed into this routine
1656*/
1657PetscErrorCode MatInvertVariableBlockDiagonal_SeqAIJ(Mat A,PetscInt nblocks,const PetscInt *bsizes,PetscScalar *diag)
1658{
1659 PetscErrorCode ierr;
1660 PetscInt n = A->rmap->n, i, ncnt = 0, *indx,j,bsizemax = 0,*v_pivots;
1661 PetscBool allowzeropivot,zeropivotdetected=PETSC_FALSE;
1662 const PetscReal shift = 0.0;
1663 PetscInt ipvt[5];
1664 PetscScalar work[25],*v_work;
1665
1666 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1666; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1667 allowzeropivot = PetscNot(A->erroriffailure)((A->erroriffailure) ? PETSC_FALSE : PETSC_TRUE);
1668 for (i=0; i<nblocks; i++) ncnt += bsizes[i];
1669 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
),1669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
60);}} while (0)
;
1670 for (i=0; i<nblocks; i++) {
1671 bsizemax = PetscMax(bsizemax,bsizes[i])(((bsizemax)<(bsizes[i])) ? (bsizes[i]) : (bsizemax));
1672 }
1673 ierr = PetscMalloc1(bsizemax,&indx)PetscMallocA(1,PETSC_FALSE,1673,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(bsizemax)*sizeof(**(&indx)),(&indx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1673,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1674 if (bsizemax > 7) {
1675 ierr = PetscMalloc2(bsizemax,&v_work,bsizemax,&v_pivots)PetscMallocA(2,PETSC_FALSE,1675,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(bsizemax)*sizeof(**(&v_work)),(&v_work),(size_t
)(bsizemax)*sizeof(**(&v_pivots)),(&v_pivots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1675,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1676 }
1677 ncnt = 0;
1678 for (i=0; i<nblocks; i++) {
1679 for (j=0; j<bsizes[i]; j++) indx[j] = ncnt+j;
1680 ierr = MatGetValues(A,bsizes[i],indx,bsizes[i],indx,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1680,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1681 switch (bsizes[i]) {
1682 case 1:
1683 *diag = 1.0/(*diag);
1684 break;
1685 case 2:
1686 ierr = PetscKernel_A_gets_inverse_A_2(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1686,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1687 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1688 ierr = PetscKernel_A_gets_transpose_A_2(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1689 break;
1690 case 3:
1691 ierr = PetscKernel_A_gets_inverse_A_3(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1691,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1692 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1693 ierr = PetscKernel_A_gets_transpose_A_3(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1693,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1694 break;
1695 case 4:
1696 ierr = PetscKernel_A_gets_inverse_A_4(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1697 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1698 ierr = PetscKernel_A_gets_transpose_A_4(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1699 break;
1700 case 5:
1701 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),1701,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1702 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1703 ierr = PetscKernel_A_gets_transpose_A_5(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1703,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1704 break;
1705 case 6:
1706 ierr = PetscKernel_A_gets_inverse_A_6(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1706,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1707 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1708 ierr = PetscKernel_A_gets_transpose_A_6(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1708,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1709 break;
1710 case 7:
1711 ierr = PetscKernel_A_gets_inverse_A_7(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1711,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1712 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1713 ierr = PetscKernel_A_gets_transpose_A_7(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1713,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1714 break;
1715 default:
1716 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),1716,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1717 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1718 ierr = PetscKernel_A_gets_transpose_A_N(diag,bsizes[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1718,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1719 }
1720 ncnt += bsizes[i];
1721 diag += bsizes[i]*bsizes[i];
1722 }
1723 if (bsizemax > 7) {
1724 ierr = PetscFree2(v_work,v_pivots)PetscFreeA(2,1724,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(v_work),&(v_pivots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1724,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1725 }
1726 ierr = PetscFree(indx)((*PetscTrFree)((void*)(indx),1726,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((indx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1726,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1727 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1728}
1729
1730/*
1731 Negative shift indicates do not generate an error if there is a zero diagonal, just invert it anyways
1732*/
1733PetscErrorCode MatInvertDiagonal_SeqAIJ(Mat A,PetscScalar omega,PetscScalar fshift)
1734{
1735 Mat_SeqAIJ *a = (Mat_SeqAIJ*) A->data;
1736 PetscErrorCode ierr;
1737 PetscInt i,*diag,m = A->rmap->n;
1738 MatScalar *v = a->a;
1739 PetscScalar *idiag,*mdiag;
1740
1741 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1741; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1742 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)
;
1743 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1743,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1744 diag = a->diag;
1745 if (!a->idiag) {
1746 ierr = PetscMalloc3(m,&a->idiag,m,&a->mdiag,m,&a->ssor_work)PetscMallocA(3,PETSC_FALSE,1746,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&a->idiag)),(&a->idiag),
(size_t)(m)*sizeof(**(&a->mdiag)),(&a->mdiag),(
size_t)(m)*sizeof(**(&a->ssor_work)),(&a->ssor_work
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1746,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1747 ierr = PetscLogObjectMemory((PetscObject)A, 3*m*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1747,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1748 v = a->a;
1749 }
1750 mdiag = a->mdiag;
1751 idiag = a->idiag;
1752
1753 if (omega == 1.0 && PetscRealPart(fshift)(fshift) <= 0.0) {
1754 for (i=0; i<m; i++) {
1755 mdiag[i] = v[diag[i]];
1756 if (!PetscAbsScalar(mdiag[i])) { /* zero diagonal */
1757 if (PetscRealPart(fshift)(fshift)) {
1758 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),1758,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1759 A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
1760 A->factorerror_zeropivot_value = 0.0;
1761 A->factorerror_zeropivot_row = i;
1762 } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Zero diagonal on row %D",i)return PetscError(((MPI_Comm)0x44000001),1762,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,75,PETSC_ERROR_INITIAL,"Zero diagonal on row %D",i)
;
1763 }
1764 idiag[i] = 1.0/v[diag[i]];
1765 }
1766 ierr = PetscLogFlops(m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1766,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1767 } else {
1768 for (i=0; i<m; i++) {
1769 mdiag[i] = v[diag[i]];
1770 idiag[i] = omega/(fshift + v[diag[i]]);
1771 }
1772 ierr = PetscLogFlops(2.0*m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1772,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1773 }
1774 a->idiagvalid = PETSC_TRUE;
1775 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1776}
1777
1778#include <../src/mat/impls/aij/seq/ftn-kernels/frelax.h>
1779PetscErrorCode MatSOR_SeqAIJ(Mat A,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx)
1780{
1781 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1782 PetscScalar *x,d,sum,*t,scale;
1783 const MatScalar *v,*idiag=0,*mdiag;
1784 const PetscScalar *b, *bs,*xb, *ts;
1785 PetscErrorCode ierr;
1786 PetscInt n,m = A->rmap->n,i;
1787 const PetscInt *idx,*diag;
1788
1789 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1789; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1790 its = its*lits;
1791
1792 if (fshift != a->fshift || omega != a->omega) a->idiagvalid = PETSC_FALSE; /* must recompute idiag[] */
1793 if (!a->idiagvalid) {ierr = MatInvertDiagonal_SeqAIJ(A,omega,fshift);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1793,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
1794 a->fshift = fshift;
1795 a->omega = omega;
1796
1797 diag = a->diag;
1798 t = a->ssor_work;
1799 idiag = a->idiag;
1800 mdiag = a->mdiag;
1801
1802 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1803 ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1803,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1804 /* We count flops by assuming the upper triangular and lower triangular parts have the same number of nonzeros */
1805 if (flag == SOR_APPLY_UPPER) {
1806 /* apply (U + D/omega) to the vector */
1807 bs = b;
1808 for (i=0; i<m; i++) {
1809 d = fshift + mdiag[i];
1810 n = a->i[i+1] - diag[i] - 1;
1811 idx = a->j + diag[i] + 1;
1812 v = a->a + diag[i] + 1;
1813 sum = b[i]*d/omega;
1814 PetscSparseDensePlusDot(sum,bs,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += v[__i] * bs
[idx[__i]];}
;
1815 x[i] = sum;
1816 }
1817 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1817,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1818 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1818,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1819 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1819,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1820 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1821 }
1822
1823 if (flag == SOR_APPLY_LOWER) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SOR_APPLY_LOWER is not implemented")return PetscError(((MPI_Comm)0x44000001),1823,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"SOR_APPLY_LOWER is not implemented")
;
1824 else if (flag & SOR_EISENSTAT) {
1825 /* Let A = L + U + D; where L is lower trianglar,
1826 U is upper triangular, E = D/omega; This routine applies
1827
1828 (L + E)^{-1} A (U + E)^{-1}
1829
1830 to a vector efficiently using Eisenstat's trick.
1831 */
1832 scale = (2.0/omega) - 1.0;
1833
1834 /* x = (E + U)^{-1} b */
1835 for (i=m-1; i>=0; i--) {
1836 n = a->i[i+1] - diag[i] - 1;
1837 idx = a->j + diag[i] + 1;
1838 v = a->a + diag[i] + 1;
1839 sum = b[i];
1840 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1841 x[i] = sum*idiag[i];
1842 }
1843
1844 /* t = b - (2*E - D)x */
1845 v = a->a;
1846 for (i=0; i<m; i++) t[i] = b[i] - scale*(v[*diag++])*x[i];
1847
1848 /* t = (E + L)^{-1}t */
1849 ts = t;
1850 diag = a->diag;
1851 for (i=0; i<m; i++) {
1852 n = diag[i] - a->i[i];
1853 idx = a->j + a->i[i];
1854 v = a->a + a->i[i];
1855 sum = t[i];
1856 PetscSparseDenseMinusDot(sum,ts,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * ts
[idx[__i]];}
;
1857 t[i] = sum*idiag[i];
1858 /* x = x + t */
1859 x[i] += t[i];
1860 }
1861
1862 ierr = PetscLogFlops(6.0*m-1 + 2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1862,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1863 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1863,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1864 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1865 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1866 }
1867 if (flag & SOR_ZERO_INITIAL_GUESS) {
1868 if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) {
1869 for (i=0; i<m; i++) {
1870 n = diag[i] - a->i[i];
1871 idx = a->j + a->i[i];
1872 v = a->a + a->i[i];
1873 sum = b[i];
1874 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1875 t[i] = sum;
1876 x[i] = sum*idiag[i];
1877 }
1878 xb = t;
1879 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1879,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1880 } else xb = b;
1881 if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) {
1882 for (i=m-1; i>=0; i--) {
1883 n = a->i[i+1] - diag[i] - 1;
1884 idx = a->j + diag[i] + 1;
1885 v = a->a + diag[i] + 1;
1886 sum = xb[i];
1887 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1888 if (xb == b) {
1889 x[i] = sum*idiag[i];
1890 } else {
1891 x[i] = (1-omega)*x[i] + sum*idiag[i]; /* omega in idiag */
1892 }
1893 }
1894 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1894,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* assumes 1/2 in upper */
1895 }
1896 its--;
1897 }
1898 while (its--) {
1899 if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) {
1900 for (i=0; i<m; i++) {
1901 /* lower */
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; /* save application of the lower-triangular part */
1908 /* upper */
1909 n = a->i[i+1] - diag[i] - 1;
1910 idx = a->j + diag[i] + 1;
1911 v = a->a + diag[i] + 1;
1912 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1913 x[i] = (1. - omega)*x[i] + sum*idiag[i]; /* omega in idiag */
1914 }
1915 xb = t;
1916 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1916,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1917 } else xb = b;
1918 if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) {
1919 for (i=m-1; i>=0; i--) {
1920 sum = xb[i];
1921 if (xb == b) {
1922 /* whole matrix (no checkpointing available) */
1923 n = a->i[i+1] - a->i[i];
1924 idx = a->j + a->i[i];
1925 v = a->a + a->i[i];
1926 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1927 x[i] = (1. - omega)*x[i] + (sum + mdiag[i]*x[i])*idiag[i];
1928 } else { /* lower-triangular part has been saved, so only apply upper-triangular */
1929 n = a->i[i+1] - diag[i] - 1;
1930 idx = a->j + diag[i] + 1;
1931 v = a->a + diag[i] + 1;
1932 PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x
[idx[__i]];}
;
1933 x[i] = (1. - omega)*x[i] + sum*idiag[i]; /* omega in idiag */
1934 }
1935 }
1936 if (xb == b) {
1937 ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1937,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1938 } else {
1939 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1939,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* assumes 1/2 in upper */
1940 }
1941 }
1942 }
1943 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1943,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1944 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1944,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1945 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1946}
1947
1948
1949PetscErrorCode MatGetInfo_SeqAIJ(Mat A,MatInfoType flag,MatInfo *info)
1950{
1951 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1952
1953 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1953; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1954 info->block_size = 1.0;
1955 info->nz_allocated = (double)a->maxnz;
1956 info->nz_used = (double)a->nz;
1957 info->nz_unneeded = (double)(a->maxnz - a->nz);
1958 info->assemblies = (double)A->num_ass;
1959 info->mallocs = (double)A->info.mallocs;
1960 info->memory = ((PetscObject)A)->mem;
1961 if (A->factortype) {
1962 info->fill_ratio_given = A->info.fill_ratio_given;
1963 info->fill_ratio_needed = A->info.fill_ratio_needed;
1964 info->factor_mallocs = A->info.factor_mallocs;
1965 } else {
1966 info->fill_ratio_given = 0;
1967 info->fill_ratio_needed = 0;
1968 info->factor_mallocs = 0;
1969 }
1970 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1971}
1972
1973PetscErrorCode MatZeroRows_SeqAIJ(Mat A,PetscInt N,const PetscInt rows[],PetscScalar diag,Vec x,Vec b)
1974{
1975 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
1976 PetscInt i,m = A->rmap->n - 1;
1977 PetscErrorCode ierr;
1978 const PetscScalar *xx;
1979 PetscScalar *bb;
1980 PetscInt d = 0;
1981
1982 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 1982; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1983 if (x && b) {
1984 ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1984,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1985 ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1985,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1986 for (i=0; i<N; i++) {
1987 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),1987,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
1988 if (rows[i] >= A->cmap->n) continue;
1989 bb[rows[i]] = diag*xx[rows[i]];
1990 }
1991 ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1991,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1992 ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),1992,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1993 }
1994
1995 if (a->keepnonzeropattern) {
1996 for (i=0; i<N; i++) {
1997 if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),1997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
1998 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),1998,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
1999 }
2000 if (diag != 0.0) {
2001 for (i=0; i<N; i++) {
2002 d = rows[i];
2003 if (rows[i] >= A->cmap->n) continue;
2004 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),2004,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Matrix is missing diagonal entry in the zeroed row %D"
,d)
;
2005 }
2006 for (i=0; i<N; i++) {
2007 if (rows[i] >= A->cmap->n) continue;
2008 a->a[a->diag[rows[i]]] = diag;
2009 }
2010 }
2011 } else {
2012 if (diag != 0.0) {
2013 for (i=0; i<N; i++) {
2014 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),2014,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
2015 if (a->ilen[rows[i]] > 0) {
2016 if (rows[i] >= A->cmap->n) {
2017 a->ilen[rows[i]] = 0;
2018 } else {
2019 a->ilen[rows[i]] = 1;
2020 a->a[a->i[rows[i]]] = diag;
2021 a->j[a->i[rows[i]]] = rows[i];
2022 }
2023 } else if (rows[i] < A->cmap->n) { /* in case row was completely empty */
2024 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),2024,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2025 }
2026 }
2027 } else {
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.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
2030 a->ilen[rows[i]] = 0;
2031 }
2032 }
2033 A->nonzerostate++;
2034 }
2035 ierr = (*A->ops->assemblyend)(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2035,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2036 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2037}
2038
2039PetscErrorCode MatZeroRowsColumns_SeqAIJ(Mat A,PetscInt N,const PetscInt rows[],PetscScalar diag,Vec x,Vec b)
2040{
2041 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2042 PetscInt i,j,m = A->rmap->n - 1,d = 0;
2043 PetscErrorCode ierr;
2044 PetscBool missing,*zeroed,vecs = PETSC_FALSE;
2045 const PetscScalar *xx;
2046 PetscScalar *bb;
2047
2048 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2048; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2049 if (x && b) {
2050 ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2050,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2051 ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2051,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2052 vecs = PETSC_TRUE;
2053 }
2054 ierr = PetscCalloc1(A->rmap->n,&zeroed)PetscMallocA(1,PETSC_TRUE,2054,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->rmap->n)*sizeof(**(&zeroed)),(&zeroed
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2054,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2055 for (i=0; i<N; i++) {
2056 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),2056,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i])
;
2057 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),2057,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2058
2059 zeroed[rows[i]] = PETSC_TRUE;
2060 }
2061 for (i=0; i<A->rmap->n; i++) {
2062 if (!zeroed[i]) {
2063 for (j=a->i[i]; j<a->i[i+1]; j++) {
2064 if (a->j[j] < A->rmap->n && zeroed[a->j[j]]) {
2065 if (vecs) bb[i] -= a->a[j]*xx[a->j[j]];
2066 a->a[j] = 0.0;
2067 }
2068 }
2069 } else if (vecs && i < A->cmap->N) bb[i] = diag*xx[i];
2070 }
2071 if (x && b) {
2072 ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2072,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2073 ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2073,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2074 }
2075 ierr = PetscFree(zeroed)((*PetscTrFree)((void*)(zeroed),2075,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((zeroed) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2075,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2076 if (diag != 0.0) {
2077 ierr = MatMissingDiagonal_SeqAIJ(A,&missing,&d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2077,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2078 if (missing) {
2079 for (i=0; i<N; i++) {
2080 if (rows[i] >= A->cmap->N) continue;
2081 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
),2081,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
73);}} while (0)
;
2082 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),2082,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2083 }
2084 } else {
2085 for (i=0; i<N; i++) {
2086 a->a[a->diag[rows[i]]] = diag;
2087 }
2088 }
2089 }
2090 ierr = (*A->ops->assemblyend)(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2090,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2091 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2092}
2093
2094PetscErrorCode MatGetRow_SeqAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
2095{
2096 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2097 PetscInt *itmp;
2098
2099 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2099; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2100 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),2100,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"Row %D out of range",row)
;
2101
2102 *nz = a->i[row+1] - a->i[row];
2103 if (v) *v = a->a + a->i[row];
2104 if (idx) {
2105 itmp = a->j + a->i[row];
2106 if (*nz) *idx = itmp;
2107 else *idx = 0;
2108 }
2109 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2110}
2111
2112/* remove this function? */
2113PetscErrorCode MatRestoreRow_SeqAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
2114{
2115 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2115; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2116 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2117}
2118
2119PetscErrorCode MatNorm_SeqAIJ(Mat A,NormType type,PetscReal *nrm)
2120{
2121 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2122 MatScalar *v = a->a;
2123 PetscReal sum = 0.0;
2124 PetscErrorCode ierr;
2125 PetscInt i,j;
2126
2127 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2127; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2128 if (type == NORM_FROBENIUS) {
2129#if defined(PETSC_USE_REAL___FP16)
2130 PetscBLASInt one = 1,nz = a->nz;
2131 *nrm = BLASnrm2_dnrm2_(&nz,v,&one);
2132#else
2133 for (i=0; i<a->nz; i++) {
2134 sum += PetscRealPart(PetscConj(*v)*(*v))((*v)*(*v)); v++;
2135 }
2136 *nrm = PetscSqrtReal(sum)sqrt(sum);
2137#endif
2138 ierr = PetscLogFlops(2*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2138,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2139 } else if (type == NORM_1) {
2140 PetscReal *tmp;
2141 PetscInt *jj = a->j;
2142 ierr = PetscCalloc1(A->cmap->n+1,&tmp)PetscMallocA(1,PETSC_TRUE,2142,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(A->cmap->n+1)*sizeof(**(&tmp)),(&tmp)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2142,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2143 *nrm = 0.0;
2144 for (j=0; j<a->nz; j++) {
2145 tmp[*jj++] += PetscAbsScalar(*v); v++;
2146 }
2147 for (j=0; j<A->cmap->n; j++) {
2148 if (tmp[j] > *nrm) *nrm = tmp[j];
2149 }
2150 ierr = PetscFree(tmp)((*PetscTrFree)((void*)(tmp),2150,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((tmp) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2150,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2151 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),2151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2152 } else if (type == NORM_INFINITY) {
2153 *nrm = 0.0;
2154 for (j=0; j<A->rmap->n; j++) {
2155 v = a->a + a->i[j];
2156 sum = 0.0;
2157 for (i=0; i<a->i[j+1]-a->i[j]; i++) {
2158 sum += PetscAbsScalar(*v); v++;
2159 }
2160 if (sum > *nrm) *nrm = sum;
2161 }
2162 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),2162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2163 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for two norm")return PetscError(((MPI_Comm)0x44000001),2163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"No support for two norm")
;
2164 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2165}
2166
2167/* Merged from MatGetSymbolicTranspose_SeqAIJ() - replace MatGetSymbolicTranspose_SeqAIJ()? */
2168PetscErrorCode MatTransposeSymbolic_SeqAIJ(Mat A,Mat *B)
2169{
2170 PetscErrorCode ierr;
2171 PetscInt i,j,anzj;
2172 Mat_SeqAIJ *a=(Mat_SeqAIJ*)A->data,*b;
2173 PetscInt an=A->cmap->N,am=A->rmap->N;
2174 PetscInt *ati,*atj,*atfill,*ai=a->i,*aj=a->j;
2175
2176 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2176; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2177 /* Allocate space for symbolic transpose info and work array */
2178 ierr = PetscCalloc1(an+1,&ati)PetscMallocA(1,PETSC_TRUE,2178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(an+1)*sizeof(**(&ati)),(&ati))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2179 ierr = PetscMalloc1(ai[am],&atj)PetscMallocA(1,PETSC_FALSE,2179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(ai[am])*sizeof(**(&atj)),(&atj))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2180 ierr = PetscMalloc1(an,&atfill)PetscMallocA(1,PETSC_FALSE,2180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(an)*sizeof(**(&atfill)),(&atfill))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2181
2182 /* Walk through aj and count ## of non-zeros in each row of A^T. */
2183 /* Note: offset by 1 for fast conversion into csr format. */
2184 for (i=0;i<ai[am];i++) ati[aj[i]+1] += 1;
2185 /* Form ati for csr format of A^T. */
2186 for (i=0;i<an;i++) ati[i+1] += ati[i];
2187
2188 /* Copy ati into atfill so we have locations of the next free space in atj */
2189 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),2189,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2190
2191 /* Walk through A row-wise and mark nonzero entries of A^T. */
2192 for (i=0;i<am;i++) {
2193 anzj = ai[i+1] - ai[i];
2194 for (j=0;j<anzj;j++) {
2195 atj[atfill[*aj]] = i;
2196 atfill[*aj++] += 1;
2197 }
2198 }
2199
2200 /* Clean up temporary space and complete requests. */
2201 ierr = PetscFree(atfill)((*PetscTrFree)((void*)(atfill),2201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((atfill) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2202 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),2202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2203 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),2203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2204
2205 b = (Mat_SeqAIJ*)((*B)->data);
2206 b->free_a = PETSC_FALSE;
2207 b->free_ij = PETSC_TRUE;
2208 b->nonew = 0;
2209 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2210}
2211
2212PetscErrorCode MatIsTranspose_SeqAIJ(Mat A,Mat B,PetscReal tol,PetscBool *f)
2213{
2214 Mat_SeqAIJ *aij = (Mat_SeqAIJ*) A->data,*bij = (Mat_SeqAIJ*) B->data;
2215 PetscInt *adx,*bdx,*aii,*bii,*aptr,*bptr;
2216 MatScalar *va,*vb;
2217 PetscErrorCode ierr;
2218 PetscInt ma,na,mb,nb, i;
2219
2220 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2220; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2221 ierr = MatGetSize(A,&ma,&na);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2222 ierr = MatGetSize(B,&mb,&nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2222,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2223 if (ma!=nb || na!=mb) {
2224 *f = PETSC_FALSE;
2225 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2226 }
2227 aii = aij->i; bii = bij->i;
2228 adx = aij->j; bdx = bij->j;
2229 va = aij->a; vb = bij->a;
2230 ierr = PetscMalloc1(ma,&aptr)PetscMallocA(1,PETSC_FALSE,2230,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(ma)*sizeof(**(&aptr)),(&aptr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2230,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2231 ierr = PetscMalloc1(mb,&bptr)PetscMallocA(1,PETSC_FALSE,2231,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(mb)*sizeof(**(&bptr)),(&bptr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2231,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2232 for (i=0; i<ma; i++) aptr[i] = aii[i];
2233 for (i=0; i<mb; i++) bptr[i] = bii[i];
2234
2235 *f = PETSC_TRUE;
2236 for (i=0; i<ma; i++) {
2237 while (aptr[i]<aii[i+1]) {
2238 PetscInt idc,idr;
2239 PetscScalar vc,vr;
2240 /* column/row index/value */
2241 idc = adx[aptr[i]];
2242 idr = bdx[bptr[idc]];
2243 vc = va[aptr[i]];
2244 vr = vb[bptr[idc]];
2245 if (i!=idr || PetscAbsScalar(vc-vr) > tol) {
2246 *f = PETSC_FALSE;
2247 goto done;
2248 } else {
2249 aptr[i]++;
2250 if (B || i!=idc) bptr[idc]++;
2251 }
2252 }
2253 }
2254done:
2255 ierr = PetscFree(aptr)((*PetscTrFree)((void*)(aptr),2255,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((aptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2255,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2256 ierr = PetscFree(bptr)((*PetscTrFree)((void*)(bptr),2256,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((bptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2256,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2257 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2258}
2259
2260PetscErrorCode MatIsHermitianTranspose_SeqAIJ(Mat A,Mat B,PetscReal tol,PetscBool *f)
2261{
2262 Mat_SeqAIJ *aij = (Mat_SeqAIJ*) A->data,*bij = (Mat_SeqAIJ*) B->data;
2263 PetscInt *adx,*bdx,*aii,*bii,*aptr,*bptr;
2264 MatScalar *va,*vb;
2265 PetscErrorCode ierr;
2266 PetscInt ma,na,mb,nb, i;
2267
2268 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2268; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2269 ierr = MatGetSize(A,&ma,&na);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2269,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2270 ierr = MatGetSize(B,&mb,&nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2270,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2271 if (ma!=nb || na!=mb) {
2272 *f = PETSC_FALSE;
2273 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2274 }
2275 aii = aij->i; bii = bij->i;
2276 adx = aij->j; bdx = bij->j;
2277 va = aij->a; vb = bij->a;
2278 ierr = PetscMalloc1(ma,&aptr)PetscMallocA(1,PETSC_FALSE,2278,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(ma)*sizeof(**(&aptr)),(&aptr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2278,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2279 ierr = PetscMalloc1(mb,&bptr)PetscMallocA(1,PETSC_FALSE,2279,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(mb)*sizeof(**(&bptr)),(&bptr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2279,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2280 for (i=0; i<ma; i++) aptr[i] = aii[i];
2281 for (i=0; i<mb; i++) bptr[i] = bii[i];
2282
2283 *f = PETSC_TRUE;
2284 for (i=0; i<ma; i++) {
2285 while (aptr[i]<aii[i+1]) {
2286 PetscInt idc,idr;
2287 PetscScalar vc,vr;
2288 /* column/row index/value */
2289 idc = adx[aptr[i]];
2290 idr = bdx[bptr[idc]];
2291 vc = va[aptr[i]];
2292 vr = vb[bptr[idc]];
2293 if (i!=idr || PetscAbsScalar(vc-PetscConj(vr)(vr)) > tol) {
2294 *f = PETSC_FALSE;
2295 goto done;
2296 } else {
2297 aptr[i]++;
2298 if (B || i!=idc) bptr[idc]++;
2299 }
2300 }
2301 }
2302done:
2303 ierr = PetscFree(aptr)((*PetscTrFree)((void*)(aptr),2303,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((aptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2303,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2304 ierr = PetscFree(bptr)((*PetscTrFree)((void*)(bptr),2304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((bptr) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2305 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2306}
2307
2308PetscErrorCode MatIsSymmetric_SeqAIJ(Mat A,PetscReal tol,PetscBool *f)
2309{
2310 PetscErrorCode ierr;
2311
2312 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2312; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2313 ierr = MatIsTranspose_SeqAIJ(A,A,tol,f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2313,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2314 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2315}
2316
2317PetscErrorCode MatIsHermitian_SeqAIJ(Mat A,PetscReal tol,PetscBool *f)
2318{
2319 PetscErrorCode ierr;
2320
2321 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2321; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2322 ierr = MatIsHermitianTranspose_SeqAIJ(A,A,tol,f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2322,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2323 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2324}
2325
2326PetscErrorCode MatDiagonalScale_SeqAIJ(Mat A,Vec ll,Vec rr)
2327{
2328 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2329 const PetscScalar *l,*r;
2330 PetscScalar x;
2331 MatScalar *v;
2332 PetscErrorCode ierr;
2333 PetscInt i,j,m = A->rmap->n,n = A->cmap->n,M,nz = a->nz;
2334 const PetscInt *jj;
2335
2336 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2336; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2337 if (ll) {
2338 /* The local size is used so that VecMPI can be passed to this routine
2339 by MatDiagonalScale_MPIAIJ */
2340 ierr = VecGetLocalSize(ll,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2340,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2341 if (m != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Left scaling vector wrong length")return PetscError(((MPI_Comm)0x44000001),2341,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Left scaling vector wrong length")
;
2342 ierr = VecGetArrayRead(ll,&l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2342,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2343 v = a->a;
2344 for (i=0; i<m; i++) {
2345 x = l[i];
2346 M = a->i[i+1] - a->i[i];
2347 for (j=0; j<M; j++) (*v++) *= x;
2348 }
2349 ierr = VecRestoreArrayRead(ll,&l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2349,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2350 ierr = PetscLogFlops(nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2350,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2351 }
2352 if (rr) {
2353 ierr = VecGetLocalSize(rr,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2354 if (n != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Right scaling vector wrong length")return PetscError(((MPI_Comm)0x44000001),2354,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Right scaling vector wrong length")
;
2355 ierr = VecGetArrayRead(rr,&r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2355,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2356 v = a->a; jj = a->j;
2357 for (i=0; i<nz; i++) (*v++) *= r[*jj++];
2358 ierr = VecRestoreArrayRead(rr,&r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2358,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2359 ierr = PetscLogFlops(nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2359,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2360 }
2361 ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2362 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; 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 MatCreateSubMatrix_SeqAIJ(Mat A,IS isrow,IS iscol,PetscInt csize,MatReuse scall,Mat *B)
2366{
2367 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data,*c;
2368 PetscErrorCode ierr;
2369 PetscInt *smap,i,k,kstart,kend,oldcols = A->cmap->n,*lens;
2370 PetscInt row,mat_i,*mat_j,tcol,first,step,*mat_ilen,sum,lensi;
2371 const PetscInt *irow,*icol;
2372 PetscInt nrows,ncols;
2373 PetscInt *starts,*j_new,*i_new,*aj = a->j,*ai = a->i,ii,*ailen = a->ilen;
2374 MatScalar *a_new,*mat_a;
2375 Mat C;
2376 PetscBool stride;
2377
2378 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2378; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2379
2380 ierr = ISGetIndices(isrow,&irow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2380,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2381 ierr = ISGetLocalSize(isrow,&nrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2381,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2382 ierr = ISGetLocalSize(iscol,&ncols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2382,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2383
2384 ierr = PetscObjectTypeCompare((PetscObject)iscol,ISSTRIDE"stride",&stride);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2384,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2385 if (stride) {
2386 ierr = ISStrideGetInfo(iscol,&first,&step);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2386,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2387 } else {
2388 first = 0;
2389 step = 0;
2390 }
2391 if (stride && step == 1) {
2392 /* special case of contiguous rows */
2393 ierr = PetscMalloc2(nrows,&lens,nrows,&starts)PetscMallocA(2,PETSC_FALSE,2393,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nrows)*sizeof(**(&lens)),(&lens),(size_t)(nrows
)*sizeof(**(&starts)),(&starts))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2393,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2394 /* loop over new rows determining lens and starting points */
2395 for (i=0; i<nrows; i++) {
2396 kstart = ai[irow[i]];
2397 kend = kstart + ailen[irow[i]];
2398 starts[i] = kstart;
2399 for (k=kstart; k<kend; k++) {
2400 if (aj[k] >= first) {
2401 starts[i] = k;
2402 break;
2403 }
2404 }
2405 sum = 0;
2406 while (k < kend) {
2407 if (aj[k++] >= first+ncols) break;
2408 sum++;
2409 }
2410 lens[i] = sum;
2411 }
2412 /* create submatrix */
2413 if (scall == MAT_REUSE_MATRIX) {
2414 PetscInt n_cols,n_rows;
2415 ierr = MatGetSize(*B,&n_rows,&n_cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2415,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2416 if (n_rows != nrows || n_cols != ncols) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Reused submatrix wrong size")return PetscError(((MPI_Comm)0x44000001),2416,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Reused submatrix wrong size")
;
2417 ierr = MatZeroEntries(*B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2417,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2418 C = *B;
2419 } else {
2420 PetscInt rbs,cbs;
2421 ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2421,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2422 ierr = MatSetSizes(C,nrows,ncols,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2422,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2423 ierr = ISGetBlockSize(isrow,&rbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2423,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2424 ierr = ISGetBlockSize(iscol,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2424,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2425 ierr = MatSetBlockSizes(C,rbs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2425,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2426 ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2426,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2427 ierr = MatSeqAIJSetPreallocation_SeqAIJ(C,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2427,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2428 }
2429 c = (Mat_SeqAIJ*)C->data;
2430
2431 /* loop over rows inserting into submatrix */
2432 a_new = c->a;
2433 j_new = c->j;
2434 i_new = c->i;
2435
2436 for (i=0; i<nrows; i++) {
2437 ii = starts[i];
2438 lensi = lens[i];
2439 for (k=0; k<lensi; k++) {
2440 *j_new++ = aj[ii+k] - first;
2441 }
2442 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),2442,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2443 a_new += lensi;
2444 i_new[i+1] = i_new[i] + lensi;
2445 c->ilen[i] = lensi;
2446 }
2447 ierr = PetscFree2(lens,starts)PetscFreeA(2,2447,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(lens),&(starts))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2447,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2448 } else {
2449 ierr = ISGetIndices(iscol,&icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2449,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2450 ierr = PetscCalloc1(oldcols,&smap)PetscMallocA(1,PETSC_TRUE,2450,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(oldcols)*sizeof(**(&smap)),(&smap))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2450,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2451 ierr = PetscMalloc1(1+nrows,&lens)PetscMallocA(1,PETSC_FALSE,2451,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(1+nrows)*sizeof(**(&lens)),(&lens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2451,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2452 for (i=0; i<ncols; i++) {
2453#if defined(PETSC_USE_DEBUG1)
2454 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
),2454,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
2455#endif
2456 smap[icol[i]] = i+1;
2457 }
2458
2459 /* determine lens of each row */
2460 for (i=0; i<nrows; i++) {
2461 kstart = ai[irow[i]];
2462 kend = kstart + a->ilen[irow[i]];
2463 lens[i] = 0;
2464 for (k=kstart; k<kend; k++) {
2465 if (smap[aj[k]]) {
2466 lens[i]++;
2467 }
2468 }
2469 }
2470 /* Create and fill new matrix */
2471 if (scall == MAT_REUSE_MATRIX) {
2472 PetscBool equal;
2473
2474 c = (Mat_SeqAIJ*)((*B)->data);
2475 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),2475,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Cannot reuse matrix. wrong size")
;
2476 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),2476,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2477 if (!equal) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Cannot reuse matrix. wrong no of nonzeros")return PetscError(((MPI_Comm)0x44000001),2477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Cannot reuse matrix. wrong no of nonzeros"
)
;
2478 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),2478,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2479 C = *B;
2480 } else {
2481 PetscInt rbs,cbs;
2482 ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2482,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2483 ierr = MatSetSizes(C,nrows,ncols,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2483,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2484 ierr = ISGetBlockSize(isrow,&rbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2484,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2485 ierr = ISGetBlockSize(iscol,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2485,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2486 ierr = MatSetBlockSizes(C,rbs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2486,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2487 ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2488 ierr = MatSeqAIJSetPreallocation_SeqAIJ(C,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2488,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2489 }
2490 c = (Mat_SeqAIJ*)(C->data);
2491 for (i=0; i<nrows; i++) {
2492 row = irow[i];
2493 kstart = ai[row];
2494 kend = kstart + a->ilen[row];
2495 mat_i = c->i[i];
2496 mat_j = c->j + mat_i;
2497 mat_a = c->a + mat_i;
2498 mat_ilen = c->ilen + i;
2499 for (k=kstart; k<kend; k++) {
2500 if ((tcol=smap[a->j[k]])) {
2501 *mat_j++ = tcol - 1;
2502 *mat_a++ = a->a[k];
2503 (*mat_ilen)++;
2504
2505 }
2506 }
2507 }
2508 /* Free work space */
2509 ierr = ISRestoreIndices(iscol,&icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2509,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2510 ierr = PetscFree(smap)((*PetscTrFree)((void*)(smap),2510,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((smap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2510,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2511 ierr = PetscFree(lens)((*PetscTrFree)((void*)(lens),2511,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2511,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2512 /* sort */
2513 for (i = 0; i < nrows; i++) {
2514 PetscInt ilen;
2515
2516 mat_i = c->i[i];
2517 mat_j = c->j + mat_i;
2518 mat_a = c->a + mat_i;
2519 ilen = c->ilen[i];
2520 ierr = PetscSortIntWithScalarArray(ilen,mat_j,mat_a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2520,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2521 }
2522 }
2523 ierr = MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2523,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2524 ierr = MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2524,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2525
2526 ierr = ISRestoreIndices(isrow,&irow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2526,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2527 *B = C;
2528 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2529}
2530
2531PetscErrorCode MatGetMultiProcBlock_SeqAIJ(Mat mat,MPI_Comm subComm,MatReuse scall,Mat *subMat)
2532{
2533 PetscErrorCode ierr;
2534 Mat B;
2535
2536 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2536; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2537 if (scall == MAT_INITIAL_MATRIX) {
2538 ierr = MatCreate(subComm,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2538,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2539 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),2539,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2540 ierr = MatSetBlockSizesFromMats(B,mat,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2540,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2541 ierr = MatSetType(B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2542 ierr = MatDuplicateNoCreate_SeqAIJ(B,mat,MAT_COPY_VALUES,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2542,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2543 *subMat = B;
2544 } else {
2545 ierr = MatCopy_SeqAIJ(mat,*subMat,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2545,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2546 }
2547 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2548}
2549
2550PetscErrorCode MatILUFactor_SeqAIJ(Mat inA,IS row,IS col,const MatFactorInfo *info)
2551{
2552 Mat_SeqAIJ *a = (Mat_SeqAIJ*)inA->data;
2553 PetscErrorCode ierr;
2554 Mat outA;
2555 PetscBool row_identity,col_identity;
2556
2557 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2557; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2558 if (info->levels != 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only levels=0 supported for in-place ilu")return PetscError(((MPI_Comm)0x44000001),2558,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Only levels=0 supported for in-place ilu"
)
;
2559
2560 ierr = ISIdentity(row,&row_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2560,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2561 ierr = ISIdentity(col,&col_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2561,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2562
2563 outA = inA;
2564 outA->factortype = MAT_FACTOR_LU;
2565 ierr = PetscFree(inA->solvertype)((*PetscTrFree)((void*)(inA->solvertype),2565,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((inA->solvertype) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2565,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2566 ierr = PetscStrallocpy(MATSOLVERPETSC"petsc",&inA->solvertype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2566,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2567
2568 ierr = PetscObjectReference((PetscObject)row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2569 ierr = ISDestroy(&a->row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2569,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2570
2571 a->row = row;
2572
2573 ierr = PetscObjectReference((PetscObject)col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2573,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2574 ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2574,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2575
2576 a->col = col;
2577
2578 /* Create the inverse permutation so that it can be used in MatLUFactorNumeric() */
2579 ierr = ISDestroy(&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2579,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2580 ierr = ISInvertPermutation(col,PETSC_DECIDE-1,&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2580,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2581 ierr = PetscLogObjectParent((PetscObject)inA,(PetscObject)a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2581,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2582
2583 if (!a->solve_work) { /* this matrix may have been factored before */
2584 ierr = PetscMalloc1(inA->rmap->n+1,&a->solve_work)PetscMallocA(1,PETSC_FALSE,2584,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(inA->rmap->n+1)*sizeof(**(&a->solve_work
)),(&a->solve_work))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2584,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2585 ierr = PetscLogObjectMemory((PetscObject)inA, (inA->rmap->n+1)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2585,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2586 }
2587
2588 ierr = MatMarkDiagonal_SeqAIJ(inA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2588,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2589 if (row_identity && col_identity) {
2590 ierr = MatLUFactorNumeric_SeqAIJ_inplace(outA,inA,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2590,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2591 } else {
2592 ierr = MatLUFactorNumeric_SeqAIJ_InplaceWithPerm(outA,inA,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2592,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2593 }
2594 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2595}
2596
2597PetscErrorCode MatScale_SeqAIJ(Mat inA,PetscScalar alpha)
2598{
2599 Mat_SeqAIJ *a = (Mat_SeqAIJ*)inA->data;
2600 PetscScalar oalpha = alpha;
2601 PetscErrorCode ierr;
2602 PetscBLASInt one = 1,bnz;
2603
2604 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2604; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2605 ierr = PetscBLASIntCast(a->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2605,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2606 PetscStackCallBLAS("BLASscal",BLASscal_(&bnz,&oalpha,a->a,&one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASscal"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2606; 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(2606,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),2606,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} while(0); do { ; if (petscstack &&
petscstack->currentsize > 0) { petscstack->currentsize
--; petscstack->function[petscstack->currentsize] = 0; petscstack
->file[petscstack->currentsize] = 0; petscstack->line
[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); }
while (0); } while(0)
;
2607 ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2607,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2608 ierr = MatSeqAIJInvalidateDiagonal(inA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2608,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2609 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2610}
2611
2612PetscErrorCode MatDestroySubMatrix_Private(Mat_SubSppt *submatj)
2613{
2614 PetscErrorCode ierr;
2615 PetscInt i;
2616
2617 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2617; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2618 if (!submatj->id) { /* delete data that are linked only to submats[id=0] */
2619 ierr = PetscFree4(submatj->sbuf1,submatj->ptr,submatj->tmp,submatj->ctr)PetscFreeA(4,2619,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(submatj->sbuf1),&(submatj->ptr),&(submatj
->tmp),&(submatj->ctr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2619,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2620
2621 for (i=0; i<submatj->nrqr; ++i) {
2622 ierr = PetscFree(submatj->sbuf2[i])((*PetscTrFree)((void*)(submatj->sbuf2[i]),2622,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->sbuf2[i]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2622,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2623 }
2624 ierr = PetscFree3(submatj->sbuf2,submatj->req_size,submatj->req_source1)PetscFreeA(3,2624,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(submatj->sbuf2),&(submatj->req_size),&(submatj
->req_source1))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2624,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2625
2626 if (submatj->rbuf1) {
2627 ierr = PetscFree(submatj->rbuf1[0])((*PetscTrFree)((void*)(submatj->rbuf1[0]),2627,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rbuf1[0]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2627,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2628 ierr = PetscFree(submatj->rbuf1)((*PetscTrFree)((void*)(submatj->rbuf1),2628,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rbuf1) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2628,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2629 }
2630
2631 for (i=0; i<submatj->nrqs; ++i) {
2632 ierr = PetscFree(submatj->rbuf3[i])((*PetscTrFree)((void*)(submatj->rbuf3[i]),2632,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rbuf3[i]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2632,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2633 }
2634 ierr = PetscFree3(submatj->req_source2,submatj->rbuf2,submatj->rbuf3)PetscFreeA(3,2634,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(submatj->req_source2),&(submatj->rbuf2),&
(submatj->rbuf3))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2634,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2635 ierr = PetscFree(submatj->pa)((*PetscTrFree)((void*)(submatj->pa),2635,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->pa) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2635,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2636 }
2637
2638#if defined(PETSC_USE_CTABLE1)
2639 ierr = PetscTableDestroy((PetscTable*)&submatj->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2639,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2640 if (submatj->cmap_loc) {ierr = PetscFree(submatj->cmap_loc)((*PetscTrFree)((void*)(submatj->cmap_loc),2640,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->cmap_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2640,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
2641 ierr = PetscFree(submatj->rmap_loc)((*PetscTrFree)((void*)(submatj->rmap_loc),2641,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rmap_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2641,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2642#else
2643 ierr = PetscFree(submatj->rmap)((*PetscTrFree)((void*)(submatj->rmap),2643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->rmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2644#endif
2645
2646 if (!submatj->allcolumns) {
2647#if defined(PETSC_USE_CTABLE1)
2648 ierr = PetscTableDestroy((PetscTable*)&submatj->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2649#else
2650 ierr = PetscFree(submatj->cmap)((*PetscTrFree)((void*)(submatj->cmap),2650,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->cmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2650,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2651#endif
2652 }
2653 ierr = PetscFree(submatj->row2proc)((*PetscTrFree)((void*)(submatj->row2proc),2653,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj->row2proc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2653,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2654
2655 ierr = PetscFree(submatj)((*PetscTrFree)((void*)(submatj),2655,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((submatj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2655,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2656 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2657}
2658
2659PetscErrorCode MatDestroySubMatrix_SeqAIJ(Mat C)
2660{
2661 PetscErrorCode ierr;
2662 Mat_SeqAIJ *c = (Mat_SeqAIJ*)C->data;
2663 Mat_SubSppt *submatj = c->submatis1;
2664
2665 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2665; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2666 ierr = (*submatj->destroy)(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2666,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2667 ierr = MatDestroySubMatrix_Private(submatj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2667,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2668 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2669}
2670
2671PetscErrorCode MatDestroySubMatrices_SeqAIJ(PetscInt n,Mat *mat[])
2672{
2673 PetscErrorCode ierr;
2674 PetscInt i;
2675 Mat C;
2676 Mat_SeqAIJ *c;
2677 Mat_SubSppt *submatj;
2678
2679 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2679; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2680 for (i=0; i<n; i++) {
2681 C = (*mat)[i];
2682 c = (Mat_SeqAIJ*)C->data;
2683 submatj = c->submatis1;
2684 if (submatj) {
2685 if (--((PetscObject)C)->refct <= 0) {
2686 ierr = (*submatj->destroy)(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2686,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2687 ierr = MatDestroySubMatrix_Private(submatj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2687,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2688 ierr = PetscFree(C->defaultvectype)((*PetscTrFree)((void*)(C->defaultvectype),2688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((C->defaultvectype) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2689 ierr = PetscLayoutDestroy(&C->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2689,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2690 ierr = PetscLayoutDestroy(&C->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2690,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2691 ierr = PetscHeaderDestroy(&C)(PetscHeaderDestroy_Private((PetscObject)(*&C)) || ((*PetscTrFree
)((void*)(*&C),2691,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*&C) = 0,0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2691,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2692 }
2693 } else {
2694 ierr = MatDestroy(&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2694,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2695 }
2696 }
2697
2698 /* Destroy Dummy submatrices created for reuse */
2699 ierr = MatDestroySubMatrices_Dummy(n,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2699,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2700
2701 ierr = PetscFree(*mat)((*PetscTrFree)((void*)(*mat),2701,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((*mat) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2701,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2702 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2703}
2704
2705PetscErrorCode MatCreateSubMatrices_SeqAIJ(Mat A,PetscInt n,const IS irow[],const IS icol[],MatReuse scall,Mat *B[])
2706{
2707 PetscErrorCode ierr;
2708 PetscInt i;
2709
2710 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2710; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2711 if (scall == MAT_INITIAL_MATRIX) {
2712 ierr = PetscCalloc1(n+1,B)PetscMallocA(1,PETSC_TRUE,2712,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n+1)*sizeof(**(B)),(B))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2712,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2713 }
2714
2715 for (i=0; i<n; i++) {
2716 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),2716,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2717 }
2718 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2719}
2720
2721PetscErrorCode MatIncreaseOverlap_SeqAIJ(Mat A,PetscInt is_max,IS is[],PetscInt ov)
2722{
2723 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2724 PetscErrorCode ierr;
2725 PetscInt row,i,j,k,l,m,n,*nidx,isz,val;
2726 const PetscInt *idx;
2727 PetscInt start,end,*ai,*aj;
2728 PetscBT table;
2729
2730 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2730; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2731 m = A->rmap->n;
2732 ai = a->i;
2733 aj = a->j;
2734
2735 if (ov < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"illegal negative overlap value used")return PetscError(((MPI_Comm)0x44000001),2735,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"illegal negative overlap value used"
)
;
2736
2737 ierr = PetscMalloc1(m+1,&nidx)PetscMallocA(1,PETSC_FALSE,2737,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m+1)*sizeof(**(&nidx)),(&nidx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2737,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2738 ierr = PetscBTCreate(m,&table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2738,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2739
2740 for (i=0; i<is_max; i++) {
2741 /* Initialize the two local arrays */
2742 isz = 0;
2743 ierr = PetscBTMemzero(m,table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2743,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2744
2745 /* Extract the indices, assume there can be duplicate entries */
2746 ierr = ISGetIndices(is[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2746,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2747 ierr = ISGetLocalSize(is[i],&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2747,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2748
2749 /* Enter these into the temp arrays. I.e., mark table[row], enter row into new index */
2750 for (j=0; j<n; ++j) {
2751 if (!PetscBTLookupSet(table,idx[j])) nidx[isz++] = idx[j];
2752 }
2753 ierr = ISRestoreIndices(is[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2753,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2754 ierr = ISDestroy(&is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2754,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2755
2756 k = 0;
2757 for (j=0; j<ov; j++) { /* for each overlap */
2758 n = isz;
2759 for (; k<n; k++) { /* do only those rows in nidx[k], which are not done yet */
2760 row = nidx[k];
2761 start = ai[row];
2762 end = ai[row+1];
2763 for (l = start; l<end; l++) {
2764 val = aj[l];
2765 if (!PetscBTLookupSet(table,val)) nidx[isz++] = val;
2766 }
2767 }
2768 }
2769 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),2769,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2770 }
2771 ierr = PetscBTDestroy(&table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2771,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2772 ierr = PetscFree(nidx)((*PetscTrFree)((void*)(nidx),2772,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((nidx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2772,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2773 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2774}
2775
2776/* -------------------------------------------------------------- */
2777PetscErrorCode MatPermute_SeqAIJ(Mat A,IS rowp,IS colp,Mat *B)
2778{
2779 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2780 PetscErrorCode ierr;
2781 PetscInt i,nz = 0,m = A->rmap->n,n = A->cmap->n;
2782 const PetscInt *row,*col;
2783 PetscInt *cnew,j,*lens;
2784 IS icolp,irowp;
2785 PetscInt *cwork = NULL((void*)0);
2786 PetscScalar *vwork = NULL((void*)0);
2787
2788 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2788; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2789 ierr = ISInvertPermutation(rowp,PETSC_DECIDE-1,&irowp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2789,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2790 ierr = ISGetIndices(irowp,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2790,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2791 ierr = ISInvertPermutation(colp,PETSC_DECIDE-1,&icolp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2791,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2792 ierr = ISGetIndices(icolp,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2793
2794 /* determine lengths of permuted rows */
2795 ierr = PetscMalloc1(m+1,&lens)PetscMallocA(1,PETSC_FALSE,2795,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m+1)*sizeof(**(&lens)),(&lens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2795,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2796 for (i=0; i<m; i++) lens[row[i]] = a->i[i+1] - a->i[i];
2797 ierr = MatCreate(PetscObjectComm((PetscObject)A),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2797,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2798 ierr = MatSetSizes(*B,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2798,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2799 ierr = MatSetBlockSizesFromMats(*B,A,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2799,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2800 ierr = MatSetType(*B,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2800,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2801 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*B,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2801,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2802 ierr = PetscFree(lens)((*PetscTrFree)((void*)(lens),2802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2803
2804 ierr = PetscMalloc1(n,&cnew)PetscMallocA(1,PETSC_FALSE,2804,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(n)*sizeof(**(&cnew)),(&cnew))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2804,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2805 for (i=0; i<m; i++) {
2806 ierr = MatGetRow_SeqAIJ(A,i,&nz,&cwork,&vwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2806,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2807 for (j=0; j<nz; j++) cnew[j] = col[cwork[j]];
2808 ierr = MatSetValues_SeqAIJ(*B,1,&row[i],nz,cnew,vwork,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2808,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2809 ierr = MatRestoreRow_SeqAIJ(A,i,&nz,&cwork,&vwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2809,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2810 }
2811 ierr = PetscFree(cnew)((*PetscTrFree)((void*)(cnew),2811,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((cnew) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2811,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2812
2813 (*B)->assembled = PETSC_FALSE;
2814
2815 ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2815,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2816 ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2816,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2817 ierr = ISRestoreIndices(irowp,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2817,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2818 ierr = ISRestoreIndices(icolp,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2818,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2819 ierr = ISDestroy(&irowp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2819,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2820 ierr = ISDestroy(&icolp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2820,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2821 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2822}
2823
2824PetscErrorCode MatCopy_SeqAIJ(Mat A,Mat B,MatStructure str)
2825{
2826 PetscErrorCode ierr;
2827
2828 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2828; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2829 /* If the two matrices have the same copy implementation, use fast copy. */
2830 if (str == SAME_NONZERO_PATTERN && (A->ops->copy == B->ops->copy)) {
2831 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2832 Mat_SeqAIJ *b = (Mat_SeqAIJ*)B->data;
2833
2834 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),2834,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,75,PETSC_ERROR_INITIAL,"Number of nonzeros in two matrices are different"
)
;
2835 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),2835,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2836 ierr = PetscObjectStateIncrease((PetscObject)B)(((PetscObject)B)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2836,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2837 } else {
2838 ierr = MatCopy_Basic(A,B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2838,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2839 }
2840 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2841}
2842
2843PetscErrorCode MatSetUp_SeqAIJ(Mat A)
2844{
2845 PetscErrorCode ierr;
2846
2847 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2847; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2848 ierr = MatSeqAIJSetPreallocation_SeqAIJ(A,PETSC_DEFAULT-2,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2848,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2849 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2850}
2851
2852PetscErrorCode MatSeqAIJGetArray_SeqAIJ(Mat A,PetscScalar *array[])
2853{
2854 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2855
2856 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2856; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2857 *array = a->a;
2858 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2859}
2860
2861PetscErrorCode MatSeqAIJRestoreArray_SeqAIJ(Mat A,PetscScalar *array[])
2862{
2863 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2863; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2864 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2865}
2866
2867/*
2868 Computes the number of nonzeros per row needed for preallocation when X and Y
2869 have different nonzero structure.
2870*/
2871PetscErrorCode MatAXPYGetPreallocation_SeqX_private(PetscInt m,const PetscInt *xi,const PetscInt *xj,const PetscInt *yi,const PetscInt *yj,PetscInt *nnz)
2872{
2873 PetscInt i,j,k,nzx,nzy;
2874
2875 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2875; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2876 /* Set the number of nonzeros in the new matrix */
2877 for (i=0; i<m; i++) {
2878 const PetscInt *xjj = xj+xi[i],*yjj = yj+yi[i];
2879 nzx = xi[i+1] - xi[i];
2880 nzy = yi[i+1] - yi[i];
2881 nnz[i] = 0;
2882 for (j=0,k=0; j<nzx; j++) { /* Point in X */
2883 for (; k<nzy && yjj[k]<xjj[j]; k++) nnz[i]++; /* Catch up to X */
2884 if (k<nzy && yjj[k]==xjj[j]) k++; /* Skip duplicate */
2885 nnz[i]++;
2886 }
2887 for (; k<nzy; k++) nnz[i]++;
2888 }
2889 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2890}
2891
2892PetscErrorCode MatAXPYGetPreallocation_SeqAIJ(Mat Y,Mat X,PetscInt *nnz)
2893{
2894 PetscInt m = Y->rmap->N;
2895 Mat_SeqAIJ *x = (Mat_SeqAIJ*)X->data;
2896 Mat_SeqAIJ *y = (Mat_SeqAIJ*)Y->data;
2897 PetscErrorCode ierr;
2898
2899 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2899; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2900 /* Set the number of nonzeros in the new matrix */
2901 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),2901,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2902 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2903}
2904
2905PetscErrorCode MatAXPY_SeqAIJ(Mat Y,PetscScalar a,Mat X,MatStructure str)
2906{
2907 PetscErrorCode ierr;
2908 Mat_SeqAIJ *x = (Mat_SeqAIJ*)X->data,*y = (Mat_SeqAIJ*)Y->data;
2909 PetscBLASInt one=1,bnz;
2910
2911 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2911; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2912 ierr = PetscBLASIntCast(x->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2912,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2913 if (str == SAME_NONZERO_PATTERN) {
2914 PetscScalar alpha = a;
2915 PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&bnz,&alpha,x->a,&one,y->a,&one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASaxpy"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2915; 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(2915
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm
)0x44000001),2915,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_7_ierr);}} while (0);} while(0); do { ; if (petscstack &&
petscstack->currentsize > 0) { petscstack->currentsize
--; petscstack->function[petscstack->currentsize] = 0; petscstack
->file[petscstack->currentsize] = 0; petscstack->line
[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); }
while (0); } while(0)
;
2916 ierr = MatSeqAIJInvalidateDiagonal(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2916,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2917 ierr = PetscObjectStateIncrease((PetscObject)Y)(((PetscObject)Y)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2917,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2918 } else if (str == SUBSET_NONZERO_PATTERN) { /* nonzeros of X is a subset of Y's */
2919 ierr = MatAXPY_Basic(Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2919,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2920 } else {
2921 Mat B;
2922 PetscInt *nnz;
2923 ierr = PetscMalloc1(Y->rmap->N,&nnz)PetscMallocA(1,PETSC_FALSE,2923,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(Y->rmap->N)*sizeof(**(&nnz)),(&nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2923,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2924 ierr = MatCreate(PetscObjectComm((PetscObject)Y),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2924,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2925 ierr = PetscObjectSetName((PetscObject)B,((PetscObject)Y)->name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2925,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2926 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),2926,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2927 ierr = MatSetBlockSizesFromMats(B,Y,Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2927,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2928 ierr = MatSetType(B,(MatType) ((PetscObject)Y)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2928,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2929 ierr = MatAXPYGetPreallocation_SeqAIJ(Y,X,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2929,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2930 ierr = MatSeqAIJSetPreallocation(B,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2930,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2931 ierr = MatAXPY_BasicWithPreallocation(B,Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2931,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2932 ierr = MatHeaderReplace(Y,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2932,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2933 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),2933,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2933,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2934 }
2935 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2936}
2937
2938PetscErrorCode MatConjugate_SeqAIJ(Mat mat)
2939{
2940#if defined(PETSC_USE_COMPLEX)
2941 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
2942 PetscInt i,nz;
2943 PetscScalar *a;
2944
2945 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2945; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2946 nz = aij->nz;
2947 a = aij->a;
2948 for (i=0; i<nz; i++) a[i] = PetscConj(a[i])(a[i]);
2949#else
2950 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2950; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2951#endif
2952 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2953}
2954
2955PetscErrorCode MatGetRowMaxAbs_SeqAIJ(Mat A,Vec v,PetscInt idx[])
2956{
2957 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2958 PetscErrorCode ierr;
2959 PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n;
2960 PetscReal atmp;
2961 PetscScalar *x;
2962 MatScalar *aa;
2963
2964 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2964; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2965 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),2965,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
2966 aa = a->a;
2967 ai = a->i;
2968 aj = a->j;
2969
2970 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2970,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2971 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2971,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2972 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2972,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2973 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),2973,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
2974 for (i=0; i<m; i++) {
2975 ncols = ai[1] - ai[0]; ai++;
2976 x[i] = 0.0;
2977 for (j=0; j<ncols; j++) {
2978 atmp = PetscAbsScalar(*aa);
2979 if (PetscAbsScalar(x[i]) < atmp) {x[i] = atmp; if (idx) idx[i] = *aj;}
2980 aa++; aj++;
2981 }
2982 }
2983 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),2983,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
2984 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2985}
2986
2987PetscErrorCode MatGetRowMax_SeqAIJ(Mat A,Vec v,PetscInt idx[])
2988{
2989 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
2990 PetscErrorCode ierr;
2991 PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n;
2992 PetscScalar *x;
2993 MatScalar *aa;
2994
2995 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 2995; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2996 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),2996,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
2997 aa = a->a;
2998 ai = a->i;
2999 aj = a->j;
3000
3001 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3001,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3002 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3002,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3003 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3003,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3004 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),3004,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
3005 for (i=0; i<m; i++) {
3006 ncols = ai[1] - ai[0]; ai++;
3007 if (ncols == A->cmap->n) { /* row is dense */
3008 x[i] = *aa; if (idx) idx[i] = 0;
3009 } else { /* row is sparse so already KNOW maximum is 0.0 or higher */
3010 x[i] = 0.0;
3011 if (idx) {
3012 idx[i] = 0; /* in case ncols is zero */
3013 for (j=0;j<ncols;j++) { /* find first implicit 0.0 in the row */
3014 if (aj[j] > j) {
3015 idx[i] = j;
3016 break;
3017 }
3018 }
3019 }
3020 }
3021 for (j=0; j<ncols; j++) {
3022 if (PetscRealPart(x[i])(x[i]) < PetscRealPart(*aa)(*aa)) {x[i] = *aa; if (idx) idx[i] = *aj;}
3023 aa++; aj++;
3024 }
3025 }
3026 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3026,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3027 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3028}
3029
3030PetscErrorCode MatGetRowMinAbs_SeqAIJ(Mat A,Vec v,PetscInt idx[])
3031{
3032 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
3033 PetscErrorCode ierr;
3034 PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n;
3035 PetscReal atmp;
3036 PetscScalar *x;
3037 MatScalar *aa;
3038
3039 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3039; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3040 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3040,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3041 aa = a->a;
3042 ai = a->i;
3043 aj = a->j;
3044
3045 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3045,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3046 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3046,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3047 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3047,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3048 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
),3048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
60);}} while (0)
;
3049 for (i=0; i<m; i++) {
3050 ncols = ai[1] - ai[0]; ai++;
3051 if (ncols) {
3052 /* Get first nonzero */
3053 for (j = 0; j < ncols; j++) {
3054 atmp = PetscAbsScalar(aa[j]);
3055 if (atmp > 1.0e-12) {
3056 x[i] = atmp;
3057 if (idx) idx[i] = aj[j];
3058 break;
3059 }
3060 }
3061 if (j == ncols) {x[i] = PetscAbsScalar(*aa); if (idx) idx[i] = *aj;}
3062 } else {
3063 x[i] = 0.0; if (idx) idx[i] = 0;
3064 }
3065 for (j = 0; j < ncols; j++) {
3066 atmp = PetscAbsScalar(*aa);
3067 if (atmp > 1.0e-12 && PetscAbsScalar(x[i]) > atmp) {x[i] = atmp; if (idx) idx[i] = *aj;}
3068 aa++; aj++;
3069 }
3070 }
3071 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3071,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3072 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3073}
3074
3075PetscErrorCode MatGetRowMin_SeqAIJ(Mat A,Vec v,PetscInt idx[])
3076{
3077 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
3078 PetscErrorCode ierr;
3079 PetscInt i,j,m = A->rmap->n,ncols,n;
3080 const PetscInt *ai,*aj;
3081 PetscScalar *x;
3082 const MatScalar *aa;
3083
3084 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3084; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3085 if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3085,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3086 aa = a->a;
3087 ai = a->i;
3088 aj = a->j;
3089
3090 ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3090,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3091 ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3091,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3092 ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3092,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3093 if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),3093,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector")
;
3094 for (i=0; i<m; i++) {
3095 ncols = ai[1] - ai[0]; ai++;
3096 if (ncols == A->cmap->n) { /* row is dense */
3097 x[i] = *aa; if (idx) idx[i] = 0;
3098 } else { /* row is sparse so already KNOW minimum is 0.0 or lower */
3099 x[i] = 0.0;
3100 if (idx) { /* find first implicit 0.0 in the row */
3101 idx[i] = 0; /* in case ncols is zero */
3102 for (j=0; j<ncols; j++) {
3103 if (aj[j] > j) {
3104 idx[i] = j;
3105 break;
3106 }
3107 }
3108 }
3109 }
3110 for (j=0; j<ncols; j++) {
3111 if (PetscRealPart(x[i])(x[i]) > PetscRealPart(*aa)(*aa)) {x[i] = *aa; if (idx) idx[i] = *aj;}
3112 aa++; aj++;
3113 }
3114 }
3115 ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3115,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3116 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3117}
3118
3119PetscErrorCode MatInvertBlockDiagonal_SeqAIJ(Mat A,const PetscScalar **values)
3120{
3121 Mat_SeqAIJ *a = (Mat_SeqAIJ*) A->data;
3122 PetscErrorCode ierr;
3123 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;
3124 MatScalar *diag,work[25],*v_work;
3125 const PetscReal shift = 0.0;
3126 PetscBool allowzeropivot,zeropivotdetected=PETSC_FALSE;
3127
3128 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3128; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3129 allowzeropivot = PetscNot(A->erroriffailure)((A->erroriffailure) ? PETSC_FALSE : PETSC_TRUE);
3130 if (a->ibdiagvalid) {
3131 if (values) *values = a->ibdiag;
3132 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3133 }
3134 ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3134,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3135 if (!a->ibdiag) {
3136 ierr = PetscMalloc1(bs2*mbs,&a->ibdiag)PetscMallocA(1,PETSC_FALSE,3136,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(bs2*mbs)*sizeof(**(&a->ibdiag)),(&a->
ibdiag))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3136,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3137 ierr = PetscLogObjectMemory((PetscObject)A,bs2*mbs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3137,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3138 }
3139 diag = a->ibdiag;
3140 if (values) *values = a->ibdiag;
3141 /* factor and invert each block */
3142 switch (bs) {
3143 case 1:
3144 for (i=0; i<mbs; i++) {
3145 ierr = MatGetValues(A,1,&i,1,&i,diag+i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3145,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3146 if (PetscAbsScalar(diag[i] + shift) < PETSC_MACHINE_EPSILON2.2204460492503131e-16) {
3147 if (allowzeropivot) {
3148 A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3149 A->factorerror_zeropivot_value = PetscAbsScalar(diag[i]);
3150 A->factorerror_zeropivot_row = i;
3151 ierr = PetscInfo3(A,"Zero pivot, row %D pivot %g tolerance %g\n",i,(double)PetscAbsScalar(diag[i]),(double)PETSC_MACHINE_EPSILON)PetscInfo_Private(__func__,A,"Zero pivot, row %D pivot %g tolerance %g\n"
,i,(double)PetscAbsScalar(diag[i]),(double)2.2204460492503131e-16
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3152 } 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
),3152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,71,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
71);}} while (0)
;
3153 }
3154 diag[i] = (PetscScalar)1.0 / (diag[i] + shift);
3155 }
3156 break;
3157 case 2:
3158 for (i=0; i<mbs; i++) {
3159 ij[0] = 2*i; ij[1] = 2*i + 1;
3160 ierr = MatGetValues(A,2,ij,2,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3160,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3161 ierr = PetscKernel_A_gets_inverse_A_2(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3161,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3162 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3163 ierr = PetscKernel_A_gets_transpose_A_2(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3164 diag += 4;
3165 }
3166 break;
3167 case 3:
3168 for (i=0; i<mbs; i++) {
3169 ij[0] = 3*i; ij[1] = 3*i + 1; ij[2] = 3*i + 2;
3170 ierr = MatGetValues(A,3,ij,3,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3170,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3171 ierr = PetscKernel_A_gets_inverse_A_3(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3171,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3172 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3173 ierr = PetscKernel_A_gets_transpose_A_3(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3173,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3174 diag += 9;
3175 }
3176 break;
3177 case 4:
3178 for (i=0; i<mbs; i++) {
3179 ij[0] = 4*i; ij[1] = 4*i + 1; ij[2] = 4*i + 2; ij[3] = 4*i + 3;
3180 ierr = MatGetValues(A,4,ij,4,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3181 ierr = PetscKernel_A_gets_inverse_A_4(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3181,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3182 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3183 ierr = PetscKernel_A_gets_transpose_A_4(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3183,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3184 diag += 16;
3185 }
3186 break;
3187 case 5:
3188 for (i=0; i<mbs; i++) {
3189 ij[0] = 5*i; ij[1] = 5*i + 1; ij[2] = 5*i + 2; ij[3] = 5*i + 3; ij[4] = 5*i + 4;
3190 ierr = MatGetValues(A,5,ij,5,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3190,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3191 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),3191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3192 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3193 ierr = PetscKernel_A_gets_transpose_A_5(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3194 diag += 25;
3195 }
3196 break;
3197 case 6:
3198 for (i=0; i<mbs; i++) {
3199 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;
3200 ierr = MatGetValues(A,6,ij,6,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3200,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3201 ierr = PetscKernel_A_gets_inverse_A_6(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3202 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3203 ierr = PetscKernel_A_gets_transpose_A_6(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3204 diag += 36;
3205 }
3206 break;
3207 case 7:
3208 for (i=0; i<mbs; i++) {
3209 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;
3210 ierr = MatGetValues(A,7,ij,7,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3210,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3211 ierr = PetscKernel_A_gets_inverse_A_7(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3212 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3213 ierr = PetscKernel_A_gets_transpose_A_7(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3214 diag += 49;
3215 }
3216 break;
3217 default:
3218 ierr = PetscMalloc3(bs,&v_work,bs,&v_pivots,bs,&IJ)PetscMallocA(3,PETSC_FALSE,3218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(bs)*sizeof(**(&v_work)),(&v_work),(size_t)(
bs)*sizeof(**(&v_pivots)),(&v_pivots),(size_t)(bs)*sizeof
(**(&IJ)),(&IJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3219 for (i=0; i<mbs; i++) {
3220 for (j=0; j<bs; j++) {
3221 IJ[j] = bs*i + j;
3222 }
3223 ierr = MatGetValues(A,bs,IJ,bs,IJ,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3224 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),3224,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3225 if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT;
3226 ierr = PetscKernel_A_gets_transpose_A_N(diag,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3227 diag += bs2;
3228 }
3229 ierr = PetscFree3(v_work,v_pivots,IJ)PetscFreeA(3,3229,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,&(v_work),&(v_pivots),&(IJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3229,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3230 }
3231 a->ibdiagvalid = PETSC_TRUE;
3232 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3233}
3234
3235static PetscErrorCode MatSetRandom_SeqAIJ(Mat x,PetscRandom rctx)
3236{
3237 PetscErrorCode ierr;
3238 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)x->data;
3239 PetscScalar a;
3240 PetscInt m,n,i,j,col;
3241
3242 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3242; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3243 if (!x->assembled) {
3244 ierr = MatGetSize(x,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3244,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3245 for (i=0; i<m; i++) {
3246 for (j=0; j<aij->imax[i]; j++) {
3247 ierr = PetscRandomGetValue(rctx,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3247,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3248 col = (PetscInt)(n*PetscRealPart(a)(a));
3249 ierr = MatSetValues(x,1,&i,1,&col,&a,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3249,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3250 }
3251 }
3252 } else {
3253 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),3253,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;}
3254 }
3255 ierr = MatAssemblyBegin(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3255,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3256 ierr = MatAssemblyEnd(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3256,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3257 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3258}
3259
3260/* Like MatSetRandom_SeqAIJ, but do not set values on columns in range of [low, high) */
3261PetscErrorCode MatSetRandomSkipColumnRange_SeqAIJ_Private(Mat x,PetscInt low,PetscInt high,PetscRandom rctx)
3262{
3263 PetscErrorCode ierr;
3264 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)x->data;
3265 PetscScalar a;
3266 PetscInt m,n,i,j,col,nskip;
3267
3268 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3268; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3269 nskip = high - low;
3270 ierr = MatGetSize(x,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3270,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3271 n -= nskip; /* shrink number of columns where nonzeros can be set */
3272 for (i=0; i<m; i++) {
3273 for (j=0; j<aij->imax[i]; j++) {
3274 ierr = PetscRandomGetValue(rctx,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3274,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3275 col = (PetscInt)(n*PetscRealPart(a)(a));
3276 if (col >= low) col += nskip; /* shift col rightward to skip the hole */
3277 ierr = MatSetValues(x,1,&i,1,&col,&a,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3277,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3278 }
3279 }
3280 ierr = MatAssemblyBegin(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3280,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3281 ierr = MatAssemblyEnd(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3282 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3283}
3284
3285
3286/* -------------------------------------------------------------------*/
3287static struct _MatOps MatOps_Values = { MatSetValues_SeqAIJ,
3288 MatGetRow_SeqAIJ,
3289 MatRestoreRow_SeqAIJ,
3290 MatMult_SeqAIJ,
3291 /* 4*/ MatMultAdd_SeqAIJ,
3292 MatMultTranspose_SeqAIJ,
3293 MatMultTransposeAdd_SeqAIJ,
3294 0,
3295 0,
3296 0,
3297 /* 10*/ 0,
3298 MatLUFactor_SeqAIJ,
3299 0,
3300 MatSOR_SeqAIJ,
3301 MatTranspose_SeqAIJ,
3302 /*1 5*/ MatGetInfo_SeqAIJ,
3303 MatEqual_SeqAIJ,
3304 MatGetDiagonal_SeqAIJ,
3305 MatDiagonalScale_SeqAIJ,
3306 MatNorm_SeqAIJ,
3307 /* 20*/ 0,
3308 MatAssemblyEnd_SeqAIJ,
3309 MatSetOption_SeqAIJ,
3310 MatZeroEntries_SeqAIJ,
3311 /* 24*/ MatZeroRows_SeqAIJ,
3312 0,
3313 0,
3314 0,
3315 0,
3316 /* 29*/ MatSetUp_SeqAIJ,
3317 0,
3318 0,
3319 0,
3320 0,
3321 /* 34*/ MatDuplicate_SeqAIJ,
3322 0,
3323 0,
3324 MatILUFactor_SeqAIJ,
3325 0,
3326 /* 39*/ MatAXPY_SeqAIJ,
3327 MatCreateSubMatrices_SeqAIJ,
3328 MatIncreaseOverlap_SeqAIJ,
3329 MatGetValues_SeqAIJ,
3330 MatCopy_SeqAIJ,
3331 /* 44*/ MatGetRowMax_SeqAIJ,
3332 MatScale_SeqAIJ,
3333 MatShift_SeqAIJ,
3334 MatDiagonalSet_SeqAIJ,
3335 MatZeroRowsColumns_SeqAIJ,
3336 /* 49*/ MatSetRandom_SeqAIJ,
3337 MatGetRowIJ_SeqAIJ,
3338 MatRestoreRowIJ_SeqAIJ,
3339 MatGetColumnIJ_SeqAIJ,
3340 MatRestoreColumnIJ_SeqAIJ,
3341 /* 54*/ MatFDColoringCreate_SeqXAIJ,
3342 0,
3343 0,
3344 MatPermute_SeqAIJ,
3345 0,
3346 /* 59*/ 0,
3347 MatDestroy_SeqAIJ,
3348 MatView_SeqAIJ,
3349 0,
3350 MatMatMatMult_SeqAIJ_SeqAIJ_SeqAIJ,
3351 /* 64*/ MatMatMatMultSymbolic_SeqAIJ_SeqAIJ_SeqAIJ,
3352 MatMatMatMultNumeric_SeqAIJ_SeqAIJ_SeqAIJ,
3353 0,
3354 0,
3355 0,
3356 /* 69*/ MatGetRowMaxAbs_SeqAIJ,
3357 MatGetRowMinAbs_SeqAIJ,
3358 0,
3359 0,
3360 0,
3361 /* 74*/ 0,
3362 MatFDColoringApply_AIJ,
3363 0,
3364 0,
3365 0,
3366 /* 79*/ MatFindZeroDiagonals_SeqAIJ,
3367 0,
3368 0,
3369 0,
3370 MatLoad_SeqAIJ,
3371 /* 84*/ MatIsSymmetric_SeqAIJ,
3372 MatIsHermitian_SeqAIJ,
3373 0,
3374 0,
3375 0,
3376 /* 89*/ MatMatMult_SeqAIJ_SeqAIJ,
3377 MatMatMultSymbolic_SeqAIJ_SeqAIJ,
3378 MatMatMultNumeric_SeqAIJ_SeqAIJ,
3379 MatPtAP_SeqAIJ_SeqAIJ,
3380 MatPtAPSymbolic_SeqAIJ_SeqAIJ_SparseAxpy,
3381 /* 94*/ MatPtAPNumeric_SeqAIJ_SeqAIJ_SparseAxpy,
3382 MatMatTransposeMult_SeqAIJ_SeqAIJ,
3383 MatMatTransposeMultSymbolic_SeqAIJ_SeqAIJ,
3384 MatMatTransposeMultNumeric_SeqAIJ_SeqAIJ,
3385 0,
3386 /* 99*/ 0,
3387 0,
3388 0,
3389 MatConjugate_SeqAIJ,
3390 0,
3391 /*104*/ MatSetValuesRow_SeqAIJ,
3392 MatRealPart_SeqAIJ,
3393 MatImaginaryPart_SeqAIJ,
3394 0,
3395 0,
3396 /*109*/ MatMatSolve_SeqAIJ,
3397 0,
3398 MatGetRowMin_SeqAIJ,
3399 0,
3400 MatMissingDiagonal_SeqAIJ,
3401 /*114*/ 0,
3402 0,
3403 0,
3404 0,
3405 0,
3406 /*119*/ 0,
3407 0,
3408 0,
3409 0,
3410 MatGetMultiProcBlock_SeqAIJ,
3411 /*124*/ MatFindNonzeroRows_SeqAIJ,
3412 MatGetColumnNorms_SeqAIJ,
3413 MatInvertBlockDiagonal_SeqAIJ,
3414 MatInvertVariableBlockDiagonal_SeqAIJ,
3415 0,
3416 /*129*/ 0,
3417 MatTransposeMatMult_SeqAIJ_SeqAIJ,
3418 MatTransposeMatMultSymbolic_SeqAIJ_SeqAIJ,
3419 MatTransposeMatMultNumeric_SeqAIJ_SeqAIJ,
3420 MatTransposeColoringCreate_SeqAIJ,
3421 /*134*/ MatTransColoringApplySpToDen_SeqAIJ,
3422 MatTransColoringApplyDenToSp_SeqAIJ,
3423 MatRARt_SeqAIJ_SeqAIJ,
3424 MatRARtSymbolic_SeqAIJ_SeqAIJ,
3425 MatRARtNumeric_SeqAIJ_SeqAIJ,
3426 /*139*/0,
3427 0,
3428 0,
3429 MatFDColoringSetUp_SeqXAIJ,
3430 MatFindOffBlockDiagonalEntries_SeqAIJ,
3431 /*144*/MatCreateMPIMatConcatenateSeqMat_SeqAIJ,
3432 MatDestroySubMatrices_SeqAIJ
3433};
3434
3435PetscErrorCode MatSeqAIJSetColumnIndices_SeqAIJ(Mat mat,PetscInt *indices)
3436{
3437 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3438 PetscInt i,nz,n;
3439
3440 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3440; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3441 nz = aij->maxnz;
3442 n = mat->rmap->n;
3443 for (i=0; i<nz; i++) {
3444 aij->j[i] = indices[i];
3445 }
3446 aij->nz = nz;
3447 for (i=0; i<n; i++) {
3448 aij->ilen[i] = aij->imax[i];
3449 }
3450 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3451}
3452
3453/*
3454 * When a sparse matrix has many zero columns, we should compact them out to save the space
3455 * This happens in MatPtAPSymbolic_MPIAIJ_MPIAIJ_scalable()
3456 * */
3457PetscErrorCode MatSeqAIJCompactOutExtraColumns_SeqAIJ(Mat mat, ISLocalToGlobalMapping *mapping)
3458{
3459 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3460 PetscTable gid1_lid1;
3461 PetscTablePosition tpos;
3462 PetscInt gid,lid,i,j,ncols,ec;
3463 PetscInt *garray;
3464 PetscErrorCode ierr;
3465
3466 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3466; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3467 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3467,
__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3467,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),3467,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3467,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3468 PetscValidPointer(mapping,2)do { if (!mapping) return PetscError(((MPI_Comm)0x44000001),3468
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(mapping,PETSC_CHAR)) return PetscError((
(MPI_Comm)0x44000001),3468,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
3469 /* use a table */
3470 ierr = PetscTableCreate(mat->rmap->n,mat->cmap->N+1,&gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3471 ec = 0;
3472 for (i=0; i<mat->rmap->n; i++) {
3473 ncols = aij->i[i+1] - aij->i[i];
3474 for (j=0; j<ncols; j++) {
3475 PetscInt data,gid1 = aij->j[aij->i[i] + j] + 1;
3476 ierr = PetscTableFind(gid1_lid1,gid1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3476,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3477 if (!data) {
3478 /* one based table */
3479 ierr = PetscTableAdd(gid1_lid1,gid1,++ec,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3480 }
3481 }
3482 }
3483 /* form array of columns we need */
3484 ierr = PetscMalloc1(ec+1,&garray)PetscMallocA(1,PETSC_FALSE,3484,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(ec+1)*sizeof(**(&garray)),(&garray))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3484,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3485 ierr = PetscTableGetHeadPosition(gid1_lid1,&tpos);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3485,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3486 while (tpos) {
3487 ierr = PetscTableGetNext(gid1_lid1,&tpos,&gid,&lid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3488 gid--;
3489 lid--;
3490 garray[lid] = gid;
3491 }
3492 ierr = PetscSortInt(ec,garray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3492,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* sort, and rebuild */
3493 ierr = PetscTableRemoveAll(gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3494 for (i=0; i<ec; i++) {
3495 ierr = PetscTableAdd(gid1_lid1,garray[i]+1,i+1,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3495,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3496 }
3497 /* compact out the extra columns in B */
3498 for (i=0; i<mat->rmap->n; i++) {
3499 ncols = aij->i[i+1] - aij->i[i];
3500 for (j=0; j<ncols; j++) {
3501 PetscInt gid1 = aij->j[aij->i[i] + j] + 1;
3502 ierr = PetscTableFind(gid1_lid1,gid1,&lid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3502,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3503 lid--;
3504 aij->j[aij->i[i] + j] = lid;
3505 }
3506 }
3507 mat->cmap->n = mat->cmap->N = ec;
3508 mat->cmap->bs = 1;
3509
3510 ierr = PetscTableDestroy(&gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3510,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3511 ierr = PetscLayoutSetUp((mat->cmap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3511,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3512 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),3512,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3513 ierr = ISLocalToGlobalMappingSetType(*mapping,ISLOCALTOGLOBALMAPPINGHASH"hash");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3513,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3514 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3515}
3516
3517/*@
3518 MatSeqAIJSetColumnIndices - Set the column indices for all the rows
3519 in the matrix.
3520
3521 Input Parameters:
3522+ mat - the SeqAIJ matrix
3523- indices - the column indices
3524
3525 Level: advanced
3526
3527 Notes:
3528 This can be called if you have precomputed the nonzero structure of the
3529 matrix and want to provide it to the matrix object to improve the performance
3530 of the MatSetValues() operation.
3531
3532 You MUST have set the correct numbers of nonzeros per row in the call to
3533 MatCreateSeqAIJ(), and the columns indices MUST be sorted.
3534
3535 MUST be called before any calls to MatSetValues();
3536
3537 The indices should start with zero, not one.
3538
3539@*/
3540PetscErrorCode MatSeqAIJSetColumnIndices(Mat mat,PetscInt *indices)
3541{
3542 PetscErrorCode ierr;
3543
3544 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3544; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3545 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3545,
__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3545,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),3545,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3545,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3546 PetscValidPointer(indices,2)do { if (!indices) return PetscError(((MPI_Comm)0x44000001),3546
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(indices,PETSC_CHAR)) return PetscError((
(MPI_Comm)0x44000001),3546,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
3547 ierr = PetscUseMethod(mat,"MatSeqAIJSetColumnIndices_C",(Mat,PetscInt*),(mat,indices))0; do { PetscErrorCode (*f)(Mat,PetscInt*), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)mat),("MatSeqAIJSetColumnIndices_C"),(PetscVoidFunction
*)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError
(((MPI_Comm)0x44000001),3547,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(mat,indices);
do {if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm
)0x44000001),3547,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)mat),3547,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatSeqAIJSetColumnIndices_C"); } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3547,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3548 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3549}
3550
3551/* ----------------------------------------------------------------------------------------*/
3552
3553PetscErrorCode MatStoreValues_SeqAIJ(Mat mat)
3554{
3555 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3556 PetscErrorCode ierr;
3557 size_t nz = aij->i[mat->rmap->n];
3558
3559 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3559; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3560 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),3560,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,58,PETSC_ERROR_INITIAL,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first"
)
;
3561
3562 /* allocate space for values if not already there */
3563 if (!aij->saved_values) {
3564 ierr = PetscMalloc1(nz+1,&aij->saved_values)PetscMallocA(1,PETSC_FALSE,3564,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz+1)*sizeof(**(&aij->saved_values)),(&aij
->saved_values))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3564,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3565 ierr = PetscLogObjectMemory((PetscObject)mat,(nz+1)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3565,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3566 }
3567
3568 /* copy values over */
3569 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),3569,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3570 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3571}
3572
3573/*@
3574 MatStoreValues - Stashes a copy of the matrix values; this allows, for
3575 example, reuse of the linear part of a Jacobian, while recomputing the
3576 nonlinear portion.
3577
3578 Collect on Mat
3579
3580 Input Parameters:
3581. mat - the matrix (currently only AIJ matrices support this option)
3582
3583 Level: advanced
3584
3585 Common Usage, with SNESSolve():
3586$ Create Jacobian matrix
3587$ Set linear terms into matrix
3588$ Apply boundary conditions to matrix, at this time matrix must have
3589$ final nonzero structure (i.e. setting the nonlinear terms and applying
3590$ boundary conditions again will not change the nonzero structure
3591$ ierr = MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);
3592$ ierr = MatStoreValues(mat);
3593$ Call SNESSetJacobian() with matrix
3594$ In your Jacobian routine
3595$ ierr = MatRetrieveValues(mat);
3596$ Set nonlinear terms in matrix
3597
3598 Common Usage without SNESSolve(), i.e. when you handle nonlinear solve yourself:
3599$ // build linear portion of Jacobian
3600$ ierr = MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);
3601$ ierr = MatStoreValues(mat);
3602$ loop over nonlinear iterations
3603$ ierr = MatRetrieveValues(mat);
3604$ // call MatSetValues(mat,...) to set nonliner portion of Jacobian
3605$ // call MatAssemblyBegin/End() on matrix
3606$ Solve linear system with Jacobian
3607$ endloop
3608
3609 Notes:
3610 Matrix must already be assemblied before calling this routine
3611 Must set the matrix option MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE); before
3612 calling this routine.
3613
3614 When this is called multiple times it overwrites the previous set of stored values
3615 and does not allocated additional space.
3616
3617.seealso: MatRetrieveValues()
3618
3619@*/
3620PetscErrorCode MatStoreValues(Mat mat)
3621{
3622 PetscErrorCode ierr;
3623
3624 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3624; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3625 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3625,
__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3625,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),3625,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3625,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3626 if (!mat->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for unassembled matrix")return PetscError(((MPI_Comm)0x44000001),3626,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for unassembled matrix")
;
3627 if (mat->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3627,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3628 ierr = PetscUseMethod(mat,"MatStoreValues_C",(Mat),(mat))0; do { PetscErrorCode (*f)(Mat), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)mat),("MatStoreValues_C"),(PetscVoidFunction*)
(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError
(((MPI_Comm)0x44000001),3628,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(mat);do {if (
__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),3628,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)mat),3628,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatStoreValues_C"); } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3628,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3629 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3630}
3631
3632PetscErrorCode MatRetrieveValues_SeqAIJ(Mat mat)
3633{
3634 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data;
3635 PetscErrorCode ierr;
3636 PetscInt nz = aij->i[mat->rmap->n];
3637
3638 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3638; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3639 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),3639,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,58,PETSC_ERROR_INITIAL,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first"
)
;
3640 if (!aij->saved_values) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatStoreValues(A);first")return PetscError(((MPI_Comm)0x44000001),3640,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,58,PETSC_ERROR_INITIAL,"Must call MatStoreValues(A);first")
;
3641 /* copy values over */
3642 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),3642,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3643 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3644}
3645
3646/*@
3647 MatRetrieveValues - Retrieves the copy of the matrix values; this allows, for
3648 example, reuse of the linear part of a Jacobian, while recomputing the
3649 nonlinear portion.
3650
3651 Collect on Mat
3652
3653 Input Parameters:
3654. mat - the matrix (currently only AIJ matrices support this option)
3655
3656 Level: advanced
3657
3658.seealso: MatStoreValues()
3659
3660@*/
3661PetscErrorCode MatRetrieveValues(Mat mat)
3662{
3663 PetscErrorCode ierr;
3664
3665 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3665; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3666 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3666,
__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3666,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),3666,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3666,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3667 if (!mat->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for unassembled matrix")return PetscError(((MPI_Comm)0x44000001),3667,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for unassembled matrix")
;
3668 if (mat->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3668,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_INITIAL,"Not for factored matrix")
;
3669 ierr = PetscUseMethod(mat,"MatRetrieveValues_C",(Mat),(mat))0; do { PetscErrorCode (*f)(Mat), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)mat),("MatRetrieveValues_C"),(PetscVoidFunction
*)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError
(((MPI_Comm)0x44000001),3669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(mat);do {if (
__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),3669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)mat),3669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatRetrieveValues_C"); } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3670 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3671}
3672
3673
3674/* --------------------------------------------------------------------------------*/
3675/*@C
3676 MatCreateSeqAIJ - Creates a sparse matrix in AIJ (compressed row) format
3677 (the default parallel PETSc format). For good matrix assembly performance
3678 the user should preallocate the matrix storage by setting the parameter nz
3679 (or the array nnz). By setting these parameters accurately, performance
3680 during matrix assembly can be increased by more than a factor of 50.
3681
3682 Collective
3683
3684 Input Parameters:
3685+ comm - MPI communicator, set to PETSC_COMM_SELF
3686. m - number of rows
3687. n - number of columns
3688. nz - number of nonzeros per row (same for all rows)
3689- nnz - array containing the number of nonzeros in the various rows
3690 (possibly different for each row) or NULL
3691
3692 Output Parameter:
3693. A - the matrix
3694
3695 It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(),
3696 MatXXXXSetPreallocation() paradigm instead of this routine directly.
3697 [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation]
3698
3699 Notes:
3700 If nnz is given then nz is ignored
3701
3702 The AIJ format (also called the Yale sparse matrix format or
3703 compressed row storage), is fully compatible with standard Fortran 77
3704 storage. That is, the stored row and column indices can begin at
3705 either one (as in Fortran) or zero. See the users' manual for details.
3706
3707 Specify the preallocated storage with either nz or nnz (not both).
3708 Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory
3709 allocation. For large problems you MUST preallocate memory or you
3710 will get TERRIBLE performance, see the users' manual chapter on matrices.
3711
3712 By default, this format uses inodes (identical nodes) when possible, to
3713 improve numerical efficiency of matrix-vector products and solves. We
3714 search for consecutive rows with the same nonzero structure, thereby
3715 reusing matrix information to achieve increased efficiency.
3716
3717 Options Database Keys:
3718+ -mat_no_inode - Do not use inodes
3719- -mat_inode_limit <limit> - Sets inode limit (max limit=5)
3720
3721 Level: intermediate
3722
3723.seealso: MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays()
3724
3725@*/
3726PetscErrorCode MatCreateSeqAIJ(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[],Mat *A)
3727{
3728 PetscErrorCode ierr;
3729
3730 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3730; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3731 ierr = MatCreate(comm,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3731,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3732 ierr = MatSetSizes(*A,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3732,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3733 ierr = MatSetType(*A,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3733,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3734 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*A,nz,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3734,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3735 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3736}
3737
3738/*@C
3739 MatSeqAIJSetPreallocation - For good matrix assembly performance
3740 the user should preallocate the matrix storage by setting the parameter nz
3741 (or the array nnz). By setting these parameters accurately, performance
3742 during matrix assembly can be increased by more than a factor of 50.
3743
3744 Collective
3745
3746 Input Parameters:
3747+ B - The matrix
3748. nz - number of nonzeros per row (same for all rows)
3749- nnz - array containing the number of nonzeros in the various rows
3750 (possibly different for each row) or NULL
3751
3752 Notes:
3753 If nnz is given then nz is ignored
3754
3755 The AIJ format (also called the Yale sparse matrix format or
3756 compressed row storage), is fully compatible with standard Fortran 77
3757 storage. That is, the stored row and column indices can begin at
3758 either one (as in Fortran) or zero. See the users' manual for details.
3759
3760 Specify the preallocated storage with either nz or nnz (not both).
3761 Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory
3762 allocation. For large problems you MUST preallocate memory or you
3763 will get TERRIBLE performance, see the users' manual chapter on matrices.
3764
3765 You can call MatGetInfo() to get information on how effective the preallocation was;
3766 for example the fields mallocs,nz_allocated,nz_used,nz_unneeded;
3767 You can also run with the option -info and look for messages with the string
3768 malloc in them to see if additional memory allocation was needed.
3769
3770 Developers: Use nz of MAT_SKIP_ALLOCATION to not allocate any space for the matrix
3771 entries or columns indices
3772
3773 By default, this format uses inodes (identical nodes) when possible, to
3774 improve numerical efficiency of matrix-vector products and solves. We
3775 search for consecutive rows with the same nonzero structure, thereby
3776 reusing matrix information to achieve increased efficiency.
3777
3778 Options Database Keys:
3779+ -mat_no_inode - Do not use inodes
3780- -mat_inode_limit <limit> - Sets inode limit (max limit=5)
3781
3782 Level: intermediate
3783
3784.seealso: MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays(), MatGetInfo()
3785
3786@*/
3787PetscErrorCode MatSeqAIJSetPreallocation(Mat B,PetscInt nz,const PetscInt nnz[])
3788{
3789 PetscErrorCode ierr;
3790
3791 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3791; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3792 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3792,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if (
((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3792,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3793 PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) do {if (__builtin_expect
(!!(73),0)) {PetscError(((MPI_Comm)0x44000001),3793,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",73
,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),73)
;}} while (0); } while (0)
;
3794 ierr = PetscTryMethod(B,"MatSeqAIJSetPreallocation_C",(Mat,PetscInt,const PetscInt[]),(B,nz,nnz))0; do { PetscErrorCode (*f)(Mat,PetscInt,const PetscInt[]), __ierr
; __ierr = PetscObjectQueryFunction_Private(((PetscObject)B),
("MatSeqAIJSetPreallocation_C"),(PetscVoidFunction*)(&f))
;do {if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm
)0x44000001),3794,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(B,nz,nnz);do {
if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),3794,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3794,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3795 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3796}
3797
3798PetscErrorCode MatSeqAIJSetPreallocation_SeqAIJ(Mat B,PetscInt nz,const PetscInt *nnz)
3799{
3800 Mat_SeqAIJ *b;
3801 PetscBool skipallocation = PETSC_FALSE,realalloc = PETSC_FALSE;
3802 PetscErrorCode ierr;
3803 PetscInt i;
3804
3805 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3805; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3806 if (nz >= 0 || nnz) realalloc = PETSC_TRUE;
3807 if (nz == MAT_SKIP_ALLOCATION-4) {
3808 skipallocation = PETSC_TRUE;
3809 nz = 0;
3810 }
3811 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3811,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3812 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3812,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3813
3814 if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 5;
3815 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),3815,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"nz cannot be less than 0: value %D",
nz)
;
3816#if defined(PETSC_USE_DEBUG1)
3817 if (nnz) {
3818 for (i=0; i<B->rmap->n; i++) {
3819 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
),3819,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
3820 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
),3820,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
3821 }
3822 }
3823#endif
3824
3825 B->preallocated = PETSC_TRUE;
3826
3827 b = (Mat_SeqAIJ*)B->data;
3828
3829 if (!skipallocation) {
3830 if (!b->imax) {
3831 ierr = PetscMalloc1(B->rmap->n,&b->imax)PetscMallocA(1,PETSC_FALSE,3831,__func__,"/sandbox/petsc/petsc.next-tmp/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),3831,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3832 ierr = PetscLogObjectMemory((PetscObject)B,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3832,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3833 }
3834 if (!b->ilen) {
3835 /* b->ilen will count nonzeros in each row so far. */
3836 ierr = PetscCalloc1(B->rmap->n,&b->ilen)PetscMallocA(1,PETSC_TRUE,3836,__func__,"/sandbox/petsc/petsc.next-tmp/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),3836,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3837 ierr = PetscLogObjectMemory((PetscObject)B,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3837,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3838 } else {
3839 ierr = PetscMemzero(b->ilen,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3839,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3840 }
3841 if (!b->ipre) {
3842 ierr = PetscMalloc1(B->rmap->n,&b->ipre)PetscMallocA(1,PETSC_FALSE,3842,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(B->rmap->n)*sizeof(**(&b->ipre)),(&
b->ipre))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3842,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3843 ierr = PetscLogObjectMemory((PetscObject)B,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3843,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3844 }
3845 if (!nnz) {
3846 if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 10;
3847 else if (nz < 0) nz = 1;
3848 nz = PetscMin(nz,B->cmap->n)(((nz)<(B->cmap->n)) ? (nz) : (B->cmap->n));
3849 for (i=0; i<B->rmap->n; i++) b->imax[i] = nz;
3850 nz = nz*B->rmap->n;
3851 } else {
3852 nz = 0;
3853 for (i=0; i<B->rmap->n; i++) {b->imax[i] = nnz[i]; nz += nnz[i];}
3854 }
3855
3856 /* allocate the matrix space */
3857 /* FIXME: should B's old memory be unlogged? */
3858 ierr = MatSeqXAIJFreeAIJ(B,&b->a,&b->j,&b->i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3858,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3859 if (B->structure_only) {
3860 ierr = PetscMalloc1(nz,&b->j)PetscMallocA(1,PETSC_FALSE,3860,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz)*sizeof(**(&b->j)),(&b->j))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3860,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3861 ierr = PetscMalloc1(B->rmap->n+1,&b->i)PetscMallocA(1,PETSC_FALSE,3861,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(B->rmap->n+1)*sizeof(**(&b->i)),(&
b->i))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3861,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3862 ierr = PetscLogObjectMemory((PetscObject)B,(B->rmap->n+1)*sizeof(PetscInt)+nz*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3862,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3863 } else {
3864 ierr = PetscMalloc3(nz,&b->a,nz,&b->j,B->rmap->n+1,&b->i)PetscMallocA(3,PETSC_FALSE,3864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(nz)*sizeof(**(&b->a)),(&b->a),(size_t
)(nz)*sizeof(**(&b->j)),(&b->j),(size_t)(B->
rmap->n+1)*sizeof(**(&b->i)),(&b->i))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3865 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),3865,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3866 }
3867 b->i[0] = 0;
3868 for (i=1; i<B->rmap->n+1; i++) {
3869 b->i[i] = b->i[i-1] + b->imax[i-1];
3870 }
3871 if (B->structure_only) {
3872 b->singlemalloc = PETSC_FALSE;
3873 b->free_a = PETSC_FALSE;
3874 } else {
3875 b->singlemalloc = PETSC_TRUE;
3876 b->free_a = PETSC_TRUE;
3877 }
3878 b->free_ij = PETSC_TRUE;
3879 } else {
3880 b->free_a = PETSC_FALSE;
3881 b->free_ij = PETSC_FALSE;
3882 }
3883
3884 if (b->ipre && nnz != b->ipre && b->imax) {
3885 /* reserve user-requested sparsity */
3886 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),3886,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3887 }
3888
3889
3890 b->nz = 0;
3891 b->maxnz = nz;
3892 B->info.nz_unneeded = (double)b->maxnz;
3893 if (realalloc) {
3894 ierr = MatSetOption(B,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3894,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3895 }
3896 B->was_assembled = PETSC_FALSE;
3897 B->assembled = PETSC_FALSE;
3898 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3899}
3900
3901
3902PetscErrorCode MatResetPreallocation_SeqAIJ(Mat A)
3903{
3904 Mat_SeqAIJ *a;
3905 PetscInt i;
3906 PetscErrorCode ierr;
3907
3908 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3908; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3909 PetscValidHeaderSpecific(A,MAT_CLASSID,1)do { if (!A) return PetscError(((MPI_Comm)0x44000001),3909,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(A,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3909,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(A))->classid != MAT_CLASSID) { if (
((PetscObject)(A))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3909,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3909,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3910 a = (Mat_SeqAIJ*)A->data;
3911 /* if no saved info, we error out */
3912 if (!a->ipre) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_ARG_NULL,"No saved preallocation info \n")return PetscError(PETSC_COMM_WORLD,3912,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"No saved preallocation info \n")
;
3913
3914 if (!a->i || !a->j || !a->a || !a->imax || !a->ilen) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_ARG_NULL,"Memory info is incomplete, and can not reset preallocation \n")return PetscError(PETSC_COMM_WORLD,3914,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Memory info is incomplete, and can not reset preallocation \n"
)
;
3915
3916 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),3916,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3917 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),3917,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3918 a->i[0] = 0;
3919 for (i=1; i<A->rmap->n+1; i++) {
3920 a->i[i] = a->i[i-1] + a->imax[i-1];
3921 }
3922 A->preallocated = PETSC_TRUE;
3923 a->nz = 0;
3924 a->maxnz = a->i[A->rmap->n];
3925 A->info.nz_unneeded = (double)a->maxnz;
3926 A->was_assembled = PETSC_FALSE;
3927 A->assembled = PETSC_FALSE;
3928 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3929}
3930
3931/*@
3932 MatSeqAIJSetPreallocationCSR - Allocates memory for a sparse sequential matrix in AIJ format.
3933
3934 Input Parameters:
3935+ B - the matrix
3936. i - the indices into j for the start of each row (starts with zero)
3937. j - the column indices for each row (starts with zero) these must be sorted for each row
3938- v - optional values in the matrix
3939
3940 Level: developer
3941
3942 The i,j,v values are COPIED with this routine; to avoid the copy use MatCreateSeqAIJWithArrays()
3943
3944.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatSeqAIJSetPreallocation(), MatCreateSeqAIJ(), MATSEQAIJ
3945@*/
3946PetscErrorCode MatSeqAIJSetPreallocationCSR(Mat B,const PetscInt i[],const PetscInt j[],const PetscScalar v[])
3947{
3948 PetscErrorCode ierr;
3949
3950 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3950; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3951 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3951,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3951,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if (
((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3951,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3951,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
3952 PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) do {if (__builtin_expect
(!!(73),0)) {PetscError(((MPI_Comm)0x44000001),3952,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",73
,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),73)
;}} while (0); } while (0)
;
3953 ierr = PetscTryMethod(B,"MatSeqAIJSetPreallocationCSR_C",(Mat,const PetscInt[],const PetscInt[],const PetscScalar[]),(B,i,j,v))0; do { PetscErrorCode (*f)(Mat,const PetscInt[],const PetscInt
[],const PetscScalar[]), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)B),("MatSeqAIJSetPreallocationCSR_C"),(PetscVoidFunction
*)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError
(((MPI_Comm)0x44000001),3953,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(B,i,j,v);do {
if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),3953,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3953,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
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
3957PetscErrorCode MatSeqAIJSetPreallocationCSR_SeqAIJ(Mat B,const PetscInt Ii[],const PetscInt J[],const PetscScalar v[])
3958{
3959 PetscInt i;
3960 PetscInt m,n;
3961 PetscInt nz;
3962 PetscInt *nnz, nz_max = 0;
3963 PetscErrorCode ierr;
3964
3965 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 3965; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3966 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),3966,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"Ii[0] must be 0 it is %D",Ii[0])
;
3967
3968 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3968,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3969 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3969,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3970
3971 ierr = MatGetSize(B, &m, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3971,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3972 ierr = PetscMalloc1(m+1, &nnz)PetscMallocA(1,PETSC_FALSE,3972,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m+1)*sizeof(**(&nnz)),(&nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3972,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3973 for (i = 0; i < m; i++) {
3974 nz = Ii[i+1]- Ii[i];
3975 nz_max = PetscMax(nz_max, nz)(((nz_max)<(nz)) ? (nz) : (nz_max));
3976 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
),3976,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
3977 nnz[i] = nz;
3978 }
3979 ierr = MatSeqAIJSetPreallocation(B, 0, nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3979,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3980 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),3980,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3980,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3981
3982 for (i = 0; i < m; i++) {
3983 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),3983,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3984 }
3985
3986 ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3986,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3987 ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3987,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3988
3989 ierr = MatSetOption(B,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),3989,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
3990 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3991}
3992
3993#include <../src/mat/impls/dense/seq/dense.h>
3994#include <petsc/private/kernels/petscaxpy.h>
3995
3996/*
3997 Computes (B'*A')' since computing B*A directly is untenable
3998
3999 n p p
4000 ( ) ( ) ( )
4001 m ( A ) * n ( B ) = m ( C )
4002 ( ) ( ) ( )
4003
4004*/
4005PetscErrorCode MatMatMultNumeric_SeqDense_SeqAIJ(Mat A,Mat B,Mat C)
4006{
4007 PetscErrorCode ierr;
4008 Mat_SeqDense *sub_a = (Mat_SeqDense*)A->data;
4009 Mat_SeqAIJ *sub_b = (Mat_SeqAIJ*)B->data;
4010 Mat_SeqDense *sub_c = (Mat_SeqDense*)C->data;
4011 PetscInt i,n,m,q,p;
4012 const PetscInt *ii,*idx;
4013 const PetscScalar *b,*a,*a_q;
4014 PetscScalar *c,*c_q;
4015
4016 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4016; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4017 m = A->rmap->n;
4018 n = A->cmap->n;
4019 p = B->cmap->n;
4020 a = sub_a->v;
4021 b = sub_b->a;
4022 c = sub_c->v;
4023 ierr = PetscArrayzero(c,m*p)PetscMemzero(c,(m*p)*sizeof(*(c)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4023,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4024
4025 ii = sub_b->i;
4026 idx = sub_b->j;
4027 for (i=0; i<n; i++) {
4028 q = ii[i+1] - ii[i];
4029 while (q-->0) {
4030 c_q = c + m*(*idx);
4031 a_q = a + m*i;
4032 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];}
;
4033 idx++;
4034 b++;
4035 }
4036 }
4037 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4038}
4039
4040PetscErrorCode MatMatMultSymbolic_SeqDense_SeqAIJ(Mat A,Mat B,PetscReal fill,Mat *C)
4041{
4042 PetscErrorCode ierr;
4043 PetscInt m=A->rmap->n,n=B->cmap->n;
4044 Mat Cmat;
4045
4046 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4046; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4047 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
),4047,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
60);}} while (0)
;
4048 ierr = MatCreate(PetscObjectComm((PetscObject)A),&Cmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4049 ierr = MatSetSizes(Cmat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4049,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4050 ierr = MatSetBlockSizesFromMats(Cmat,A,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4050,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4051 ierr = MatSetType(Cmat,MATSEQDENSE"seqdense");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4051,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4052 ierr = MatSeqDenseSetPreallocation(Cmat,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4052,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4053
4054 Cmat->ops->matmultnumeric = MatMatMultNumeric_SeqDense_SeqAIJ;
4055
4056 *C = Cmat;
4057 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4058}
4059
4060/* ----------------------------------------------------------------*/
4061PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatMatMult_SeqDense_SeqAIJ(Mat A,Mat B,MatReuse scall,PetscReal fill,Mat *C)
4062{
4063 PetscErrorCode ierr;
4064
4065 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4065; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4066 if (scall == MAT_INITIAL_MATRIX) {
4067 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),4067,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4068 ierr = MatMatMultSymbolic_SeqDense_SeqAIJ(A,B,fill,C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4068,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4069 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),4069,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4070 }
4071 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),4071,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4072 ierr = MatMatMultNumeric_SeqDense_SeqAIJ(A,B,*C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4072,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4073 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),4073,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4074 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4075}
4076
4077
4078/*MC
4079 MATSEQAIJ - MATSEQAIJ = "seqaij" - A matrix type to be used for sequential sparse matrices,
4080 based on compressed sparse row format.
4081
4082 Options Database Keys:
4083. -mat_type seqaij - sets the matrix type to "seqaij" during a call to MatSetFromOptions()
4084
4085 Level: beginner
4086
4087.seealso: MatCreateSeqAIJ(), MatSetFromOptions(), MatSetType(), MatCreate(), MatType
4088M*/
4089
4090/*MC
4091 MATAIJ - MATAIJ = "aij" - A matrix type to be used for sparse matrices.
4092
4093 This matrix type is identical to MATSEQAIJ when constructed with a single process communicator,
4094 and MATMPIAIJ otherwise. As a result, for single process communicators,
4095 MatSeqAIJSetPreallocation is supported, and similarly MatMPIAIJSetPreallocation is supported
4096 for communicators controlling multiple processes. It is recommended that you call both of
4097 the above preallocation routines for simplicity.
4098
4099 Options Database Keys:
4100. -mat_type aij - sets the matrix type to "aij" during a call to MatSetFromOptions()
4101
4102 Developer Notes:
4103 Subclasses include MATAIJCUSPARSE, MATAIJPERM, MATAIJSELL, MATAIJMKL, MATAIJCRL, and also automatically switches over to use inodes when
4104 enough exist.
4105
4106 Level: beginner
4107
4108.seealso: MatCreateAIJ(), MatCreateSeqAIJ(), MATSEQAIJ,MATMPIAIJ
4109M*/
4110
4111/*MC
4112 MATAIJCRL - MATAIJCRL = "aijcrl" - A matrix type to be used for sparse matrices.
4113
4114 This matrix type is identical to MATSEQAIJCRL when constructed with a single process communicator,
4115 and MATMPIAIJCRL otherwise. As a result, for single process communicators,
4116 MatSeqAIJSetPreallocation() is supported, and similarly MatMPIAIJSetPreallocation() is supported
4117 for communicators controlling multiple processes. It is recommended that you call both of
4118 the above preallocation routines for simplicity.
4119
4120 Options Database Keys:
4121. -mat_type aijcrl - sets the matrix type to "aijcrl" during a call to MatSetFromOptions()
4122
4123 Level: beginner
4124
4125.seealso: MatCreateMPIAIJCRL,MATSEQAIJCRL,MATMPIAIJCRL, MATSEQAIJCRL, MATMPIAIJCRL
4126M*/
4127
4128PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_SeqAIJCRL(Mat,MatType,MatReuse,Mat*);
4129#if defined(PETSC_HAVE_ELEMENTAL)
4130PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_Elemental(Mat,MatType,MatReuse,Mat*);
4131#endif
4132#if defined(PETSC_HAVE_HYPRE)
4133PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_AIJ_HYPRE(Mat A,MatType,MatReuse,Mat*);
4134PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatMatMatMult_Transpose_AIJ_AIJ(Mat,Mat,Mat,MatReuse,PetscReal,Mat*);
4135#endif
4136PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_SeqDense(Mat,MatType,MatReuse,Mat*);
4137
4138PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatConvert_SeqAIJ_SeqSELL(Mat,MatType,MatReuse,Mat*);
4139PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_XAIJ_IS(Mat,MatType,MatReuse,Mat*);
4140PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatPtAP_IS_XAIJ(Mat,Mat,MatReuse,PetscReal,Mat*);
4141
4142/*@C
4143 MatSeqAIJGetArray - gives access to the array where the data for a MATSEQAIJ matrix is stored
4144
4145 Not Collective
4146
4147 Input Parameter:
4148. mat - a MATSEQAIJ matrix
4149
4150 Output Parameter:
4151. array - pointer to the data
4152
4153 Level: intermediate
4154
4155.seealso: MatSeqAIJRestoreArray(), MatSeqAIJGetArrayF90()
4156@*/
4157PetscErrorCode MatSeqAIJGetArray(Mat A,PetscScalar **array)
4158{
4159 PetscErrorCode ierr;
4160
4161 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4161; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4162 ierr = PetscUseMethod(A,"MatSeqAIJGetArray_C",(Mat,PetscScalar**),(A,array))0; do { PetscErrorCode (*f)(Mat,PetscScalar**), __ierr; __ierr
= PetscObjectQueryFunction_Private(((PetscObject)A),("MatSeqAIJGetArray_C"
),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr
),0)) {PetscError(((MPI_Comm)0x44000001),4162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(A,array);do {
if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),4162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)A),4162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatSeqAIJGetArray_C"); } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4163 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4164}
4165
4166/*@C
4167 MatSeqAIJGetMaxRowNonzeros - returns the maximum number of nonzeros in any row
4168
4169 Not Collective
4170
4171 Input Parameter:
4172. mat - a MATSEQAIJ matrix
4173
4174 Output Parameter:
4175. nz - the maximum number of nonzeros in any row
4176
4177 Level: intermediate
4178
4179.seealso: MatSeqAIJRestoreArray(), MatSeqAIJGetArrayF90()
4180@*/
4181PetscErrorCode MatSeqAIJGetMaxRowNonzeros(Mat A,PetscInt *nz)
4182{
4183 Mat_SeqAIJ *aij = (Mat_SeqAIJ*)A->data;
4184
4185 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4185; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4186 *nz = aij->rmax;
4187 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4188}
4189
4190/*@C
4191 MatSeqAIJRestoreArray - returns access to the array where the data for a MATSEQAIJ matrix is stored obtained by MatSeqAIJGetArray()
4192
4193 Not Collective
4194
4195 Input Parameters:
4196. mat - a MATSEQAIJ matrix
4197. array - pointer to the data
4198
4199 Level: intermediate
4200
4201.seealso: MatSeqAIJGetArray(), MatSeqAIJRestoreArrayF90()
4202@*/
4203PetscErrorCode MatSeqAIJRestoreArray(Mat A,PetscScalar **array)
4204{
4205 PetscErrorCode ierr;
4206
4207 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4207; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4208 ierr = PetscUseMethod(A,"MatSeqAIJRestoreArray_C",(Mat,PetscScalar**),(A,array))0; do { PetscErrorCode (*f)(Mat,PetscScalar**), __ierr; __ierr
= PetscObjectQueryFunction_Private(((PetscObject)A),("MatSeqAIJRestoreArray_C"
),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr
),0)) {PetscError(((MPI_Comm)0x44000001),4208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0); if (f) {__ierr = (*f)(A,array);do {
if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001
),4208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),__ierr);}} while (0);} else return PetscError(PetscObjectComm
((PetscObject)A),4208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object"
,"MatSeqAIJRestoreArray_C"); } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4209 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4210}
4211
4212#if defined(PETSC_HAVE_CUDA)
4213PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatConvert_SeqAIJ_SeqAIJCUSPARSE(Mat);
4214#endif
4215
4216PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_SeqAIJ(Mat B)
4217{
4218 Mat_SeqAIJ *b;
4219 PetscErrorCode ierr;
4220 PetscMPIInt size;
4221
4222 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4222; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4223 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4224 if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Comm must be of size 1")return PetscError(((MPI_Comm)0x44000001),4224,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"Comm must be of size 1")
;
4225
4226 ierr = PetscNewLog(B,&b)(PetscMallocA(1,PETSC_TRUE,4226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(1)*sizeof(**(((&b)))),(((&b)))) || PetscLogObjectMemory
((PetscObject)B,sizeof(**(&b))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4227
4228 B->data = (void*)b;
4229
4230 ierr = PetscMemcpy(B->ops,&MatOps_Values,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4230,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4231 if (B->sortedfull) B->ops->setvalues = MatSetValues_SeqAIJ_SortedFull;
4232
4233 b->row = 0;
4234 b->col = 0;
4235 b->icol = 0;
4236 b->reallocs = 0;
4237 b->ignorezeroentries = PETSC_FALSE;
4238 b->roworiented = PETSC_TRUE;
4239 b->nonew = 0;
4240 b->diag = 0;
4241 b->solve_work = 0;
4242 B->spptr = 0;
4243 b->saved_values = 0;
4244 b->idiag = 0;
4245 b->mdiag = 0;
4246 b->ssor_work = 0;
4247 b->omega = 1.0;
4248 b->fshift = 0.0;
4249 b->idiagvalid = PETSC_FALSE;
4250 b->ibdiagvalid = PETSC_FALSE;
4251 b->keepnonzeropattern = PETSC_FALSE;
4252
4253 ierr = PetscObjectChangeTypeName((PetscObject)B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4253,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4254 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),4254,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4255 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),4255,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4256
4257#if defined(PETSC_HAVE_MATLAB_ENGINE)
4258 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),4258,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4259 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),4259,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4260#endif
4261
4262 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),4262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4263 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),4263,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4264 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),4264,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4265 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),4265,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4266 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),4266,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4267 ierr = PetscObjectComposeFunction((PetscObject)B,"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),4267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4268 ierr = PetscObjectComposeFunction((PetscObject)B,"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),4268,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4269#if defined(PETSC_HAVE_MKL_SPARSE)
4270 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),4270,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4271#endif
4272#if defined(PETSC_HAVE_CUDA)
4273 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),4273,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4274#endif
4275 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),4275,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4276#if defined(PETSC_HAVE_ELEMENTAL)
4277 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),4277,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4278#endif
4279#if defined(PETSC_HAVE_HYPRE)
4280 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),4280,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4281 ierr = PetscObjectComposeFunction((PetscObject)B,"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),4281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4282#endif
4283 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),4283,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4284 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),4284,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4285 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),4285,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4286 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),4286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4287 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),4287,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4288 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),4288,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4289 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),4289,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4290 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),4290,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4291 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),4291,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4292 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),4292,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4293 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),4293,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4294 ierr = PetscObjectComposeFunction((PetscObject)B,"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),4294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4295 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),4295,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4296 ierr = MatCreate_SeqAIJ_Inode(B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4297 ierr = PetscObjectChangeTypeName((PetscObject)B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4297,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4298 ierr = MatSeqAIJSetTypeFromOptions(B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4298,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
; /* this allows changing the matrix subtype to say MATSEQAIJPERM */
4299 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4300}
4301
4302/*
4303 Given a matrix generated with MatGetFactor() duplicates all the information in A into B
4304*/
4305PetscErrorCode MatDuplicateNoCreate_SeqAIJ(Mat C,Mat A,MatDuplicateOption cpvalues,PetscBool mallocmatspace)
4306{
4307 Mat_SeqAIJ *c,*a = (Mat_SeqAIJ*)A->data;
4308 PetscErrorCode ierr;
4309 PetscInt m = A->rmap->n,i;
4310
4311 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4311; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4312 c = (Mat_SeqAIJ*)C->data;
4313
4314 C->factortype = A->factortype;
4315 c->row = 0;
4316 c->col = 0;
4317 c->icol = 0;
4318 c->reallocs = 0;
4319
4320 C->assembled = PETSC_TRUE;
4321
4322 ierr = PetscLayoutReference(A->rmap,&C->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4322,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4323 ierr = PetscLayoutReference(A->cmap,&C->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4323,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4324
4325 ierr = PetscMalloc1(m,&c->imax)PetscMallocA(1,PETSC_FALSE,4325,__func__,"/sandbox/petsc/petsc.next-tmp/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),4325,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4326 ierr = PetscMemcpy(c->imax,a->imax,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4326,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4327 ierr = PetscMalloc1(m,&c->ilen)PetscMallocA(1,PETSC_FALSE,4327,__func__,"/sandbox/petsc/petsc.next-tmp/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),4327,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4328 ierr = PetscMemcpy(c->ilen,a->ilen,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4328,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4329 ierr = PetscLogObjectMemory((PetscObject)C, 2*m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4330
4331 /* allocate the matrix space */
4332 if (mallocmatspace) {
4333 ierr = PetscMalloc3(a->i[m],&c->a,a->i[m],&c->j,m+1,&c->i)PetscMallocA(3,PETSC_FALSE,4333,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(a->i[m])*sizeof(**(&c->a)),(&c->a)
,(size_t)(a->i[m])*sizeof(**(&c->j)),(&c->j)
,(size_t)(m+1)*sizeof(**(&c->i)),(&c->i))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4333,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4334 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),4334,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4335
4336 c->singlemalloc = PETSC_TRUE;
4337
4338 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),4338,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4339 if (m > 0) {
4340 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),4340,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4341 if (cpvalues == MAT_COPY_VALUES) {
4342 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),4342,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4343 } else {
4344 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),4344,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4345 }
4346 }
4347 }
4348
4349 c->ignorezeroentries = a->ignorezeroentries;
4350 c->roworiented = a->roworiented;
4351 c->nonew = a->nonew;
4352 if (a->diag) {
4353 ierr = PetscMalloc1(m+1,&c->diag)PetscMallocA(1,PETSC_FALSE,4353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m+1)*sizeof(**(&c->diag)),(&c->diag))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4354 ierr = PetscMemcpy(c->diag,a->diag,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4354,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4355 ierr = PetscLogObjectMemory((PetscObject)C,(m+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4355,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4356 } else c->diag = NULL((void*)0);
4357
4358 c->solve_work = 0;
4359 c->saved_values = 0;
4360 c->idiag = 0;
4361 c->ssor_work = 0;
4362 c->keepnonzeropattern = a->keepnonzeropattern;
4363 c->free_a = PETSC_TRUE;
4364 c->free_ij = PETSC_TRUE;
4365
4366 c->rmax = a->rmax;
4367 c->nz = a->nz;
4368 c->maxnz = a->nz; /* Since we allocate exactly the right amount */
4369 C->preallocated = PETSC_TRUE;
4370
4371 c->compressedrow.use = a->compressedrow.use;
4372 c->compressedrow.nrows = a->compressedrow.nrows;
4373 if (a->compressedrow.use) {
4374 i = a->compressedrow.nrows;
4375 ierr = PetscMalloc2(i+1,&c->compressedrow.i,i,&c->compressedrow.rindex)PetscMallocA(2,PETSC_FALSE,4375,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(i+1)*sizeof(**(&c->compressedrow.i)),(&c
->compressedrow.i),(size_t)(i)*sizeof(**(&c->compressedrow
.rindex)),(&c->compressedrow.rindex))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4375,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4376 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),4376,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4377 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),4377,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4378 } else {
4379 c->compressedrow.use = PETSC_FALSE;
4380 c->compressedrow.i = NULL((void*)0);
4381 c->compressedrow.rindex = NULL((void*)0);
4382 }
4383 c->nonzerorowcnt = a->nonzerorowcnt;
4384 C->nonzerostate = A->nonzerostate;
4385
4386 ierr = MatDuplicate_SeqAIJ_Inode(A,cpvalues,&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4386,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4387 ierr = PetscFunctionListDuplicate(((PetscObject)A)->qlist,&((PetscObject)C)->qlist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4387,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4388 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4389}
4390
4391PetscErrorCode MatDuplicate_SeqAIJ(Mat A,MatDuplicateOption cpvalues,Mat *B)
4392{
4393 PetscErrorCode ierr;
4394
4395 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4395; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4396 ierr = MatCreate(PetscObjectComm((PetscObject)A),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4396,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4397 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),4397,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4398 if (!(A->rmap->n % A->rmap->bs) && !(A->cmap->n % A->cmap->bs)) {
4399 ierr = MatSetBlockSizesFromMats(*B,A,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4399,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4400 }
4401 ierr = MatSetType(*B,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4401,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4402 ierr = MatDuplicateNoCreate_SeqAIJ(*B,A,cpvalues,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4402,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4403 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4404}
4405
4406PetscErrorCode MatLoad_SeqAIJ(Mat newMat, PetscViewer viewer)
4407{
4408 PetscBool isbinary, ishdf5;
4409 PetscErrorCode ierr;
4410
4411 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4411; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4412 PetscValidHeaderSpecific(newMat,MAT_CLASSID,1)do { if (!newMat) return PetscError(((MPI_Comm)0x44000001),4412
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(newMat,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),4412,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(newMat))->classid != MAT_CLASSID) {
if (((PetscObject)(newMat))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),4412,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),4412,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
4413 PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),4413
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),4413,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(viewer))->classid != PETSC_VIEWER_CLASSID
) { if (((PetscObject)(viewer))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),4413,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),4413,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,2); } } while (0)
;
4414 /* force binary viewer to load .info file if it has not yet done so */
4415 ierr = PetscViewerSetUp(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4415,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4416 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4416,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4417 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4417,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4418 if (isbinary) {
4419 ierr = MatLoad_SeqAIJ_Binary(newMat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4419,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4420 } else if (ishdf5) {
4421#if defined(PETSC_HAVE_HDF5)
4422 ierr = MatLoad_AIJ_HDF5(newMat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4422,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4423#else
4424 SETERRQ(PetscObjectComm((PetscObject)newMat),PETSC_ERR_SUP,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject)newMat),4424,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
56,PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"
)
;
4425#endif
4426 } else {
4427 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
),4427,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,56,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)newMat),56);}} while (0)
;
4428 }
4429 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4430}
4431
4432PetscErrorCode MatLoad_SeqAIJ_Binary(Mat newMat, PetscViewer viewer)
4433{
4434 Mat_SeqAIJ *a;
4435 PetscErrorCode ierr;
4436 PetscInt i,sum,nz,header[4],*rowlengths = 0,M,N,rows,cols;
4437 int fd;
4438 PetscMPIInt size;
4439 MPI_Comm comm;
4440 PetscInt bs = newMat->rmap->bs;
4441
4442 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4442; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4443 ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4443,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4444 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4444,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4445 if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"view must have one processor")return PetscError(((MPI_Comm)0x44000001),4445,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,60,PETSC_ERROR_INITIAL,"view must have one processor")
;
4446
4447 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),4447,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_5_ierr);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4447,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4448 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),4448,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4449 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) {PetscError(((MPI_Comm)0x44000001
),4449,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),_5_ierr);}} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4449,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4450 if (bs < 0) bs = 1;
4451 ierr = MatSetBlockSize(newMat,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4451,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4452
4453 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4453,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4454 ierr = PetscBinaryRead(fd,header,4,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4454,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4455 if (header[0] != MAT_FILE_CLASSID1211216) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"not matrix object in file")return PetscError(((MPI_Comm)0x44000001),4455,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,79,PETSC_ERROR_INITIAL,"not matrix object in file")
;
4456 M = header[1]; N = header[2]; nz = header[3];
4457
4458 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),4458,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,79,PETSC_ERROR_INITIAL,"Matrix stored in special format on disk,cannot load as SeqAIJ"
)
;
4459
4460 /* read in row lengths */
4461 ierr = PetscMalloc1(M,&rowlengths)PetscMallocA(1,PETSC_FALSE,4461,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(M)*sizeof(**(&rowlengths)),(&rowlengths))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4461,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4462 ierr = PetscBinaryRead(fd,rowlengths,M,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4462,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4463
4464 /* check if sum of rowlengths is same as nz */
4465 for (i=0,sum=0; i< M; i++) sum +=rowlengths[i];
4466 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
),4466,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,66,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
66);}} while (0)
;
4467
4468 /* set global size if not set already*/
4469 if (newMat->rmap->n < 0 && newMat->rmap->N < 0 && newMat->cmap->n < 0 && newMat->cmap->N < 0) {
4470 ierr = MatSetSizes(newMat,PETSC_DECIDE-1,PETSC_DECIDE-1,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4471 } else {
4472 /* if sizes and type are already set, check if the matrix global sizes are correct */
4473 ierr = MatGetSize(newMat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4473,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4474 if (rows < 0 && cols < 0) { /* user might provide local size instead of global size */
4475 ierr = MatGetLocalSize(newMat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4475,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4476 }
4477 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),4477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,79,PETSC_ERROR_INITIAL,"Matrix in file of different length (%D, %D) than the input matrix (%D, %D)"
,M,N,rows,cols)
;
4478 }
4479 ierr = MatSeqAIJSetPreallocation_SeqAIJ(newMat,0,rowlengths);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4480 a = (Mat_SeqAIJ*)newMat->data;
4481
4482 ierr = PetscBinaryRead(fd,a->j,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4482,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4483
4484 /* read in nonzero values */
4485 ierr = PetscBinaryRead(fd,a->a,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4485,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4486
4487 /* set matrix "i" values */
4488 a->i[0] = 0;
4489 for (i=1; i<= M; i++) {
4490 a->i[i] = a->i[i-1] + rowlengths[i-1];
4491 a->ilen[i-1] = rowlengths[i-1];
4492 }
4493 ierr = PetscFree(rowlengths)((*PetscTrFree)((void*)(rowlengths),4493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((rowlengths) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4494
4495 ierr = MatAssemblyBegin(newMat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4495,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4496 ierr = MatAssemblyEnd(newMat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4496,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4497 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4498}
4499
4500PetscErrorCode MatEqual_SeqAIJ(Mat A,Mat B,PetscBool * flg)
4501{
4502 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data,*b = (Mat_SeqAIJ*)B->data;
4503 PetscErrorCode ierr;
4504#if defined(PETSC_USE_COMPLEX)
4505 PetscInt k;
4506#endif
4507
4508 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4508; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4509 /* If the matrix dimensions are not equal,or no of nonzeros */
4510 if ((A->rmap->n != B->rmap->n) || (A->cmap->n != B->cmap->n) ||(a->nz != b->nz)) {
4511 *flg = PETSC_FALSE;
4512 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4513 }
4514
4515 /* if the a->i are the same */
4516 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),4516,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4517 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)
;
4518
4519 /* if a->j are the same */
4520 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),4520,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4521 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)
;
4522
4523 /* if a->a are the same */
4524#if defined(PETSC_USE_COMPLEX)
4525 for (k=0; k<a->nz; k++) {
4526 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.)) {
4527 *flg = PETSC_FALSE;
4528 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4529 }
4530 }
4531#else
4532 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),4532,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4533#endif
4534 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4535}
4536
4537/*@
4538 MatCreateSeqAIJWithArrays - Creates an sequential AIJ matrix using matrix elements (in CSR format)
4539 provided by the user.
4540
4541 Collective
4542
4543 Input Parameters:
4544+ comm - must be an MPI communicator of size 1
4545. m - number of rows
4546. n - number of columns
4547. i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row of the matrix
4548. j - column indices
4549- a - matrix values
4550
4551 Output Parameter:
4552. mat - the matrix
4553
4554 Level: intermediate
4555
4556 Notes:
4557 The i, j, and a arrays are not copied by this routine, the user must free these arrays
4558 once the matrix is destroyed and not before
4559
4560 You cannot set new nonzero locations into this matrix, that will generate an error.
4561
4562 The i and j indices are 0 based
4563
4564 The format which is used for the sparse matrix input, is equivalent to a
4565 row-major ordering.. i.e for the following matrix, the input data expected is
4566 as shown
4567
4568$ 1 0 0
4569$ 2 0 3
4570$ 4 5 6
4571$
4572$ i = {0,1,3,6} [size = nrow+1 = 3+1]
4573$ j = {0,0,2,0,1,2} [size = 6]; values must be sorted for each row
4574$ v = {1,2,3,4,5,6} [size = 6]
4575
4576
4577.seealso: MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateMPIAIJWithArrays(), MatMPIAIJSetPreallocationCSR()
4578
4579@*/
4580PetscErrorCode MatCreateSeqAIJWithArrays(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt i[],PetscInt j[],PetscScalar a[],Mat *mat)
4581{
4582 PetscErrorCode ierr;
4583 PetscInt ii;
4584 Mat_SeqAIJ *aij;
4585#if defined(PETSC_USE_DEBUG1)
4586 PetscInt jj;
4587#endif
4588
4589 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4589; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4590 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),4590,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_INITIAL,"i (row indices) must start with 0")
;
4591 ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4591,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4592 ierr = MatSetSizes(*mat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4592,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4593 /* ierr = MatSetBlockSizes(*mat,,);CHKERRQ(ierr); */
4594 ierr = MatSetType(*mat,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4594,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4595 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*mat,MAT_SKIP_ALLOCATION-4,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4595,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4596 aij = (Mat_SeqAIJ*)(*mat)->data;
4597 ierr = PetscMalloc1(m,&aij->imax)PetscMallocA(1,PETSC_FALSE,4597,__func__,"/sandbox/petsc/petsc.next-tmp/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),4597,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4598 ierr = PetscMalloc1(m,&aij->ilen)PetscMallocA(1,PETSC_FALSE,4598,__func__,"/sandbox/petsc/petsc.next-tmp/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),4598,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4599
4600 aij->i = i;
4601 aij->j = j;
4602 aij->a = a;
4603 aij->singlemalloc = PETSC_FALSE;
4604 aij->nonew = -1; /*this indicates that inserting a new value in the matrix that generates a new nonzero is an error*/
4605 aij->free_a = PETSC_FALSE;
4606 aij->free_ij = PETSC_FALSE;
4607
4608 for (ii=0; ii<m; ii++) {
4609 aij->ilen[ii] = aij->imax[ii] = i[ii+1] - i[ii];
4610#if defined(PETSC_USE_DEBUG1)
4611 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
),4611,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4612 for (jj=i[ii]+1; jj<i[ii+1]; jj++) {
4613 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
),4613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4614 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
),4614,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4615 }
4616#endif
4617 }
4618#if defined(PETSC_USE_DEBUG1)
4619 for (ii=0; ii<aij->i[m]; ii++) {
4620 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
),4620,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4621 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
),4621,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0)
;
4622 }
4623#endif
4624
4625 ierr = MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4625,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4626 ierr = MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4626,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4627 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4628}
4629/*@C
4630 MatCreateSeqAIJFromTriple - Creates an sequential AIJ matrix using matrix elements (in COO format)
4631 provided by the user.
4632
4633 Collective
4634
4635 Input Parameters:
4636+ comm - must be an MPI communicator of size 1
4637. m - number of rows
4638. n - number of columns
4639. i - row indices
4640. j - column indices
4641. a - matrix values
4642. nz - number of nonzeros
4643- idx - 0 or 1 based
4644
4645 Output Parameter:
4646. mat - the matrix
4647
4648 Level: intermediate
4649
4650 Notes:
4651 The i and j indices are 0 based
4652
4653 The format which is used for the sparse matrix input, is equivalent to a
4654 row-major ordering.. i.e for the following matrix, the input data expected is
4655 as shown:
4656
4657 1 0 0
4658 2 0 3
4659 4 5 6
4660
4661 i = {0,1,1,2,2,2}
4662 j = {0,0,2,0,1,2}
4663 v = {1,2,3,4,5,6}
4664
4665
4666.seealso: MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateSeqAIJWithArrays(), MatMPIAIJSetPreallocationCSR()
4667
4668@*/
4669PetscErrorCode MatCreateSeqAIJFromTriple(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt i[],PetscInt j[],PetscScalar a[],Mat *mat,PetscInt nz,PetscBool idx)
4670{
4671 PetscErrorCode ierr;
4672 PetscInt ii, *nnz, one = 1,row,col;
4673
4674
4675 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4675; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4676 ierr = PetscCalloc1(m,&nnz)PetscMallocA(1,PETSC_TRUE,4676,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(m)*sizeof(**(&nnz)),(&nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4676,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4677 for (ii = 0; ii < nz; ii++) {
4678 nnz[i[ii] - !!idx] += 1;
4679 }
4680 ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4680,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4681 ierr = MatSetSizes(*mat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4681,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4682 ierr = MatSetType(*mat,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4682,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4683 ierr = MatSeqAIJSetPreallocation_SeqAIJ(*mat,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4683,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4684 for (ii = 0; ii < nz; ii++) {
4685 if (idx) {
4686 row = i[ii] - 1;
4687 col = j[ii] - 1;
4688 } else {
4689 row = i[ii];
4690 col = j[ii];
4691 }
4692 ierr = MatSetValues(*mat,one,&row,one,&col,&a[ii],ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4692,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4693 }
4694 ierr = MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4694,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4695 ierr = MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4695,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4696 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),4696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4697 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4698}
4699
4700PetscErrorCode MatSeqAIJInvalidateDiagonal(Mat A)
4701{
4702 Mat_SeqAIJ *a=(Mat_SeqAIJ*)A->data;
4703 PetscErrorCode ierr;
4704
4705 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4705; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4706 a->idiagvalid = PETSC_FALSE;
4707 a->ibdiagvalid = PETSC_FALSE;
4708
4709 ierr = MatSeqAIJInvalidateDiagonal_Inode(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4709,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4710 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4711}
4712
4713PetscErrorCode MatCreateMPIMatConcatenateSeqMat_SeqAIJ(MPI_Comm comm,Mat inmat,PetscInt n,MatReuse scall,Mat *outmat)
4714{
4715 PetscErrorCode ierr;
4716 PetscMPIInt size;
4717
4718 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4718; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4719 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4719,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4720 if (size == 1) {
4721 if (scall == MAT_INITIAL_MATRIX) {
4722 ierr = MatDuplicate(inmat,MAT_COPY_VALUES,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4722,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4723 } else {
4724 ierr = MatCopy(inmat,*outmat,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4724,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4725 }
4726 } else {
4727 ierr = MatCreateMPIMatConcatenateSeqMat_MPIAIJ(comm,inmat,n,scall,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4727,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4728 }
4729 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4730}
4731
4732/*
4733 Permute A into C's *local* index space using rowemb,colemb.
4734 The embedding are supposed to be injections and the above implies that the range of rowemb is a subset
4735 of [0,m), colemb is in [0,n).
4736 If pattern == DIFFERENT_NONZERO_PATTERN, C is preallocated according to A.
4737 */
4738PetscErrorCode MatSetSeqMat_SeqAIJ(Mat C,IS rowemb,IS colemb,MatStructure pattern,Mat B)
4739{
4740 /* If making this function public, change the error returned in this function away from _PLIB. */
4741 PetscErrorCode ierr;
4742 Mat_SeqAIJ *Baij;
4743 PetscBool seqaij;
4744 PetscInt m,n,*nz,i,j,count;
4745 PetscScalar v;
4746 const PetscInt *rowindices,*colindices;
4747
4748 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4748; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4749 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)
;
4750 /* Check to make sure the target matrix (and embeddings) are compatible with C and each other. */
4751 ierr = PetscObjectBaseTypeCompare((PetscObject)B,MATSEQAIJ"seqaij",&seqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4751,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4752 if (!seqaij) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Input matrix is of wrong type")return PetscError(((MPI_Comm)0x44000001),4752,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_INITIAL,"Input matrix is of wrong type")
;
4753 if (rowemb) {
4754 ierr = ISGetLocalSize(rowemb,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4754,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4755 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
),4755,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
77);}} while (0)
;
4756 } else {
4757 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),4757,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_INITIAL,"Input matrix is row-incompatible with the target matrix"
)
;
4758 }
4759 if (colemb) {
4760 ierr = ISGetLocalSize(colemb,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4760,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4761 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
),4761,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
77);}} while (0)
;
4762 } else {
4763 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),4763,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,77,PETSC_ERROR_INITIAL,"Input matrix is col-incompatible with the target matrix"
)
;
4764 }
4765
4766 Baij = (Mat_SeqAIJ*)(B->data);
4767 if (pattern == DIFFERENT_NONZERO_PATTERN) {
4768 ierr = PetscMalloc1(B->rmap->n,&nz)PetscMallocA(1,PETSC_FALSE,4768,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,(size_t)(B->rmap->n)*sizeof(**(&nz)),(&nz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4768,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4769 for (i=0; i<B->rmap->n; i++) {
4770 nz[i] = Baij->i[i+1] - Baij->i[i];
4771 }
4772 ierr = MatSeqAIJSetPreallocation(C,0,nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4772,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4773 ierr = PetscFree(nz)((*PetscTrFree)((void*)(nz),4773,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
) || ((nz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4773,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4774 }
4775 if (pattern == SUBSET_NONZERO_PATTERN) {
4776 ierr = MatZeroEntries(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4776,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4777 }
4778 count = 0;
4779 rowindices = NULL((void*)0);
4780 colindices = NULL((void*)0);
4781 if (rowemb) {
4782 ierr = ISGetIndices(rowemb,&rowindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4782,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4783 }
4784 if (colemb) {
4785 ierr = ISGetIndices(colemb,&colindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4785,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4786 }
4787 for (i=0; i<B->rmap->n; i++) {
4788 PetscInt row;
4789 row = i;
4790 if (rowindices) row = rowindices[i];
4791 for (j=Baij->i[i]; j<Baij->i[i+1]; j++) {
4792 PetscInt col;
4793 col = Baij->j[count];
4794 if (colindices) col = colindices[col];
4795 v = Baij->a[count];
4796 ierr = MatSetValues(C,1,&row,1,&col,&v,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4796,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4797 ++count;
4798 }
4799 }
4800 /* FIXME: set C's nonzerostate correctly. */
4801 /* Assembly for C is necessary. */
4802 C->preallocated = PETSC_TRUE;
4803 C->assembled = PETSC_TRUE;
4804 C->was_assembled = PETSC_FALSE;
4805 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4806}
4807
4808PetscFunctionList MatSeqAIJList = NULL((void*)0);
4809
4810/*@C
4811 MatSeqAIJSetType - Converts a MATSEQAIJ matrix to a subtype
4812
4813 Collective on Mat
4814
4815 Input Parameters:
4816+ mat - the matrix object
4817- matype - matrix type
4818
4819 Options Database Key:
4820. -mat_seqai_type <method> - for example seqaijcrl
4821
4822
4823 Level: intermediate
4824
4825.seealso: PCSetType(), VecSetType(), MatCreate(), MatType, Mat
4826@*/
4827PetscErrorCode MatSeqAIJSetType(Mat mat, MatType matype)
4828{
4829 PetscErrorCode ierr,(*r)(Mat,MatType,MatReuse,Mat*);
4830 PetscBool sametype;
4831
4832 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4832; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4833 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),4833,
__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),4833,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),4833,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),4833,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
4834 ierr = PetscObjectTypeCompare((PetscObject)mat,matype,&sametype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4834,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4835 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)
;
4836
4837 ierr = PetscFunctionListFind(MatSeqAIJList,matype,&r)PetscFunctionListFind_Private((MatSeqAIJList),(matype),(PetscVoidFunction
*)(&r))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4837,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4838 if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown Mat type given: %s",matype)return PetscError(((MPI_Comm)0x44000001),4838,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,86,PETSC_ERROR_INITIAL,"Unknown Mat type given: %s",matype)
;
4839 ierr = (*r)(mat,matype,MAT_INPLACE_MATRIX,&mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4839,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4840 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4841}
4842
4843
4844/*@C
4845 MatSeqAIJRegister - - Adds a new sub-matrix type for sequential AIJ matrices
4846
4847 Not Collective
4848
4849 Input Parameters:
4850+ name - name of a new user-defined matrix type, for example MATSEQAIJCRL
4851- function - routine to convert to subtype
4852
4853 Notes:
4854 MatSeqAIJRegister() may be called multiple times to add several user-defined solvers.
4855
4856
4857 Then, your matrix can be chosen with the procedural interface at runtime via the option
4858$ -mat_seqaij_type my_mat
4859
4860 Level: advanced
4861
4862.seealso: MatSeqAIJRegisterAll()
4863
4864
4865 Level: advanced
4866@*/
4867PetscErrorCode MatSeqAIJRegister(const char sname[],PetscErrorCode (*function)(Mat,MatType,MatReuse,Mat *))
4868{
4869 PetscErrorCode ierr;
4870
4871 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4871; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4872 ierr = MatInitializePackage();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4872,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4873 ierr = PetscFunctionListAdd(&MatSeqAIJList,sname,function)PetscFunctionListAdd_Private((&MatSeqAIJList),(sname),(PetscVoidFunction
)(function))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4873,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4874 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4875}
4876
4877PetscBool MatSeqAIJRegisterAllCalled = PETSC_FALSE;
4878
4879/*@C
4880 MatSeqAIJRegisterAll - Registers all of the matrix subtypes of SeqAIJ
4881
4882 Not Collective
4883
4884 Level: advanced
4885
4886 Developers Note: CUSP and CUSPARSE do not yet support the MatConvert_SeqAIJ..() paradigm and thus cannot be registered here
4887
4888.seealso: MatRegisterAll(), MatSeqAIJRegister()
4889@*/
4890PetscErrorCode MatSeqAIJRegisterAll(void)
4891{
4892 PetscErrorCode ierr;
4893
4894 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4894; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4895 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)
;
4896 MatSeqAIJRegisterAllCalled = PETSC_TRUE;
4897
4898 ierr = MatSeqAIJRegister(MATSEQAIJCRL"seqaijcrl", MatConvert_SeqAIJ_SeqAIJCRL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4898,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4899 ierr = MatSeqAIJRegister(MATSEQAIJPERM"seqaijperm", MatConvert_SeqAIJ_SeqAIJPERM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4899,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4900 ierr = MatSeqAIJRegister(MATSEQAIJSELL"seqaijsell", MatConvert_SeqAIJ_SeqAIJSELL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4900,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4901#if defined(PETSC_HAVE_MKL_SPARSE)
4902 ierr = MatSeqAIJRegister(MATSEQAIJMKL"seqaijmkl", MatConvert_SeqAIJ_SeqAIJMKL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4902,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4903#endif
4904#if defined(PETSC_HAVE_VIENNACL) && defined(PETSC_HAVE_VIENNACL_NO_CUDA)
4905 ierr = MatSeqAIJRegister(MATMPIAIJVIENNACL"mpiaijviennacl", MatConvert_SeqAIJ_SeqAIJViennaCL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4905,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
;
4906#endif
4907 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4908}
4909
4910/*
4911 Special version for direct calls from Fortran
4912*/
4913#include <petsc/private/fortranimpl.h>
4914#if defined(PETSC_HAVE_FORTRAN_CAPS)
4915#define matsetvaluesseqaij_ MATSETVALUESSEQAIJ
4916#elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE1)
4917#define matsetvaluesseqaij_ matsetvaluesseqaij
4918#endif
4919
4920/* Change these macros so can be used in void function */
4921#undef CHKERRQ
4922#define CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4922,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
CHKERRABORT(PetscObjectComm((PetscObject)A),ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4922,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0)
4923#undef SETERRQ2
4924#define SETERRQ2(comm,ierr,b,c,d)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4924,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (
0)
CHKERRABORT(comm,ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4924,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (
0)
4925#undef SETERRQ3
4926#define SETERRQ3(comm,ierr,b,c,d,e)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4926,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (
0)
CHKERRABORT(comm,ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)
0x44000001),4926,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (
0)
4927
4928PETSC_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)
4929{
4930 Mat A = *AA;
4931 PetscInt m = *mm, n = *nn;
4932 InsertMode is = *isis;
4933 Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data;
4934 PetscInt *rp,k,low,high,t,ii,row,nrow,i,col,l,rmax,N;
4935 PetscInt *imax,*ai,*ailen;
4936 PetscErrorCode ierr;
4937 PetscInt *aj,nonew = a->nonew,lastcol = -1;
4938 MatScalar *ap,value,*aa;
4939 PetscBool ignorezeroentries = a->ignorezeroentries;
4940 PetscBool roworiented = a->roworiented;
4941
4942 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
; petscstack->line[petscstack->currentsize] = 4942; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4943 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) do {if
(__builtin_expect(!!(73),0)) {PetscError(((MPI_Comm)0x44000001
),4943,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,73,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
73);}} while (0); } while (0)
;
4944 imax = a->imax;
4945 ai = a->i;
4946 ailen = a->ilen;
4947 aj = a->j;
4948 aa = a->a;
4949
4950 for (k=0; k<m; k++) { /* loop over added rows */
4951 row = im[k];
4952 if (row < 0) continue;
4953#if defined(PETSC_USE_DEBUG1)
4954 if (row >= A->rmap->n) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Row too large")do {PetscError(PetscObjectComm((PetscObject)A),4954,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",63
,PETSC_ERROR_INITIAL,"Row too large");MPI_Abort(PetscObjectComm
((PetscObject)A),63);} while (0)
;
4955#endif
4956 rp = aj + ai[row]; ap = aa + ai[row];
4957 rmax = imax[row]; nrow = ailen[row];
4958 low = 0;
4959 high = nrow;
4960 for (l=0; l<n; l++) { /* loop over added columns */
4961 if (in[l] < 0) continue;
4962#if defined(PETSC_USE_DEBUG1)
4963 if (in[l] >= A->cmap->n) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Column too large")do {PetscError(PetscObjectComm((PetscObject)A),4963,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",63
,PETSC_ERROR_INITIAL,"Column too large");MPI_Abort(PetscObjectComm
((PetscObject)A),63);} while (0)
;
4964#endif
4965 col = in[l];
4966 if (roworiented) value = v[l + k*n];
4967 else value = v[k + l*m];
4968
4969 if (value == 0.0 && ignorezeroentries && (is == ADD_VALUES)) continue;
4970
4971 if (col <= lastcol) low = 0;
4972 else high = nrow;
4973 lastcol = col;
4974 while (high-low > 5) {
4975 t = (low+high)/2;
4976 if (rp[t] > col) high = t;
4977 else low = t;
4978 }
4979 for (i=low; i<high; i++) {
4980 if (rp[i] > col) break;
4981 if (rp[i] == col) {
4982 if (is == ADD_VALUES) ap[i] += value;
4983 else ap[i] = value;
4984 goto noinsert;
4985 }
4986 }
4987 if (value == 0.0 && ignorezeroentries) goto noinsert;
4988 if (nonew == 1) goto noinsert;
4989 if (nonew == -1) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero in the matrix")do {PetscError(PetscObjectComm((PetscObject)A),4989,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",63
,PETSC_ERROR_INITIAL,"Inserting a new nonzero in the matrix")
;MPI_Abort(PetscObjectComm((PetscObject)A),63);} while (0)
;
4990 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
),4990,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),
63);}} while (0); ierr = PetscMallocA(3,PETSC_FALSE,4990,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
(size_t)(1*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(A->
rmap->n+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),4990,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); for (ii=0; ii<row+1; ii++) {new_i[
ii] = ai[ii];} for (ii=row+1; ii<A->rmap->n+1; ii++)
{new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((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),4990,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); len = (new_nz - CHUNKSIZE - ai[row] -
nrow); ierr = ((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),4990,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = ((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),4990,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = PetscMemzero(new_a+1*(ai[row]+
nrow),(1*CHUNKSIZE)*sizeof(*(new_a+1*(ai[row]+nrow))));;do {if
(__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001
),4990,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = ((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),4990,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",
ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); ierr = MatSeqXAIJFreeAIJ(A,&Ain->
a,&Ain->j,&Ain->i);do {if (__builtin_expect(!!(
ierr),0)) {PetscError(((MPI_Comm)0x44000001),4990,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c"
,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject
)A),ierr);}} while (0); aa = new_a; Ain->a = (MatScalar*) new_a
; ai = Ain->i = new_i; aj = Ain->j = new_j; Ain->singlemalloc
= PETSC_TRUE; rp = aj + ai[row]; ap = aa + 1*ai[row]; rmax =
imax[row] = imax[row] + CHUNKSIZE; Ain->maxnz += 1*CHUNKSIZE
; Ain->reallocs++; }
;
4991 N = nrow++ - 1; a->nz++; high++;
4992 /* shift up all the later entries in this row */
4993 for (ii=N; ii>=i; ii--) {
4994 rp[ii+1] = rp[ii];
4995 ap[ii+1] = ap[ii];
4996 }
4997 rp[i] = col;
4998 ap[i] = value;
4999 A->nonzerostate++;
5000noinsert:;
5001 low = i + 1;
5002 }
5003 ailen[row] = nrow;
5004 }
5005 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)
;
5006}