Bug Summary

File:mat/impls/kaij/kaij.c
Warning:line 1318, column 3
Value stored to 'ierr' is never read

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1
2/*
3 Defines the basic matrix operations for the KAIJ matrix storage format.
4 This format is used to evaluate matrices of the form:
5
6 [I \otimes S + A \otimes T]
7
8 where
9 S is a dense (p \times q) matrix
10 T is a dense (p \times q) matrix
11 A is an AIJ (n \times n) matrix
12 I is the identity matrix
13
14 The resulting matrix is (np \times nq)
15
16 We provide:
17 MatMult()
18 MatMultAdd()
19 MatInvertBlockDiagonal()
20 and
21 MatCreateKAIJ(Mat,PetscInt,PetscInt,const PetscScalar[],const PetscScalar[],Mat*)
22
23 This single directory handles both the sequential and parallel codes
24*/
25
26#include <../src/mat/impls/kaij/kaij.h> /*I "petscmat.h" I*/
27#include <../src/mat/utils/freespace.h>
28#include <petsc/private/vecimpl.h>
29
30/*@C
31 MatKAIJGetAIJ - Get the AIJ matrix describing the blockwise action of the KAIJ matrix
32
33 Not Collective, but if the KAIJ matrix is parallel, the AIJ matrix is also parallel
34
35 Input Parameter:
36. A - the KAIJ matrix
37
38 Output Parameter:
39. B - the AIJ matrix
40
41 Level: advanced
42
43 Notes: The reference count on the AIJ matrix is not increased so you should not destroy it.
44
45.seealso: MatCreateKAIJ()
46@*/
47PetscErrorCode MatKAIJGetAIJ(Mat A,Mat *B)
48{
49 PetscErrorCode ierr;
50 PetscBool ismpikaij,isseqkaij;
51
52 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 52; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
53 ierr = PetscObjectTypeCompare((PetscObject)A,MATMPIKAIJ"mpikaij",&ismpikaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),53,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
54 ierr = PetscObjectTypeCompare((PetscObject)A,MATSEQKAIJ"seqkaij",&isseqkaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),54,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
55 if (ismpikaij) {
56 Mat_MPIKAIJ *b = (Mat_MPIKAIJ*)A->data;
57
58 *B = b->A;
59 } else if (isseqkaij) {
60 Mat_SeqKAIJ *b = (Mat_SeqKAIJ*)A->data;
61
62 *B = b->AIJ;
63 } else SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_WRONG,"Matrix passed in is not of type KAIJ")return PetscError(PetscObjectComm((PetscObject)A),63,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c",62,PETSC_ERROR_INITIAL
,"Matrix passed in is not of type KAIJ")
;
64 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
65}
66
67/*@C
68 MatKAIJGetS - Get the S matrix describing the shift action of the KAIJ matrix
69
70 Not Collective; the entire S is stored and returned independently on all processes.
71
72 Input Parameter:
73. A - the KAIJ matrix
74
75 Output Parameters:
76+ m - the number of rows in S
77. n - the number of columns in S
78- S - the S matrix, in form of a scalar array in column-major format
79
80 Note: All output parameters are optional (pass NULL or PETSC_IGNORE if not desired)
81
82 Level: advanced
83
84.seealso: MatCreateKAIJ(), MatGetBlockSizes()
85@*/
86PetscErrorCode MatKAIJGetS(Mat A,PetscInt *m,PetscInt *n,PetscScalar **S)
87{
88 Mat_SeqKAIJ *b = (Mat_SeqKAIJ*)A->data;
89 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 89; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
90 if (m) *m = b->p;
91 if (n) *n = b->q;
92 if (S) *S = b->S;
93 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
94}
95
96/*@C
97 MatKAIJGetSRead - Get a read-only pointer to the S matrix describing the shift action of the KAIJ matrix
98
99 Not Collective; the entire S is stored and returned independently on all processes.
100
101 Input Parameter:
102. A - the KAIJ matrix
103
104 Output Parameters:
105+ m - the number of rows in S
106. n - the number of columns in S
107- S - the S matrix, in form of a scalar array in column-major format
108
109 Note: All output parameters are optional (pass NULL or PETSC_IGNORE if not desired)
110
111 Level: advanced
112
113.seealso: MatCreateKAIJ(), MatGetBlockSizes()
114@*/
115PetscErrorCode MatKAIJGetSRead(Mat A,PetscInt *m,PetscInt *n,const PetscScalar **S)
116{
117 Mat_SeqKAIJ *b = (Mat_SeqKAIJ*)A->data;
118 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.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 if (m) *m = b->p;
120 if (n) *n = b->q;
121 if (S) *S = b->S;
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
125/*@C
126 MatKAIJRestoreS - Restore array obtained with MatKAIJGetS()
127
128 Not collective
129
130 Input Parameter:
131. A - the KAIJ matrix
132
133 Output Parameter:
134. S - location of pointer to array obtained with MatKAIJGetS()
135
136 Note: This routine zeros the array pointer to prevent accidental reuse after it has been restored.
137 If NULL is passed, it will not attempt to zero the array pointer.
138
139 Level: advanced
140.seealso: MatKAIJGetS(), MatKAIJGetSRead(), MatKAIJRestoreSRead()
141@*/
142PetscErrorCode MatKAIJRestoreS(Mat A,PetscScalar **S)
143{
144 PetscErrorCode ierr;
145
146 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 146; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
147 if (S) *S = NULL((void*)0);
148 ierr = PetscObjectStateIncrease((PetscObject)A)(((PetscObject)A)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),148,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
149 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
150}
151
152/*@C
153 MatKAIJRestoreSRead - Restore array obtained with MatKAIJGetSRead()
154
155 Not collective
156
157 Input Parameter:
158. A - the KAIJ matrix
159
160 Output Parameter:
161. S - location of pointer to array obtained with MatKAIJGetS()
162
163 Note: This routine zeros the array pointer to prevent accidental reuse after it has been restored.
164 If NULL is passed, it will not attempt to zero the array pointer.
165
166 Level: advanced
167.seealso: MatKAIJGetS(), MatKAIJGetSRead(), MatKAIJRestoreSRead()
168@*/
169PetscErrorCode MatKAIJRestoreSRead(Mat A,const PetscScalar **S)
170{
171 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 171; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
172 if (S) *S = NULL((void*)0);
173 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
174}
175
176/*@C
177 MatKAIJGetT - Get the transformation matrix T associated with the KAIJ matrix
178
179 Not Collective; the entire T is stored and returned independently on all processes
180
181 Input Parameter:
182. A - the KAIJ matrix
183
184 Output Parameter:
185+ m - the number of rows in T
186. n - the number of columns in T
187- T - the T matrix, in form of a scalar array in column-major format
188
189 Note: All output parameters are optional (pass NULL or PETSC_IGNORE if not desired)
190
191 Level: advanced
192
193.seealso: MatCreateKAIJ(), MatGetBlockSizes()
194@*/
195PetscErrorCode MatKAIJGetT(Mat A,PetscInt *m,PetscInt *n,PetscScalar **T)
196{
197 Mat_SeqKAIJ *b = (Mat_SeqKAIJ*)A->data;
198 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 198; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
199 if (m) *m = b->p;
200 if (n) *n = b->q;
201 if (T) *T = b->T;
202 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
203}
204
205/*@C
206 MatKAIJGetTRead - Get a read-only pointer to the transformation matrix T associated with the KAIJ matrix
207
208 Not Collective; the entire T is stored and returned independently on all processes
209
210 Input Parameter:
211. A - the KAIJ matrix
212
213 Output Parameter:
214+ m - the number of rows in T
215. n - the number of columns in T
216- T - the T matrix, in form of a scalar array in column-major format
217
218 Note: All output parameters are optional (pass NULL or PETSC_IGNORE if not desired)
219
220 Level: advanced
221
222.seealso: MatCreateKAIJ(), MatGetBlockSizes()
223@*/
224PetscErrorCode MatKAIJGetTRead(Mat A,PetscInt *m,PetscInt *n,const PetscScalar **T)
225{
226 Mat_SeqKAIJ *b = (Mat_SeqKAIJ*)A->data;
227 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 227; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
228 if (m) *m = b->p;
229 if (n) *n = b->q;
230 if (T) *T = b->T;
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
234/*@C
235 MatKAIJRestoreT - Restore array obtained with MatKAIJGetT()
236
237 Not collective
238
239 Input Parameter:
240. A - the KAIJ matrix
241
242 Output Parameter:
243. T - location of pointer to array obtained with MatKAIJGetS()
244
245 Note: This routine zeros the array pointer to prevent accidental reuse after it has been restored.
246 If NULL is passed, it will not attempt to zero the array pointer.
247
248 Level: advanced
249.seealso: MatKAIJGetT(), MatKAIJGetTRead(), MatKAIJRestoreTRead()
250@*/
251PetscErrorCode MatKAIJRestoreT(Mat A,PetscScalar **T)
252{
253 PetscErrorCode ierr;
254
255 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 255; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
256 if (T) *T = NULL((void*)0);
257 ierr = PetscObjectStateIncrease((PetscObject)A)(((PetscObject)A)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),257,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
258 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
259}
260
261/*@C
262 MatKAIJRestoreTRead - Restore array obtained with MatKAIJGetTRead()
263
264 Not collective
265
266 Input Parameter:
267. A - the KAIJ matrix
268
269 Output Parameter:
270. T - location of pointer to array obtained with MatKAIJGetS()
271
272 Note: This routine zeros the array pointer to prevent accidental reuse after it has been restored.
273 If NULL is passed, it will not attempt to zero the array pointer.
274
275 Level: advanced
276.seealso: MatKAIJGetT(), MatKAIJGetTRead(), MatKAIJRestoreTRead()
277@*/
278PetscErrorCode MatKAIJRestoreTRead(Mat A,const PetscScalar **T)
279{
280 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 280; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
281 if (T) *T = NULL((void*)0);
282 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
283}
284
285/*@
286 MatKAIJSetAIJ - Set the AIJ matrix describing the blockwise action of the KAIJ matrix
287
288 Logically Collective; if the AIJ matrix is parallel, the KAIJ matrix is also parallel
289
290 Input Parameters:
291+ A - the KAIJ matrix
292- B - the AIJ matrix
293
294 Notes:
295 This function increases the reference count on the AIJ matrix, so the user is free to destroy the matrix if it is not needed.
296 Changes to the entries of the AIJ matrix will immediately affect the KAIJ matrix.
297
298 Level: advanced
299
300.seealso: MatKAIJGetAIJ(), MatKAIJSetS(), MatKAIJSetT()
301@*/
302PetscErrorCode MatKAIJSetAIJ(Mat A,Mat B)
303{
304 PetscErrorCode ierr;
305 PetscMPIInt size;
306
307 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 307; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
308 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),308,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
309 if (size == 1) {
310 Mat_SeqKAIJ *a = (Mat_SeqKAIJ*)A->data;
311 a->AIJ = B;
312 } else {
313 Mat_MPIKAIJ *a = (Mat_MPIKAIJ*)A->data;
314 a->A = B;
315 }
316 ierr = PetscObjectReference((PetscObject)B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),316,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
317 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
318}
319
320/*@C
321 MatKAIJSetS - Set the S matrix describing the shift action of the KAIJ matrix
322
323 Logically Collective; the entire S is stored independently on all processes.
324
325 Input Parameters:
326+ A - the KAIJ matrix
327. p - the number of rows in S
328. q - the number of columns in S
329- S - the S matrix, in form of a scalar array in column-major format
330
331 Notes: The dimensions p and q must match those of the transformation matrix T associated with the KAIJ matrix.
332 The S matrix is copied, so the user can destroy this array.
333
334 Level: Advanced
335
336.seealso: MatKAIJGetS(), MatKAIJSetT(), MatKAIJSetAIJ()
337@*/
338PetscErrorCode MatKAIJSetS(Mat A,PetscInt p,PetscInt q,const PetscScalar S[])
339{
340 PetscErrorCode ierr;
341 Mat_SeqKAIJ *a = (Mat_SeqKAIJ*)A->data;
342
343 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 343; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
344 ierr = PetscFree(a->S)((*PetscTrFree)((void*)(a->S),344,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((a->S) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),344,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
345 if (S) {
346 ierr = PetscMalloc1(p*q*sizeof(PetscScalar),&a->S)PetscMallocA(1,PETSC_FALSE,346,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,(size_t)(p*q*sizeof(PetscScalar))*sizeof(**(&a->S)),(
&a->S))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),346,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
347 ierr = PetscMemcpy(a->S,S,p*q*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),347,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
348 } else a->S = NULL((void*)0);
349
350 a->p = p;
351 a->q = q;
352 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
353}
354
355/*@C
356 MatKAIJSetT - Set the transformation matrix T associated with the KAIJ matrix
357
358 Logically Collective; the entire T is stored independently on all processes.
359
360 Input Parameters:
361+ A - the KAIJ matrix
362. p - the number of rows in S
363. q - the number of columns in S
364- T - the T matrix, in form of a scalar array in column-major format
365
366 Notes: The dimensions p and q must match those of the shift matrix S associated with the KAIJ matrix.
367 The T matrix is copied, so the user can destroy this array.
368
369 Level: Advanced
370
371.seealso: MatKAIJGetT(), MatKAIJSetS(), MatKAIJSetAIJ()
372@*/
373PetscErrorCode MatKAIJSetT(Mat A,PetscInt p,PetscInt q,const PetscScalar T[])
374{
375 PetscErrorCode ierr;
376 PetscInt i,j;
377 Mat_SeqKAIJ *a = (Mat_SeqKAIJ*)A->data;
378 PetscBool isTI = PETSC_FALSE;
379
380 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 380; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
381 /* check if T is an identity matrix */
382 if (T && (p == q)) {
383 isTI = PETSC_TRUE;
384 for (i=0; i<p; i++) {
385 for (j=0; j<q; j++) {
386 if (i == j) {
387 /* diagonal term must be 1 */
388 if (T[i+j*p] != 1.0) isTI = PETSC_FALSE;
389 } else {
390 /* off-diagonal term must be 0 */
391 if (T[i+j*p] != 0.0) isTI = PETSC_FALSE;
392 }
393 }
394 }
395 }
396 a->isTI = isTI;
397
398 ierr = PetscFree(a->T)((*PetscTrFree)((void*)(a->T),398,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((a->T) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),398,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
399 if (T && (!isTI)) {
400 ierr = PetscMalloc1(p*q*sizeof(PetscScalar),&a->T)PetscMallocA(1,PETSC_FALSE,400,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,(size_t)(p*q*sizeof(PetscScalar))*sizeof(**(&a->T)),(
&a->T))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),400,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
401 ierr = PetscMemcpy(a->T,T,p*q*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),401,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
402 } else a->T = NULL((void*)0);
403
404 a->p = p;
405 a->q = q;
406 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
407}
408
409PetscErrorCode MatDestroy_SeqKAIJ(Mat A)
410{
411 PetscErrorCode ierr;
412 Mat_SeqKAIJ *b = (Mat_SeqKAIJ*)A->data;
413
414 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 414; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
415 ierr = MatDestroy(&b->AIJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),415,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
416 ierr = PetscFree(b->S)((*PetscTrFree)((void*)(b->S),416,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((b->S) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),416,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
417 ierr = PetscFree(b->T)((*PetscTrFree)((void*)(b->T),417,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((b->T) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),417,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
418 ierr = PetscFree(b->ibdiag)((*PetscTrFree)((void*)(b->ibdiag),418,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((b->ibdiag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),418,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
419 ierr = PetscFree5(b->sor.w,b->sor.y,b->sor.work,b->sor.t,b->sor.arr)PetscFreeA(5,419,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,&(b->sor.w),&(b->sor.y),&(b->sor.work),
&(b->sor.t),&(b->sor.arr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),419,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
420 ierr = PetscFree(A->data)((*PetscTrFree)((void*)(A->data),420,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((A->data) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),420,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
421 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
422}
423
424PetscErrorCode MatSetUp_KAIJ(Mat A)
425{
426 PetscErrorCode ierr;
427 PetscInt n;
428 PetscMPIInt size;
429 Mat_SeqKAIJ *seqkaij = (Mat_SeqKAIJ*)A->data;
430
431 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 431; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
432 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),432,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
433 if (size == 1) {
434 ierr = MatSetSizes(A,seqkaij->p*seqkaij->AIJ->rmap->n,seqkaij->q*seqkaij->AIJ->cmap->n,seqkaij->p*seqkaij->AIJ->rmap->N,seqkaij->q*seqkaij->AIJ->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),434,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
435 ierr = PetscLayoutSetBlockSize(A->rmap,seqkaij->p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),435,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
436 ierr = PetscLayoutSetBlockSize(A->cmap,seqkaij->q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),436,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
437 ierr = PetscLayoutSetUp(A->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),437,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
438 ierr = PetscLayoutSetUp(A->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),438,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
439 } else {
440 Mat_MPIKAIJ *a;
441 Mat_MPIAIJ *mpiaij;
442 IS from,to;
443 Vec gvec;
444 PetscScalar *T;
445 PetscInt i,j;
446
447 a = (Mat_MPIKAIJ*)A->data;
448 mpiaij = (Mat_MPIAIJ*)a->A->data;
449 ierr = MatSetSizes(A,a->p*a->A->rmap->n,a->q*a->A->cmap->n,a->p*a->A->rmap->N,a->q*a->A->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),449,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
450 ierr = PetscLayoutSetBlockSize(A->rmap,seqkaij->p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),450,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
451 ierr = PetscLayoutSetBlockSize(A->cmap,seqkaij->q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),451,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
452 ierr = PetscLayoutSetUp(A->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),452,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
453 ierr = PetscLayoutSetUp(A->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),453,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
454
455 if (a->isTI) {
456 /* If the transformation matrix associated with the parallel matrix A is the identity matrix, then a->T will be NULL.
457 * In this case, if we pass a->T directly to the MatCreateKAIJ() calls to create the sequential submatrices, the routine will
458 * not be able to tell that transformation matrix should be set to the identity; thus we create a temporary identity matrix
459 * to pass in. */
460 ierr = PetscMalloc1(a->p*a->q*sizeof(PetscScalar),&T)PetscMallocA(1,PETSC_FALSE,460,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,(size_t)(a->p*a->q*sizeof(PetscScalar))*sizeof(**(&
T)),(&T))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),460,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
461 for (i=0; i<a->p; i++) {
462 for (j=0; j<a->q; j++) {
463 if (i==j) T[i+j*a->p] = 1.0;
464 else T[i+j*a->p] = 0.0;
465 }
466 }
467 } else T = a->T;
468 ierr = MatCreateKAIJ(mpiaij->A,a->p,a->q,a->S,T,&a->AIJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),468,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
469 ierr = MatCreateKAIJ(mpiaij->B,a->p,a->q,NULL((void*)0),T,&a->OAIJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),469,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
470 if (a->isTI) {
471 ierr = PetscFree(T)((*PetscTrFree)((void*)(T),471,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((T) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),471,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
472 }
473
474 ierr = VecGetSize(mpiaij->lvec,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),474,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
475 ierr = VecCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&a->w);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),475,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
476 ierr = VecSetSizes(a->w,n*a->q,n*a->q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),476,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
477 ierr = VecSetBlockSize(a->w,a->q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),477,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
478 ierr = VecSetType(a->w,VECSEQ"seq");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),478,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
479
480 /* create two temporary Index sets for build scatter gather */
481 ierr = ISCreateBlock(PetscObjectComm((PetscObject)a->A),a->q,n,mpiaij->garray,PETSC_COPY_VALUES,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),481,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
482 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),n*a->q,0,1,&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),482,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
483
484 /* create temporary global vector to generate scatter context */
485 ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)a->A),a->q,a->q*a->A->cmap->n,a->q*a->A->cmap->N,NULL((void*)0),&gvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),485,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
486
487 /* generate the scatter context */
488 ierr = VecScatterCreate(gvec,from,a->w,to,&a->ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),488,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
489
490 ierr = ISDestroy(&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),490,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
491 ierr = ISDestroy(&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),491,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
492 ierr = VecDestroy(&gvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),492,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
493 }
494
495 A->assembled = PETSC_TRUE;
496 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
497}
498
499PetscErrorCode MatView_KAIJ(Mat A,PetscViewer viewer)
500{
501 PetscViewerFormat format;
502 Mat_SeqKAIJ *a = (Mat_SeqKAIJ*)A->data;
503 Mat B;
504 PetscInt i;
505 PetscErrorCode ierr;
506 PetscBool ismpikaij;
507
508 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 508; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
509 ierr = PetscObjectTypeCompare((PetscObject)A,MATMPIKAIJ"mpikaij",&ismpikaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),509,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
510 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),510,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
511 if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL || format == PETSC_VIEWER_ASCII_IMPL) {
512 ierr = PetscViewerASCIIPrintf(viewer,"S and T have %D rows and %D columns\n",a->p,a->q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),512,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
513
514 /* Print appropriate details for S. */
515 if (!a->S) {
516 ierr = PetscViewerASCIIPrintf(viewer,"S is NULL\n");
517 } else if (format == PETSC_VIEWER_ASCII_IMPL) {
518 ierr = PetscViewerASCIIPrintf(viewer,"Entries of S are ");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),518,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
519 for (i=0; i<(a->p * a->q); i++) {
520#if defined(PETSC_USE_COMPLEX)
521 ierr = PetscViewerASCIIPrintf(viewer,"%18.16e %18.16e ",(double)PetscRealPart(a->S[i])(a->S[i]),(double)PetscImaginaryPart(a->S[i])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),521,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
522#else
523 ierr = PetscViewerASCIIPrintf(viewer,"%18.16e ",(double)PetscRealPart(a->S[i])(a->S[i]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),523,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
524#endif
525 }
526 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),526,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
527 }
528
529 /* Print appropriate details for T. */
530 if (a->isTI) {
531 ierr = PetscViewerASCIIPrintf(viewer,"T is the identity matrix\n");
532 } else if (!a->T) {
533 ierr = PetscViewerASCIIPrintf(viewer,"T is NULL\n");
534 } else if (format == PETSC_VIEWER_ASCII_IMPL) {
535 ierr = PetscViewerASCIIPrintf(viewer,"Entries of T are ");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),535,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
536 for (i=0; i<(a->p * a->q); i++) {
537#if defined(PETSC_USE_COMPLEX)
538 ierr = PetscViewerASCIIPrintf(viewer,"%18.16e %18.16e ",(double)PetscRealPart(a->T[i])(a->T[i]),(double)PetscImaginaryPart(a->T[i])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),538,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
539#else
540 ierr = PetscViewerASCIIPrintf(viewer,"%18.16e ",(double)PetscRealPart(a->T[i])(a->T[i]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),540,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
541#endif
542 }
543 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),543,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
544 }
545
546 /* Now print details for the AIJ matrix, using the AIJ viewer. */
547 ierr = PetscViewerASCIIPrintf(viewer,"Now viewing the associated AIJ matrix:\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),547,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
548 if (ismpikaij) {
549 Mat_MPIKAIJ *b = (Mat_MPIKAIJ*)A->data;
550 ierr = MatView(b->A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),550,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
551 } else {
552 ierr = MatView(a->AIJ,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),552,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
553 }
554
555 } else {
556 /* For all other matrix viewer output formats, simply convert to an AIJ matrix and call MatView() on that. */
557 if (ismpikaij) {
558 ierr = MatConvert(A,MATMPIAIJ"mpiaij",MAT_INITIAL_MATRIX,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),558,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
559 } else {
560 ierr = MatConvert(A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),560,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
561 }
562 ierr = MatView(B,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),562,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
563 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),563,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
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
568PetscErrorCode MatDestroy_MPIKAIJ(Mat A)
569{
570 PetscErrorCode ierr;
571 Mat_MPIKAIJ *b = (Mat_MPIKAIJ*)A->data;
572
573 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 573; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
574 ierr = MatDestroy(&b->AIJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),574,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
575 ierr = MatDestroy(&b->OAIJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),575,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
576 ierr = MatDestroy(&b->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),576,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
577 ierr = VecScatterDestroy(&b->ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),577,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
578 ierr = VecDestroy(&b->w);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),578,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
579 ierr = PetscFree(b->S)((*PetscTrFree)((void*)(b->S),579,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((b->S) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),579,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
580 ierr = PetscFree(b->T)((*PetscTrFree)((void*)(b->T),580,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((b->T) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),580,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
581 ierr = PetscFree(b->ibdiag)((*PetscTrFree)((void*)(b->ibdiag),581,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((b->ibdiag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),581,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
582 ierr = PetscFree(A->data)((*PetscTrFree)((void*)(A->data),582,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
) || ((A->data) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),582,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
583 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
584}
585
586/* --------------------------------------------------------------------------------------*/
587
588/* zz = yy + Axx */
589PetscErrorCode MatMultAdd_SeqKAIJ(Mat A,Vec xx,Vec yy,Vec zz)
590{
591 Mat_SeqKAIJ *b = (Mat_SeqKAIJ*)A->data;
592 Mat_SeqAIJ *a = (Mat_SeqAIJ*)b->AIJ->data;
593 const PetscScalar *s = b->S, *t = b->T;
594 const PetscScalar *x,*v,*bx;
595 PetscScalar *y,*sums;
596 PetscErrorCode ierr;
597 const PetscInt m = b->AIJ->rmap->n,*idx,*ii;
598 PetscInt n,i,jrow,j,l,p=b->p,q=b->q,k;
599
600 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 600; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
601 if (!yy) {
602 ierr = VecSet(zz,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),602,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
603 } else {
604 ierr = VecCopy(yy,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),604,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
605 }
606 if ((!s) && (!t) && (!b->isTI)) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
607
608 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),608,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
609 ierr = VecGetArray(zz,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),609,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
610 idx = a->j;
611 v = a->a;
612 ii = a->i;
613
614 if (b->isTI) {
615 for (i=0; i<m; i++) {
616 jrow = ii[i];
617 n = ii[i+1] - jrow;
618 sums = y + p*i;
619 for (j=0; j<n; j++) {
620 for (k=0; k<p; k++) {
621 sums[k] += v[jrow+j]*x[q*idx[jrow+j]+k];
622 }
623 }
624 }
625 ierr = PetscLogFlops((a->nz)*3*p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),625,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
626 } else if (t) {
627 for (i=0; i<m; i++) {
628 jrow = ii[i];
629 n = ii[i+1] - jrow;
630 sums = y + p*i;
631 bx = x + q*i;
632 for (j=0; j<n; j++) {
633 for (k=0; k<p; k++) {
634 for (l=0; l<q; l++) {
635 sums[k] += v[jrow+j]*t[k+l*p]*x[q*idx[jrow+j]+l];
636 }
637 }
638 }
639 }
640 /* The flop count below assumes that v[jrow+j] is hoisted out (which an optimizing compiler is likely to do),
641 * and also that T part is hoisted outside this loop (in exchange for temporary storage) as (A \otimes I) (I \otimes T),
642 * so that this multiply doesn't have to be redone for each matrix entry, but just once per column. The latter
643 * transformation is much less likely to be applied, but we nonetheless count the minimum flops required. */
644 ierr = PetscLogFlops((2.0*p*q-p)*m+2*p*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),644,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
645 }
646 if (s) {
647 for (i=0; i<m; i++) {
648 sums = y + p*i;
649 bx = x + q*i;
650 if (i < b->AIJ->cmap->n) {
651 for (j=0; j<q; j++) {
652 for (k=0; k<p; k++) {
653 sums[k] += s[k+j*p]*bx[j];
654 }
655 }
656 }
657 }
658 ierr = PetscLogFlops(m*2*p*q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),658,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
659 }
660
661 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),661,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
662 ierr = VecRestoreArray(zz,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),662,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
663 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
664}
665
666PetscErrorCode MatMult_SeqKAIJ(Mat A,Vec xx,Vec yy)
667{
668 PetscErrorCode ierr;
669 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 669; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
670 ierr = MatMultAdd_SeqKAIJ(A,xx,PETSC_NULL((void*)0),yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),670,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
671 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
672}
673
674#include <petsc/private/kernels/blockinvert.h>
675
676PetscErrorCode MatInvertBlockDiagonal_SeqKAIJ(Mat A,const PetscScalar **values)
677{
678 Mat_SeqKAIJ *b = (Mat_SeqKAIJ*)A->data;
679 Mat_SeqAIJ *a = (Mat_SeqAIJ*)b->AIJ->data;
680 const PetscScalar *S = b->S;
681 const PetscScalar *T = b->T;
682 const PetscScalar *v = a->a;
683 const PetscInt p = b->p, q = b->q, m = b->AIJ->rmap->n, *idx = a->j, *ii = a->i;
684 PetscErrorCode ierr;
685 PetscInt i,j,*v_pivots,dof,dof2;
686 PetscScalar *diag,aval,*v_work;
687
688 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 688; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
689 if (p != q) SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_SUP,"MATKAIJ: Block size must be square to calculate inverse.")return PetscError(PetscObjectComm((PetscObject)A),689,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c",56,PETSC_ERROR_INITIAL
,"MATKAIJ: Block size must be square to calculate inverse.")
;
690 if ((!S) && (!T) && (!b->isTI)) SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_SUP,"MATKAIJ: Cannot invert a zero matrix.")return PetscError(PetscObjectComm((PetscObject)A),690,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c",56,PETSC_ERROR_INITIAL
,"MATKAIJ: Cannot invert a zero matrix.")
;
691
692 dof = p;
693 dof2 = dof*dof;
694
695 if (b->ibdiagvalid) {
696 if (values) *values = b->ibdiag;
697 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
698 }
699 if (!b->ibdiag) {
700 ierr = PetscMalloc1(dof2*m*sizeof(PetscScalar),&b->ibdiag)PetscMallocA(1,PETSC_FALSE,700,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,(size_t)(dof2*m*sizeof(PetscScalar))*sizeof(**(&b->ibdiag
)),(&b->ibdiag))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),700,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
701 ierr = PetscLogObjectMemory((PetscObject)A,dof2*m*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),701,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
702 }
703 if (values) *values = b->ibdiag;
704 diag = b->ibdiag;
705
706 ierr = PetscMalloc2(dof,&v_work,dof,&v_pivots)PetscMallocA(2,PETSC_FALSE,706,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,(size_t)(dof)*sizeof(**(&v_work)),(&v_work),(size_t)
(dof)*sizeof(**(&v_pivots)),(&v_pivots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),706,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
707 for (i=0; i<m; i++) {
708 if (S) {
709 ierr = PetscMemcpy(diag,S,dof2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),709,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
710 } else {
711 ierr = PetscMemzero(diag,dof2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),711,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
712 }
713 if (b->isTI) {
714 aval = 0;
715 for (j=ii[i]; j<ii[i+1]; j++) if (idx[j] == i) aval = v[j];
716 for (j=0; j<dof; j++) diag[j+dof*j] += aval;
717 } else if (T) {
718 aval = 0;
719 for (j=ii[i]; j<ii[i+1]; j++) if (idx[j] == i) aval = v[j];
720 for (j=0; j<dof2; j++) diag[j] += aval*T[j];
721 }
722 ierr = PetscKernel_A_gets_inverse_A(dof,diag,v_pivots,v_work,PETSC_FALSE,NULL)(PetscLINPACKgefa((diag),(dof),(v_pivots),(PETSC_FALSE),(((void
*)0))) || PetscLINPACKgedi((diag),(dof),(v_pivots),(v_work)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),722,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
723 diag += dof2;
724 }
725 ierr = PetscFree2(v_work,v_pivots)PetscFreeA(2,725,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,&(v_work),&(v_pivots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),725,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
726
727 b->ibdiagvalid = PETSC_TRUE;
728 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
729}
730
731static PetscErrorCode MatGetDiagonalBlock_MPIKAIJ(Mat A,Mat *B)
732{
733 Mat_MPIKAIJ *kaij = (Mat_MPIKAIJ*) A->data;
734
735 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 735; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
736 *B = kaij->AIJ;
737 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
738}
739
740PetscErrorCode MatSOR_SeqKAIJ(Mat A,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx)
741{
742 PetscErrorCode ierr;
743 Mat_SeqKAIJ *kaij = (Mat_SeqKAIJ*) A->data;
744 Mat_SeqAIJ *a = (Mat_SeqAIJ*)kaij->AIJ->data;
745 const PetscScalar *aa = a->a, *T = kaij->T, *v;
746 const PetscInt m = kaij->AIJ->rmap->n, *ai=a->i, *aj=a->j, p = kaij->p, q = kaij->q, *diag, *vi;
747 const PetscScalar *b, *xb, *idiag;
748 PetscScalar *x, *work, *workt, *w, *y, *arr, *t, *arrt;
749 PetscInt i, j, k, i2, bs, bs2, nz;
750
751 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 751; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
752 its = its*lits;
753 if (flag & SOR_EISENSTAT) SETERRQ (PETSC_COMM_SELF,PETSC_ERR_SUP,"No support yet for Eisenstat")return PetscError(((MPI_Comm)0x44000001),753,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,56,PETSC_ERROR_INITIAL,"No support yet for Eisenstat")
;
754 if (its <= 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Relaxation requires global its %D and local its %D both positive",its,lits)return PetscError(((MPI_Comm)0x44000001),754,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,62,PETSC_ERROR_INITIAL,"Relaxation requires global its %D and local its %D both positive"
,its,lits)
;
755 if (fshift) SETERRQ (PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for diagonal shift")return PetscError(((MPI_Comm)0x44000001),755,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,56,PETSC_ERROR_INITIAL,"No support for diagonal shift")
;
756 if ((flag & SOR_APPLY_UPPER) || (flag & SOR_APPLY_LOWER)) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for applying upper or lower triangular parts")return PetscError(((MPI_Comm)0x44000001),756,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,56,PETSC_ERROR_INITIAL,"No support for applying upper or lower triangular parts"
)
;
757 if (p != q) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"MatSOR for KAIJ: No support for non-square dense blocks")return PetscError(((MPI_Comm)0x44000001),757,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,56,PETSC_ERROR_INITIAL,"MatSOR for KAIJ: No support for non-square dense blocks"
)
;
758 else {bs = p; bs2 = bs*bs; }
759
760 if (!m) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
761
762 if (!kaij->ibdiagvalid) { ierr = MatInvertBlockDiagonal_SeqKAIJ(A,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),762,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
763 idiag = kaij->ibdiag;
764 diag = a->diag;
765
766 if (!kaij->sor.setup) {
767 ierr = PetscMalloc5(bs,&kaij->sor.w,bs,&kaij->sor.y,m*bs,&kaij->sor.work,m*bs,&kaij->sor.t,m*bs2,&kaij->sor.arr)PetscMallocA(5,PETSC_FALSE,767,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,(size_t)(bs)*sizeof(**(&kaij->sor.w)),(&kaij->
sor.w),(size_t)(bs)*sizeof(**(&kaij->sor.y)),(&kaij
->sor.y),(size_t)(m*bs)*sizeof(**(&kaij->sor.work))
,(&kaij->sor.work),(size_t)(m*bs)*sizeof(**(&kaij->
sor.t)),(&kaij->sor.t),(size_t)(m*bs2)*sizeof(**(&
kaij->sor.arr)),(&kaij->sor.arr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),767,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
768 kaij->sor.setup = PETSC_TRUE;
769 }
770 y = kaij->sor.y;
771 w = kaij->sor.w;
772 work = kaij->sor.work;
773 t = kaij->sor.t;
774 arr = kaij->sor.arr;
775
776 ierr = VecGetArray(xx,&x); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),776,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
777 ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),777,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
778
779 if (flag & SOR_ZERO_INITIAL_GUESS) {
780 if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) {
781 PetscKernel_w_gets_Ar_times_v(bs,bs,b,idiag,x){ PetscScalar _one = 1.0,_zero = 0.0; PetscBLASInt _ione = 1,
_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast(
bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),781,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),781,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 781; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&_bncols,&_one,idiag,&(_bbs
),b,&_ione,&_zero,x,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(781,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),781,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
; /* x[0:bs] <- D^{-1} b[0:bs] */
782 ierr = PetscMemcpy(t,b,bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),782,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
783 i2 = bs;
784 idiag += bs2;
785 for (i=1; i<m; i++) {
786 v = aa + ai[i];
787 vi = aj + ai[i];
788 nz = diag[i] - ai[i];
789
790 if (T) { /* b - T (Arow * x) */
791 ierr = PetscMemzero(w,bs*sizeof(PetscScalar));
792 for (j=0; j<nz; j++) {
793 for (k=0; k<bs; k++) w[k] -= v[j] * x[vi[j]*bs+k];
794 }
795 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs,w,T,&t[i2]){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),795,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),795,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 795; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,T,&(_bbs
),&t[i2],&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(795,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),795,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
796 for (k=0; k<bs; k++) t[i2+k] += b[i2+k];
797 } else if (kaij->isTI) {
798 ierr = PetscMemcpy(t+i2,b+i2,bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),798,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
799 for (j=0; j<nz; j++) {
800 for (k=0; k<bs; k++) t[i2+k] -= v[j] * x[vi[j]*bs+k];
801 }
802 } else {
803 ierr = PetscMemcpy(t+i2,b+i2,bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),803,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
804 }
805
806 PetscKernel_w_gets_Ar_times_v(bs,bs,t+i2,idiag,y){ PetscScalar _one = 1.0,_zero = 0.0; PetscBLASInt _ione = 1,
_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast(
bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),806,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),806,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 806; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&_bncols,&_one,idiag,&(_bbs
),t+i2,&_ione,&_zero,y,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(806,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),806,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
807 for (j=0; j<bs; j++) x[i2+j] = omega * y[j];
808
809 idiag += bs2;
810 i2 += bs;
811 }
812 /* for logging purposes assume number of nonzero in lower half is 1/2 of total */
813 ierr = PetscLogFlops(1.0*bs2*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),813,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
814 xb = t;
815 } else xb = b;
816 if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) {
817 idiag = kaij->ibdiag+bs2*(m-1);
818 i2 = bs * (m-1);
819 ierr = PetscMemcpy(w,xb+i2,bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),819,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
820 PetscKernel_w_gets_Ar_times_v(bs,bs,w,idiag,x+i2){ PetscScalar _one = 1.0,_zero = 0.0; PetscBLASInt _ione = 1,
_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast(
bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),820,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),820,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 820; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&_bncols,&_one,idiag,&(_bbs
),w,&_ione,&_zero,x+i2,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(820,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),820,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
821 i2 -= bs;
822 idiag -= bs2;
823 for (i=m-2; i>=0; i--) {
824 v = aa + diag[i] + 1 ;
825 vi = aj + diag[i] + 1;
826 nz = ai[i+1] - diag[i] - 1;
827
828 if (T) { /* FIXME: This branch untested */
829 ierr = PetscMemcpy(w,xb+i2,bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),829,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
830 /* copy all rows of x that are needed into contiguous space */
831 workt = work;
832 for (j=0; j<nz; j++) {
833 ierr = PetscMemcpy(workt,x + bs*(*vi++),bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),833,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
834 workt += bs;
835 }
836 arrt = arr;
837 for (j=0; j<nz; j++) {
838 ierr = PetscMemcpy(arrt,T,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),838,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
839 for (k=0; k<bs2; k++) arrt[k] *= v[j];
840 arrt += bs2;
841 }
842 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),842,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),842,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 842; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(842,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),842,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
843 } else if (kaij->isTI) {
844 ierr = PetscMemcpy(w,t+i2,bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),844,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
845 for (j=0; j<nz; j++) {
846 for (k=0; k<bs; k++) w[k] -= v[j] * x[vi[j]*bs+k];
847 }
848 }
849
850 PetscKernel_w_gets_Ar_times_v(bs,bs,w,idiag,y){ PetscScalar _one = 1.0,_zero = 0.0; PetscBLASInt _ione = 1,
_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast(
bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),850,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),850,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 850; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&_bncols,&_one,idiag,&(_bbs
),w,&_ione,&_zero,y,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(850,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),850,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
; /* RHS incorrect for omega != 1.0 */
851 for (j=0; j<bs; j++) x[i2+j] = (1.0-omega) * x[i2+j] + omega * y[j];
852
853 idiag -= bs2;
854 i2 -= bs;
855 }
856 ierr = PetscLogFlops(1.0*bs2*(a->nz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),856,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
857 }
858 its--;
859 }
860 while (its--) { /* FIXME: This branch not updated */
861 if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) {
862 i2 = 0;
863 idiag = kaij->ibdiag;
864 for (i=0; i<m; i++) {
865 ierr = PetscMemcpy(w,b+i2,bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),865,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
866
867 v = aa + ai[i];
868 vi = aj + ai[i];
869 nz = diag[i] - ai[i];
870 workt = work;
871 for (j=0; j<nz; j++) {
872 ierr = PetscMemcpy(workt,x + bs*(*vi++),bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),872,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
873 workt += bs;
874 }
875 arrt = arr;
876 if (T) {
877 for (j=0; j<nz; j++) {
878 ierr = PetscMemcpy(arrt,T,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),878,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
879 for (k=0; k<bs2; k++) arrt[k] *= v[j];
880 arrt += bs2;
881 }
882 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),882,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),882,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 882; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(882,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),882,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
883 } else if (kaij->isTI) {
884 for (j=0; j<nz; j++) {
885 ierr = PetscMemzero(arrt,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),885,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
886 for (k=0; k<bs; k++) arrt[k+bs*k] = v[j];
887 arrt += bs2;
888 }
889 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),889,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),889,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 889; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(889,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),889,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
890 }
891 ierr = PetscMemcpy(t+i2,w,bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),891,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
892
893 v = aa + diag[i] + 1;
894 vi = aj + diag[i] + 1;
895 nz = ai[i+1] - diag[i] - 1;
896 workt = work;
897 for (j=0; j<nz; j++) {
898 ierr = PetscMemcpy(workt,x + bs*(*vi++),bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),898,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
899 workt += bs;
900 }
901 arrt = arr;
902 if (T) {
903 for (j=0; j<nz; j++) {
904 ierr = PetscMemcpy(arrt,T,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),904,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
905 for (k=0; k<bs2; k++) arrt[k] *= v[j];
906 arrt += bs2;
907 }
908 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),908,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),908,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 908; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(908,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),908,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
909 } else if (kaij->isTI) {
910 for (j=0; j<nz; j++) {
911 ierr = PetscMemzero(arrt,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),911,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
912 for (k=0; k<bs; k++) arrt[k+bs*k] = v[j];
913 arrt += bs2;
914 }
915 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),915,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),915,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 915; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(915,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),915,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
916 }
917
918 PetscKernel_w_gets_Ar_times_v(bs,bs,w,idiag,y){ PetscScalar _one = 1.0,_zero = 0.0; PetscBLASInt _ione = 1,
_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast(
bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),918,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),918,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 918; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&_bncols,&_one,idiag,&(_bbs
),w,&_ione,&_zero,y,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(918,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),918,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
919 for (j=0; j<bs; j++) *(x+i2+j) = (1.0-omega) * *(x+i2+j) + omega * *(y+j);
920
921 idiag += bs2;
922 i2 += bs;
923 }
924 xb = t;
925 }
926 else xb = b;
927 if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) {
928 idiag = kaij->ibdiag+bs2*(m-1);
929 i2 = bs * (m-1);
930 if (xb == b) {
931 for (i=m-1; i>=0; i--) {
932 ierr = PetscMemcpy(w,b+i2,bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),932,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
933
934 v = aa + ai[i];
935 vi = aj + ai[i];
936 nz = diag[i] - ai[i];
937 workt = work;
938 for (j=0; j<nz; j++) {
939 ierr = PetscMemcpy(workt,x + bs*(*vi++),bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),939,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
940 workt += bs;
941 }
942 arrt = arr;
943 if (T) {
944 for (j=0; j<nz; j++) {
945 ierr = PetscMemcpy(arrt,T,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),945,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
946 for (k=0; k<bs2; k++) arrt[k] *= v[j];
947 arrt += bs2;
948 }
949 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),949,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),949,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 949; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(949,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),949,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
950 } else if (kaij->isTI) {
951 for (j=0; j<nz; j++) {
952 ierr = PetscMemzero(arrt,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),952,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
953 for (k=0; k<bs; k++) arrt[k+bs*k] = v[j];
954 arrt += bs2;
955 }
956 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),956,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),956,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 956; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(956,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),956,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
957 }
958
959 v = aa + diag[i] + 1;
960 vi = aj + diag[i] + 1;
961 nz = ai[i+1] - diag[i] - 1;
962 workt = work;
963 for (j=0; j<nz; j++) {
964 ierr = PetscMemcpy(workt,x + bs*(*vi++),bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),964,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
965 workt += bs;
966 }
967 arrt = arr;
968 if (T) {
969 for (j=0; j<nz; j++) {
970 ierr = PetscMemcpy(arrt,T,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),970,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
971 for (k=0; k<bs2; k++) arrt[k] *= v[j];
972 arrt += bs2;
973 }
974 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),974,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),974,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 974; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(974,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),974,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
975 } else if (kaij->isTI) {
976 for (j=0; j<nz; j++) {
977 ierr = PetscMemzero(arrt,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),977,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
978 for (k=0; k<bs; k++) arrt[k+bs*k] = v[j];
979 arrt += bs2;
980 }
981 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),981,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),981,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 981; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(981,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),981,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
982 }
983
984 PetscKernel_w_gets_Ar_times_v(bs,bs,w,idiag,y){ PetscScalar _one = 1.0,_zero = 0.0; PetscBLASInt _ione = 1,
_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast(
bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),984,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),984,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 984; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&_bncols,&_one,idiag,&(_bbs
),w,&_ione,&_zero,y,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(984,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),984,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
985 for (j=0; j<bs; j++) *(x+i2+j) = (1.0-omega) * *(x+i2+j) + omega * *(y+j);
986 }
987 } else {
988 for (i=m-1; i>=0; i--) {
989 ierr = PetscMemcpy(w,xb+i2,bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),989,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
990 v = aa + diag[i] + 1;
991 vi = aj + diag[i] + 1;
992 nz = ai[i+1] - diag[i] - 1;
993 workt = work;
994 for (j=0; j<nz; j++) {
995 ierr = PetscMemcpy(workt,x + bs*(*vi++),bs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),995,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
996 workt += bs;
997 }
998 arrt = arr;
999 if (T) {
1000 for (j=0; j<nz; j++) {
1001 ierr = PetscMemcpy(arrt,T,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1001,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1002 for (k=0; k<bs2; k++) arrt[k] *= v[j];
1003 arrt += bs2;
1004 }
1005 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),1005,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),1005,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 1005; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(1005,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),1005,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
1006 } else if (kaij->isTI) {
1007 for (j=0; j<nz; j++) {
1008 ierr = PetscMemzero(arrt,bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1008,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1009 for (k=0; k<bs; k++) arrt[k+bs*k] = v[j];
1010 arrt += bs2;
1011 }
1012 PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,arr,work){ PetscScalar _one = 1.0,_mone = -1.0; PetscBLASInt _ione = 1
,_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast
(bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),1012,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),1012,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 1012; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&(_bncols),&_mone,arr,&(_bbs
),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(1012,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),1012,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
1013 }
1014 PetscKernel_w_gets_Ar_times_v(bs,bs,w,idiag,y){ PetscScalar _one = 1.0,_zero = 0.0; PetscBLASInt _ione = 1,
_bbs,_bncols; PetscErrorCode _ierr; _ierr = PetscBLASIntCast(
bs,&_bbs);do {if (__builtin_expect(!!(_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),1014,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast
(bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),1014,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack
&& (petscstack->currentsize < 64)) { petscstack
->function[petscstack->currentsize] = "BLASgemv"; petscstack
->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
; petscstack->line[petscstack->currentsize] = 1014; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemv_("N",&(_bbs),&_bncols,&_one,idiag,&(_bbs
),w,&_ione,&_zero,y,&_ione); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(1014,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),1014,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} 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); }
;
1015 for (j=0; j<bs; j++) *(x+i2+j) = (1.0-omega) * *(x+i2+j) + omega * *(y+j);
1016 }
1017 idiag -= bs2;
1018 i2 -= bs;
1019 }
1020 ierr = PetscLogFlops(1.0*bs2*(a->nz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1020,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1021 }
1022 }
1023
1024 ierr = VecRestoreArray(xx,&x); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1024,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1025 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1025,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1026 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1027}
1028
1029/*===================================================================================*/
1030
1031PetscErrorCode MatMultAdd_MPIKAIJ(Mat A,Vec xx,Vec yy,Vec zz)
1032{
1033 Mat_MPIKAIJ *b = (Mat_MPIKAIJ*)A->data;
1034 PetscErrorCode ierr;
1035
1036 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 1036; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1037 if (!yy) {
1038 ierr = VecSet(zz,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1038,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1039 } else {
1040 ierr = VecCopy(yy,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1040,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1041 }
1042 /* start the scatter */
1043 ierr = VecScatterBegin(b->ctx,xx,b->w,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1043,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1044 ierr = (*b->AIJ->ops->multadd)(b->AIJ,xx,zz,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1044,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1045 ierr = VecScatterEnd(b->ctx,xx,b->w,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1045,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1046 ierr = (*b->OAIJ->ops->multadd)(b->OAIJ,b->w,zz,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1046,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1047 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1048}
1049
1050PetscErrorCode MatMult_MPIKAIJ(Mat A,Vec xx,Vec yy)
1051{
1052 PetscErrorCode ierr;
1053 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 1053; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1054 ierr = MatMultAdd_MPIKAIJ(A,xx,PETSC_NULL((void*)0),yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1054,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1055 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1056}
1057
1058PetscErrorCode MatInvertBlockDiagonal_MPIKAIJ(Mat A,const PetscScalar **values)
1059{
1060 Mat_MPIKAIJ *b = (Mat_MPIKAIJ*)A->data;
1061 PetscErrorCode ierr;
1062
1063 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 1063; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1064 ierr = (*b->AIJ->ops->invertblockdiagonal)(b->AIJ,values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1064,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1065 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1066}
1067
1068/* ----------------------------------------------------------------*/
1069
1070PetscErrorCode MatGetRow_SeqKAIJ(Mat A,PetscInt row,PetscInt *ncols,PetscInt **cols,PetscScalar **values)
1071{
1072 Mat_SeqKAIJ *b = (Mat_SeqKAIJ*) A->data;
1073 PetscErrorCode diag = PETSC_FALSE;
1074 PetscErrorCode ierr;
1075 PetscInt nzaij,nz,*colsaij,*idx,i,j,p=b->p,q=b->q,r=row/p,s=row%p,c;
1076 PetscScalar *vaij,*v,*S=b->S,*T=b->T;
1077
1078 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 1078; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1079 if (b->getrowactive) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Already active")return PetscError(((MPI_Comm)0x44000001),1079,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,73,PETSC_ERROR_INITIAL,"Already active")
;
1080 b->getrowactive = PETSC_TRUE;
1081 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),1081,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,63,PETSC_ERROR_INITIAL,"Row %D out of range",row)
;
1082
1083 if ((!S) && (!T) && (!b->isTI)) {
1084 if (ncols) *ncols = 0;
1085 if (cols) *cols = NULL((void*)0);
1086 if (values) *values = NULL((void*)0);
1087 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1088 }
1089
1090 if (T || b->isTI) {
1091 ierr = MatGetRow_SeqAIJ(b->AIJ,r,&nzaij,&colsaij,&vaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1091,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1092 c = nzaij;
1093 for (i=0; i<nzaij; i++) {
1094 /* check if this row contains a diagonal entry */
1095 if (colsaij[i] == r) {
1096 diag = PETSC_TRUE;
1097 c = i;
1098 }
1099 }
1100 } else nzaij = c = 0;
1101
1102 /* calculate size of row */
1103 nz = 0;
1104 if (S) nz += q;
1105 if (T || b->isTI) nz += (diag && S ? (nzaij-1)*q : nzaij*q);
1106
1107 if (cols || values) {
1108 ierr = PetscMalloc2(nz,&idx,nz,&v)PetscMallocA(2,PETSC_FALSE,1108,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,(size_t)(nz)*sizeof(**(&idx)),(&idx),(size_t)(nz)*sizeof
(**(&v)),(&v))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1108,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1109 for (i=0; i<q; i++) {
1110 /* We need to initialize the v[i] to zero to handle the case in which T is NULL (not the identity matrix). */
1111 v[i] = 0.0;
1112 }
1113 if (b->isTI) {
1114 for (i=0; i<nzaij; i++) {
1115 for (j=0; j<q; j++) {
1116 idx[i*q+j] = colsaij[i]*q+j;
1117 v[i*q+j] = (j==s ? vaij[i] : 0);
1118 }
1119 }
1120 } else if (T) {
1121 for (i=0; i<nzaij; i++) {
1122 for (j=0; j<q; j++) {
1123 idx[i*q+j] = colsaij[i]*q+j;
1124 v[i*q+j] = vaij[i]*T[s+j*p];
1125 }
1126 }
1127 }
1128 if (S) {
1129 for (j=0; j<q; j++) {
1130 idx[c*q+j] = r*q+j;
1131 v[c*q+j] += S[s+j*p];
1132 }
1133 }
1134 }
1135
1136 if (ncols) *ncols = nz;
1137 if (cols) *cols = idx;
1138 if (values) *values = v;
1139 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1140}
1141
1142PetscErrorCode MatRestoreRow_SeqKAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
1143{
1144 PetscErrorCode ierr;
1145 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 1145; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1146 ierr = PetscFree2(*idx,*v)PetscFreeA(2,1146,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,&(*idx),&(*v))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1146,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1147 ((Mat_SeqKAIJ*)A->data)->getrowactive = PETSC_FALSE;
1148 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1149}
1150
1151PetscErrorCode MatGetRow_MPIKAIJ(Mat A,PetscInt row,PetscInt *ncols,PetscInt **cols,PetscScalar **values)
1152{
1153 Mat_MPIKAIJ *b = (Mat_MPIKAIJ*) A->data;
1154 Mat MatAIJ = ((Mat_SeqKAIJ*)b->AIJ->data)->AIJ;
1155 Mat MatOAIJ = ((Mat_SeqKAIJ*)b->OAIJ->data)->AIJ;
1156 Mat AIJ = b->A;
1157 PetscBool diag = PETSC_FALSE;
1158 PetscErrorCode ierr;
1159 const PetscInt rstart=A->rmap->rstart,rend=A->rmap->rend,p=b->p,q=b->q,*garray;
1160 PetscInt nz,*idx,ncolsaij,ncolsoaij,*colsaij,*colsoaij,r,s,c,i,j,lrow;
1161 PetscScalar *v,*vals,*ovals,*S=b->S,*T=b->T;
1162
1163 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 1163; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1164 if (b->getrowactive) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Already active")return PetscError(((MPI_Comm)0x44000001),1164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,73,PETSC_ERROR_INITIAL,"Already active")
;
1165 b->getrowactive = PETSC_TRUE;
1166 if (row < rstart || row >= rend) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Only local rows")return PetscError(((MPI_Comm)0x44000001),1166,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,63,PETSC_ERROR_INITIAL,"Only local rows")
;
1167 lrow = row - rstart;
1168
1169 if ((!S) && (!T) && (!b->isTI)) {
1170 if (ncols) *ncols = 0;
1171 if (cols) *cols = NULL((void*)0);
1172 if (values) *values = NULL((void*)0);
1173 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1174 }
1175
1176 r = lrow/p;
1177 s = lrow%p;
1178
1179 if (T || b->isTI) {
1180 ierr = MatMPIAIJGetSeqAIJ(AIJ,NULL((void*)0),NULL((void*)0),&garray);
1181 ierr = MatGetRow_SeqAIJ(MatAIJ,lrow/p,&ncolsaij,&colsaij,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1181,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1182 ierr = MatGetRow_SeqAIJ(MatOAIJ,lrow/p,&ncolsoaij,&colsoaij,&ovals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1182,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1183
1184 c = ncolsaij + ncolsoaij;
1185 for (i=0; i<ncolsaij; i++) {
1186 /* check if this row contains a diagonal entry */
1187 if (colsaij[i] == r) {
1188 diag = PETSC_TRUE;
1189 c = i;
1190 }
1191 }
1192 } else c = 0;
1193
1194 /* calculate size of row */
1195 nz = 0;
1196 if (S) nz += q;
1197 if (T || b->isTI) nz += (diag && S ? (ncolsaij+ncolsoaij-1)*q : (ncolsaij+ncolsoaij)*q);
1198
1199 if (cols || values) {
1200 ierr = PetscMalloc2(nz,&idx,nz,&v)PetscMallocA(2,PETSC_FALSE,1200,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,(size_t)(nz)*sizeof(**(&idx)),(&idx),(size_t)(nz)*sizeof
(**(&v)),(&v))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1200,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1201 for (i=0; i<q; i++) {
1202 /* We need to initialize the v[i] to zero to handle the case in which T is NULL (not the identity matrix). */
1203 v[i] = 0.0;
1204 }
1205 if (b->isTI) {
1206 for (i=0; i<ncolsaij; i++) {
1207 for (j=0; j<q; j++) {
1208 idx[i*q+j] = (colsaij[i]+rstart/p)*q+j;
1209 v[i*q+j] = (j==s ? vals[i] : 0.0);
1210 }
1211 }
1212 for (i=0; i<ncolsoaij; i++) {
1213 for (j=0; j<q; j++) {
1214 idx[(i+ncolsaij)*q+j] = garray[colsoaij[i]]*q+j;
1215 v[(i+ncolsaij)*q+j] = (j==s ? ovals[i]: 0.0);
1216 }
1217 }
1218 } else if (T) {
1219 for (i=0; i<ncolsaij; i++) {
1220 for (j=0; j<q; j++) {
1221 idx[i*q+j] = (colsaij[i]+rstart/p)*q+j;
1222 v[i*q+j] = vals[i]*T[s+j*p];
1223 }
1224 }
1225 for (i=0; i<ncolsoaij; i++) {
1226 for (j=0; j<q; j++) {
1227 idx[(i+ncolsaij)*q+j] = garray[colsoaij[i]]*q+j;
1228 v[(i+ncolsaij)*q+j] = ovals[i]*T[s+j*p];
1229 }
1230 }
1231 }
1232 if (S) {
1233 for (j=0; j<q; j++) {
1234 idx[c*q+j] = (r+rstart/p)*q+j;
1235 v[c*q+j] += S[s+j*p];
1236 }
1237 }
1238 }
1239
1240 if (ncols) *ncols = nz;
1241 if (cols) *cols = idx;
1242 if (values) *values = v;
1243 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1244}
1245
1246PetscErrorCode MatRestoreRow_MPIKAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
1247{
1248 PetscErrorCode ierr;
1249 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 1249; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1250 ierr = PetscFree2(*idx,*v)PetscFreeA(2,1250,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,&(*idx),&(*v))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1250,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1251 ((Mat_SeqKAIJ*)A->data)->getrowactive = PETSC_FALSE;
1252 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1253}
1254
1255PetscErrorCode MatCreateSubMatrix_KAIJ(Mat mat,IS isrow,IS iscol,MatReuse cll,Mat *newmat)
1256{
1257 PetscErrorCode ierr;
1258 Mat A;
1259
1260 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 1260; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1261 ierr = MatConvert(mat,MATAIJ"aij",MAT_INITIAL_MATRIX,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1261,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1262 ierr = MatCreateSubMatrix(A,isrow,iscol,cll,newmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1262,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1263 ierr = MatDestroy(&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1263,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1264 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1265}
1266
1267/* ---------------------------------------------------------------------------------- */
1268/*@C
1269 MatCreateKAIJ - Creates a matrix type to be used for matrices of the following form:
1270
1271 [I \otimes S + A \otimes T]
1272
1273 where
1274 S is a dense (p \times q) matrix
1275 T is a dense (p \times q) matrix
1276 A is an AIJ (n \times n) matrix
1277 I is the identity matrix
1278 The resulting matrix is (np \times nq)
1279
1280 S and T are always stored independently on all processes as PetscScalar arrays in column-major format.
1281
1282 Collective
1283
1284 Input Parameters:
1285+ A - the AIJ matrix
1286. p - number of rows in S and T
1287. q - number of columns in S and T
1288. S - the S matrix (can be PETSC_NULL), stored as a PetscScalar array (column-major)
1289- T - the T matrix (can be PETSC_NULL), stored as a PetscScalar array (column-major)
1290
1291 Output Parameter:
1292. kaij - the new KAIJ matrix
1293
1294 Notes:
1295 This function increases the reference count on the AIJ matrix, so the user is free to destroy the matrix if it is not needed.
1296 Changes to the entries of the AIJ matrix will immediately affect the KAIJ matrix.
1297
1298 Level: advanced
1299
1300.seealso: MatKAIJSetAIJ(), MatKAIJSetS(), MatKAIJSetT(), MatKAIJGetAIJ(), MatKAIJGetS(), MatKAIJGetT(), MATKAIJ
1301@*/
1302PetscErrorCode MatCreateKAIJ(Mat A,PetscInt p,PetscInt q,const PetscScalar S[],const PetscScalar T[],Mat *kaij)
1303{
1304 PetscErrorCode ierr;
1305 PetscMPIInt size;
1306
1307 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 1307; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1308 ierr = MatCreate(PetscObjectComm((PetscObject)A),kaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1308,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1309 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1309,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1310 if (size == 1) {
1311 ierr = MatSetType(*kaij,MATSEQKAIJ"seqkaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1311,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1312 } else {
1313 ierr = MatSetType(*kaij,MATMPIKAIJ"mpikaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1313,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1314 }
1315 ierr = MatKAIJSetAIJ(*kaij,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1315,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1316 ierr = MatKAIJSetS(*kaij,p,q,S);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1316,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1317 ierr = MatKAIJSetT(*kaij,p,q,T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1317,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1318 ierr = MatSetUp(*kaij);
Value stored to 'ierr' is never read
1319 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1320}
1321
1322/*MC
1323 MATKAIJ - MATKAIJ = "kaij" - A matrix type to be used to evaluate matrices of the following form:
1324
1325 [I \otimes S + A \otimes T]
1326
1327 where
1328 S is a dense (p \times q) matrix
1329 T is a dense (p \times q) matrix
1330 A is an AIJ (n \times n) matrix
1331 I is the identity matrix
1332 The resulting matrix is (np \times nq)
1333
1334 S and T are always stored independently on all processes as PetscScalar arrays in column-major format.
1335
1336 Level: advanced
1337
1338.seealso: MatKAIJSetAIJ(), MatKAIJSetS(), MatKAIJSetT(), MatKAIJGetAIJ(), MatKAIJGetS(), MatKAIJGetT(), MatCreateKAIJ()
1339M*/
1340
1341PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_KAIJ(Mat A)
1342{
1343 PetscErrorCode ierr;
1344 Mat_MPIKAIJ *b;
1345 PetscMPIInt size;
1346
1347 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"; petscstack
->line[petscstack->currentsize] = 1347; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1348 ierr = PetscNewLog(A,&b)(PetscMallocA(1,PETSC_TRUE,1348,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,(size_t)(1)*sizeof(**(((&b)))),(((&b)))) || PetscLogObjectMemory
((PetscObject)A,sizeof(**(&b))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1348,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1349 A->data = (void*)b;
1350
1351 ierr = PetscMemzero(A->ops,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1351,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1352
1353 A->ops->setup = MatSetUp_KAIJ;
1354
1355 b->w = 0;
1356 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1356,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1357 if (size == 1) {
1358 ierr = PetscObjectChangeTypeName((PetscObject)A,MATSEQKAIJ"seqkaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1358,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1359 A->ops->setup = MatSetUp_KAIJ;
1360 A->ops->destroy = MatDestroy_SeqKAIJ;
1361 A->ops->view = MatView_KAIJ;
1362 A->ops->mult = MatMult_SeqKAIJ;
1363 A->ops->multadd = MatMultAdd_SeqKAIJ;
1364 A->ops->invertblockdiagonal = MatInvertBlockDiagonal_SeqKAIJ;
1365 A->ops->getrow = MatGetRow_SeqKAIJ;
1366 A->ops->restorerow = MatRestoreRow_SeqKAIJ;
1367 A->ops->sor = MatSOR_SeqKAIJ;
1368 } else {
1369 ierr = PetscObjectChangeTypeName((PetscObject)A,MATMPIKAIJ"mpikaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1369,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1370 A->ops->setup = MatSetUp_KAIJ;
1371 A->ops->destroy = MatDestroy_MPIKAIJ;
1372 A->ops->view = MatView_KAIJ;
1373 A->ops->mult = MatMult_MPIKAIJ;
1374 A->ops->multadd = MatMultAdd_MPIKAIJ;
1375 A->ops->invertblockdiagonal = MatInvertBlockDiagonal_MPIKAIJ;
1376 A->ops->getrow = MatGetRow_MPIKAIJ;
1377 A->ops->restorerow = MatRestoreRow_MPIKAIJ;
1378 ierr = PetscObjectComposeFunction((PetscObject)A,"MatGetDiagonalBlock_C",MatGetDiagonalBlock_MPIKAIJ)PetscObjectComposeFunction_Private((PetscObject)A,"MatGetDiagonalBlock_C"
,(PetscVoidFunction)(MatGetDiagonalBlock_MPIKAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1378,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/kaij/kaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1379 }
1380 A->ops->createsubmatrix = MatCreateSubMatrix_KAIJ;
1381 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1382}