File: | mat/impls/aij/seq/fdaij.c |
Warning: | line 260, column 30 Dereference of undefined pointer value |
[?] Use j/k keys for keyboard navigation
1 | #include <../src/mat/impls/aij/seq/aij.h> | |||
2 | #include <../src/mat/impls/baij/seq/baij.h> | |||
3 | #include <../src/mat/impls/sell/seq/sell.h> | |||
4 | #include <petsc/private/isimpl.h> | |||
5 | ||||
6 | /* | |||
7 | This routine is shared by SeqAIJ and SeqBAIJ matrices, | |||
8 | since it operators only on the nonzero structure of the elements or blocks. | |||
9 | */ | |||
10 | PetscErrorCode MatFDColoringCreate_SeqXAIJ(Mat mat,ISColoring iscoloring,MatFDColoring c) | |||
11 | { | |||
12 | PetscErrorCode ierr; | |||
13 | PetscInt bs,nis=iscoloring->n,m=mat->rmap->n; | |||
14 | PetscBool isBAIJ,isSELL; | |||
15 | ||||
16 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ; petscstack->line[petscstack->currentsize] = 16; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
17 | /* set default brows and bcols for speedup inserting the dense matrix into sparse Jacobian */ | |||
18 | ierr = MatGetBlockSize(mat,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
19 | ierr = PetscObjectTypeCompare((PetscObject)mat,MATSEQBAIJ"seqbaij",&isBAIJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),19,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
20 | ierr = PetscObjectTypeCompare((PetscObject)mat,MATSEQSELL"seqsell",&isSELL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),20,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
21 | if (isBAIJ) { | |||
22 | c->brows = m; | |||
23 | c->bcols = 1; | |||
24 | } else { /* seqaij matrix */ | |||
25 | /* bcols is chosen s.t. dy-array takes 50% of memory space as mat */ | |||
26 | PetscReal mem; | |||
27 | PetscInt nz,brows,bcols; | |||
28 | if (isSELL) { | |||
29 | Mat_SeqSELL *spA = (Mat_SeqSELL*)mat->data; | |||
30 | nz = spA->nz; | |||
31 | } else { | |||
32 | Mat_SeqAIJ *spA = (Mat_SeqAIJ*)mat->data; | |||
33 | nz = spA->nz; | |||
34 | } | |||
35 | ||||
36 | bs = 1; /* only bs=1 is supported for SeqAIJ matrix */ | |||
37 | ||||
38 | mem = nz*(sizeof(PetscScalar) + sizeof(PetscInt)) + 3*m*sizeof(PetscInt); | |||
39 | bcols = (PetscInt)(0.5*mem /(m*sizeof(PetscScalar))); | |||
40 | brows = 1000/bcols; | |||
41 | if (bcols > nis) bcols = nis; | |||
42 | if (brows == 0 || brows > m) brows = m; | |||
43 | c->brows = brows; | |||
44 | c->bcols = bcols; | |||
45 | } | |||
46 | ||||
47 | c->M = mat->rmap->N/bs; /* set total rows, columns and local rows */ | |||
48 | c->N = mat->cmap->N/bs; | |||
49 | c->m = mat->rmap->N/bs; | |||
50 | c->rstart = 0; | |||
51 | c->ncolors = nis; | |||
52 | c->ctype = iscoloring->ctype; | |||
53 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
54 | } | |||
55 | ||||
56 | /* | |||
57 | Reorder Jentry such that blocked brows*bols of entries from dense matrix are inserted into Jacobian for improved cache performance | |||
58 | Input Parameters: | |||
59 | + mat - the matrix containing the nonzero structure of the Jacobian | |||
60 | . color - the coloring context | |||
61 | - nz - number of local non-zeros in mat | |||
62 | */ | |||
63 | PetscErrorCode MatFDColoringSetUpBlocked_AIJ_Private(Mat mat,MatFDColoring c,PetscInt nz) | |||
64 | { | |||
65 | PetscErrorCode ierr; | |||
66 | PetscInt i,j,nrows,nbcols,brows=c->brows,bcols=c->bcols,mbs=c->m,nis=c->ncolors; | |||
67 | PetscInt *color_start,*row_start,*nrows_new,nz_new,row_end; | |||
68 | ||||
69 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ; petscstack->line[petscstack->currentsize] = 69; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
70 | if (brows < 1 || brows > mbs) brows = mbs; | |||
71 | ierr = PetscMalloc2(bcols+1,&color_start,bcols,&row_start)PetscMallocA(2,PETSC_FALSE,71,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(bcols+1)*sizeof(**(&color_start)),(&color_start ),(size_t)(bcols)*sizeof(**(&row_start)),(&row_start) );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),71,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
72 | ierr = PetscCalloc1(nis,&nrows_new)PetscMallocA(1,PETSC_TRUE,72,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(nis)*sizeof(**(&nrows_new)),(&nrows_new));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),72,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
73 | ierr = PetscMalloc1(bcols*mat->rmap->n,&c->dy)PetscMallocA(1,PETSC_FALSE,73,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(bcols*mat->rmap->n)*sizeof(**(&c->dy)) ,(&c->dy));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),73,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
74 | ierr = PetscLogObjectMemory((PetscObject)c,bcols*mat->rmap->n*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),74,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
75 | ||||
76 | nz_new = 0; | |||
77 | nbcols = 0; | |||
78 | color_start[bcols] = 0; | |||
79 | ||||
80 | if (c->htype[0] == 'd') { /* ---- c->htype == 'ds', use MatEntry --------*/ | |||
81 | MatEntry *Jentry_new,*Jentry=c->matentry; | |||
82 | ierr = PetscMalloc1(nz,&Jentry_new)PetscMallocA(1,PETSC_FALSE,82,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(nz)*sizeof(**(&Jentry_new)),(&Jentry_new));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),82,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
83 | for (i=0; i<nis; i+=bcols) { /* loop over colors */ | |||
84 | if (i + bcols > nis) { | |||
85 | color_start[nis - i] = color_start[bcols]; | |||
86 | bcols = nis - i; | |||
87 | } | |||
88 | ||||
89 | color_start[0] = color_start[bcols]; | |||
90 | for (j=0; j<bcols; j++) { | |||
91 | color_start[j+1] = c->nrows[i+j] + color_start[j]; | |||
92 | row_start[j] = 0; | |||
93 | } | |||
94 | ||||
95 | row_end = brows; | |||
96 | if (row_end > mbs) row_end = mbs; | |||
97 | ||||
98 | while (row_end <= mbs) { /* loop over block rows */ | |||
99 | for (j=0; j<bcols; j++) { /* loop over block columns */ | |||
100 | nrows = c->nrows[i+j]; | |||
101 | nz = color_start[j]; | |||
102 | while (row_start[j] < nrows) { | |||
103 | if (Jentry[nz].row >= row_end) { | |||
104 | color_start[j] = nz; | |||
105 | break; | |||
106 | } else { /* copy Jentry[nz] to Jentry_new[nz_new] */ | |||
107 | Jentry_new[nz_new].row = Jentry[nz].row + j*mbs; /* index in dy-array */ | |||
108 | Jentry_new[nz_new].col = Jentry[nz].col; | |||
109 | Jentry_new[nz_new].valaddr = Jentry[nz].valaddr; | |||
110 | nz_new++; nz++; row_start[j]++; | |||
111 | } | |||
112 | } | |||
113 | } | |||
114 | if (row_end == mbs) break; | |||
115 | row_end += brows; | |||
116 | if (row_end > mbs) row_end = mbs; | |||
117 | } | |||
118 | nrows_new[nbcols++] = nz_new; | |||
119 | } | |||
120 | ierr = PetscFree(Jentry)((*PetscTrFree)((void*)(Jentry),120,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ) || ((Jentry) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),120,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
121 | c->matentry = Jentry_new; | |||
122 | } else { /* --------- c->htype == 'wp', use MatEntry2 ------------------*/ | |||
123 | MatEntry2 *Jentry2_new,*Jentry2=c->matentry2; | |||
124 | ierr = PetscMalloc1(nz,&Jentry2_new)PetscMallocA(1,PETSC_FALSE,124,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(nz)*sizeof(**(&Jentry2_new)),(&Jentry2_new) );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),124,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
125 | for (i=0; i<nis; i+=bcols) { /* loop over colors */ | |||
126 | if (i + bcols > nis) { | |||
127 | color_start[nis - i] = color_start[bcols]; | |||
128 | bcols = nis - i; | |||
129 | } | |||
130 | ||||
131 | color_start[0] = color_start[bcols]; | |||
132 | for (j=0; j<bcols; j++) { | |||
133 | color_start[j+1] = c->nrows[i+j] + color_start[j]; | |||
134 | row_start[j] = 0; | |||
135 | } | |||
136 | ||||
137 | row_end = brows; | |||
138 | if (row_end > mbs) row_end = mbs; | |||
139 | ||||
140 | while (row_end <= mbs) { /* loop over block rows */ | |||
141 | for (j=0; j<bcols; j++) { /* loop over block columns */ | |||
142 | nrows = c->nrows[i+j]; | |||
143 | nz = color_start[j]; | |||
144 | while (row_start[j] < nrows) { | |||
145 | if (Jentry2[nz].row >= row_end) { | |||
146 | color_start[j] = nz; | |||
147 | break; | |||
148 | } else { /* copy Jentry2[nz] to Jentry2_new[nz_new] */ | |||
149 | Jentry2_new[nz_new].row = Jentry2[nz].row + j*mbs; /* index in dy-array */ | |||
150 | Jentry2_new[nz_new].valaddr = Jentry2[nz].valaddr; | |||
151 | nz_new++; nz++; row_start[j]++; | |||
152 | } | |||
153 | } | |||
154 | } | |||
155 | if (row_end == mbs) break; | |||
156 | row_end += brows; | |||
157 | if (row_end > mbs) row_end = mbs; | |||
158 | } | |||
159 | nrows_new[nbcols++] = nz_new; | |||
160 | } | |||
161 | ierr = PetscFree(Jentry2)((*PetscTrFree)((void*)(Jentry2),161,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ) || ((Jentry2) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),161,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
162 | c->matentry2 = Jentry2_new; | |||
163 | } /* ---------------------------------------------*/ | |||
164 | ||||
165 | ierr = PetscFree2(color_start,row_start)PetscFreeA(2,165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,&(color_start),&(row_start));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
166 | ||||
167 | for (i=nbcols-1; i>0; i--) nrows_new[i] -= nrows_new[i-1]; | |||
168 | ierr = PetscFree(c->nrows)((*PetscTrFree)((void*)(c->nrows),168,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ) || ((c->nrows) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),168,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
169 | c->nrows = nrows_new; | |||
170 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
171 | } | |||
172 | ||||
173 | PetscErrorCode MatFDColoringSetUp_SeqXAIJ(Mat mat,ISColoring iscoloring,MatFDColoring c) | |||
174 | { | |||
175 | PetscErrorCode ierr; | |||
176 | PetscInt i,n,nrows,mbs=c->m,j,k,m,ncols,col,nis=iscoloring->n,*rowhit,bs,bs2,*spidx,nz,tmp; | |||
177 | const PetscInt *is,*row,*ci,*cj; | |||
178 | PetscBool isBAIJ,isSELL; | |||
179 | const PetscScalar *A_val; | |||
180 | PetscScalar **valaddrhit; | |||
181 | MatEntry *Jentry; | |||
| ||||
182 | MatEntry2 *Jentry2; | |||
183 | ||||
184 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ; petscstack->line[petscstack->currentsize] = 184; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
185 | ierr = ISColoringGetIS(iscoloring,PETSC_OWN_POINTER,PETSC_IGNORE((void*)0),&c->isa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),185,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
186 | ||||
187 | ierr = MatGetBlockSize(mat,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),187,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
188 | ierr = PetscObjectTypeCompare((PetscObject)mat,MATSEQBAIJ"seqbaij",&isBAIJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),188,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
189 | ierr = PetscObjectTypeCompare((PetscObject)mat,MATSEQSELL"seqsell",&isSELL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),189,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
190 | if (isBAIJ) { | |||
191 | Mat_SeqBAIJ *spA = (Mat_SeqBAIJ*)mat->data; | |||
192 | A_val = spA->a; | |||
193 | nz = spA->nz; | |||
194 | } else if (isSELL) { | |||
195 | Mat_SeqSELL *spA = (Mat_SeqSELL*)mat->data; | |||
196 | A_val = spA->val; | |||
197 | nz = spA->nz; | |||
198 | bs = 1; /* only bs=1 is supported for SeqSELL matrix */ | |||
199 | } else { | |||
200 | Mat_SeqAIJ *spA = (Mat_SeqAIJ*)mat->data; | |||
201 | A_val = spA->a; | |||
202 | nz = spA->nz; | |||
203 | bs = 1; /* only bs=1 is supported for SeqAIJ matrix */ | |||
204 | } | |||
205 | ||||
206 | ierr = PetscMalloc2(nis,&c->ncolumns,nis,&c->columns)PetscMallocA(2,PETSC_FALSE,206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(nis)*sizeof(**(&c->ncolumns)),(&c->ncolumns ),(size_t)(nis)*sizeof(**(&c->columns)),(&c->columns ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
207 | ierr = PetscMalloc1(nis,&c->nrows)PetscMallocA(1,PETSC_FALSE,207,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(nis)*sizeof(**(&c->nrows)),(&c->nrows ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),207,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); /* nrows is freeed seperately from ncolumns and columns */ | |||
208 | ierr = PetscLogObjectMemory((PetscObject)c,3*nis*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
209 | ||||
210 | if (c->htype[0] == 'd') { | |||
211 | ierr = PetscMalloc1(nz,&Jentry)PetscMallocA(1,PETSC_FALSE,211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(nz)*sizeof(**(&Jentry)),(&Jentry));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
212 | ierr = PetscLogObjectMemory((PetscObject)c,nz*sizeof(MatEntry));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),212,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
213 | c->matentry = Jentry; | |||
214 | } else if (c->htype[0] == 'w') { | |||
215 | ierr = PetscMalloc1(nz,&Jentry2)PetscMallocA(1,PETSC_FALSE,215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(nz)*sizeof(**(&Jentry2)),(&Jentry2));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
216 | ierr = PetscLogObjectMemory((PetscObject)c,nz*sizeof(MatEntry2));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
217 | c->matentry2 = Jentry2; | |||
218 | } else SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"htype is not supported")return PetscError(PetscObjectComm((PetscObject)mat),218,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,56,PETSC_ERROR_INITIAL,"htype is not supported"); | |||
219 | ||||
220 | if (isBAIJ) { | |||
221 | ierr = MatGetColumnIJ_SeqBAIJ_Color(mat,0,PETSC_FALSE,PETSC_FALSE,&ncols,&ci,&cj,&spidx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
222 | } else if (isSELL) { | |||
223 | ierr = MatGetColumnIJ_SeqSELL_Color(mat,0,PETSC_FALSE,PETSC_FALSE,&ncols,&ci,&cj,&spidx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
224 | } else { | |||
225 | ierr = MatGetColumnIJ_SeqAIJ_Color(mat,0,PETSC_FALSE,PETSC_FALSE,&ncols,&ci,&cj,&spidx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),225,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
226 | } | |||
227 | ||||
228 | ierr = PetscCalloc1(c->m,&rowhit)PetscMallocA(1,PETSC_TRUE,228,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(c->m)*sizeof(**(&rowhit)),(&rowhit));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),228,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
229 | ierr = PetscMalloc1(c->m,&valaddrhit)PetscMallocA(1,PETSC_FALSE,229,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(c->m)*sizeof(**(&valaddrhit)),(&valaddrhit ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),229,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
230 | ||||
231 | nz = 0; | |||
232 | for (i=0; i<nis; i++) { /* loop over colors */ | |||
233 | ierr = ISGetLocalSize(c->isa[i],&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),233,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
234 | ierr = ISGetIndices(c->isa[i],&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
235 | ||||
236 | c->ncolumns[i] = n; | |||
237 | c->columns[i] = (PetscInt*)is; | |||
238 | /* note: we know that c->isa is going to be around as long at the c->columns values */ | |||
239 | ierr = ISRestoreIndices(c->isa[i],&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),239,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
240 | ||||
241 | /* fast, crude version requires O(N*N) work */ | |||
242 | bs2 = bs*bs; | |||
243 | nrows = 0; | |||
244 | for (j=0; j<n; j++) { /* loop over columns */ | |||
245 | col = is[j]; | |||
246 | tmp = ci[col]; | |||
247 | row = cj + tmp; | |||
248 | m = ci[col+1] - tmp; | |||
249 | nrows += m; | |||
250 | for (k=0; k<m; k++) { /* loop over columns marking them in rowhit */ | |||
251 | rowhit[*row] = col + 1; | |||
252 | valaddrhit[*row++] = (PetscScalar*)&A_val[bs2*spidx[tmp + k]]; | |||
253 | } | |||
254 | } | |||
255 | c->nrows[i] = nrows; /* total num of rows for this color */ | |||
256 | ||||
257 | if (c->htype[0] == 'd') { | |||
258 | for (j=0; j<mbs; j++) { /* loop over rows */ | |||
259 | if (rowhit[j]) { | |||
260 | Jentry[nz].row = j; /* local row index */ | |||
| ||||
261 | Jentry[nz].col = rowhit[j] - 1; /* local column index */ | |||
262 | Jentry[nz].valaddr = valaddrhit[j]; /* address of mat value for this entry */ | |||
263 | nz++; | |||
264 | rowhit[j] = 0.0; /* zero rowhit for reuse */ | |||
265 | } | |||
266 | } | |||
267 | } else { /* c->htype == 'wp' */ | |||
268 | for (j=0; j<mbs; j++) { /* loop over rows */ | |||
269 | if (rowhit[j]) { | |||
270 | Jentry2[nz].row = j; /* local row index */ | |||
271 | Jentry2[nz].valaddr = valaddrhit[j]; /* address of mat value for this entry */ | |||
272 | nz++; | |||
273 | rowhit[j] = 0.0; /* zero rowhit for reuse */ | |||
274 | } | |||
275 | } | |||
276 | } | |||
277 | } | |||
278 | ||||
279 | if (c->bcols > 1) { /* reorder Jentry for faster MatFDColoringApply() */ | |||
280 | ierr = MatFDColoringSetUpBlocked_AIJ_Private(mat,c,nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),280,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
281 | } | |||
282 | ||||
283 | if (isBAIJ) { | |||
284 | ierr = MatRestoreColumnIJ_SeqBAIJ_Color(mat,0,PETSC_FALSE,PETSC_FALSE,&ncols,&ci,&cj,&spidx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),284,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
285 | ierr = PetscMalloc1(bs*mat->rmap->n,&c->dy)PetscMallocA(1,PETSC_FALSE,285,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,(size_t)(bs*mat->rmap->n)*sizeof(**(&c->dy)),(& c->dy));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),285,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
286 | ierr = PetscLogObjectMemory((PetscObject)c,bs*mat->rmap->n*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
287 | } else if (isSELL) { | |||
288 | ierr = MatRestoreColumnIJ_SeqSELL_Color(mat,0,PETSC_FALSE,PETSC_FALSE,&ncols,&ci,&cj,&spidx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),288,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
289 | } else { | |||
290 | ierr = MatRestoreColumnIJ_SeqAIJ_Color(mat,0,PETSC_FALSE,PETSC_FALSE,&ncols,&ci,&cj,&spidx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),290,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
291 | } | |||
292 | ierr = PetscFree(rowhit)((*PetscTrFree)((void*)(rowhit),292,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ) || ((rowhit) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),292,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
293 | ierr = PetscFree(valaddrhit)((*PetscTrFree)((void*)(valaddrhit),293,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ) || ((valaddrhit) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),293,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
294 | ierr = ISColoringRestoreIS(iscoloring,PETSC_OWN_POINTER,&c->isa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
295 | ||||
296 | ierr = VecCreateGhost(PetscObjectComm((PetscObject)mat),mat->rmap->n,PETSC_DETERMINE-1,0,NULL((void*)0),&c->vscale);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
297 | ierr = PetscInfo3(c,"ncolors %D, brows %D and bcols %D are used.\n",c->ncolors,c->brows,c->bcols)PetscInfo_Private(__func__,c,"ncolors %D, brows %D and bcols %D are used.\n" ,c->ncolors,c->brows,c->bcols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),297,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/fdaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
298 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
299 | } |