File: | mat/impls/baij/seq/baij.c |
Warning: | line 1884, column 22 Dereference of null pointer |
[?] Use j/k keys for keyboard navigation
1 | ||||
2 | /* | |||
3 | Defines the basic matrix operations for the BAIJ (compressed row) | |||
4 | matrix storage format. | |||
5 | */ | |||
6 | #include <../src/mat/impls/baij/seq/baij.h> /*I "petscmat.h" I*/ | |||
7 | #include <petscblaslapack.h> | |||
8 | #include <petsc/private/kernels/blockinvert.h> | |||
9 | #include <petsc/private/kernels/blockmatmult.h> | |||
10 | ||||
11 | #if defined(PETSC_HAVE_HYPRE) | |||
12 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_AIJ_HYPRE(Mat,MatType,MatReuse,Mat*); | |||
13 | #endif | |||
14 | ||||
15 | #if defined(PETSC_HAVE_MKL_SPARSE_OPTIMIZE) | |||
16 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqBAIJ_SeqBAIJMKL(Mat,MatType,MatReuse,Mat*); | |||
17 | #endif | |||
18 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_XAIJ_IS(Mat,MatType,MatReuse,Mat*); | |||
19 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatPtAP_IS_XAIJ(Mat,Mat,MatReuse,PetscReal,Mat*); | |||
20 | ||||
21 | PetscErrorCode MatInvertBlockDiagonal_SeqBAIJ(Mat A,const PetscScalar **values) | |||
22 | { | |||
23 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*) A->data; | |||
24 | PetscErrorCode ierr; | |||
25 | PetscInt *diag_offset,i,bs = A->rmap->bs,mbs = a->mbs,ipvt[5],bs2 = bs*bs,*v_pivots; | |||
26 | MatScalar *v = a->a,*odiag,*diag,work[25],*v_work; | |||
27 | PetscReal shift = 0.0; | |||
28 | PetscBool allowzeropivot,zeropivotdetected=PETSC_FALSE; | |||
29 | ||||
30 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 30; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
31 | allowzeropivot = PetscNot(A->erroriffailure)((A->erroriffailure) ? PETSC_FALSE : PETSC_TRUE); | |||
32 | ||||
33 | if (a->idiagvalid) { | |||
34 | if (values) *values = a->idiag; | |||
35 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
36 | } | |||
37 | ierr = MatMarkDiagonal_SeqBAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),37,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
38 | diag_offset = a->diag; | |||
39 | if (!a->idiag) { | |||
40 | ierr = PetscMalloc1(bs2*mbs,&a->idiag)PetscMallocA(1,PETSC_FALSE,40,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(bs2*mbs)*sizeof(**(&a->idiag)),(&a->idiag ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),40,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
41 | ierr = PetscLogObjectMemory((PetscObject)A,bs2*mbs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),41,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
42 | } | |||
43 | diag = a->idiag; | |||
44 | if (values) *values = a->idiag; | |||
45 | /* factor and invert each block */ | |||
46 | switch (bs) { | |||
47 | case 1: | |||
48 | for (i=0; i<mbs; i++) { | |||
49 | odiag = v + 1*diag_offset[i]; | |||
50 | diag[0] = odiag[0]; | |||
51 | ||||
52 | if (PetscAbsScalar(diag[0] + shift) < PETSC_MACHINE_EPSILON2.2204460492503131e-16) { | |||
53 | if (allowzeropivot) { | |||
54 | A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
55 | A->factorerror_zeropivot_value = PetscAbsScalar(diag[0]); | |||
56 | A->factorerror_zeropivot_row = i; | |||
57 | ierr = PetscInfo1(A,"Zero pivot, row %D\n",i)PetscInfo_Private(__func__,A,"Zero pivot, row %D\n",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),57,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
58 | } else SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_MAT_LU_ZRPVT,"Zero pivot, row %D pivot value %g tolerance %g",i,(double)PetscAbsScalar(diag[0]),(double)PETSC_MACHINE_EPSILON)return PetscError(((MPI_Comm)0x44000001),58,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,71,PETSC_ERROR_INITIAL,"Zero pivot, row %D pivot value %g tolerance %g" ,i,(double)PetscAbsScalar(diag[0]),(double)2.2204460492503131e-16 ); | |||
59 | } | |||
60 | ||||
61 | diag[0] = (PetscScalar)1.0 / (diag[0] + shift); | |||
62 | diag += 1; | |||
63 | } | |||
64 | break; | |||
65 | case 2: | |||
66 | for (i=0; i<mbs; i++) { | |||
67 | odiag = v + 4*diag_offset[i]; | |||
68 | diag[0] = odiag[0]; diag[1] = odiag[1]; diag[2] = odiag[2]; diag[3] = odiag[3]; | |||
69 | ierr = PetscKernel_A_gets_inverse_A_2(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),69,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
70 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
71 | diag += 4; | |||
72 | } | |||
73 | break; | |||
74 | case 3: | |||
75 | for (i=0; i<mbs; i++) { | |||
76 | odiag = v + 9*diag_offset[i]; | |||
77 | diag[0] = odiag[0]; diag[1] = odiag[1]; diag[2] = odiag[2]; diag[3] = odiag[3]; | |||
78 | diag[4] = odiag[4]; diag[5] = odiag[5]; diag[6] = odiag[6]; diag[7] = odiag[7]; | |||
79 | diag[8] = odiag[8]; | |||
80 | ierr = PetscKernel_A_gets_inverse_A_3(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),80,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
81 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
82 | diag += 9; | |||
83 | } | |||
84 | break; | |||
85 | case 4: | |||
86 | for (i=0; i<mbs; i++) { | |||
87 | odiag = v + 16*diag_offset[i]; | |||
88 | ierr = PetscArraycpy(diag,odiag,16)((sizeof(*(diag)) != sizeof(*(odiag))) || PetscMemcpy(diag,odiag ,(16)*sizeof(*(diag))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),88,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
89 | ierr = PetscKernel_A_gets_inverse_A_4(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),89,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
90 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
91 | diag += 16; | |||
92 | } | |||
93 | break; | |||
94 | case 5: | |||
95 | for (i=0; i<mbs; i++) { | |||
96 | odiag = v + 25*diag_offset[i]; | |||
97 | ierr = PetscArraycpy(diag,odiag,25)((sizeof(*(diag)) != sizeof(*(odiag))) || PetscMemcpy(diag,odiag ,(25)*sizeof(*(diag))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),97,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
98 | ierr = PetscKernel_A_gets_inverse_A_5(diag,ipvt,work,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),98,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
99 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
100 | diag += 25; | |||
101 | } | |||
102 | break; | |||
103 | case 6: | |||
104 | for (i=0; i<mbs; i++) { | |||
105 | odiag = v + 36*diag_offset[i]; | |||
106 | ierr = PetscArraycpy(diag,odiag,36)((sizeof(*(diag)) != sizeof(*(odiag))) || PetscMemcpy(diag,odiag ,(36)*sizeof(*(diag))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),106,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
107 | ierr = PetscKernel_A_gets_inverse_A_6(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),107,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
108 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
109 | diag += 36; | |||
110 | } | |||
111 | break; | |||
112 | case 7: | |||
113 | for (i=0; i<mbs; i++) { | |||
114 | odiag = v + 49*diag_offset[i]; | |||
115 | ierr = PetscArraycpy(diag,odiag,49)((sizeof(*(diag)) != sizeof(*(odiag))) || PetscMemcpy(diag,odiag ,(49)*sizeof(*(diag))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),115,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
116 | ierr = PetscKernel_A_gets_inverse_A_7(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),116,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
117 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
118 | diag += 49; | |||
119 | } | |||
120 | break; | |||
121 | default: | |||
122 | ierr = PetscMalloc2(bs,&v_work,bs,&v_pivots)PetscMallocA(2,PETSC_FALSE,122,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(bs)*sizeof(**(&v_work)),(&v_work),(size_t)( bs)*sizeof(**(&v_pivots)),(&v_pivots));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),122,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
123 | for (i=0; i<mbs; i++) { | |||
124 | odiag = v + bs2*diag_offset[i]; | |||
125 | ierr = PetscArraycpy(diag,odiag,bs2)((sizeof(*(diag)) != sizeof(*(odiag))) || PetscMemcpy(diag,odiag ,(bs2)*sizeof(*(diag))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),125,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
126 | ierr = PetscKernel_A_gets_inverse_A(bs,diag,v_pivots,v_work,allowzeropivot,&zeropivotdetected)(PetscLINPACKgefa((diag),(bs),(v_pivots),(allowzeropivot),(& zeropivotdetected)) || PetscLINPACKgedi((diag),(bs),(v_pivots ),(v_work)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
127 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
128 | diag += bs2; | |||
129 | } | |||
130 | ierr = PetscFree2(v_work,v_pivots)PetscFreeA(2,130,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,&(v_work),&(v_pivots));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),130,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
131 | } | |||
132 | a->idiagvalid = PETSC_TRUE; | |||
133 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
134 | } | |||
135 | ||||
136 | PetscErrorCode MatSOR_SeqBAIJ(Mat A,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx) | |||
137 | { | |||
138 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
139 | PetscScalar *x,*work,*w,*workt,*t; | |||
140 | const MatScalar *v,*aa = a->a, *idiag; | |||
141 | const PetscScalar *b,*xb; | |||
142 | PetscScalar s[7], xw[7]={0}; /* avoid some compilers thinking xw is uninitialized */ | |||
143 | PetscErrorCode ierr; | |||
144 | PetscInt m = a->mbs,i,i2,nz,bs = A->rmap->bs,bs2 = bs*bs,k,j,idx,it; | |||
145 | const PetscInt *diag,*ai = a->i,*aj = a->j,*vi; | |||
146 | ||||
147 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 147; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
148 | its = its*lits; | |||
149 | if (flag & SOR_EISENSTAT) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support yet for Eisenstat")return PetscError(((MPI_Comm)0x44000001),149,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"No support yet for Eisenstat"); | |||
150 | 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),150,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"Relaxation requires global its %D and local its %D both positive" ,its,lits); | |||
151 | if (fshift) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Sorry, no support for diagonal shift")return PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"Sorry, no support for diagonal shift" ); | |||
152 | if (omega != 1.0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Sorry, no support for non-trivial relaxation factor")return PetscError(((MPI_Comm)0x44000001),152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"Sorry, no support for non-trivial relaxation factor" ); | |||
153 | if ((flag & SOR_APPLY_UPPER) || (flag & SOR_APPLY_LOWER)) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Sorry, no support for applying upper or lower triangular parts")return PetscError(((MPI_Comm)0x44000001),153,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"Sorry, no support for applying upper or lower triangular parts" ); | |||
154 | ||||
155 | if (!a->idiagvalid) {ierr = MatInvertBlockDiagonal(A,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),155,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
156 | ||||
157 | 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); | |||
158 | diag = a->diag; | |||
159 | idiag = a->idiag; | |||
160 | k = PetscMax(A->rmap->n,A->cmap->n)(((A->rmap->n)<(A->cmap->n)) ? (A->cmap-> n) : (A->rmap->n)); | |||
161 | if (!a->mult_work) { | |||
162 | ierr = PetscMalloc1(k+1,&a->mult_work)PetscMallocA(1,PETSC_FALSE,162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(k+1)*sizeof(**(&a->mult_work)),(&a->mult_work ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
163 | } | |||
164 | if (!a->sor_workt) { | |||
165 | ierr = PetscMalloc1(k,&a->sor_workt)PetscMallocA(1,PETSC_FALSE,165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(k)*sizeof(**(&a->sor_workt)),(&a->sor_workt ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
166 | } | |||
167 | if (!a->sor_work) { | |||
168 | ierr = PetscMalloc1(bs,&a->sor_work)PetscMallocA(1,PETSC_FALSE,168,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(bs)*sizeof(**(&a->sor_work)),(&a->sor_work ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),168,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
169 | } | |||
170 | work = a->mult_work; | |||
171 | t = a->sor_workt; | |||
172 | w = a->sor_work; | |||
173 | ||||
174 | ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),174,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
175 | ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),175,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
176 | ||||
177 | if (flag & SOR_ZERO_INITIAL_GUESS) { | |||
178 | if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) { | |||
179 | switch (bs) { | |||
180 | case 1: | |||
181 | PetscKernel_v_gets_A_times_w_1(x,idiag,b)do { x[0] = idiag[0]*b[0]; } while (0); | |||
182 | t[0] = b[0]; | |||
183 | i2 = 1; | |||
184 | idiag += 1; | |||
185 | for (i=1; i<m; i++) { | |||
186 | v = aa + ai[i]; | |||
187 | vi = aj + ai[i]; | |||
188 | nz = diag[i] - ai[i]; | |||
189 | s[0] = b[i2]; | |||
190 | for (j=0; j<nz; j++) { | |||
191 | xw[0] = x[vi[j]]; | |||
192 | PetscKernel_v_gets_v_minus_A_times_w_1(s,(v+j),xw)do { s[0] -= (v+j)[0]*xw[0]; } while (0); | |||
193 | } | |||
194 | t[i2] = s[0]; | |||
195 | PetscKernel_v_gets_A_times_w_1(xw,idiag,s)do { xw[0] = idiag[0]*s[0]; } while (0); | |||
196 | x[i2] = xw[0]; | |||
197 | idiag += 1; | |||
198 | i2 += 1; | |||
199 | } | |||
200 | break; | |||
201 | case 2: | |||
202 | PetscKernel_v_gets_A_times_w_2(x,idiag,b)do { x[0] = idiag[0]*b[0] + idiag[2]*b[1]; x[1] = idiag[1]*b[ 0] + idiag[3]*b[1]; } while (0); | |||
203 | t[0] = b[0]; t[1] = b[1]; | |||
204 | i2 = 2; | |||
205 | idiag += 4; | |||
206 | for (i=1; i<m; i++) { | |||
207 | v = aa + 4*ai[i]; | |||
208 | vi = aj + ai[i]; | |||
209 | nz = diag[i] - ai[i]; | |||
210 | s[0] = b[i2]; s[1] = b[i2+1]; | |||
211 | for (j=0; j<nz; j++) { | |||
212 | idx = 2*vi[j]; | |||
213 | it = 4*j; | |||
214 | xw[0] = x[idx]; xw[1] = x[1+idx]; | |||
215 | PetscKernel_v_gets_v_minus_A_times_w_2(s,(v+it),xw)do { s[0] -= (v+it)[0]*xw[0] + (v+it)[2]*xw[1]; s[1] -= (v+it )[1]*xw[0] + (v+it)[3]*xw[1]; } while (0); | |||
216 | } | |||
217 | t[i2] = s[0]; t[i2+1] = s[1]; | |||
218 | PetscKernel_v_gets_A_times_w_2(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[2]*s[1]; xw[1] = idiag[1]* s[0] + idiag[3]*s[1]; } while (0); | |||
219 | x[i2] = xw[0]; x[i2+1] = xw[1]; | |||
220 | idiag += 4; | |||
221 | i2 += 2; | |||
222 | } | |||
223 | break; | |||
224 | case 3: | |||
225 | PetscKernel_v_gets_A_times_w_3(x,idiag,b)do { x[0] = idiag[0]*b[0] + idiag[3]*b[1] + idiag[6]*b[2]; x[ 1] = idiag[1]*b[0] + idiag[4]*b[1] + idiag[7]*b[2]; x[2] = idiag [2]*b[0] + idiag[5]*b[1] + idiag[8]*b[2]; } while (0); | |||
226 | t[0] = b[0]; t[1] = b[1]; t[2] = b[2]; | |||
227 | i2 = 3; | |||
228 | idiag += 9; | |||
229 | for (i=1; i<m; i++) { | |||
230 | v = aa + 9*ai[i]; | |||
231 | vi = aj + ai[i]; | |||
232 | nz = diag[i] - ai[i]; | |||
233 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; | |||
234 | while (nz--) { | |||
235 | idx = 3*(*vi++); | |||
236 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
237 | PetscKernel_v_gets_v_minus_A_times_w_3(s,v,xw)do { s[0] -= v[0]*xw[0] + v[3]*xw[1] + v[6]*xw[2]; s[1] -= v[ 1]*xw[0] + v[4]*xw[1] + v[7]*xw[2]; s[2] -= v[2]*xw[0] + v[5] *xw[1] + v[8]*xw[2]; } while (0); | |||
238 | v += 9; | |||
239 | } | |||
240 | t[i2] = s[0]; t[i2+1] = s[1]; t[i2+2] = s[2]; | |||
241 | PetscKernel_v_gets_A_times_w_3(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[3]*s[1] + idiag[6]*s[2]; xw [1] = idiag[1]*s[0] + idiag[4]*s[1] + idiag[7]*s[2]; xw[2] = idiag [2]*s[0] + idiag[5]*s[1] + idiag[8]*s[2]; } while (0); | |||
242 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; | |||
243 | idiag += 9; | |||
244 | i2 += 3; | |||
245 | } | |||
246 | break; | |||
247 | case 4: | |||
248 | PetscKernel_v_gets_A_times_w_4(x,idiag,b)do { x[0] = idiag[0]*b[0] + idiag[4]*b[1] + idiag[8] *b[2] + idiag [12]*b[3]; x[1] = idiag[1]*b[0] + idiag[5]*b[1] + idiag[9] *b [2] + idiag[13]*b[3]; x[2] = idiag[2]*b[0] + idiag[6]*b[1] + idiag [10]*b[2] + idiag[14]*b[3]; x[3] = idiag[3]*b[0] + idiag[7]*b [1] + idiag[11]*b[2] + idiag[15]*b[3]; } while (0); | |||
249 | t[0] = b[0]; t[1] = b[1]; t[2] = b[2]; t[3] = b[3]; | |||
250 | i2 = 4; | |||
251 | idiag += 16; | |||
252 | for (i=1; i<m; i++) { | |||
253 | v = aa + 16*ai[i]; | |||
254 | vi = aj + ai[i]; | |||
255 | nz = diag[i] - ai[i]; | |||
256 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; s[3] = b[i2+3]; | |||
257 | while (nz--) { | |||
258 | idx = 4*(*vi++); | |||
259 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; xw[3] = x[3+idx]; | |||
260 | PetscKernel_v_gets_v_minus_A_times_w_4(s,v,xw)do { s[0] -= v[0]*xw[0] + v[4]*xw[1] + v[8] *xw[2] + v[12]*xw [3]; s[1] -= v[1]*xw[0] + v[5]*xw[1] + v[9] *xw[2] + v[13]*xw [3]; s[2] -= v[2]*xw[0] + v[6]*xw[1] + v[10]*xw[2] + v[14]*xw [3]; s[3] -= v[3]*xw[0] + v[7]*xw[1] + v[11]*xw[2] + v[15]*xw [3]; } while (0); | |||
261 | v += 16; | |||
262 | } | |||
263 | t[i2] = s[0]; t[i2+1] = s[1]; t[i2+2] = s[2]; t[i2 + 3] = s[3]; | |||
264 | PetscKernel_v_gets_A_times_w_4(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[4]*s[1] + idiag[8] *s[2] + idiag[12]*s[3]; xw[1] = idiag[1]*s[0] + idiag[5]*s[1] + idiag [9] *s[2] + idiag[13]*s[3]; xw[2] = idiag[2]*s[0] + idiag[6]* s[1] + idiag[10]*s[2] + idiag[14]*s[3]; xw[3] = idiag[3]*s[0] + idiag[7]*s[1] + idiag[11]*s[2] + idiag[15]*s[3]; } while ( 0); | |||
265 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; x[i2+3] = xw[3]; | |||
266 | idiag += 16; | |||
267 | i2 += 4; | |||
268 | } | |||
269 | break; | |||
270 | case 5: | |||
271 | PetscKernel_v_gets_A_times_w_5(x,idiag,b)do { x[0] = idiag[0]*b[0] + idiag[5]*b[1] + idiag[10]*b[2] + idiag [15]*b[3] + idiag[20]*b[4]; x[1] = idiag[1]*b[0] + idiag[6]*b [1] + idiag[11]*b[2] + idiag[16]*b[3] + idiag[21]*b[4]; x[2] = idiag[2]*b[0] + idiag[7]*b[1] + idiag[12]*b[2] + idiag[17]*b [3] + idiag[22]*b[4]; x[3] = idiag[3]*b[0] + idiag[8]*b[1] + idiag [13]*b[2] + idiag[18]*b[3] + idiag[23]*b[4]; x[4] = idiag[4]* b[0] + idiag[9]*b[1] + idiag[14]*b[2] + idiag[19]*b[3] + idiag [24]*b[4]; } while (0); | |||
272 | t[0] = b[0]; t[1] = b[1]; t[2] = b[2]; t[3] = b[3]; t[4] = b[4]; | |||
273 | i2 = 5; | |||
274 | idiag += 25; | |||
275 | for (i=1; i<m; i++) { | |||
276 | v = aa + 25*ai[i]; | |||
277 | vi = aj + ai[i]; | |||
278 | nz = diag[i] - ai[i]; | |||
279 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; s[3] = b[i2+3]; s[4] = b[i2+4]; | |||
280 | while (nz--) { | |||
281 | idx = 5*(*vi++); | |||
282 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; xw[3] = x[3+idx]; xw[4] = x[4+idx]; | |||
283 | PetscKernel_v_gets_v_minus_A_times_w_5(s,v,xw)do { s[0] -= v[0]*xw[0] + v[5]*xw[1] + v[10]*xw[2] + v[15]*xw [3] + v[20]*xw[4]; s[1] -= v[1]*xw[0] + v[6]*xw[1] + v[11]*xw [2] + v[16]*xw[3] + v[21]*xw[4]; s[2] -= v[2]*xw[0] + v[7]*xw [1] + v[12]*xw[2] + v[17]*xw[3] + v[22]*xw[4]; s[3] -= v[3]*xw [0] + v[8]*xw[1] + v[13]*xw[2] + v[18]*xw[3] + v[23]*xw[4]; s [4] -= v[4]*xw[0] + v[9]*xw[1] + v[14]*xw[2] + v[19]*xw[3] + v [24]*xw[4]; } while (0); | |||
284 | v += 25; | |||
285 | } | |||
286 | t[i2] = s[0]; t[i2+1] = s[1]; t[i2+2] = s[2]; t[i2+3] = s[3]; t[i2+4] = s[4]; | |||
287 | PetscKernel_v_gets_A_times_w_5(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[5]*s[1] + idiag[10]*s[2] + idiag[15]*s[3] + idiag[20]*s[4]; xw[1] = idiag[1]*s[0] + idiag [6]*s[1] + idiag[11]*s[2] + idiag[16]*s[3] + idiag[21]*s[4]; xw [2] = idiag[2]*s[0] + idiag[7]*s[1] + idiag[12]*s[2] + idiag[ 17]*s[3] + idiag[22]*s[4]; xw[3] = idiag[3]*s[0] + idiag[8]*s [1] + idiag[13]*s[2] + idiag[18]*s[3] + idiag[23]*s[4]; xw[4] = idiag[4]*s[0] + idiag[9]*s[1] + idiag[14]*s[2] + idiag[19] *s[3] + idiag[24]*s[4]; } while (0); | |||
288 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; x[i2+3] = xw[3]; x[i2+4] = xw[4]; | |||
289 | idiag += 25; | |||
290 | i2 += 5; | |||
291 | } | |||
292 | break; | |||
293 | case 6: | |||
294 | PetscKernel_v_gets_A_times_w_6(x,idiag,b)do { x[0] = idiag[0]*b[0] + idiag[6] *b[1] + idiag[12]*b[2] + idiag[18]*b[3] + idiag[24]*b[4] + idiag[30]*b[5]; x[1] = idiag [1]*b[0] + idiag[7] *b[1] + idiag[13]*b[2] + idiag[19]*b[3] + idiag[25]*b[4] + idiag[31]*b[5]; x[2] = idiag[2]*b[0] + idiag [8] *b[1] + idiag[14]*b[2] + idiag[20]*b[3] + idiag[26]*b[4] + idiag[32]*b[5]; x[3] = idiag[3]*b[0] + idiag[9] *b[1] + idiag [15]*b[2] + idiag[21]*b[3] + idiag[27]*b[4] + idiag[33]*b[5]; x[4] = idiag[4]*b[0] + idiag[10]*b[1] + idiag[16]*b[2] + idiag [22]*b[3] + idiag[28]*b[4] + idiag[34]*b[5]; x[5] = idiag[5]* b[0] + idiag[11]*b[1] + idiag[17]*b[2] + idiag[23]*b[3] + idiag [29]*b[4] + idiag[35]*b[5]; } while (0); | |||
295 | t[0] = b[0]; t[1] = b[1]; t[2] = b[2]; t[3] = b[3]; t[4] = b[4]; t[5] = b[5]; | |||
296 | i2 = 6; | |||
297 | idiag += 36; | |||
298 | for (i=1; i<m; i++) { | |||
299 | v = aa + 36*ai[i]; | |||
300 | vi = aj + ai[i]; | |||
301 | nz = diag[i] - ai[i]; | |||
302 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; s[3] = b[i2+3]; s[4] = b[i2+4]; s[5] = b[i2+5]; | |||
303 | while (nz--) { | |||
304 | idx = 6*(*vi++); | |||
305 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
306 | xw[3] = x[3+idx]; xw[4] = x[4+idx]; xw[5] = x[5+idx]; | |||
307 | PetscKernel_v_gets_v_minus_A_times_w_6(s,v,xw)do { s[0] -= v[0]*xw[0] + v[6] *xw[1] + v[12]*xw[2] + v[18]*xw [3] + v[24]*xw[4] + v[30]*xw[5]; s[1] -= v[1]*xw[0] + v[7] *xw [1] + v[13]*xw[2] + v[19]*xw[3] + v[25]*xw[4] + v[31]*xw[5]; s [2] -= v[2]*xw[0] + v[8] *xw[1] + v[14]*xw[2] + v[20]*xw[3] + v[26]*xw[4] + v[32]*xw[5]; s[3] -= v[3]*xw[0] + v[9] *xw[1] + v[15]*xw[2] + v[21]*xw[3] + v[27]*xw[4] + v[33]*xw[5]; s[4] -= v[4]*xw[0] + v[10]*xw[1] + v[16]*xw[2] + v[22]*xw[3] + v[28] *xw[4] + v[34]*xw[5]; s[5] -= v[5]*xw[0] + v[11]*xw[1] + v[17 ]*xw[2] + v[23]*xw[3] + v[29]*xw[4] + v[35]*xw[5]; } while (0 ); | |||
308 | v += 36; | |||
309 | } | |||
310 | t[i2] = s[0]; t[i2+1] = s[1]; t[i2+2] = s[2]; | |||
311 | t[i2+3] = s[3]; t[i2+4] = s[4]; t[i2+5] = s[5]; | |||
312 | PetscKernel_v_gets_A_times_w_6(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[6] *s[1] + idiag[12]*s[2] + idiag[18]*s[3] + idiag[24]*s[4] + idiag[30]*s[5]; xw[1] = idiag [1]*s[0] + idiag[7] *s[1] + idiag[13]*s[2] + idiag[19]*s[3] + idiag[25]*s[4] + idiag[31]*s[5]; xw[2] = idiag[2]*s[0] + idiag [8] *s[1] + idiag[14]*s[2] + idiag[20]*s[3] + idiag[26]*s[4] + idiag[32]*s[5]; xw[3] = idiag[3]*s[0] + idiag[9] *s[1] + idiag [15]*s[2] + idiag[21]*s[3] + idiag[27]*s[4] + idiag[33]*s[5]; xw[4] = idiag[4]*s[0] + idiag[10]*s[1] + idiag[16]*s[2] + idiag [22]*s[3] + idiag[28]*s[4] + idiag[34]*s[5]; xw[5] = idiag[5] *s[0] + idiag[11]*s[1] + idiag[17]*s[2] + idiag[23]*s[3] + idiag [29]*s[4] + idiag[35]*s[5]; } while (0); | |||
313 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; x[i2+3] = xw[3]; x[i2+4] = xw[4]; x[i2+5] = xw[5]; | |||
314 | idiag += 36; | |||
315 | i2 += 6; | |||
316 | } | |||
317 | break; | |||
318 | case 7: | |||
319 | PetscKernel_v_gets_A_times_w_7(x,idiag,b)do { x[0] = idiag[0]*b[0] + idiag[7] *b[1] + idiag[14]*b[2] + idiag[21]*b[3] + idiag[28]*b[4] + idiag[35]*b[5] + idiag[42] *b[6]; x[1] = idiag[1]*b[0] + idiag[8] *b[1] + idiag[15]*b[2] + idiag[22]*b[3] + idiag[29]*b[4] + idiag[36]*b[5] + idiag[43 ]*b[6]; x[2] = idiag[2]*b[0] + idiag[9] *b[1] + idiag[16]*b[2 ] + idiag[23]*b[3] + idiag[30]*b[4] + idiag[37]*b[5] + idiag[ 44]*b[6]; x[3] = idiag[3]*b[0] + idiag[10]*b[1] + idiag[17]*b [2] + idiag[24]*b[3] + idiag[31]*b[4] + idiag[38]*b[5] + idiag [45]*b[6]; x[4] = idiag[4]*b[0] + idiag[11]*b[1] + idiag[18]* b[2] + idiag[25]*b[3] + idiag[32]*b[4] + idiag[39]*b[5] + idiag [46]*b[6]; x[5] = idiag[5]*b[0] + idiag[12]*b[1] + idiag[19]* b[2] + idiag[26]*b[3] + idiag[33]*b[4] + idiag[40]*b[5] + idiag [47]*b[6]; x[6] = idiag[6]*b[0] + idiag[13]*b[1] + idiag[20]* b[2] + idiag[27]*b[3] + idiag[34]*b[4] + idiag[41]*b[5] + idiag [48]*b[6]; } while (0); | |||
320 | t[0] = b[0]; t[1] = b[1]; t[2] = b[2]; | |||
321 | t[3] = b[3]; t[4] = b[4]; t[5] = b[5]; t[6] = b[6]; | |||
322 | i2 = 7; | |||
323 | idiag += 49; | |||
324 | for (i=1; i<m; i++) { | |||
325 | v = aa + 49*ai[i]; | |||
326 | vi = aj + ai[i]; | |||
327 | nz = diag[i] - ai[i]; | |||
328 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; | |||
329 | s[3] = b[i2+3]; s[4] = b[i2+4]; s[5] = b[i2+5]; s[6] = b[i2+6]; | |||
330 | while (nz--) { | |||
331 | idx = 7*(*vi++); | |||
332 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
333 | xw[3] = x[3+idx]; xw[4] = x[4+idx]; xw[5] = x[5+idx]; xw[6] = x[6+idx]; | |||
334 | PetscKernel_v_gets_v_minus_A_times_w_7(s,v,xw)do { s[0] -= v[0]*xw[0] + v[7] *xw[1] + v[14]*xw[2] + v[21]*xw [3] + v[28]*xw[4] + v[35]*xw[5] + v[42]*xw[6]; s[1] -= v[1]*xw [0] + v[8] *xw[1] + v[15]*xw[2] + v[22]*xw[3] + v[29]*xw[4] + v[36]*xw[5] + v[43]*xw[6]; s[2] -= v[2]*xw[0] + v[9] *xw[1] + v[16]*xw[2] + v[23]*xw[3] + v[30]*xw[4] + v[37]*xw[5] + v[44 ]*xw[6]; s[3] -= v[3]*xw[0] + v[10]*xw[1] + v[17]*xw[2] + v[24 ]*xw[3] + v[31]*xw[4] + v[38]*xw[5] + v[45]*xw[6]; s[4] -= v[ 4]*xw[0] + v[11]*xw[1] + v[18]*xw[2] + v[25]*xw[3] + v[32]*xw [4] + v[39]*xw[5] + v[46]*xw[6]; s[5] -= v[5]*xw[0] + v[12]*xw [1] + v[19]*xw[2] + v[26]*xw[3] + v[33]*xw[4] + v[40]*xw[5] + v[47]*xw[6]; s[6] -= v[6]*xw[0] + v[13]*xw[1] + v[20]*xw[2] + v[27]*xw[3] + v[34]*xw[4] + v[41]*xw[5] + v[48]*xw[6]; } while (0); | |||
335 | v += 49; | |||
336 | } | |||
337 | t[i2] = s[0]; t[i2+1] = s[1]; t[i2+2] = s[2]; | |||
338 | t[i2+3] = s[3]; t[i2+4] = s[4]; t[i2+5] = s[5]; t[i2+6] = s[6]; | |||
339 | PetscKernel_v_gets_A_times_w_7(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[7] *s[1] + idiag[14]*s[2] + idiag[21]*s[3] + idiag[28]*s[4] + idiag[35]*s[5] + idiag[42] *s[6]; xw[1] = idiag[1]*s[0] + idiag[8] *s[1] + idiag[15]*s[2 ] + idiag[22]*s[3] + idiag[29]*s[4] + idiag[36]*s[5] + idiag[ 43]*s[6]; xw[2] = idiag[2]*s[0] + idiag[9] *s[1] + idiag[16]* s[2] + idiag[23]*s[3] + idiag[30]*s[4] + idiag[37]*s[5] + idiag [44]*s[6]; xw[3] = idiag[3]*s[0] + idiag[10]*s[1] + idiag[17] *s[2] + idiag[24]*s[3] + idiag[31]*s[4] + idiag[38]*s[5] + idiag [45]*s[6]; xw[4] = idiag[4]*s[0] + idiag[11]*s[1] + idiag[18] *s[2] + idiag[25]*s[3] + idiag[32]*s[4] + idiag[39]*s[5] + idiag [46]*s[6]; xw[5] = idiag[5]*s[0] + idiag[12]*s[1] + idiag[19] *s[2] + idiag[26]*s[3] + idiag[33]*s[4] + idiag[40]*s[5] + idiag [47]*s[6]; xw[6] = idiag[6]*s[0] + idiag[13]*s[1] + idiag[20] *s[2] + idiag[27]*s[3] + idiag[34]*s[4] + idiag[41]*s[5] + idiag [48]*s[6]; } while (0); | |||
340 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; | |||
341 | x[i2+3] = xw[3]; x[i2+4] = xw[4]; x[i2+5] = xw[5]; x[i2+6] = xw[6]; | |||
342 | idiag += 49; | |||
343 | i2 += 7; | |||
344 | } | |||
345 | break; | |||
346 | default: | |||
347 | 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),347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast (bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return PetscError(((MPI_Comm)0x44000001),347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 347; 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(347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); }; | |||
348 | ierr = PetscArraycpy(t,b,bs)((sizeof(*(t)) != sizeof(*(b))) || PetscMemcpy(t,b,(bs)*sizeof (*(t))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),348,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
349 | i2 = bs; | |||
350 | idiag += bs2; | |||
351 | for (i=1; i<m; i++) { | |||
352 | v = aa + bs2*ai[i]; | |||
353 | vi = aj + ai[i]; | |||
354 | nz = diag[i] - ai[i]; | |||
355 | ||||
356 | ierr = PetscArraycpy(w,b+i2,bs)((sizeof(*(w)) != sizeof(*(b+i2))) || PetscMemcpy(w,b+i2,(bs) *sizeof(*(w))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),356,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
357 | /* copy all rows of x that are needed into contiguous space */ | |||
358 | workt = work; | |||
359 | for (j=0; j<nz; j++) { | |||
360 | ierr = PetscArraycpy(workt,x + bs*(*vi++),bs)((sizeof(*(workt)) != sizeof(*(x + bs*(*vi++)))) || PetscMemcpy (workt,x + bs*(*vi++),(bs)*sizeof(*(workt))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),360,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
361 | workt += bs; | |||
362 | } | |||
363 | PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,v,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),363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast (bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return PetscError(((MPI_Comm)0x44000001),363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 363; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); dgemv_("N",&(_bbs),&(_bncols),&_mone,v,&(_bbs ),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); }; | |||
364 | ierr = PetscArraycpy(t+i2,w,bs)((sizeof(*(t+i2)) != sizeof(*(w))) || PetscMemcpy(t+i2,w,(bs) *sizeof(*(t+i2))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),364,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
365 | 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),365,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast (bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return PetscError(((MPI_Comm)0x44000001),365,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 365; 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(365,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),365,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); }; | |||
366 | ||||
367 | idiag += bs2; | |||
368 | i2 += bs; | |||
369 | } | |||
370 | break; | |||
371 | } | |||
372 | /* for logging purposes assume number of nonzero in lower half is 1/2 of total */ | |||
373 | ierr = PetscLogFlops(1.0*bs2*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),373,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
374 | xb = t; | |||
375 | } | |||
376 | else xb = b; | |||
377 | if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) { | |||
378 | idiag = a->idiag+bs2*(a->mbs-1); | |||
379 | i2 = bs * (m-1); | |||
380 | switch (bs) { | |||
381 | case 1: | |||
382 | s[0] = xb[i2]; | |||
383 | PetscKernel_v_gets_A_times_w_1(xw,idiag,s)do { xw[0] = idiag[0]*s[0]; } while (0); | |||
384 | x[i2] = xw[0]; | |||
385 | i2 -= 1; | |||
386 | for (i=m-2; i>=0; i--) { | |||
387 | v = aa + (diag[i]+1); | |||
388 | vi = aj + diag[i] + 1; | |||
389 | nz = ai[i+1] - diag[i] - 1; | |||
390 | s[0] = xb[i2]; | |||
391 | for (j=0; j<nz; j++) { | |||
392 | xw[0] = x[vi[j]]; | |||
393 | PetscKernel_v_gets_v_minus_A_times_w_1(s,(v+j),xw)do { s[0] -= (v+j)[0]*xw[0]; } while (0); | |||
394 | } | |||
395 | PetscKernel_v_gets_A_times_w_1(xw,idiag,s)do { xw[0] = idiag[0]*s[0]; } while (0); | |||
396 | x[i2] = xw[0]; | |||
397 | idiag -= 1; | |||
398 | i2 -= 1; | |||
399 | } | |||
400 | break; | |||
401 | case 2: | |||
402 | s[0] = xb[i2]; s[1] = xb[i2+1]; | |||
403 | PetscKernel_v_gets_A_times_w_2(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[2]*s[1]; xw[1] = idiag[1]* s[0] + idiag[3]*s[1]; } while (0); | |||
404 | x[i2] = xw[0]; x[i2+1] = xw[1]; | |||
405 | i2 -= 2; | |||
406 | idiag -= 4; | |||
407 | for (i=m-2; i>=0; i--) { | |||
408 | v = aa + 4*(diag[i] + 1); | |||
409 | vi = aj + diag[i] + 1; | |||
410 | nz = ai[i+1] - diag[i] - 1; | |||
411 | s[0] = xb[i2]; s[1] = xb[i2+1]; | |||
412 | for (j=0; j<nz; j++) { | |||
413 | idx = 2*vi[j]; | |||
414 | it = 4*j; | |||
415 | xw[0] = x[idx]; xw[1] = x[1+idx]; | |||
416 | PetscKernel_v_gets_v_minus_A_times_w_2(s,(v+it),xw)do { s[0] -= (v+it)[0]*xw[0] + (v+it)[2]*xw[1]; s[1] -= (v+it )[1]*xw[0] + (v+it)[3]*xw[1]; } while (0); | |||
417 | } | |||
418 | PetscKernel_v_gets_A_times_w_2(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[2]*s[1]; xw[1] = idiag[1]* s[0] + idiag[3]*s[1]; } while (0); | |||
419 | x[i2] = xw[0]; x[i2+1] = xw[1]; | |||
420 | idiag -= 4; | |||
421 | i2 -= 2; | |||
422 | } | |||
423 | break; | |||
424 | case 3: | |||
425 | s[0] = xb[i2]; s[1] = xb[i2+1]; s[2] = xb[i2+2]; | |||
426 | PetscKernel_v_gets_A_times_w_3(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[3]*s[1] + idiag[6]*s[2]; xw [1] = idiag[1]*s[0] + idiag[4]*s[1] + idiag[7]*s[2]; xw[2] = idiag [2]*s[0] + idiag[5]*s[1] + idiag[8]*s[2]; } while (0); | |||
427 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; | |||
428 | i2 -= 3; | |||
429 | idiag -= 9; | |||
430 | for (i=m-2; i>=0; i--) { | |||
431 | v = aa + 9*(diag[i]+1); | |||
432 | vi = aj + diag[i] + 1; | |||
433 | nz = ai[i+1] - diag[i] - 1; | |||
434 | s[0] = xb[i2]; s[1] = xb[i2+1]; s[2] = xb[i2+2]; | |||
435 | while (nz--) { | |||
436 | idx = 3*(*vi++); | |||
437 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
438 | PetscKernel_v_gets_v_minus_A_times_w_3(s,v,xw)do { s[0] -= v[0]*xw[0] + v[3]*xw[1] + v[6]*xw[2]; s[1] -= v[ 1]*xw[0] + v[4]*xw[1] + v[7]*xw[2]; s[2] -= v[2]*xw[0] + v[5] *xw[1] + v[8]*xw[2]; } while (0); | |||
439 | v += 9; | |||
440 | } | |||
441 | PetscKernel_v_gets_A_times_w_3(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[3]*s[1] + idiag[6]*s[2]; xw [1] = idiag[1]*s[0] + idiag[4]*s[1] + idiag[7]*s[2]; xw[2] = idiag [2]*s[0] + idiag[5]*s[1] + idiag[8]*s[2]; } while (0); | |||
442 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; | |||
443 | idiag -= 9; | |||
444 | i2 -= 3; | |||
445 | } | |||
446 | break; | |||
447 | case 4: | |||
448 | s[0] = xb[i2]; s[1] = xb[i2+1]; s[2] = xb[i2+2]; s[3] = xb[i2+3]; | |||
449 | PetscKernel_v_gets_A_times_w_4(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[4]*s[1] + idiag[8] *s[2] + idiag[12]*s[3]; xw[1] = idiag[1]*s[0] + idiag[5]*s[1] + idiag [9] *s[2] + idiag[13]*s[3]; xw[2] = idiag[2]*s[0] + idiag[6]* s[1] + idiag[10]*s[2] + idiag[14]*s[3]; xw[3] = idiag[3]*s[0] + idiag[7]*s[1] + idiag[11]*s[2] + idiag[15]*s[3]; } while ( 0); | |||
450 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; x[i2+3] = xw[3]; | |||
451 | i2 -= 4; | |||
452 | idiag -= 16; | |||
453 | for (i=m-2; i>=0; i--) { | |||
454 | v = aa + 16*(diag[i]+1); | |||
455 | vi = aj + diag[i] + 1; | |||
456 | nz = ai[i+1] - diag[i] - 1; | |||
457 | s[0] = xb[i2]; s[1] = xb[i2+1]; s[2] = xb[i2+2]; s[3] = xb[i2+3]; | |||
458 | while (nz--) { | |||
459 | idx = 4*(*vi++); | |||
460 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; xw[3] = x[3+idx]; | |||
461 | PetscKernel_v_gets_v_minus_A_times_w_4(s,v,xw)do { s[0] -= v[0]*xw[0] + v[4]*xw[1] + v[8] *xw[2] + v[12]*xw [3]; s[1] -= v[1]*xw[0] + v[5]*xw[1] + v[9] *xw[2] + v[13]*xw [3]; s[2] -= v[2]*xw[0] + v[6]*xw[1] + v[10]*xw[2] + v[14]*xw [3]; s[3] -= v[3]*xw[0] + v[7]*xw[1] + v[11]*xw[2] + v[15]*xw [3]; } while (0); | |||
462 | v += 16; | |||
463 | } | |||
464 | PetscKernel_v_gets_A_times_w_4(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[4]*s[1] + idiag[8] *s[2] + idiag[12]*s[3]; xw[1] = idiag[1]*s[0] + idiag[5]*s[1] + idiag [9] *s[2] + idiag[13]*s[3]; xw[2] = idiag[2]*s[0] + idiag[6]* s[1] + idiag[10]*s[2] + idiag[14]*s[3]; xw[3] = idiag[3]*s[0] + idiag[7]*s[1] + idiag[11]*s[2] + idiag[15]*s[3]; } while ( 0); | |||
465 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; x[i2+3] = xw[3]; | |||
466 | idiag -= 16; | |||
467 | i2 -= 4; | |||
468 | } | |||
469 | break; | |||
470 | case 5: | |||
471 | s[0] = xb[i2]; s[1] = xb[i2+1]; s[2] = xb[i2+2]; s[3] = xb[i2+3]; s[4] = xb[i2+4]; | |||
472 | PetscKernel_v_gets_A_times_w_5(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[5]*s[1] + idiag[10]*s[2] + idiag[15]*s[3] + idiag[20]*s[4]; xw[1] = idiag[1]*s[0] + idiag [6]*s[1] + idiag[11]*s[2] + idiag[16]*s[3] + idiag[21]*s[4]; xw [2] = idiag[2]*s[0] + idiag[7]*s[1] + idiag[12]*s[2] + idiag[ 17]*s[3] + idiag[22]*s[4]; xw[3] = idiag[3]*s[0] + idiag[8]*s [1] + idiag[13]*s[2] + idiag[18]*s[3] + idiag[23]*s[4]; xw[4] = idiag[4]*s[0] + idiag[9]*s[1] + idiag[14]*s[2] + idiag[19] *s[3] + idiag[24]*s[4]; } while (0); | |||
473 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; x[i2+3] = xw[3]; x[i2+4] = xw[4]; | |||
474 | i2 -= 5; | |||
475 | idiag -= 25; | |||
476 | for (i=m-2; i>=0; i--) { | |||
477 | v = aa + 25*(diag[i]+1); | |||
478 | vi = aj + diag[i] + 1; | |||
479 | nz = ai[i+1] - diag[i] - 1; | |||
480 | s[0] = xb[i2]; s[1] = xb[i2+1]; s[2] = xb[i2+2]; s[3] = xb[i2+3]; s[4] = xb[i2+4]; | |||
481 | while (nz--) { | |||
482 | idx = 5*(*vi++); | |||
483 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; xw[3] = x[3+idx]; xw[4] = x[4+idx]; | |||
484 | PetscKernel_v_gets_v_minus_A_times_w_5(s,v,xw)do { s[0] -= v[0]*xw[0] + v[5]*xw[1] + v[10]*xw[2] + v[15]*xw [3] + v[20]*xw[4]; s[1] -= v[1]*xw[0] + v[6]*xw[1] + v[11]*xw [2] + v[16]*xw[3] + v[21]*xw[4]; s[2] -= v[2]*xw[0] + v[7]*xw [1] + v[12]*xw[2] + v[17]*xw[3] + v[22]*xw[4]; s[3] -= v[3]*xw [0] + v[8]*xw[1] + v[13]*xw[2] + v[18]*xw[3] + v[23]*xw[4]; s [4] -= v[4]*xw[0] + v[9]*xw[1] + v[14]*xw[2] + v[19]*xw[3] + v [24]*xw[4]; } while (0); | |||
485 | v += 25; | |||
486 | } | |||
487 | PetscKernel_v_gets_A_times_w_5(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[5]*s[1] + idiag[10]*s[2] + idiag[15]*s[3] + idiag[20]*s[4]; xw[1] = idiag[1]*s[0] + idiag [6]*s[1] + idiag[11]*s[2] + idiag[16]*s[3] + idiag[21]*s[4]; xw [2] = idiag[2]*s[0] + idiag[7]*s[1] + idiag[12]*s[2] + idiag[ 17]*s[3] + idiag[22]*s[4]; xw[3] = idiag[3]*s[0] + idiag[8]*s [1] + idiag[13]*s[2] + idiag[18]*s[3] + idiag[23]*s[4]; xw[4] = idiag[4]*s[0] + idiag[9]*s[1] + idiag[14]*s[2] + idiag[19] *s[3] + idiag[24]*s[4]; } while (0); | |||
488 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; x[i2+3] = xw[3]; x[i2+4] = xw[4]; | |||
489 | idiag -= 25; | |||
490 | i2 -= 5; | |||
491 | } | |||
492 | break; | |||
493 | case 6: | |||
494 | s[0] = xb[i2]; s[1] = xb[i2+1]; s[2] = xb[i2+2]; s[3] = xb[i2+3]; s[4] = xb[i2+4]; s[5] = xb[i2+5]; | |||
495 | PetscKernel_v_gets_A_times_w_6(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[6] *s[1] + idiag[12]*s[2] + idiag[18]*s[3] + idiag[24]*s[4] + idiag[30]*s[5]; xw[1] = idiag [1]*s[0] + idiag[7] *s[1] + idiag[13]*s[2] + idiag[19]*s[3] + idiag[25]*s[4] + idiag[31]*s[5]; xw[2] = idiag[2]*s[0] + idiag [8] *s[1] + idiag[14]*s[2] + idiag[20]*s[3] + idiag[26]*s[4] + idiag[32]*s[5]; xw[3] = idiag[3]*s[0] + idiag[9] *s[1] + idiag [15]*s[2] + idiag[21]*s[3] + idiag[27]*s[4] + idiag[33]*s[5]; xw[4] = idiag[4]*s[0] + idiag[10]*s[1] + idiag[16]*s[2] + idiag [22]*s[3] + idiag[28]*s[4] + idiag[34]*s[5]; xw[5] = idiag[5] *s[0] + idiag[11]*s[1] + idiag[17]*s[2] + idiag[23]*s[3] + idiag [29]*s[4] + idiag[35]*s[5]; } while (0); | |||
496 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; x[i2+3] = xw[3]; x[i2+4] = xw[4]; x[i2+5] = xw[5]; | |||
497 | i2 -= 6; | |||
498 | idiag -= 36; | |||
499 | for (i=m-2; i>=0; i--) { | |||
500 | v = aa + 36*(diag[i]+1); | |||
501 | vi = aj + diag[i] + 1; | |||
502 | nz = ai[i+1] - diag[i] - 1; | |||
503 | s[0] = xb[i2]; s[1] = xb[i2+1]; s[2] = xb[i2+2]; s[3] = xb[i2+3]; s[4] = xb[i2+4]; s[5] = xb[i2+5]; | |||
504 | while (nz--) { | |||
505 | idx = 6*(*vi++); | |||
506 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
507 | xw[3] = x[3+idx]; xw[4] = x[4+idx]; xw[5] = x[5+idx]; | |||
508 | PetscKernel_v_gets_v_minus_A_times_w_6(s,v,xw)do { s[0] -= v[0]*xw[0] + v[6] *xw[1] + v[12]*xw[2] + v[18]*xw [3] + v[24]*xw[4] + v[30]*xw[5]; s[1] -= v[1]*xw[0] + v[7] *xw [1] + v[13]*xw[2] + v[19]*xw[3] + v[25]*xw[4] + v[31]*xw[5]; s [2] -= v[2]*xw[0] + v[8] *xw[1] + v[14]*xw[2] + v[20]*xw[3] + v[26]*xw[4] + v[32]*xw[5]; s[3] -= v[3]*xw[0] + v[9] *xw[1] + v[15]*xw[2] + v[21]*xw[3] + v[27]*xw[4] + v[33]*xw[5]; s[4] -= v[4]*xw[0] + v[10]*xw[1] + v[16]*xw[2] + v[22]*xw[3] + v[28] *xw[4] + v[34]*xw[5]; s[5] -= v[5]*xw[0] + v[11]*xw[1] + v[17 ]*xw[2] + v[23]*xw[3] + v[29]*xw[4] + v[35]*xw[5]; } while (0 ); | |||
509 | v += 36; | |||
510 | } | |||
511 | PetscKernel_v_gets_A_times_w_6(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[6] *s[1] + idiag[12]*s[2] + idiag[18]*s[3] + idiag[24]*s[4] + idiag[30]*s[5]; xw[1] = idiag [1]*s[0] + idiag[7] *s[1] + idiag[13]*s[2] + idiag[19]*s[3] + idiag[25]*s[4] + idiag[31]*s[5]; xw[2] = idiag[2]*s[0] + idiag [8] *s[1] + idiag[14]*s[2] + idiag[20]*s[3] + idiag[26]*s[4] + idiag[32]*s[5]; xw[3] = idiag[3]*s[0] + idiag[9] *s[1] + idiag [15]*s[2] + idiag[21]*s[3] + idiag[27]*s[4] + idiag[33]*s[5]; xw[4] = idiag[4]*s[0] + idiag[10]*s[1] + idiag[16]*s[2] + idiag [22]*s[3] + idiag[28]*s[4] + idiag[34]*s[5]; xw[5] = idiag[5] *s[0] + idiag[11]*s[1] + idiag[17]*s[2] + idiag[23]*s[3] + idiag [29]*s[4] + idiag[35]*s[5]; } while (0); | |||
512 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; x[i2+3] = xw[3]; x[i2+4] = xw[4]; x[i2+5] = xw[5]; | |||
513 | idiag -= 36; | |||
514 | i2 -= 6; | |||
515 | } | |||
516 | break; | |||
517 | case 7: | |||
518 | s[0] = xb[i2]; s[1] = xb[i2+1]; s[2] = xb[i2+2]; | |||
519 | s[3] = xb[i2+3]; s[4] = xb[i2+4]; s[5] = xb[i2+5]; s[6] = xb[i2+6]; | |||
520 | PetscKernel_v_gets_A_times_w_7(x,idiag,b)do { x[0] = idiag[0]*b[0] + idiag[7] *b[1] + idiag[14]*b[2] + idiag[21]*b[3] + idiag[28]*b[4] + idiag[35]*b[5] + idiag[42] *b[6]; x[1] = idiag[1]*b[0] + idiag[8] *b[1] + idiag[15]*b[2] + idiag[22]*b[3] + idiag[29]*b[4] + idiag[36]*b[5] + idiag[43 ]*b[6]; x[2] = idiag[2]*b[0] + idiag[9] *b[1] + idiag[16]*b[2 ] + idiag[23]*b[3] + idiag[30]*b[4] + idiag[37]*b[5] + idiag[ 44]*b[6]; x[3] = idiag[3]*b[0] + idiag[10]*b[1] + idiag[17]*b [2] + idiag[24]*b[3] + idiag[31]*b[4] + idiag[38]*b[5] + idiag [45]*b[6]; x[4] = idiag[4]*b[0] + idiag[11]*b[1] + idiag[18]* b[2] + idiag[25]*b[3] + idiag[32]*b[4] + idiag[39]*b[5] + idiag [46]*b[6]; x[5] = idiag[5]*b[0] + idiag[12]*b[1] + idiag[19]* b[2] + idiag[26]*b[3] + idiag[33]*b[4] + idiag[40]*b[5] + idiag [47]*b[6]; x[6] = idiag[6]*b[0] + idiag[13]*b[1] + idiag[20]* b[2] + idiag[27]*b[3] + idiag[34]*b[4] + idiag[41]*b[5] + idiag [48]*b[6]; } while (0); | |||
521 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; | |||
522 | x[i2+3] = xw[3]; x[i2+4] = xw[4]; x[i2+5] = xw[5]; x[i2+6] = xw[6]; | |||
523 | i2 -= 7; | |||
524 | idiag -= 49; | |||
525 | for (i=m-2; i>=0; i--) { | |||
526 | v = aa + 49*(diag[i]+1); | |||
527 | vi = aj + diag[i] + 1; | |||
528 | nz = ai[i+1] - diag[i] - 1; | |||
529 | s[0] = xb[i2]; s[1] = xb[i2+1]; s[2] = xb[i2+2]; | |||
530 | s[3] = xb[i2+3]; s[4] = xb[i2+4]; s[5] = xb[i2+5]; s[6] = xb[i2+6]; | |||
531 | while (nz--) { | |||
532 | idx = 7*(*vi++); | |||
533 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
534 | xw[3] = x[3+idx]; xw[4] = x[4+idx]; xw[5] = x[5+idx]; xw[6] = x[6+idx]; | |||
535 | PetscKernel_v_gets_v_minus_A_times_w_7(s,v,xw)do { s[0] -= v[0]*xw[0] + v[7] *xw[1] + v[14]*xw[2] + v[21]*xw [3] + v[28]*xw[4] + v[35]*xw[5] + v[42]*xw[6]; s[1] -= v[1]*xw [0] + v[8] *xw[1] + v[15]*xw[2] + v[22]*xw[3] + v[29]*xw[4] + v[36]*xw[5] + v[43]*xw[6]; s[2] -= v[2]*xw[0] + v[9] *xw[1] + v[16]*xw[2] + v[23]*xw[3] + v[30]*xw[4] + v[37]*xw[5] + v[44 ]*xw[6]; s[3] -= v[3]*xw[0] + v[10]*xw[1] + v[17]*xw[2] + v[24 ]*xw[3] + v[31]*xw[4] + v[38]*xw[5] + v[45]*xw[6]; s[4] -= v[ 4]*xw[0] + v[11]*xw[1] + v[18]*xw[2] + v[25]*xw[3] + v[32]*xw [4] + v[39]*xw[5] + v[46]*xw[6]; s[5] -= v[5]*xw[0] + v[12]*xw [1] + v[19]*xw[2] + v[26]*xw[3] + v[33]*xw[4] + v[40]*xw[5] + v[47]*xw[6]; s[6] -= v[6]*xw[0] + v[13]*xw[1] + v[20]*xw[2] + v[27]*xw[3] + v[34]*xw[4] + v[41]*xw[5] + v[48]*xw[6]; } while (0); | |||
536 | v += 49; | |||
537 | } | |||
538 | PetscKernel_v_gets_A_times_w_7(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[7] *s[1] + idiag[14]*s[2] + idiag[21]*s[3] + idiag[28]*s[4] + idiag[35]*s[5] + idiag[42] *s[6]; xw[1] = idiag[1]*s[0] + idiag[8] *s[1] + idiag[15]*s[2 ] + idiag[22]*s[3] + idiag[29]*s[4] + idiag[36]*s[5] + idiag[ 43]*s[6]; xw[2] = idiag[2]*s[0] + idiag[9] *s[1] + idiag[16]* s[2] + idiag[23]*s[3] + idiag[30]*s[4] + idiag[37]*s[5] + idiag [44]*s[6]; xw[3] = idiag[3]*s[0] + idiag[10]*s[1] + idiag[17] *s[2] + idiag[24]*s[3] + idiag[31]*s[4] + idiag[38]*s[5] + idiag [45]*s[6]; xw[4] = idiag[4]*s[0] + idiag[11]*s[1] + idiag[18] *s[2] + idiag[25]*s[3] + idiag[32]*s[4] + idiag[39]*s[5] + idiag [46]*s[6]; xw[5] = idiag[5]*s[0] + idiag[12]*s[1] + idiag[19] *s[2] + idiag[26]*s[3] + idiag[33]*s[4] + idiag[40]*s[5] + idiag [47]*s[6]; xw[6] = idiag[6]*s[0] + idiag[13]*s[1] + idiag[20] *s[2] + idiag[27]*s[3] + idiag[34]*s[4] + idiag[41]*s[5] + idiag [48]*s[6]; } while (0); | |||
539 | x[i2] = xw[0]; x[i2+1] = xw[1]; x[i2+2] = xw[2]; | |||
540 | x[i2+3] = xw[3]; x[i2+4] = xw[4]; x[i2+5] = xw[5]; x[i2+6] = xw[6]; | |||
541 | idiag -= 49; | |||
542 | i2 -= 7; | |||
543 | } | |||
544 | break; | |||
545 | default: | |||
546 | ierr = PetscArraycpy(w,xb+i2,bs)((sizeof(*(w)) != sizeof(*(xb+i2))) || PetscMemcpy(w,xb+i2,(bs )*sizeof(*(w))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),546,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
547 | 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),547,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast (bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return PetscError(((MPI_Comm)0x44000001),547,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 547; 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(547,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),547,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); }; | |||
548 | i2 -= bs; | |||
549 | idiag -= bs2; | |||
550 | for (i=m-2; i>=0; i--) { | |||
551 | v = aa + bs2*(diag[i]+1); | |||
552 | vi = aj + diag[i] + 1; | |||
553 | nz = ai[i+1] - diag[i] - 1; | |||
554 | ||||
555 | ierr = PetscArraycpy(w,xb+i2,bs)((sizeof(*(w)) != sizeof(*(xb+i2))) || PetscMemcpy(w,xb+i2,(bs )*sizeof(*(w))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),555,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
556 | /* copy all rows of x that are needed into contiguous space */ | |||
557 | workt = work; | |||
558 | for (j=0; j<nz; j++) { | |||
559 | ierr = PetscArraycpy(workt,x + bs*(*vi++),bs)((sizeof(*(workt)) != sizeof(*(x + bs*(*vi++)))) || PetscMemcpy (workt,x + bs*(*vi++),(bs)*sizeof(*(workt))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),559,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
560 | workt += bs; | |||
561 | } | |||
562 | PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,v,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),562,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast (bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return PetscError(((MPI_Comm)0x44000001),562,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 562; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); dgemv_("N",&(_bbs),&(_bncols),&_mone,v,&(_bbs ),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(562,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),562,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); }; | |||
563 | 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),563,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast (bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return PetscError(((MPI_Comm)0x44000001),563,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 563; 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(563,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),563,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); }; | |||
564 | ||||
565 | idiag -= bs2; | |||
566 | i2 -= bs; | |||
567 | } | |||
568 | break; | |||
569 | } | |||
570 | ierr = PetscLogFlops(1.0*bs2*(a->nz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),570,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
571 | } | |||
572 | its--; | |||
573 | } | |||
574 | while (its--) { | |||
575 | if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) { | |||
576 | idiag = a->idiag; | |||
577 | i2 = 0; | |||
578 | switch (bs) { | |||
579 | case 1: | |||
580 | for (i=0; i<m; i++) { | |||
581 | v = aa + ai[i]; | |||
582 | vi = aj + ai[i]; | |||
583 | nz = ai[i+1] - ai[i]; | |||
584 | s[0] = b[i2]; | |||
585 | for (j=0; j<nz; j++) { | |||
586 | xw[0] = x[vi[j]]; | |||
587 | PetscKernel_v_gets_v_minus_A_times_w_1(s,(v+j),xw)do { s[0] -= (v+j)[0]*xw[0]; } while (0); | |||
588 | } | |||
589 | PetscKernel_v_gets_A_times_w_1(xw,idiag,s)do { xw[0] = idiag[0]*s[0]; } while (0); | |||
590 | x[i2] += xw[0]; | |||
591 | idiag += 1; | |||
592 | i2 += 1; | |||
593 | } | |||
594 | break; | |||
595 | case 2: | |||
596 | for (i=0; i<m; i++) { | |||
597 | v = aa + 4*ai[i]; | |||
598 | vi = aj + ai[i]; | |||
599 | nz = ai[i+1] - ai[i]; | |||
600 | s[0] = b[i2]; s[1] = b[i2+1]; | |||
601 | for (j=0; j<nz; j++) { | |||
602 | idx = 2*vi[j]; | |||
603 | it = 4*j; | |||
604 | xw[0] = x[idx]; xw[1] = x[1+idx]; | |||
605 | PetscKernel_v_gets_v_minus_A_times_w_2(s,(v+it),xw)do { s[0] -= (v+it)[0]*xw[0] + (v+it)[2]*xw[1]; s[1] -= (v+it )[1]*xw[0] + (v+it)[3]*xw[1]; } while (0); | |||
606 | } | |||
607 | PetscKernel_v_gets_A_times_w_2(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[2]*s[1]; xw[1] = idiag[1]* s[0] + idiag[3]*s[1]; } while (0); | |||
608 | x[i2] += xw[0]; x[i2+1] += xw[1]; | |||
609 | idiag += 4; | |||
610 | i2 += 2; | |||
611 | } | |||
612 | break; | |||
613 | case 3: | |||
614 | for (i=0; i<m; i++) { | |||
615 | v = aa + 9*ai[i]; | |||
616 | vi = aj + ai[i]; | |||
617 | nz = ai[i+1] - ai[i]; | |||
618 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; | |||
619 | while (nz--) { | |||
620 | idx = 3*(*vi++); | |||
621 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
622 | PetscKernel_v_gets_v_minus_A_times_w_3(s,v,xw)do { s[0] -= v[0]*xw[0] + v[3]*xw[1] + v[6]*xw[2]; s[1] -= v[ 1]*xw[0] + v[4]*xw[1] + v[7]*xw[2]; s[2] -= v[2]*xw[0] + v[5] *xw[1] + v[8]*xw[2]; } while (0); | |||
623 | v += 9; | |||
624 | } | |||
625 | PetscKernel_v_gets_A_times_w_3(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[3]*s[1] + idiag[6]*s[2]; xw [1] = idiag[1]*s[0] + idiag[4]*s[1] + idiag[7]*s[2]; xw[2] = idiag [2]*s[0] + idiag[5]*s[1] + idiag[8]*s[2]; } while (0); | |||
626 | x[i2] += xw[0]; x[i2+1] += xw[1]; x[i2+2] += xw[2]; | |||
627 | idiag += 9; | |||
628 | i2 += 3; | |||
629 | } | |||
630 | break; | |||
631 | case 4: | |||
632 | for (i=0; i<m; i++) { | |||
633 | v = aa + 16*ai[i]; | |||
634 | vi = aj + ai[i]; | |||
635 | nz = ai[i+1] - ai[i]; | |||
636 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; s[3] = b[i2+3]; | |||
637 | while (nz--) { | |||
638 | idx = 4*(*vi++); | |||
639 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; xw[3] = x[3+idx]; | |||
640 | PetscKernel_v_gets_v_minus_A_times_w_4(s,v,xw)do { s[0] -= v[0]*xw[0] + v[4]*xw[1] + v[8] *xw[2] + v[12]*xw [3]; s[1] -= v[1]*xw[0] + v[5]*xw[1] + v[9] *xw[2] + v[13]*xw [3]; s[2] -= v[2]*xw[0] + v[6]*xw[1] + v[10]*xw[2] + v[14]*xw [3]; s[3] -= v[3]*xw[0] + v[7]*xw[1] + v[11]*xw[2] + v[15]*xw [3]; } while (0); | |||
641 | v += 16; | |||
642 | } | |||
643 | PetscKernel_v_gets_A_times_w_4(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[4]*s[1] + idiag[8] *s[2] + idiag[12]*s[3]; xw[1] = idiag[1]*s[0] + idiag[5]*s[1] + idiag [9] *s[2] + idiag[13]*s[3]; xw[2] = idiag[2]*s[0] + idiag[6]* s[1] + idiag[10]*s[2] + idiag[14]*s[3]; xw[3] = idiag[3]*s[0] + idiag[7]*s[1] + idiag[11]*s[2] + idiag[15]*s[3]; } while ( 0); | |||
644 | x[i2] += xw[0]; x[i2+1] += xw[1]; x[i2+2] += xw[2]; x[i2+3] += xw[3]; | |||
645 | idiag += 16; | |||
646 | i2 += 4; | |||
647 | } | |||
648 | break; | |||
649 | case 5: | |||
650 | for (i=0; i<m; i++) { | |||
651 | v = aa + 25*ai[i]; | |||
652 | vi = aj + ai[i]; | |||
653 | nz = ai[i+1] - ai[i]; | |||
654 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; s[3] = b[i2+3]; s[4] = b[i2+4]; | |||
655 | while (nz--) { | |||
656 | idx = 5*(*vi++); | |||
657 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; xw[3] = x[3+idx]; xw[4] = x[4+idx]; | |||
658 | PetscKernel_v_gets_v_minus_A_times_w_5(s,v,xw)do { s[0] -= v[0]*xw[0] + v[5]*xw[1] + v[10]*xw[2] + v[15]*xw [3] + v[20]*xw[4]; s[1] -= v[1]*xw[0] + v[6]*xw[1] + v[11]*xw [2] + v[16]*xw[3] + v[21]*xw[4]; s[2] -= v[2]*xw[0] + v[7]*xw [1] + v[12]*xw[2] + v[17]*xw[3] + v[22]*xw[4]; s[3] -= v[3]*xw [0] + v[8]*xw[1] + v[13]*xw[2] + v[18]*xw[3] + v[23]*xw[4]; s [4] -= v[4]*xw[0] + v[9]*xw[1] + v[14]*xw[2] + v[19]*xw[3] + v [24]*xw[4]; } while (0); | |||
659 | v += 25; | |||
660 | } | |||
661 | PetscKernel_v_gets_A_times_w_5(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[5]*s[1] + idiag[10]*s[2] + idiag[15]*s[3] + idiag[20]*s[4]; xw[1] = idiag[1]*s[0] + idiag [6]*s[1] + idiag[11]*s[2] + idiag[16]*s[3] + idiag[21]*s[4]; xw [2] = idiag[2]*s[0] + idiag[7]*s[1] + idiag[12]*s[2] + idiag[ 17]*s[3] + idiag[22]*s[4]; xw[3] = idiag[3]*s[0] + idiag[8]*s [1] + idiag[13]*s[2] + idiag[18]*s[3] + idiag[23]*s[4]; xw[4] = idiag[4]*s[0] + idiag[9]*s[1] + idiag[14]*s[2] + idiag[19] *s[3] + idiag[24]*s[4]; } while (0); | |||
662 | x[i2] += xw[0]; x[i2+1] += xw[1]; x[i2+2] += xw[2]; x[i2+3] += xw[3]; x[i2+4] += xw[4]; | |||
663 | idiag += 25; | |||
664 | i2 += 5; | |||
665 | } | |||
666 | break; | |||
667 | case 6: | |||
668 | for (i=0; i<m; i++) { | |||
669 | v = aa + 36*ai[i]; | |||
670 | vi = aj + ai[i]; | |||
671 | nz = ai[i+1] - ai[i]; | |||
672 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; s[3] = b[i2+3]; s[4] = b[i2+4]; s[5] = b[i2+5]; | |||
673 | while (nz--) { | |||
674 | idx = 6*(*vi++); | |||
675 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
676 | xw[3] = x[3+idx]; xw[4] = x[4+idx]; xw[5] = x[5+idx]; | |||
677 | PetscKernel_v_gets_v_minus_A_times_w_6(s,v,xw)do { s[0] -= v[0]*xw[0] + v[6] *xw[1] + v[12]*xw[2] + v[18]*xw [3] + v[24]*xw[4] + v[30]*xw[5]; s[1] -= v[1]*xw[0] + v[7] *xw [1] + v[13]*xw[2] + v[19]*xw[3] + v[25]*xw[4] + v[31]*xw[5]; s [2] -= v[2]*xw[0] + v[8] *xw[1] + v[14]*xw[2] + v[20]*xw[3] + v[26]*xw[4] + v[32]*xw[5]; s[3] -= v[3]*xw[0] + v[9] *xw[1] + v[15]*xw[2] + v[21]*xw[3] + v[27]*xw[4] + v[33]*xw[5]; s[4] -= v[4]*xw[0] + v[10]*xw[1] + v[16]*xw[2] + v[22]*xw[3] + v[28] *xw[4] + v[34]*xw[5]; s[5] -= v[5]*xw[0] + v[11]*xw[1] + v[17 ]*xw[2] + v[23]*xw[3] + v[29]*xw[4] + v[35]*xw[5]; } while (0 ); | |||
678 | v += 36; | |||
679 | } | |||
680 | PetscKernel_v_gets_A_times_w_6(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[6] *s[1] + idiag[12]*s[2] + idiag[18]*s[3] + idiag[24]*s[4] + idiag[30]*s[5]; xw[1] = idiag [1]*s[0] + idiag[7] *s[1] + idiag[13]*s[2] + idiag[19]*s[3] + idiag[25]*s[4] + idiag[31]*s[5]; xw[2] = idiag[2]*s[0] + idiag [8] *s[1] + idiag[14]*s[2] + idiag[20]*s[3] + idiag[26]*s[4] + idiag[32]*s[5]; xw[3] = idiag[3]*s[0] + idiag[9] *s[1] + idiag [15]*s[2] + idiag[21]*s[3] + idiag[27]*s[4] + idiag[33]*s[5]; xw[4] = idiag[4]*s[0] + idiag[10]*s[1] + idiag[16]*s[2] + idiag [22]*s[3] + idiag[28]*s[4] + idiag[34]*s[5]; xw[5] = idiag[5] *s[0] + idiag[11]*s[1] + idiag[17]*s[2] + idiag[23]*s[3] + idiag [29]*s[4] + idiag[35]*s[5]; } while (0); | |||
681 | x[i2] += xw[0]; x[i2+1] += xw[1]; x[i2+2] += xw[2]; | |||
682 | x[i2+3] += xw[3]; x[i2+4] += xw[4]; x[i2+5] += xw[5]; | |||
683 | idiag += 36; | |||
684 | i2 += 6; | |||
685 | } | |||
686 | break; | |||
687 | case 7: | |||
688 | for (i=0; i<m; i++) { | |||
689 | v = aa + 49*ai[i]; | |||
690 | vi = aj + ai[i]; | |||
691 | nz = ai[i+1] - ai[i]; | |||
692 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; | |||
693 | s[3] = b[i2+3]; s[4] = b[i2+4]; s[5] = b[i2+5]; s[6] = b[i2+6]; | |||
694 | while (nz--) { | |||
695 | idx = 7*(*vi++); | |||
696 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
697 | xw[3] = x[3+idx]; xw[4] = x[4+idx]; xw[5] = x[5+idx]; xw[6] = x[6+idx]; | |||
698 | PetscKernel_v_gets_v_minus_A_times_w_7(s,v,xw)do { s[0] -= v[0]*xw[0] + v[7] *xw[1] + v[14]*xw[2] + v[21]*xw [3] + v[28]*xw[4] + v[35]*xw[5] + v[42]*xw[6]; s[1] -= v[1]*xw [0] + v[8] *xw[1] + v[15]*xw[2] + v[22]*xw[3] + v[29]*xw[4] + v[36]*xw[5] + v[43]*xw[6]; s[2] -= v[2]*xw[0] + v[9] *xw[1] + v[16]*xw[2] + v[23]*xw[3] + v[30]*xw[4] + v[37]*xw[5] + v[44 ]*xw[6]; s[3] -= v[3]*xw[0] + v[10]*xw[1] + v[17]*xw[2] + v[24 ]*xw[3] + v[31]*xw[4] + v[38]*xw[5] + v[45]*xw[6]; s[4] -= v[ 4]*xw[0] + v[11]*xw[1] + v[18]*xw[2] + v[25]*xw[3] + v[32]*xw [4] + v[39]*xw[5] + v[46]*xw[6]; s[5] -= v[5]*xw[0] + v[12]*xw [1] + v[19]*xw[2] + v[26]*xw[3] + v[33]*xw[4] + v[40]*xw[5] + v[47]*xw[6]; s[6] -= v[6]*xw[0] + v[13]*xw[1] + v[20]*xw[2] + v[27]*xw[3] + v[34]*xw[4] + v[41]*xw[5] + v[48]*xw[6]; } while (0); | |||
699 | v += 49; | |||
700 | } | |||
701 | PetscKernel_v_gets_A_times_w_7(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[7] *s[1] + idiag[14]*s[2] + idiag[21]*s[3] + idiag[28]*s[4] + idiag[35]*s[5] + idiag[42] *s[6]; xw[1] = idiag[1]*s[0] + idiag[8] *s[1] + idiag[15]*s[2 ] + idiag[22]*s[3] + idiag[29]*s[4] + idiag[36]*s[5] + idiag[ 43]*s[6]; xw[2] = idiag[2]*s[0] + idiag[9] *s[1] + idiag[16]* s[2] + idiag[23]*s[3] + idiag[30]*s[4] + idiag[37]*s[5] + idiag [44]*s[6]; xw[3] = idiag[3]*s[0] + idiag[10]*s[1] + idiag[17] *s[2] + idiag[24]*s[3] + idiag[31]*s[4] + idiag[38]*s[5] + idiag [45]*s[6]; xw[4] = idiag[4]*s[0] + idiag[11]*s[1] + idiag[18] *s[2] + idiag[25]*s[3] + idiag[32]*s[4] + idiag[39]*s[5] + idiag [46]*s[6]; xw[5] = idiag[5]*s[0] + idiag[12]*s[1] + idiag[19] *s[2] + idiag[26]*s[3] + idiag[33]*s[4] + idiag[40]*s[5] + idiag [47]*s[6]; xw[6] = idiag[6]*s[0] + idiag[13]*s[1] + idiag[20] *s[2] + idiag[27]*s[3] + idiag[34]*s[4] + idiag[41]*s[5] + idiag [48]*s[6]; } while (0); | |||
702 | x[i2] += xw[0]; x[i2+1] += xw[1]; x[i2+2] += xw[2]; | |||
703 | x[i2+3] += xw[3]; x[i2+4] += xw[4]; x[i2+5] += xw[5]; x[i2+6] += xw[6]; | |||
704 | idiag += 49; | |||
705 | i2 += 7; | |||
706 | } | |||
707 | break; | |||
708 | default: | |||
709 | for (i=0; i<m; i++) { | |||
710 | v = aa + bs2*ai[i]; | |||
711 | vi = aj + ai[i]; | |||
712 | nz = ai[i+1] - ai[i]; | |||
713 | ||||
714 | ierr = PetscArraycpy(w,b+i2,bs)((sizeof(*(w)) != sizeof(*(b+i2))) || PetscMemcpy(w,b+i2,(bs) *sizeof(*(w))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),714,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
715 | /* copy all rows of x that are needed into contiguous space */ | |||
716 | workt = work; | |||
717 | for (j=0; j<nz; j++) { | |||
718 | ierr = PetscArraycpy(workt,x + bs*(*vi++),bs)((sizeof(*(workt)) != sizeof(*(x + bs*(*vi++)))) || PetscMemcpy (workt,x + bs*(*vi++),(bs)*sizeof(*(workt))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),718,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
719 | workt += bs; | |||
720 | } | |||
721 | PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,v,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),721,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast (bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return PetscError(((MPI_Comm)0x44000001),721,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 721; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); dgemv_("N",&(_bbs),&(_bncols),&_mone,v,&(_bbs ),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(721,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),721,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); }; | |||
722 | PetscKernel_w_gets_w_plus_Ar_times_v(bs,bs,w,idiag,x+i2){ PetscScalar _one = 1.0; PetscBLASInt _ione = 1,_bbs,_bncols ; PetscErrorCode _ierr; _ierr = PetscBLASIntCast(bs,&_bbs );do {if (__builtin_expect(!!(_ierr),0)) return PetscError((( MPI_Comm)0x44000001),722,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast (bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return PetscError(((MPI_Comm)0x44000001),722,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 722; 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,&_one,x+i2,&_ione); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(722,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),722,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); }; | |||
723 | ||||
724 | idiag += bs2; | |||
725 | i2 += bs; | |||
726 | } | |||
727 | break; | |||
728 | } | |||
729 | ierr = PetscLogFlops(2.0*bs2*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),729,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
730 | } | |||
731 | if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) { | |||
732 | idiag = a->idiag+bs2*(a->mbs-1); | |||
733 | i2 = bs * (m-1); | |||
734 | switch (bs) { | |||
735 | case 1: | |||
736 | for (i=m-1; i>=0; i--) { | |||
737 | v = aa + ai[i]; | |||
738 | vi = aj + ai[i]; | |||
739 | nz = ai[i+1] - ai[i]; | |||
740 | s[0] = b[i2]; | |||
741 | for (j=0; j<nz; j++) { | |||
742 | xw[0] = x[vi[j]]; | |||
743 | PetscKernel_v_gets_v_minus_A_times_w_1(s,(v+j),xw)do { s[0] -= (v+j)[0]*xw[0]; } while (0); | |||
744 | } | |||
745 | PetscKernel_v_gets_A_times_w_1(xw,idiag,s)do { xw[0] = idiag[0]*s[0]; } while (0); | |||
746 | x[i2] += xw[0]; | |||
747 | idiag -= 1; | |||
748 | i2 -= 1; | |||
749 | } | |||
750 | break; | |||
751 | case 2: | |||
752 | for (i=m-1; i>=0; i--) { | |||
753 | v = aa + 4*ai[i]; | |||
754 | vi = aj + ai[i]; | |||
755 | nz = ai[i+1] - ai[i]; | |||
756 | s[0] = b[i2]; s[1] = b[i2+1]; | |||
757 | for (j=0; j<nz; j++) { | |||
758 | idx = 2*vi[j]; | |||
759 | it = 4*j; | |||
760 | xw[0] = x[idx]; xw[1] = x[1+idx]; | |||
761 | PetscKernel_v_gets_v_minus_A_times_w_2(s,(v+it),xw)do { s[0] -= (v+it)[0]*xw[0] + (v+it)[2]*xw[1]; s[1] -= (v+it )[1]*xw[0] + (v+it)[3]*xw[1]; } while (0); | |||
762 | } | |||
763 | PetscKernel_v_gets_A_times_w_2(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[2]*s[1]; xw[1] = idiag[1]* s[0] + idiag[3]*s[1]; } while (0); | |||
764 | x[i2] += xw[0]; x[i2+1] += xw[1]; | |||
765 | idiag -= 4; | |||
766 | i2 -= 2; | |||
767 | } | |||
768 | break; | |||
769 | case 3: | |||
770 | for (i=m-1; i>=0; i--) { | |||
771 | v = aa + 9*ai[i]; | |||
772 | vi = aj + ai[i]; | |||
773 | nz = ai[i+1] - ai[i]; | |||
774 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; | |||
775 | while (nz--) { | |||
776 | idx = 3*(*vi++); | |||
777 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
778 | PetscKernel_v_gets_v_minus_A_times_w_3(s,v,xw)do { s[0] -= v[0]*xw[0] + v[3]*xw[1] + v[6]*xw[2]; s[1] -= v[ 1]*xw[0] + v[4]*xw[1] + v[7]*xw[2]; s[2] -= v[2]*xw[0] + v[5] *xw[1] + v[8]*xw[2]; } while (0); | |||
779 | v += 9; | |||
780 | } | |||
781 | PetscKernel_v_gets_A_times_w_3(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[3]*s[1] + idiag[6]*s[2]; xw [1] = idiag[1]*s[0] + idiag[4]*s[1] + idiag[7]*s[2]; xw[2] = idiag [2]*s[0] + idiag[5]*s[1] + idiag[8]*s[2]; } while (0); | |||
782 | x[i2] += xw[0]; x[i2+1] += xw[1]; x[i2+2] += xw[2]; | |||
783 | idiag -= 9; | |||
784 | i2 -= 3; | |||
785 | } | |||
786 | break; | |||
787 | case 4: | |||
788 | for (i=m-1; i>=0; i--) { | |||
789 | v = aa + 16*ai[i]; | |||
790 | vi = aj + ai[i]; | |||
791 | nz = ai[i+1] - ai[i]; | |||
792 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; s[3] = b[i2+3]; | |||
793 | while (nz--) { | |||
794 | idx = 4*(*vi++); | |||
795 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; xw[3] = x[3+idx]; | |||
796 | PetscKernel_v_gets_v_minus_A_times_w_4(s,v,xw)do { s[0] -= v[0]*xw[0] + v[4]*xw[1] + v[8] *xw[2] + v[12]*xw [3]; s[1] -= v[1]*xw[0] + v[5]*xw[1] + v[9] *xw[2] + v[13]*xw [3]; s[2] -= v[2]*xw[0] + v[6]*xw[1] + v[10]*xw[2] + v[14]*xw [3]; s[3] -= v[3]*xw[0] + v[7]*xw[1] + v[11]*xw[2] + v[15]*xw [3]; } while (0); | |||
797 | v += 16; | |||
798 | } | |||
799 | PetscKernel_v_gets_A_times_w_4(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[4]*s[1] + idiag[8] *s[2] + idiag[12]*s[3]; xw[1] = idiag[1]*s[0] + idiag[5]*s[1] + idiag [9] *s[2] + idiag[13]*s[3]; xw[2] = idiag[2]*s[0] + idiag[6]* s[1] + idiag[10]*s[2] + idiag[14]*s[3]; xw[3] = idiag[3]*s[0] + idiag[7]*s[1] + idiag[11]*s[2] + idiag[15]*s[3]; } while ( 0); | |||
800 | x[i2] += xw[0]; x[i2+1] += xw[1]; x[i2+2] += xw[2]; x[i2+3] += xw[3]; | |||
801 | idiag -= 16; | |||
802 | i2 -= 4; | |||
803 | } | |||
804 | break; | |||
805 | case 5: | |||
806 | for (i=m-1; i>=0; i--) { | |||
807 | v = aa + 25*ai[i]; | |||
808 | vi = aj + ai[i]; | |||
809 | nz = ai[i+1] - ai[i]; | |||
810 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; s[3] = b[i2+3]; s[4] = b[i2+4]; | |||
811 | while (nz--) { | |||
812 | idx = 5*(*vi++); | |||
813 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; xw[3] = x[3+idx]; xw[4] = x[4+idx]; | |||
814 | PetscKernel_v_gets_v_minus_A_times_w_5(s,v,xw)do { s[0] -= v[0]*xw[0] + v[5]*xw[1] + v[10]*xw[2] + v[15]*xw [3] + v[20]*xw[4]; s[1] -= v[1]*xw[0] + v[6]*xw[1] + v[11]*xw [2] + v[16]*xw[3] + v[21]*xw[4]; s[2] -= v[2]*xw[0] + v[7]*xw [1] + v[12]*xw[2] + v[17]*xw[3] + v[22]*xw[4]; s[3] -= v[3]*xw [0] + v[8]*xw[1] + v[13]*xw[2] + v[18]*xw[3] + v[23]*xw[4]; s [4] -= v[4]*xw[0] + v[9]*xw[1] + v[14]*xw[2] + v[19]*xw[3] + v [24]*xw[4]; } while (0); | |||
815 | v += 25; | |||
816 | } | |||
817 | PetscKernel_v_gets_A_times_w_5(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[5]*s[1] + idiag[10]*s[2] + idiag[15]*s[3] + idiag[20]*s[4]; xw[1] = idiag[1]*s[0] + idiag [6]*s[1] + idiag[11]*s[2] + idiag[16]*s[3] + idiag[21]*s[4]; xw [2] = idiag[2]*s[0] + idiag[7]*s[1] + idiag[12]*s[2] + idiag[ 17]*s[3] + idiag[22]*s[4]; xw[3] = idiag[3]*s[0] + idiag[8]*s [1] + idiag[13]*s[2] + idiag[18]*s[3] + idiag[23]*s[4]; xw[4] = idiag[4]*s[0] + idiag[9]*s[1] + idiag[14]*s[2] + idiag[19] *s[3] + idiag[24]*s[4]; } while (0); | |||
818 | x[i2] += xw[0]; x[i2+1] += xw[1]; x[i2+2] += xw[2]; x[i2+3] += xw[3]; x[i2+4] += xw[4]; | |||
819 | idiag -= 25; | |||
820 | i2 -= 5; | |||
821 | } | |||
822 | break; | |||
823 | case 6: | |||
824 | for (i=m-1; i>=0; i--) { | |||
825 | v = aa + 36*ai[i]; | |||
826 | vi = aj + ai[i]; | |||
827 | nz = ai[i+1] - ai[i]; | |||
828 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; s[3] = b[i2+3]; s[4] = b[i2+4]; s[5] = b[i2+5]; | |||
829 | while (nz--) { | |||
830 | idx = 6*(*vi++); | |||
831 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
832 | xw[3] = x[3+idx]; xw[4] = x[4+idx]; xw[5] = x[5+idx]; | |||
833 | PetscKernel_v_gets_v_minus_A_times_w_6(s,v,xw)do { s[0] -= v[0]*xw[0] + v[6] *xw[1] + v[12]*xw[2] + v[18]*xw [3] + v[24]*xw[4] + v[30]*xw[5]; s[1] -= v[1]*xw[0] + v[7] *xw [1] + v[13]*xw[2] + v[19]*xw[3] + v[25]*xw[4] + v[31]*xw[5]; s [2] -= v[2]*xw[0] + v[8] *xw[1] + v[14]*xw[2] + v[20]*xw[3] + v[26]*xw[4] + v[32]*xw[5]; s[3] -= v[3]*xw[0] + v[9] *xw[1] + v[15]*xw[2] + v[21]*xw[3] + v[27]*xw[4] + v[33]*xw[5]; s[4] -= v[4]*xw[0] + v[10]*xw[1] + v[16]*xw[2] + v[22]*xw[3] + v[28] *xw[4] + v[34]*xw[5]; s[5] -= v[5]*xw[0] + v[11]*xw[1] + v[17 ]*xw[2] + v[23]*xw[3] + v[29]*xw[4] + v[35]*xw[5]; } while (0 ); | |||
834 | v += 36; | |||
835 | } | |||
836 | PetscKernel_v_gets_A_times_w_6(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[6] *s[1] + idiag[12]*s[2] + idiag[18]*s[3] + idiag[24]*s[4] + idiag[30]*s[5]; xw[1] = idiag [1]*s[0] + idiag[7] *s[1] + idiag[13]*s[2] + idiag[19]*s[3] + idiag[25]*s[4] + idiag[31]*s[5]; xw[2] = idiag[2]*s[0] + idiag [8] *s[1] + idiag[14]*s[2] + idiag[20]*s[3] + idiag[26]*s[4] + idiag[32]*s[5]; xw[3] = idiag[3]*s[0] + idiag[9] *s[1] + idiag [15]*s[2] + idiag[21]*s[3] + idiag[27]*s[4] + idiag[33]*s[5]; xw[4] = idiag[4]*s[0] + idiag[10]*s[1] + idiag[16]*s[2] + idiag [22]*s[3] + idiag[28]*s[4] + idiag[34]*s[5]; xw[5] = idiag[5] *s[0] + idiag[11]*s[1] + idiag[17]*s[2] + idiag[23]*s[3] + idiag [29]*s[4] + idiag[35]*s[5]; } while (0); | |||
837 | x[i2] += xw[0]; x[i2+1] += xw[1]; x[i2+2] += xw[2]; | |||
838 | x[i2+3] += xw[3]; x[i2+4] += xw[4]; x[i2+5] += xw[5]; | |||
839 | idiag -= 36; | |||
840 | i2 -= 6; | |||
841 | } | |||
842 | break; | |||
843 | case 7: | |||
844 | for (i=m-1; i>=0; i--) { | |||
845 | v = aa + 49*ai[i]; | |||
846 | vi = aj + ai[i]; | |||
847 | nz = ai[i+1] - ai[i]; | |||
848 | s[0] = b[i2]; s[1] = b[i2+1]; s[2] = b[i2+2]; | |||
849 | s[3] = b[i2+3]; s[4] = b[i2+4]; s[5] = b[i2+5]; s[6] = b[i2+6]; | |||
850 | while (nz--) { | |||
851 | idx = 7*(*vi++); | |||
852 | xw[0] = x[idx]; xw[1] = x[1+idx]; xw[2] = x[2+idx]; | |||
853 | xw[3] = x[3+idx]; xw[4] = x[4+idx]; xw[5] = x[5+idx]; xw[6] = x[6+idx]; | |||
854 | PetscKernel_v_gets_v_minus_A_times_w_7(s,v,xw)do { s[0] -= v[0]*xw[0] + v[7] *xw[1] + v[14]*xw[2] + v[21]*xw [3] + v[28]*xw[4] + v[35]*xw[5] + v[42]*xw[6]; s[1] -= v[1]*xw [0] + v[8] *xw[1] + v[15]*xw[2] + v[22]*xw[3] + v[29]*xw[4] + v[36]*xw[5] + v[43]*xw[6]; s[2] -= v[2]*xw[0] + v[9] *xw[1] + v[16]*xw[2] + v[23]*xw[3] + v[30]*xw[4] + v[37]*xw[5] + v[44 ]*xw[6]; s[3] -= v[3]*xw[0] + v[10]*xw[1] + v[17]*xw[2] + v[24 ]*xw[3] + v[31]*xw[4] + v[38]*xw[5] + v[45]*xw[6]; s[4] -= v[ 4]*xw[0] + v[11]*xw[1] + v[18]*xw[2] + v[25]*xw[3] + v[32]*xw [4] + v[39]*xw[5] + v[46]*xw[6]; s[5] -= v[5]*xw[0] + v[12]*xw [1] + v[19]*xw[2] + v[26]*xw[3] + v[33]*xw[4] + v[40]*xw[5] + v[47]*xw[6]; s[6] -= v[6]*xw[0] + v[13]*xw[1] + v[20]*xw[2] + v[27]*xw[3] + v[34]*xw[4] + v[41]*xw[5] + v[48]*xw[6]; } while (0); | |||
855 | v += 49; | |||
856 | } | |||
857 | PetscKernel_v_gets_A_times_w_7(xw,idiag,s)do { xw[0] = idiag[0]*s[0] + idiag[7] *s[1] + idiag[14]*s[2] + idiag[21]*s[3] + idiag[28]*s[4] + idiag[35]*s[5] + idiag[42] *s[6]; xw[1] = idiag[1]*s[0] + idiag[8] *s[1] + idiag[15]*s[2 ] + idiag[22]*s[3] + idiag[29]*s[4] + idiag[36]*s[5] + idiag[ 43]*s[6]; xw[2] = idiag[2]*s[0] + idiag[9] *s[1] + idiag[16]* s[2] + idiag[23]*s[3] + idiag[30]*s[4] + idiag[37]*s[5] + idiag [44]*s[6]; xw[3] = idiag[3]*s[0] + idiag[10]*s[1] + idiag[17] *s[2] + idiag[24]*s[3] + idiag[31]*s[4] + idiag[38]*s[5] + idiag [45]*s[6]; xw[4] = idiag[4]*s[0] + idiag[11]*s[1] + idiag[18] *s[2] + idiag[25]*s[3] + idiag[32]*s[4] + idiag[39]*s[5] + idiag [46]*s[6]; xw[5] = idiag[5]*s[0] + idiag[12]*s[1] + idiag[19] *s[2] + idiag[26]*s[3] + idiag[33]*s[4] + idiag[40]*s[5] + idiag [47]*s[6]; xw[6] = idiag[6]*s[0] + idiag[13]*s[1] + idiag[20] *s[2] + idiag[27]*s[3] + idiag[34]*s[4] + idiag[41]*s[5] + idiag [48]*s[6]; } while (0); | |||
858 | x[i2] += xw[0]; x[i2+1] += xw[1]; x[i2+2] += xw[2]; | |||
859 | x[i2+3] += xw[3]; x[i2+4] += xw[4]; x[i2+5] += xw[5]; x[i2+6] += xw[6]; | |||
860 | idiag -= 49; | |||
861 | i2 -= 7; | |||
862 | } | |||
863 | break; | |||
864 | default: | |||
865 | for (i=m-1; i>=0; i--) { | |||
866 | v = aa + bs2*ai[i]; | |||
867 | vi = aj + ai[i]; | |||
868 | nz = ai[i+1] - ai[i]; | |||
869 | ||||
870 | ierr = PetscArraycpy(w,b+i2,bs)((sizeof(*(w)) != sizeof(*(b+i2))) || PetscMemcpy(w,b+i2,(bs) *sizeof(*(w))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),870,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
871 | /* copy all rows of x that are needed into contiguous space */ | |||
872 | workt = work; | |||
873 | for (j=0; j<nz; j++) { | |||
874 | ierr = PetscArraycpy(workt,x + bs*(*vi++),bs)((sizeof(*(workt)) != sizeof(*(x + bs*(*vi++)))) || PetscMemcpy (workt,x + bs*(*vi++),(bs)*sizeof(*(workt))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),874,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
875 | workt += bs; | |||
876 | } | |||
877 | PetscKernel_w_gets_w_minus_Ar_times_v(bs,bs*nz,w,v,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),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast (bs*nz,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return PetscError(((MPI_Comm)0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 877; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); dgemv_("N",&(_bbs),&(_bncols),&_mone,v,&(_bbs ),work,&_ione,&_one,w,&_ione); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); }; | |||
878 | PetscKernel_w_gets_w_plus_Ar_times_v(bs,bs,w,idiag,x+i2){ PetscScalar _one = 1.0; PetscBLASInt _ione = 1,_bbs,_bncols ; PetscErrorCode _ierr; _ierr = PetscBLASIntCast(bs,&_bbs );do {if (__builtin_expect(!!(_ierr),0)) return PetscError((( MPI_Comm)0x44000001),878,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_ierr,PETSC_ERROR_REPEAT," ");} while (0); _ierr = PetscBLASIntCast (bs,&_bncols);do {if (__builtin_expect(!!(_ierr),0)) return PetscError(((MPI_Comm)0x44000001),878,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 878; 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,&_one,x+i2,&_ione); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(878,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),878,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); }; | |||
879 | ||||
880 | idiag -= bs2; | |||
881 | i2 -= bs; | |||
882 | } | |||
883 | break; | |||
884 | } | |||
885 | ierr = PetscLogFlops(2.0*bs2*(a->nz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),885,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
886 | } | |||
887 | } | |||
888 | ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),888,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
889 | ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),889,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
890 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
891 | } | |||
892 | ||||
893 | ||||
894 | /* | |||
895 | Special version for direct calls from Fortran (Used in PETSc-fun3d) | |||
896 | */ | |||
897 | #if defined(PETSC_HAVE_FORTRAN_CAPS) | |||
898 | #define matsetvaluesblocked4_ MATSETVALUESBLOCKED4 | |||
899 | #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE1) | |||
900 | #define matsetvaluesblocked4_ matsetvaluesblocked4 | |||
901 | #endif | |||
902 | ||||
903 | PETSC_EXTERNextern __attribute__((visibility ("default"))) void matsetvaluesblocked4_(Mat *AA,PetscInt *mm,const PetscInt im[],PetscInt *nn,const PetscInt in[],const PetscScalar v[]) | |||
904 | { | |||
905 | Mat A = *AA; | |||
906 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
907 | PetscInt *rp,k,low,high,t,ii,jj,row,nrow,i,col,l,N,m = *mm,n = *nn; | |||
908 | PetscInt *ai =a->i,*ailen=a->ilen; | |||
909 | PetscInt *aj =a->j,stepval,lastcol = -1; | |||
910 | const PetscScalar *value = v; | |||
911 | MatScalar *ap,*aa = a->a,*bap; | |||
912 | PetscErrorCode ierr; | |||
913 | ||||
914 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 914; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
915 | if (A->rmap->bs != 4) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_WRONG,"Can only be called with a block size of 4")do {PetscError(PetscObjectComm((PetscObject)A),915,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"Can only be called with a block size of 4" );MPI_Abort(PetscObjectComm((PetscObject)A),62);} while (0); | |||
916 | stepval = (n-1)*4; | |||
917 | for (k=0; k<m; k++) { /* loop over added rows */ | |||
918 | row = im[k]; | |||
919 | rp = aj + ai[row]; | |||
920 | ap = aa + 16*ai[row]; | |||
921 | nrow = ailen[row]; | |||
922 | low = 0; | |||
923 | high = nrow; | |||
924 | for (l=0; l<n; l++) { /* loop over added columns */ | |||
925 | col = in[l]; | |||
926 | if (col <= lastcol) low = 0; | |||
927 | else high = nrow; | |||
928 | lastcol = col; | |||
929 | value = v + k*(stepval+4 + l)*4; | |||
930 | while (high-low > 7) { | |||
931 | t = (low+high)/2; | |||
932 | if (rp[t] > col) high = t; | |||
933 | else low = t; | |||
934 | } | |||
935 | for (i=low; i<high; i++) { | |||
936 | if (rp[i] > col) break; | |||
937 | if (rp[i] == col) { | |||
938 | bap = ap + 16*i; | |||
939 | for (ii=0; ii<4; ii++,value+=stepval) { | |||
940 | for (jj=ii; jj<16; jj+=4) { | |||
941 | bap[jj] += *value++; | |||
942 | } | |||
943 | } | |||
944 | goto noinsert2; | |||
945 | } | |||
946 | } | |||
947 | N = nrow++ - 1; | |||
948 | high++; /* added new column index thus must search to one higher than before */ | |||
949 | /* shift up all the later entries in this row */ | |||
950 | for (ii=N; ii>=i; ii--) { | |||
951 | rp[ii+1] = rp[ii]; | |||
952 | ierr = PetscArraycpy(ap+16*(ii+1),ap+16*(ii),16)((sizeof(*(ap+16*(ii+1))) != sizeof(*(ap+16*(ii)))) || PetscMemcpy (ap+16*(ii+1),ap+16*(ii),(16)*sizeof(*(ap+16*(ii+1)))));;CHKERRV(ierr)do {if (__builtin_expect(!!(ierr),0)) {ierr = PetscError(((MPI_Comm )0x44000001),952,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");return;}} while(0); | |||
953 | } | |||
954 | if (N >= i) { | |||
955 | ierr = PetscArrayzero(ap+16*i,16)PetscMemzero(ap+16*i,(16)*sizeof(*(ap+16*i)));;CHKERRV(ierr)do {if (__builtin_expect(!!(ierr),0)) {ierr = PetscError(((MPI_Comm )0x44000001),955,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");return;}} while(0); | |||
956 | } | |||
957 | rp[i] = col; | |||
958 | bap = ap + 16*i; | |||
959 | for (ii=0; ii<4; ii++,value+=stepval) { | |||
960 | for (jj=ii; jj<16; jj+=4) { | |||
961 | bap[jj] = *value++; | |||
962 | } | |||
963 | } | |||
964 | noinsert2:; | |||
965 | low = i; | |||
966 | } | |||
967 | ailen[row] = nrow; | |||
968 | } | |||
969 | PetscFunctionReturnVoid()do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return;} while (0); | |||
970 | } | |||
971 | ||||
972 | #if defined(PETSC_HAVE_FORTRAN_CAPS) | |||
973 | #define matsetvalues4_ MATSETVALUES4 | |||
974 | #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE1) | |||
975 | #define matsetvalues4_ matsetvalues4 | |||
976 | #endif | |||
977 | ||||
978 | PETSC_EXTERNextern __attribute__((visibility ("default"))) void matsetvalues4_(Mat *AA,PetscInt *mm,PetscInt *im,PetscInt *nn,PetscInt *in,PetscScalar *v) | |||
979 | { | |||
980 | Mat A = *AA; | |||
981 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
982 | PetscInt *rp,k,low,high,t,row,nrow,i,col,l,N,n = *nn,m = *mm; | |||
983 | PetscInt *ai=a->i,*ailen=a->ilen; | |||
984 | PetscInt *aj=a->j,brow,bcol; | |||
985 | PetscInt ridx,cidx,lastcol = -1; | |||
986 | MatScalar *ap,value,*aa=a->a,*bap; | |||
987 | PetscErrorCode ierr; | |||
988 | ||||
989 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 989; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
990 | for (k=0; k<m; k++) { /* loop over added rows */ | |||
991 | row = im[k]; brow = row/4; | |||
992 | rp = aj + ai[brow]; | |||
993 | ap = aa + 16*ai[brow]; | |||
994 | nrow = ailen[brow]; | |||
995 | low = 0; | |||
996 | high = nrow; | |||
997 | for (l=0; l<n; l++) { /* loop over added columns */ | |||
998 | col = in[l]; bcol = col/4; | |||
999 | ridx = row % 4; cidx = col % 4; | |||
1000 | value = v[l + k*n]; | |||
1001 | if (col <= lastcol) low = 0; | |||
1002 | else high = nrow; | |||
1003 | lastcol = col; | |||
1004 | while (high-low > 7) { | |||
1005 | t = (low+high)/2; | |||
1006 | if (rp[t] > bcol) high = t; | |||
1007 | else low = t; | |||
1008 | } | |||
1009 | for (i=low; i<high; i++) { | |||
1010 | if (rp[i] > bcol) break; | |||
1011 | if (rp[i] == bcol) { | |||
1012 | bap = ap + 16*i + 4*cidx + ridx; | |||
1013 | *bap += value; | |||
1014 | goto noinsert1; | |||
1015 | } | |||
1016 | } | |||
1017 | N = nrow++ - 1; | |||
1018 | high++; /* added new column thus must search to one higher than before */ | |||
1019 | /* shift up all the later entries in this row */ | |||
1020 | ierr = PetscArraymove(rp+i+1,rp+i,N-i+1)((sizeof(*(rp+i+1)) != sizeof(*(rp+i))) || PetscMemmove(rp+i+ 1,rp+i,(N-i+1)*sizeof(*(rp+i+1))));;CHKERRV(ierr)do {if (__builtin_expect(!!(ierr),0)) {ierr = PetscError(((MPI_Comm )0x44000001),1020,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");return;}} while(0); | |||
1021 | ierr = PetscArraymove(ap+16*i+16,ap+16*i,16*(N-i+1))((sizeof(*(ap+16*i+16)) != sizeof(*(ap+16*i))) || PetscMemmove (ap+16*i+16,ap+16*i,(16*(N-i+1))*sizeof(*(ap+16*i+16))));;CHKERRV(ierr)do {if (__builtin_expect(!!(ierr),0)) {ierr = PetscError(((MPI_Comm )0x44000001),1021,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");return;}} while(0); | |||
1022 | ierr = PetscArrayzero(ap+16*i,16)PetscMemzero(ap+16*i,(16)*sizeof(*(ap+16*i)));;CHKERRV(ierr)do {if (__builtin_expect(!!(ierr),0)) {ierr = PetscError(((MPI_Comm )0x44000001),1022,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");return;}} while(0); | |||
1023 | rp[i] = bcol; | |||
1024 | ap[16*i + 4*cidx + ridx] = value; | |||
1025 | noinsert1:; | |||
1026 | low = i; | |||
1027 | } | |||
1028 | ailen[brow] = nrow; | |||
1029 | } | |||
1030 | PetscFunctionReturnVoid()do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return;} while (0); | |||
1031 | } | |||
1032 | ||||
1033 | /* | |||
1034 | Checks for missing diagonals | |||
1035 | */ | |||
1036 | PetscErrorCode MatMissingDiagonal_SeqBAIJ(Mat A,PetscBool *missing,PetscInt *d) | |||
1037 | { | |||
1038 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1039 | PetscErrorCode ierr; | |||
1040 | PetscInt *diag,*ii = a->i,i; | |||
1041 | ||||
1042 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1042; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1043 | ierr = MatMarkDiagonal_SeqBAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1043,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1044 | *missing = PETSC_FALSE; | |||
1045 | if (A->rmap->n > 0 && !ii) { | |||
1046 | *missing = PETSC_TRUE; | |||
1047 | if (d) *d = 0; | |||
1048 | ierr = PetscInfo(A,"Matrix has no entries therefore is missing diagonal\n")PetscInfo_Private(__func__,A,"Matrix has no entries therefore is missing diagonal\n" );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1049 | } else { | |||
1050 | diag = a->diag; | |||
1051 | for (i=0; i<a->mbs; i++) { | |||
1052 | if (diag[i] >= ii[i+1]) { | |||
1053 | *missing = PETSC_TRUE; | |||
1054 | if (d) *d = i; | |||
1055 | ierr = PetscInfo1(A,"Matrix is missing block diagonal number %D\n",i)PetscInfo_Private(__func__,A,"Matrix is missing block diagonal number %D\n" ,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1055,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1056 | break; | |||
1057 | } | |||
1058 | } | |||
1059 | } | |||
1060 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1061 | } | |||
1062 | ||||
1063 | PetscErrorCode MatMarkDiagonal_SeqBAIJ(Mat A) | |||
1064 | { | |||
1065 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1066 | PetscErrorCode ierr; | |||
1067 | PetscInt i,j,m = a->mbs; | |||
1068 | ||||
1069 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1069; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1070 | if (!a->diag) { | |||
1071 | ierr = PetscMalloc1(m,&a->diag)PetscMallocA(1,PETSC_FALSE,1071,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(m)*sizeof(**(&a->diag)),(&a->diag));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1071,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1072 | ierr = PetscLogObjectMemory((PetscObject)A,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1072,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1073 | a->free_diag = PETSC_TRUE; | |||
1074 | } | |||
1075 | for (i=0; i<m; i++) { | |||
1076 | a->diag[i] = a->i[i+1]; | |||
1077 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1078 | if (a->j[j] == i) { | |||
1079 | a->diag[i] = j; | |||
1080 | break; | |||
1081 | } | |||
1082 | } | |||
1083 | } | |||
1084 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1085 | } | |||
1086 | ||||
1087 | ||||
1088 | static PetscErrorCode MatGetRowIJ_SeqBAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool blockcompressed,PetscInt *nn,const PetscInt *inia[],const PetscInt *inja[],PetscBool *done) | |||
1089 | { | |||
1090 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1091 | PetscErrorCode ierr; | |||
1092 | PetscInt i,j,n = a->mbs,nz = a->i[n],*tia,*tja,bs = A->rmap->bs,k,l,cnt; | |||
1093 | PetscInt **ia = (PetscInt**)inia,**ja = (PetscInt**)inja; | |||
1094 | ||||
1095 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1095; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1096 | *nn = n; | |||
1097 | if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1098 | if (symmetric) { | |||
1099 | ierr = MatToSymmetricIJ_SeqAIJ(n,a->i,a->j,PETSC_TRUE,0,0,&tia,&tja);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1099,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1100 | nz = tia[n]; | |||
1101 | } else { | |||
1102 | tia = a->i; tja = a->j; | |||
1103 | } | |||
1104 | ||||
1105 | if (!blockcompressed && bs > 1) { | |||
1106 | (*nn) *= bs; | |||
1107 | /* malloc & create the natural set of indices */ | |||
1108 | ierr = PetscMalloc1((n+1)*bs,ia)PetscMallocA(1,PETSC_FALSE,1108,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)((n+1)*bs)*sizeof(**(ia)),(ia));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1108,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1109 | if (n) { | |||
1110 | (*ia)[0] = oshift; | |||
1111 | for (j=1; j<bs; j++) { | |||
1112 | (*ia)[j] = (tia[1]-tia[0])*bs+(*ia)[j-1]; | |||
1113 | } | |||
1114 | } | |||
1115 | ||||
1116 | for (i=1; i<n; i++) { | |||
1117 | (*ia)[i*bs] = (tia[i]-tia[i-1])*bs + (*ia)[i*bs-1]; | |||
1118 | for (j=1; j<bs; j++) { | |||
1119 | (*ia)[i*bs+j] = (tia[i+1]-tia[i])*bs + (*ia)[i*bs+j-1]; | |||
1120 | } | |||
1121 | } | |||
1122 | if (n) { | |||
1123 | (*ia)[n*bs] = (tia[n]-tia[n-1])*bs + (*ia)[n*bs-1]; | |||
1124 | } | |||
1125 | ||||
1126 | if (inja) { | |||
1127 | ierr = PetscMalloc1(nz*bs*bs,ja)PetscMallocA(1,PETSC_FALSE,1127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(nz*bs*bs)*sizeof(**(ja)),(ja));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1128 | cnt = 0; | |||
1129 | for (i=0; i<n; i++) { | |||
1130 | for (j=0; j<bs; j++) { | |||
1131 | for (k=tia[i]; k<tia[i+1]; k++) { | |||
1132 | for (l=0; l<bs; l++) { | |||
1133 | (*ja)[cnt++] = bs*tja[k] + l; | |||
1134 | } | |||
1135 | } | |||
1136 | } | |||
1137 | } | |||
1138 | } | |||
1139 | ||||
1140 | if (symmetric) { /* deallocate memory allocated in MatToSymmetricIJ_SeqAIJ() */ | |||
1141 | ierr = PetscFree(tia)((*PetscTrFree)((void*)(tia),1141,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((tia) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1141,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1142 | ierr = PetscFree(tja)((*PetscTrFree)((void*)(tja),1142,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((tja) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1142,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1143 | } | |||
1144 | } else if (oshift == 1) { | |||
1145 | if (symmetric) { | |||
1146 | nz = tia[A->rmap->n/bs]; | |||
1147 | /* add 1 to i and j indices */ | |||
1148 | for (i=0; i<A->rmap->n/bs+1; i++) tia[i] = tia[i] + 1; | |||
1149 | *ia = tia; | |||
1150 | if (ja) { | |||
1151 | for (i=0; i<nz; i++) tja[i] = tja[i] + 1; | |||
1152 | *ja = tja; | |||
1153 | } | |||
1154 | } else { | |||
1155 | nz = a->i[A->rmap->n/bs]; | |||
1156 | /* malloc space and add 1 to i and j indices */ | |||
1157 | ierr = PetscMalloc1(A->rmap->n/bs+1,ia)PetscMallocA(1,PETSC_FALSE,1157,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(A->rmap->n/bs+1)*sizeof(**(ia)),(ia));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1157,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1158 | for (i=0; i<A->rmap->n/bs+1; i++) (*ia)[i] = a->i[i] + 1; | |||
1159 | if (ja) { | |||
1160 | ierr = PetscMalloc1(nz,ja)PetscMallocA(1,PETSC_FALSE,1160,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(nz)*sizeof(**(ja)),(ja));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1160,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1161 | for (i=0; i<nz; i++) (*ja)[i] = a->j[i] + 1; | |||
1162 | } | |||
1163 | } | |||
1164 | } else { | |||
1165 | *ia = tia; | |||
1166 | if (ja) *ja = tja; | |||
1167 | } | |||
1168 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1169 | } | |||
1170 | ||||
1171 | static PetscErrorCode MatRestoreRowIJ_SeqBAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool blockcompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done) | |||
1172 | { | |||
1173 | PetscErrorCode ierr; | |||
1174 | ||||
1175 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1175; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1176 | if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1177 | if ((!blockcompressed && A->rmap->bs > 1) || (symmetric || oshift == 1)) { | |||
1178 | ierr = PetscFree(*ia)((*PetscTrFree)((void*)(*ia),1178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((*ia) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1179 | if (ja) {ierr = PetscFree(*ja)((*PetscTrFree)((void*)(*ja),1179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((*ja) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1180 | } | |||
1181 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1182 | } | |||
1183 | ||||
1184 | PetscErrorCode MatDestroy_SeqBAIJ(Mat A) | |||
1185 | { | |||
1186 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1187 | PetscErrorCode ierr; | |||
1188 | ||||
1189 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1189; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1190 | #if defined(PETSC_USE_LOG1) | |||
1191 | PetscLogObjectState((PetscObject)A,"Rows=%D, Cols=%D, NZ=%D",A->rmap->N,A->cmap->n,a->nz); | |||
1192 | #endif | |||
1193 | ierr = MatSeqXAIJFreeAIJ(A,&a->a,&a->j,&a->i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1194 | ierr = ISDestroy(&a->row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1194,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1195 | ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1195,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1196 | if (a->free_diag) {ierr = PetscFree(a->diag)((*PetscTrFree)((void*)(a->diag),1196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((a->diag) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1197 | ierr = PetscFree(a->idiag)((*PetscTrFree)((void*)(a->idiag),1197,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((a->idiag) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1197,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1198 | if (a->free_imax_ilen) {ierr = PetscFree2(a->imax,a->ilen)PetscFreeA(2,1198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,&(a->imax),&(a->ilen));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1199 | ierr = PetscFree(a->solve_work)((*PetscTrFree)((void*)(a->solve_work),1199,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((a->solve_work) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1199,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1200 | ierr = PetscFree(a->mult_work)((*PetscTrFree)((void*)(a->mult_work),1200,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((a->mult_work) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1200,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1201 | ierr = PetscFree(a->sor_workt)((*PetscTrFree)((void*)(a->sor_workt),1201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((a->sor_workt) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1202 | ierr = PetscFree(a->sor_work)((*PetscTrFree)((void*)(a->sor_work),1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((a->sor_work) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1203 | ierr = ISDestroy(&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1204 | ierr = PetscFree(a->saved_values)((*PetscTrFree)((void*)(a->saved_values),1204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((a->saved_values) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1205 | ierr = PetscFree2(a->compressedrow.i,a->compressedrow.rindex)PetscFreeA(2,1205,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,&(a->compressedrow.i),&(a->compressedrow.rindex ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1205,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1206 | ||||
1207 | ierr = MatDestroy(&a->sbaijMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1207,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1208 | ierr = MatDestroy(&a->parent);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1209 | ierr = PetscFree(A->data)((*PetscTrFree)((void*)(A->data),1209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((A->data) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1210 | ||||
1211 | ierr = PetscObjectChangeTypeName((PetscObject)A,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1212 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatInvertBlockDiagonal_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatInvertBlockDiagonal_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1212,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1213 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatStoreValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatStoreValues_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1214 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatRetrieveValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatRetrieveValues_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1214,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1215 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatSeqBAIJSetColumnIndices_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatSeqBAIJSetColumnIndices_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1216 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqbaij_seqaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqbaij_seqaij_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1217 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqbaij_seqsbaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqbaij_seqsbaij_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1217,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1218 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatSeqBAIJSetPreallocation_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatSeqBAIJSetPreallocation_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1219 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatSeqBAIJSetPreallocationCSR_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatSeqBAIJSetPreallocationCSR_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1219,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1220 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqbaij_seqbstrm_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqbaij_seqbstrm_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1220,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1221 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatIsTranspose_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatIsTranspose_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1222 | #if defined(PETSC_HAVE_HYPRE) | |||
1223 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqbaij_hypre_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqbaij_hypre_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1224 | #endif | |||
1225 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqbaij_is_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqbaij_is_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1225,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1226 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatPtAP_is_seqaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatPtAP_is_seqaij_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1227 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1228 | } | |||
1229 | ||||
1230 | PetscErrorCode MatSetOption_SeqBAIJ(Mat A,MatOption op,PetscBool flg) | |||
1231 | { | |||
1232 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1233 | PetscErrorCode ierr; | |||
1234 | ||||
1235 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1235; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1236 | switch (op) { | |||
1237 | case MAT_ROW_ORIENTED: | |||
1238 | a->roworiented = flg; | |||
1239 | break; | |||
1240 | case MAT_KEEP_NONZERO_PATTERN: | |||
1241 | a->keepnonzeropattern = flg; | |||
1242 | break; | |||
1243 | case MAT_NEW_NONZERO_LOCATIONS: | |||
1244 | a->nonew = (flg ? 0 : 1); | |||
1245 | break; | |||
1246 | case MAT_NEW_NONZERO_LOCATION_ERR: | |||
1247 | a->nonew = (flg ? -1 : 0); | |||
1248 | break; | |||
1249 | case MAT_NEW_NONZERO_ALLOCATION_ERR: | |||
1250 | a->nonew = (flg ? -2 : 0); | |||
1251 | break; | |||
1252 | case MAT_UNUSED_NONZERO_LOCATION_ERR: | |||
1253 | a->nounused = (flg ? -1 : 0); | |||
1254 | break; | |||
1255 | case MAT_NEW_DIAGONALS: | |||
1256 | case MAT_IGNORE_OFF_PROC_ENTRIES: | |||
1257 | case MAT_USE_HASH_TABLE: | |||
1258 | case MAT_SORTED_FULL: | |||
1259 | ierr = PetscInfo1(A,"Option %s ignored\n",MatOptions[op])PetscInfo_Private(__func__,A,"Option %s ignored\n",MatOptions [op]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1259,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1260 | break; | |||
1261 | case MAT_SPD: | |||
1262 | case MAT_SYMMETRIC: | |||
1263 | case MAT_STRUCTURALLY_SYMMETRIC: | |||
1264 | case MAT_HERMITIAN: | |||
1265 | case MAT_SYMMETRY_ETERNAL: | |||
1266 | case MAT_SUBMAT_SINGLEIS: | |||
1267 | case MAT_STRUCTURE_ONLY: | |||
1268 | /* These options are handled directly by MatSetOption() */ | |||
1269 | break; | |||
1270 | default: | |||
1271 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unknown option %d",op)return PetscError(((MPI_Comm)0x44000001),1271,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"unknown option %d",op); | |||
1272 | } | |||
1273 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1274 | } | |||
1275 | ||||
1276 | /* used for both SeqBAIJ and SeqSBAIJ matrices */ | |||
1277 | PetscErrorCode MatGetRow_SeqBAIJ_private(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v,PetscInt *ai,PetscInt *aj,PetscScalar *aa) | |||
1278 | { | |||
1279 | PetscErrorCode ierr; | |||
1280 | PetscInt itmp,i,j,k,M,bn,bp,*idx_i,bs,bs2; | |||
1281 | MatScalar *aa_i; | |||
1282 | PetscScalar *v_i; | |||
1283 | ||||
1284 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1284; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1285 | bs = A->rmap->bs; | |||
1286 | bs2 = bs*bs; | |||
1287 | 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),1287,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Row %D out of range",row); | |||
1288 | ||||
1289 | bn = row/bs; /* Block number */ | |||
1290 | bp = row % bs; /* Block Position */ | |||
1291 | M = ai[bn+1] - ai[bn]; | |||
1292 | *nz = bs*M; | |||
1293 | ||||
1294 | if (v) { | |||
1295 | *v = 0; | |||
1296 | if (*nz) { | |||
1297 | ierr = PetscMalloc1(*nz,v)PetscMallocA(1,PETSC_FALSE,1297,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(*nz)*sizeof(**(v)),(v));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1297,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1298 | for (i=0; i<M; i++) { /* for each block in the block row */ | |||
1299 | v_i = *v + i*bs; | |||
1300 | aa_i = aa + bs2*(ai[bn] + i); | |||
1301 | for (j=bp,k=0; j<bs2; j+=bs,k++) v_i[k] = aa_i[j]; | |||
1302 | } | |||
1303 | } | |||
1304 | } | |||
1305 | ||||
1306 | if (idx) { | |||
1307 | *idx = 0; | |||
1308 | if (*nz) { | |||
1309 | ierr = PetscMalloc1(*nz,idx)PetscMallocA(1,PETSC_FALSE,1309,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(*nz)*sizeof(**(idx)),(idx));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1309,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1310 | for (i=0; i<M; i++) { /* for each block in the block row */ | |||
1311 | idx_i = *idx + i*bs; | |||
1312 | itmp = bs*aj[ai[bn] + i]; | |||
1313 | for (j=0; j<bs; j++) idx_i[j] = itmp++; | |||
1314 | } | |||
1315 | } | |||
1316 | } | |||
1317 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1318 | } | |||
1319 | ||||
1320 | PetscErrorCode MatGetRow_SeqBAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v) | |||
1321 | { | |||
1322 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1323 | PetscErrorCode ierr; | |||
1324 | ||||
1325 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1325; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1326 | ierr = MatGetRow_SeqBAIJ_private(A,row,nz,idx,v,a->i,a->j,a->a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1326,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1327 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1328 | } | |||
1329 | ||||
1330 | PetscErrorCode MatRestoreRow_SeqBAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v) | |||
1331 | { | |||
1332 | PetscErrorCode ierr; | |||
1333 | ||||
1334 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1334; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1335 | if (idx) {ierr = PetscFree(*idx)((*PetscTrFree)((void*)(*idx),1335,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((*idx) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1335,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1336 | if (v) {ierr = PetscFree(*v)((*PetscTrFree)((void*)(*v),1336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((*v) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1337 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1338 | } | |||
1339 | ||||
1340 | PetscErrorCode MatTranspose_SeqBAIJ(Mat A,MatReuse reuse,Mat *B) | |||
1341 | { | |||
1342 | Mat_SeqBAIJ *a=(Mat_SeqBAIJ*)A->data,*at; | |||
1343 | Mat C; | |||
1344 | PetscErrorCode ierr; | |||
1345 | PetscInt i,j,k,*aj=a->j,*ai=a->i,bs=A->rmap->bs,mbs=a->mbs,nbs=a->nbs,*atfill; | |||
1346 | PetscInt bs2=a->bs2,*ati,*atj,anzj,kr; | |||
1347 | MatScalar *ata,*aa=a->a; | |||
1348 | ||||
1349 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1349; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1350 | ierr = PetscCalloc1(1+nbs,&atfill)PetscMallocA(1,PETSC_TRUE,1350,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(1+nbs)*sizeof(**(&atfill)),(&atfill));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1350,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1351 | if (reuse == MAT_INITIAL_MATRIX || reuse == MAT_INPLACE_MATRIX) { | |||
1352 | for (i=0; i<ai[mbs]; i++) atfill[aj[i]] += 1; /* count num of non-zeros in row aj[i] */ | |||
1353 | ||||
1354 | ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1354,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1355 | ierr = MatSetSizes(C,A->cmap->n,A->rmap->N,A->cmap->n,A->rmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1355,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1356 | ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1356,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1357 | ierr = MatSeqBAIJSetPreallocation(C,bs,0,atfill);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1357,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1358 | ||||
1359 | at = (Mat_SeqBAIJ*)C->data; | |||
1360 | ati = at->i; | |||
1361 | for (i=0; i<nbs; i++) at->ilen[i] = at->imax[i] = ati[i+1] - ati[i]; | |||
1362 | } else { | |||
1363 | C = *B; | |||
1364 | at = (Mat_SeqBAIJ*)C->data; | |||
1365 | ati = at->i; | |||
1366 | } | |||
1367 | ||||
1368 | atj = at->j; | |||
1369 | ata = at->a; | |||
1370 | ||||
1371 | /* Copy ati into atfill so we have locations of the next free space in atj */ | |||
1372 | ierr = PetscArraycpy(atfill,ati,nbs)((sizeof(*(atfill)) != sizeof(*(ati))) || PetscMemcpy(atfill, ati,(nbs)*sizeof(*(atfill))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1372,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1373 | ||||
1374 | /* Walk through A row-wise and mark nonzero entries of A^T. */ | |||
1375 | for (i=0; i<mbs; i++) { | |||
1376 | anzj = ai[i+1] - ai[i]; | |||
1377 | for (j=0; j<anzj; j++) { | |||
1378 | atj[atfill[*aj]] = i; | |||
1379 | for (kr=0; kr<bs; kr++) { | |||
1380 | for (k=0; k<bs; k++) { | |||
1381 | ata[bs2*atfill[*aj]+k*bs+kr] = *aa++; | |||
1382 | } | |||
1383 | } | |||
1384 | atfill[*aj++] += 1; | |||
1385 | } | |||
1386 | } | |||
1387 | ierr = MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1387,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1388 | ierr = MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1388,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1389 | ||||
1390 | /* Clean up temporary space and complete requests. */ | |||
1391 | ierr = PetscFree(atfill)((*PetscTrFree)((void*)(atfill),1391,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((atfill) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1391,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1392 | ||||
1393 | if (reuse == MAT_INITIAL_MATRIX || reuse == MAT_REUSE_MATRIX) { | |||
1394 | ierr = MatSetBlockSizes(C,PetscAbs(A->cmap->bs)(((A->cmap->bs) >= 0) ? (A->cmap->bs) : (-(A-> cmap->bs))),PetscAbs(A->rmap->bs)(((A->rmap->bs) >= 0) ? (A->rmap->bs) : (-(A-> rmap->bs))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1394,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1395 | *B = C; | |||
1396 | } else { | |||
1397 | ierr = MatHeaderMerge(A,&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1397,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1398 | } | |||
1399 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1400 | } | |||
1401 | ||||
1402 | PetscErrorCode MatIsTranspose_SeqBAIJ(Mat A,Mat B,PetscReal tol,PetscBool *f) | |||
1403 | { | |||
1404 | PetscErrorCode ierr; | |||
1405 | Mat Btrans; | |||
1406 | ||||
1407 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1407; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1408 | *f = PETSC_FALSE; | |||
1409 | ierr = MatTranspose_SeqBAIJ(A,MAT_INITIAL_MATRIX,&Btrans);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1409,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1410 | ierr = MatEqual_SeqBAIJ(B,Btrans,f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1410,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1411 | ierr = MatDestroy(&Btrans);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1411,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1412 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1413 | } | |||
1414 | ||||
1415 | static PetscErrorCode MatView_SeqBAIJ_Binary(Mat A,PetscViewer viewer) | |||
1416 | { | |||
1417 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1418 | PetscErrorCode ierr; | |||
1419 | PetscInt i,*col_lens,bs = A->rmap->bs,count,*jj,j,k,l,bs2=a->bs2; | |||
1420 | int fd; | |||
1421 | PetscScalar *aa; | |||
1422 | FILE *file; | |||
1423 | ||||
1424 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1424; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1425 | ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1425,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1426 | ierr = PetscMalloc1(4+A->rmap->N,&col_lens)PetscMallocA(1,PETSC_FALSE,1426,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(4+A->rmap->N)*sizeof(**(&col_lens)),(& col_lens));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1426,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1427 | col_lens[0] = MAT_FILE_CLASSID1211216; | |||
1428 | ||||
1429 | col_lens[1] = A->rmap->N; | |||
1430 | col_lens[2] = A->cmap->n; | |||
1431 | col_lens[3] = a->nz*bs2; | |||
1432 | ||||
1433 | /* store lengths of each row and write (including header) to file */ | |||
1434 | count = 0; | |||
1435 | for (i=0; i<a->mbs; i++) { | |||
1436 | for (j=0; j<bs; j++) { | |||
1437 | col_lens[4+count++] = bs*(a->i[i+1] - a->i[i]); | |||
1438 | } | |||
1439 | } | |||
1440 | ierr = PetscBinaryWrite(fd,col_lens,4+A->rmap->N,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1440,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1441 | ierr = PetscFree(col_lens)((*PetscTrFree)((void*)(col_lens),1441,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((col_lens) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1441,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1442 | ||||
1443 | /* store column indices (zero start index) */ | |||
1444 | ierr = PetscMalloc1((a->nz+1)*bs2,&jj)PetscMallocA(1,PETSC_FALSE,1444,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)((a->nz+1)*bs2)*sizeof(**(&jj)),(&jj));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1444,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1445 | count = 0; | |||
1446 | for (i=0; i<a->mbs; i++) { | |||
1447 | for (j=0; j<bs; j++) { | |||
1448 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
1449 | for (l=0; l<bs; l++) { | |||
1450 | jj[count++] = bs*a->j[k] + l; | |||
1451 | } | |||
1452 | } | |||
1453 | } | |||
1454 | } | |||
1455 | ierr = PetscBinaryWrite(fd,jj,bs2*a->nz,PETSC_INT,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1455,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1456 | ierr = PetscFree(jj)((*PetscTrFree)((void*)(jj),1456,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((jj) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1456,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1457 | ||||
1458 | /* store nonzero values */ | |||
1459 | ierr = PetscMalloc1((a->nz+1)*bs2,&aa)PetscMallocA(1,PETSC_FALSE,1459,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)((a->nz+1)*bs2)*sizeof(**(&aa)),(&aa));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1459,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1460 | count = 0; | |||
1461 | for (i=0; i<a->mbs; i++) { | |||
1462 | for (j=0; j<bs; j++) { | |||
1463 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
1464 | for (l=0; l<bs; l++) { | |||
1465 | aa[count++] = a->a[bs2*k + l*bs + j]; | |||
1466 | } | |||
1467 | } | |||
1468 | } | |||
1469 | } | |||
1470 | ierr = PetscBinaryWrite(fd,aa,bs2*a->nz,PETSC_SCALARPETSC_DOUBLE,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1471 | ierr = PetscFree(aa)((*PetscTrFree)((void*)(aa),1471,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((aa) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1471,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1472 | ||||
1473 | ierr = PetscViewerBinaryGetInfoPointer(viewer,&file);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1473,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1474 | if (file) { | |||
1475 | fprintf(file,"-matload_block_size %d\n",(int)A->rmap->bs); | |||
1476 | } | |||
1477 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1478 | } | |||
1479 | ||||
1480 | static PetscErrorCode MatView_SeqBAIJ_ASCII_structonly(Mat A,PetscViewer viewer) | |||
1481 | { | |||
1482 | PetscErrorCode ierr; | |||
1483 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1484 | PetscInt i,bs = A->rmap->bs,k; | |||
1485 | ||||
1486 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1486; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1487 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1488 | for (i=0; i<a->mbs; i++) { | |||
1489 | ierr = PetscViewerASCIIPrintf(viewer,"row %D-%D:",i*bs,i*bs+bs-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1489,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1490 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
1491 | ierr = PetscViewerASCIIPrintf(viewer," (%D-%D) ",bs*a->j[k],bs*a->j[k]+bs-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1492 | } | |||
1493 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1494 | } | |||
1495 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1495,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1496 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1497 | } | |||
1498 | ||||
1499 | static PetscErrorCode MatView_SeqBAIJ_ASCII(Mat A,PetscViewer viewer) | |||
1500 | { | |||
1501 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1502 | PetscErrorCode ierr; | |||
1503 | PetscInt i,j,bs = A->rmap->bs,k,l,bs2=a->bs2; | |||
1504 | PetscViewerFormat format; | |||
1505 | ||||
1506 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1506; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1507 | if (A->structure_only) { | |||
1508 | ierr = MatView_SeqBAIJ_ASCII_structonly(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1508,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1509 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1510 | } | |||
1511 | ||||
1512 | ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1512,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1513 | if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) { | |||
1514 | ierr = PetscViewerASCIIPrintf(viewer," block size is %D\n",bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1514,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1515 | } else if (format == PETSC_VIEWER_ASCII_MATLAB) { | |||
1516 | const char *matname; | |||
1517 | Mat aij; | |||
1518 | ierr = MatConvert(A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&aij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1518,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1519 | ierr = PetscObjectGetName((PetscObject)A,&matname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1519,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1520 | ierr = PetscObjectSetName((PetscObject)aij,matname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1520,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1521 | ierr = MatView(aij,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1521,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1522 | ierr = MatDestroy(&aij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1522,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1523 | } else if (format == PETSC_VIEWER_ASCII_FACTOR_INFO) { | |||
1524 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1525 | } else if (format == PETSC_VIEWER_ASCII_COMMON) { | |||
1526 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1526,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1527 | for (i=0; i<a->mbs; i++) { | |||
1528 | for (j=0; j<bs; j++) { | |||
1529 | ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i*bs+j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1529,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1530 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
1531 | for (l=0; l<bs; l++) { | |||
1532 | #if defined(PETSC_USE_COMPLEX) | |||
1533 | if (PetscImaginaryPart(a->a[bs2*k + l*bs + j])((PetscReal)0.) > 0.0 && PetscRealPart(a->a[bs2*k + l*bs + j])(a->a[bs2*k + l*bs + j]) != 0.0) { | |||
1534 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %gi) ",bs*a->j[k]+l, | |||
1535 | (double)PetscRealPart(a->a[bs2*k + l*bs + j])(a->a[bs2*k + l*bs + j]),(double)PetscImaginaryPart(a->a[bs2*k + l*bs + j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1535,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1536 | } else if (PetscImaginaryPart(a->a[bs2*k + l*bs + j])((PetscReal)0.) < 0.0 && PetscRealPart(a->a[bs2*k + l*bs + j])(a->a[bs2*k + l*bs + j]) != 0.0) { | |||
1537 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %gi) ",bs*a->j[k]+l, | |||
1538 | (double)PetscRealPart(a->a[bs2*k + l*bs + j])(a->a[bs2*k + l*bs + j]),-(double)PetscImaginaryPart(a->a[bs2*k + l*bs + j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1538,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1539 | } else if (PetscRealPart(a->a[bs2*k + l*bs + j])(a->a[bs2*k + l*bs + j]) != 0.0) { | |||
1540 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",bs*a->j[k]+l,(double)PetscRealPart(a->a[bs2*k + l*bs + j])(a->a[bs2*k + l*bs + j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1540,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1541 | } | |||
1542 | #else | |||
1543 | if (a->a[bs2*k + l*bs + j] != 0.0) { | |||
1544 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",bs*a->j[k]+l,(double)a->a[bs2*k + l*bs + j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1544,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1545 | } | |||
1546 | #endif | |||
1547 | } | |||
1548 | } | |||
1549 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1549,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1550 | } | |||
1551 | } | |||
1552 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1552,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1553 | } else { | |||
1554 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1554,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1555 | for (i=0; i<a->mbs; i++) { | |||
1556 | for (j=0; j<bs; j++) { | |||
1557 | ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i*bs+j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1557,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1558 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
1559 | for (l=0; l<bs; l++) { | |||
1560 | #if defined(PETSC_USE_COMPLEX) | |||
1561 | if (PetscImaginaryPart(a->a[bs2*k + l*bs + j])((PetscReal)0.) > 0.0) { | |||
1562 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i) ",bs*a->j[k]+l, | |||
1563 | (double)PetscRealPart(a->a[bs2*k + l*bs + j])(a->a[bs2*k + l*bs + j]),(double)PetscImaginaryPart(a->a[bs2*k + l*bs + j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1563,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1564 | } else if (PetscImaginaryPart(a->a[bs2*k + l*bs + j])((PetscReal)0.) < 0.0) { | |||
1565 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i) ",bs*a->j[k]+l, | |||
1566 | (double)PetscRealPart(a->a[bs2*k + l*bs + j])(a->a[bs2*k + l*bs + j]),-(double)PetscImaginaryPart(a->a[bs2*k + l*bs + j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1566,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1567 | } else { | |||
1568 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",bs*a->j[k]+l,(double)PetscRealPart(a->a[bs2*k + l*bs + j])(a->a[bs2*k + l*bs + j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1569 | } | |||
1570 | #else | |||
1571 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",bs*a->j[k]+l,(double)a->a[bs2*k + l*bs + j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1571,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1572 | #endif | |||
1573 | } | |||
1574 | } | |||
1575 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1575,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1576 | } | |||
1577 | } | |||
1578 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1578,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1579 | } | |||
1580 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1580,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1581 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1582 | } | |||
1583 | ||||
1584 | #include <petscdraw.h> | |||
1585 | static PetscErrorCode MatView_SeqBAIJ_Draw_Zoom(PetscDraw draw,void *Aa) | |||
1586 | { | |||
1587 | Mat A = (Mat) Aa; | |||
1588 | Mat_SeqBAIJ *a=(Mat_SeqBAIJ*)A->data; | |||
1589 | PetscErrorCode ierr; | |||
1590 | PetscInt row,i,j,k,l,mbs=a->mbs,color,bs=A->rmap->bs,bs2=a->bs2; | |||
1591 | PetscReal xl,yl,xr,yr,x_l,x_r,y_l,y_r; | |||
1592 | MatScalar *aa; | |||
1593 | PetscViewer viewer; | |||
1594 | PetscViewerFormat format; | |||
1595 | ||||
1596 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1596; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1597 | ierr = PetscObjectQuery((PetscObject)A,"Zoomviewer",(PetscObject*)&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1597,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1598 | ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1598,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1599 | ierr = PetscDrawGetCoordinates(draw,&xl,&yl,&xr,&yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1599,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1600 | ||||
1601 | /* loop over matrix elements drawing boxes */ | |||
1602 | ||||
1603 | if (format != PETSC_VIEWER_DRAW_CONTOUR) { | |||
1604 | ierr = PetscDrawCollectiveBegin(draw)0; do { PetscErrorCode _Petsc_ierr; jmp_buf _Petsc_jmpbuf; volatile PetscXIOErrorHandler _Petsc_xioerrhdl = ((void*)0); PetscBool _Petsc_isdrawx, _Petsc_xioerr, _Petsc_xioerr_local = PETSC_FALSE ; _Petsc_ierr = PetscObjectTypeCompare((PetscObject)(draw),"x" ,&_Petsc_isdrawx);do {if (__builtin_expect(!!(_Petsc_ierr ),0)) return PetscError(((MPI_Comm)0x44000001),1604,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_Petsc_isdrawx ) { _Petsc_ierr = PetscMemcpy(&_Petsc_jmpbuf,&PetscXIOErrorHandlerJumpBuf ,sizeof(_Petsc_jmpbuf));do {if (__builtin_expect(!!(_Petsc_ierr ),0)) return PetscError(((MPI_Comm)0x44000001),1604,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); _Petsc_xioerrhdl = PetscSetXIOErrorHandler(PetscXIOErrorHandlerJump); if (_setjmp (PetscXIOErrorHandlerJumpBuf)) {_Petsc_xioerr_local = PETSC_TRUE ; do {_Petsc_ierr = 0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler (_Petsc_xioerrhdl); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf ,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do { if (__builtin_expect(!!(_Petsc_ierr),0)) return PetscError((( MPI_Comm)0x44000001),1604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); _Petsc_ierr = ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)(draw)))),0) || MPI_Allreduce((&_Petsc_xioerr_local ),(&_Petsc_xioerr),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)) ,(PetscObjectComm((PetscObject)(draw)))));do {if (__builtin_expect (!!(_Petsc_ierr),0)) return PetscError(((MPI_Comm)0x44000001) ,1604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_Petsc_xioerr ) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect (!!(_Petsc_ierr),0)) return PetscError(((MPI_Comm)0x44000001) ,1604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } } } while(0);do {if (__builtin_expect (!!(_Petsc_ierr),0)) return PetscError(((MPI_Comm)0x44000001) ,1604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0);} } do {} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1605 | /* Blue for negative, Cyan for zero and Red for positive */ | |||
1606 | color = PETSC_DRAW_BLUE5; | |||
1607 | for (i=0,row=0; i<mbs; i++,row+=bs) { | |||
1608 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1609 | y_l = A->rmap->N - row - 1.0; y_r = y_l + 1.0; | |||
1610 | x_l = a->j[j]*bs; x_r = x_l + 1.0; | |||
1611 | aa = a->a + j*bs2; | |||
1612 | for (k=0; k<bs; k++) { | |||
1613 | for (l=0; l<bs; l++) { | |||
1614 | if (PetscRealPart(*aa++)(*aa++) >= 0.) continue; | |||
1615 | ierr = PetscDrawRectangle(draw,x_l+k,y_l-l,x_r+k,y_r-l,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1615,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1616 | } | |||
1617 | } | |||
1618 | } | |||
1619 | } | |||
1620 | color = PETSC_DRAW_CYAN4; | |||
1621 | for (i=0,row=0; i<mbs; i++,row+=bs) { | |||
1622 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1623 | y_l = A->rmap->N - row - 1.0; y_r = y_l + 1.0; | |||
1624 | x_l = a->j[j]*bs; x_r = x_l + 1.0; | |||
1625 | aa = a->a + j*bs2; | |||
1626 | for (k=0; k<bs; k++) { | |||
1627 | for (l=0; l<bs; l++) { | |||
1628 | if (PetscRealPart(*aa++)(*aa++) != 0.) continue; | |||
1629 | ierr = PetscDrawRectangle(draw,x_l+k,y_l-l,x_r+k,y_r-l,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1629,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1630 | } | |||
1631 | } | |||
1632 | } | |||
1633 | } | |||
1634 | color = PETSC_DRAW_RED2; | |||
1635 | for (i=0,row=0; i<mbs; i++,row+=bs) { | |||
1636 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1637 | y_l = A->rmap->N - row - 1.0; y_r = y_l + 1.0; | |||
1638 | x_l = a->j[j]*bs; x_r = x_l + 1.0; | |||
1639 | aa = a->a + j*bs2; | |||
1640 | for (k=0; k<bs; k++) { | |||
1641 | for (l=0; l<bs; l++) { | |||
1642 | if (PetscRealPart(*aa++)(*aa++) <= 0.) continue; | |||
1643 | ierr = PetscDrawRectangle(draw,x_l+k,y_l-l,x_r+k,y_r-l,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1644 | } | |||
1645 | } | |||
1646 | } | |||
1647 | } | |||
1648 | ierr = PetscDrawCollectiveEnd(draw)0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler(_Petsc_xioerrhdl ); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf ,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do { if (__builtin_expect(!!(_Petsc_ierr),0)) return PetscError((( MPI_Comm)0x44000001),1648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); _Petsc_ierr = ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)(draw)))),0) || MPI_Allreduce((&_Petsc_xioerr_local ),(&_Petsc_xioerr),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)) ,(PetscObjectComm((PetscObject)(draw)))));do {if (__builtin_expect (!!(_Petsc_ierr),0)) return PetscError(((MPI_Comm)0x44000001) ,1648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_Petsc_xioerr ) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect (!!(_Petsc_ierr),0)) return PetscError(((MPI_Comm)0x44000001) ,1648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } } } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1649 | } else { | |||
1650 | /* use contour shading to indicate magnitude of values */ | |||
1651 | /* first determine max of all nonzero values */ | |||
1652 | PetscReal minv = 0.0, maxv = 0.0; | |||
1653 | PetscDraw popup; | |||
1654 | ||||
1655 | for (i=0; i<a->nz*a->bs2; i++) { | |||
1656 | if (PetscAbsScalar(a->a[i]) > maxv) maxv = PetscAbsScalar(a->a[i]); | |||
1657 | } | |||
1658 | if (minv >= maxv) maxv = minv + PETSC_SMALL1.e-10; | |||
1659 | ierr = PetscDrawGetPopup(draw,&popup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1659,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1660 | ierr = PetscDrawScalePopup(popup,0.0,maxv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1660,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1661 | ||||
1662 | ierr = PetscDrawCollectiveBegin(draw)0; do { PetscErrorCode _Petsc_ierr; jmp_buf _Petsc_jmpbuf; volatile PetscXIOErrorHandler _Petsc_xioerrhdl = ((void*)0); PetscBool _Petsc_isdrawx, _Petsc_xioerr, _Petsc_xioerr_local = PETSC_FALSE ; _Petsc_ierr = PetscObjectTypeCompare((PetscObject)(draw),"x" ,&_Petsc_isdrawx);do {if (__builtin_expect(!!(_Petsc_ierr ),0)) return PetscError(((MPI_Comm)0x44000001),1662,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_Petsc_isdrawx ) { _Petsc_ierr = PetscMemcpy(&_Petsc_jmpbuf,&PetscXIOErrorHandlerJumpBuf ,sizeof(_Petsc_jmpbuf));do {if (__builtin_expect(!!(_Petsc_ierr ),0)) return PetscError(((MPI_Comm)0x44000001),1662,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); _Petsc_xioerrhdl = PetscSetXIOErrorHandler(PetscXIOErrorHandlerJump); if (_setjmp (PetscXIOErrorHandlerJumpBuf)) {_Petsc_xioerr_local = PETSC_TRUE ; do {_Petsc_ierr = 0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler (_Petsc_xioerrhdl); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf ,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do { if (__builtin_expect(!!(_Petsc_ierr),0)) return PetscError((( MPI_Comm)0x44000001),1662,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); _Petsc_ierr = ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)(draw)))),0) || MPI_Allreduce((&_Petsc_xioerr_local ),(&_Petsc_xioerr),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)) ,(PetscObjectComm((PetscObject)(draw)))));do {if (__builtin_expect (!!(_Petsc_ierr),0)) return PetscError(((MPI_Comm)0x44000001) ,1662,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_Petsc_xioerr ) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect (!!(_Petsc_ierr),0)) return PetscError(((MPI_Comm)0x44000001) ,1662,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } } } while(0);do {if (__builtin_expect (!!(_Petsc_ierr),0)) return PetscError(((MPI_Comm)0x44000001) ,1662,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0);} } do {} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1662,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1663 | for (i=0,row=0; i<mbs; i++,row+=bs) { | |||
1664 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1665 | y_l = A->rmap->N - row - 1.0; y_r = y_l + 1.0; | |||
1666 | x_l = a->j[j]*bs; x_r = x_l + 1.0; | |||
1667 | aa = a->a + j*bs2; | |||
1668 | for (k=0; k<bs; k++) { | |||
1669 | for (l=0; l<bs; l++) { | |||
1670 | MatScalar v = *aa++; | |||
1671 | color = PetscDrawRealToColor(PetscAbsScalar(v),minv,maxv); | |||
1672 | ierr = PetscDrawRectangle(draw,x_l+k,y_l-l,x_r+k,y_r-l,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1672,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1673 | } | |||
1674 | } | |||
1675 | } | |||
1676 | } | |||
1677 | ierr = PetscDrawCollectiveEnd(draw)0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler(_Petsc_xioerrhdl ); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf ,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do { if (__builtin_expect(!!(_Petsc_ierr),0)) return PetscError((( MPI_Comm)0x44000001),1677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); _Petsc_ierr = ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)(draw)))),0) || MPI_Allreduce((&_Petsc_xioerr_local ),(&_Petsc_xioerr),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)) ,(PetscObjectComm((PetscObject)(draw)))));do {if (__builtin_expect (!!(_Petsc_ierr),0)) return PetscError(((MPI_Comm)0x44000001) ,1677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_Petsc_xioerr ) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect (!!(_Petsc_ierr),0)) return PetscError(((MPI_Comm)0x44000001) ,1677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");} while (0); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } } } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1678 | } | |||
1679 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1680 | } | |||
1681 | ||||
1682 | static PetscErrorCode MatView_SeqBAIJ_Draw(Mat A,PetscViewer viewer) | |||
1683 | { | |||
1684 | PetscErrorCode ierr; | |||
1685 | PetscReal xl,yl,xr,yr,w,h; | |||
1686 | PetscDraw draw; | |||
1687 | PetscBool isnull; | |||
1688 | ||||
1689 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1689; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1690 | ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1690,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1691 | ierr = PetscDrawIsNull(draw,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1691,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1692 | if (isnull) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1693 | ||||
1694 | xr = A->cmap->n; yr = A->rmap->N; h = yr/10.0; w = xr/10.0; | |||
1695 | xr += w; yr += h; xl = -w; yl = -h; | |||
1696 | ierr = PetscDrawSetCoordinates(draw,xl,yl,xr,yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1697 | ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",(PetscObject)viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1697,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1698 | ierr = PetscDrawZoom(draw,MatView_SeqBAIJ_Draw_Zoom,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1699 | ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1699,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1700 | ierr = PetscDrawSave(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1700,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1701 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1702 | } | |||
1703 | ||||
1704 | PetscErrorCode MatView_SeqBAIJ(Mat A,PetscViewer viewer) | |||
1705 | { | |||
1706 | PetscErrorCode ierr; | |||
1707 | PetscBool iascii,isbinary,isdraw; | |||
1708 | ||||
1709 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1709; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1710 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1710,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1711 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1711,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1712 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1712,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1713 | if (iascii) { | |||
1714 | ierr = MatView_SeqBAIJ_ASCII(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1714,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1715 | } else if (isbinary) { | |||
1716 | ierr = MatView_SeqBAIJ_Binary(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1716,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1717 | } else if (isdraw) { | |||
1718 | ierr = MatView_SeqBAIJ_Draw(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1718,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1719 | } else { | |||
1720 | Mat B; | |||
1721 | ierr = MatConvert(A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1721,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1722 | ierr = MatView(B,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1722,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1723 | ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1723,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1724 | } | |||
1725 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1726 | } | |||
1727 | ||||
1728 | ||||
1729 | PetscErrorCode MatGetValues_SeqBAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],PetscScalar v[]) | |||
1730 | { | |||
1731 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1732 | PetscInt *rp,k,low,high,t,row,nrow,i,col,l,*aj = a->j; | |||
1733 | PetscInt *ai = a->i,*ailen = a->ilen; | |||
1734 | PetscInt brow,bcol,ridx,cidx,bs=A->rmap->bs,bs2=a->bs2; | |||
1735 | MatScalar *ap,*aa = a->a; | |||
1736 | ||||
1737 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1737; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1738 | for (k=0; k<m; k++) { /* loop over rows */ | |||
1739 | row = im[k]; brow = row/bs; | |||
1740 | if (row < 0) {v += n; continue;} /* SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row"); */ | |||
1741 | if (row >= A->rmap->N) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row %D too large", row)return PetscError(((MPI_Comm)0x44000001),1741,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Row %D too large",row); | |||
1742 | rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; | |||
1743 | nrow = ailen[brow]; | |||
1744 | for (l=0; l<n; l++) { /* loop over columns */ | |||
1745 | if (in[l] < 0) {v++; continue;} /* SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column"); */ | |||
1746 | if (in[l] >= A->cmap->n) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column %D too large", in[l])return PetscError(((MPI_Comm)0x44000001),1746,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Column %D too large",in[l]); | |||
1747 | col = in[l]; | |||
1748 | bcol = col/bs; | |||
1749 | cidx = col%bs; | |||
1750 | ridx = row%bs; | |||
1751 | high = nrow; | |||
1752 | low = 0; /* assume unsorted */ | |||
1753 | while (high-low > 5) { | |||
1754 | t = (low+high)/2; | |||
1755 | if (rp[t] > bcol) high = t; | |||
1756 | else low = t; | |||
1757 | } | |||
1758 | for (i=low; i<high; i++) { | |||
1759 | if (rp[i] > bcol) break; | |||
1760 | if (rp[i] == bcol) { | |||
1761 | *v++ = ap[bs2*i+bs*cidx+ridx]; | |||
1762 | goto finished; | |||
1763 | } | |||
1764 | } | |||
1765 | *v++ = 0.0; | |||
1766 | finished:; | |||
1767 | } | |||
1768 | } | |||
1769 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1770 | } | |||
1771 | ||||
1772 | PetscErrorCode MatSetValuesBlocked_SeqBAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is) | |||
1773 | { | |||
1774 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1775 | PetscInt *rp,k,low,high,t,ii,jj,row,nrow,i,col,l,rmax,N,lastcol = -1; | |||
1776 | PetscInt *imax=a->imax,*ai=a->i,*ailen=a->ilen; | |||
1777 | PetscErrorCode ierr; | |||
1778 | PetscInt *aj =a->j,nonew=a->nonew,bs2=a->bs2,bs=A->rmap->bs,stepval; | |||
1779 | PetscBool roworiented=a->roworiented; | |||
1780 | const PetscScalar *value = v; | |||
1781 | MatScalar *ap=NULL((void*)0),*aa = a->a,*bap; | |||
1782 | ||||
1783 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1783; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1784 | if (roworiented) { | |||
| ||||
1785 | stepval = (n-1)*bs; | |||
1786 | } else { | |||
1787 | stepval = (m-1)*bs; | |||
1788 | } | |||
1789 | for (k=0; k<m; k++) { /* loop over added rows */ | |||
1790 | row = im[k]; | |||
1791 | if (row < 0) continue; | |||
1792 | #if defined(PETSC_USE_DEBUG1) | |||
1793 | if (row >= a->mbs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Block row index too large %D max %D",row,a->mbs-1)return PetscError(((MPI_Comm)0x44000001),1793,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Block row index too large %D max %D" ,row,a->mbs-1); | |||
1794 | #endif | |||
1795 | rp = aj + ai[row]; | |||
1796 | if (!A->structure_only) ap = aa + bs2*ai[row]; | |||
1797 | rmax = imax[row]; | |||
1798 | nrow = ailen[row]; | |||
1799 | low = 0; | |||
1800 | high = nrow; | |||
1801 | for (l=0; l<n; l++) { /* loop over added columns */ | |||
1802 | if (in[l] < 0) continue; | |||
1803 | #if defined(PETSC_USE_DEBUG1) | |||
1804 | if (in[l] >= a->nbs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Block column index too large %D max %D",in[l],a->nbs-1)return PetscError(((MPI_Comm)0x44000001),1804,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Block column index too large %D max %D" ,in[l],a->nbs-1); | |||
1805 | #endif | |||
1806 | col = in[l]; | |||
1807 | if (!A->structure_only) { | |||
1808 | if (roworiented) { | |||
1809 | value = v + (k*(stepval+bs) + l)*bs; | |||
1810 | } else { | |||
1811 | value = v + (l*(stepval+bs) + k)*bs; | |||
1812 | } | |||
1813 | } | |||
1814 | if (col <= lastcol) low = 0; | |||
1815 | else high = nrow; | |||
1816 | lastcol = col; | |||
1817 | while (high-low > 7) { | |||
1818 | t = (low+high)/2; | |||
1819 | if (rp[t] > col) high = t; | |||
1820 | else low = t; | |||
1821 | } | |||
1822 | for (i=low; i<high; i++) { | |||
1823 | if (rp[i] > col) break; | |||
1824 | if (rp[i] == col) { | |||
1825 | if (A->structure_only) goto noinsert2; | |||
1826 | bap = ap + bs2*i; | |||
1827 | if (roworiented) { | |||
1828 | if (is == ADD_VALUES) { | |||
1829 | for (ii=0; ii<bs; ii++,value+=stepval) { | |||
1830 | for (jj=ii; jj<bs2; jj+=bs) { | |||
1831 | bap[jj] += *value++; | |||
1832 | } | |||
1833 | } | |||
1834 | } else { | |||
1835 | for (ii=0; ii<bs; ii++,value+=stepval) { | |||
1836 | for (jj=ii; jj<bs2; jj+=bs) { | |||
1837 | bap[jj] = *value++; | |||
1838 | } | |||
1839 | } | |||
1840 | } | |||
1841 | } else { | |||
1842 | if (is == ADD_VALUES) { | |||
1843 | for (ii=0; ii<bs; ii++,value+=bs+stepval) { | |||
1844 | for (jj=0; jj<bs; jj++) { | |||
1845 | bap[jj] += value[jj]; | |||
1846 | } | |||
1847 | bap += bs; | |||
1848 | } | |||
1849 | } else { | |||
1850 | for (ii=0; ii<bs; ii++,value+=bs+stepval) { | |||
1851 | for (jj=0; jj<bs; jj++) { | |||
1852 | bap[jj] = value[jj]; | |||
1853 | } | |||
1854 | bap += bs; | |||
1855 | } | |||
1856 | } | |||
1857 | } | |||
1858 | goto noinsert2; | |||
1859 | } | |||
1860 | } | |||
1861 | if (nonew == 1) goto noinsert2; | |||
1862 | if (nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new blocked index new nonzero block (%D, %D) in the matrix", row, col)return PetscError(((MPI_Comm)0x44000001),1862,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Inserting a new blocked index new nonzero block (%D, %D) in the matrix" ,row,col); | |||
1863 | if (A->structure_only) { | |||
1864 | MatSeqXAIJReallocateAIJ_structure_only(A,a->mbs,bs2,nrow,row,col,rmax,ai,aj,rp,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data ; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE, len,*new_i=0,*new_j=0; if (nonew == -2) return PetscError(((MPI_Comm )0x44000001),1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,row,col); ierr = PetscMallocA(1,PETSC_FALSE,1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(new_nz)*sizeof(**(&new_j)),(&new_j));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm) 0x44000001),1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMallocA (1,PETSC_FALSE,1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(a->mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<row +1; ii++) {new_i[ii] = ai[ii];} for (ii=row+1; ii<a->mbs +1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j )) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof (*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError (((MPI_Comm)0x44000001),1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - ai[row] - nrow); ierr = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE )) != sizeof(*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row ]+nrow+CHUNKSIZE,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row] +nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),1864,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); Ain->a = ((void *)0); ai = Ain->i = new_i; aj = Ain->j = new_j; Ain-> singlemalloc = PETSC_FALSE; Ain->free_a = PETSC_FALSE; rp = aj + ai[row]; rmax = imax[row] = imax[row] + CHUNKSIZE; Ain-> maxnz += bs2*CHUNKSIZE; Ain->reallocs++; }; | |||
1865 | } else { | |||
1866 | MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data ; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE, len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) return PetscError(((MPI_Comm)0x44000001),1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,row,col); ierr = PetscMallocA(3,PETSC_FALSE,1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a-> mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),1866,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<row +1; ii++) {new_i[ii] = ai[ii];} for (ii=row+1; ii<a->mbs +1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j )) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof (*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError (((MPI_Comm)0x44000001),1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - ai[row] - nrow); ierr = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE )) != sizeof(*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row ]+nrow+CHUNKSIZE,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row] +nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*( new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[row ]+nrow))*sizeof(*(new_a))));;do {if (__builtin_expect(!!(ierr ),0)) return PetscError(((MPI_Comm)0x44000001),1866,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero (new_a+bs2*(ai[row]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2* (ai[row]+nrow))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*( new_a+bs2*(ai[row]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[row ]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[row]+nrow+CHUNKSIZE), aa+bs2*(ai[row]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[row]+nrow +CHUNKSIZE)))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),1866,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain-> a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain-> j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[row ]; ap = aa + bs2*ai[row]; rmax = imax[row] = imax[row] + CHUNKSIZE ; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++; }; | |||
1867 | } | |||
1868 | N = nrow++ - 1; high++; | |||
1869 | /* shift up all the later entries in this row */ | |||
1870 | ierr = PetscArraymove(rp+i+1,rp+i,N-i+1)((sizeof(*(rp+i+1)) != sizeof(*(rp+i))) || PetscMemmove(rp+i+ 1,rp+i,(N-i+1)*sizeof(*(rp+i+1))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1870,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1871 | rp[i] = col; | |||
1872 | if (!A->structure_only) { | |||
1873 | ierr = PetscArraymove(ap+bs2*(i+1),ap+bs2*i,bs2*(N-i+1))((sizeof(*(ap+bs2*(i+1))) != sizeof(*(ap+bs2*i))) || PetscMemmove (ap+bs2*(i+1),ap+bs2*i,(bs2*(N-i+1))*sizeof(*(ap+bs2*(i+1)))) );;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1873,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1874 | bap = ap + bs2*i; | |||
1875 | if (roworiented) { | |||
1876 | for (ii=0; ii<bs; ii++,value+=stepval) { | |||
1877 | for (jj=ii; jj<bs2; jj+=bs) { | |||
1878 | bap[jj] = *value++; | |||
1879 | } | |||
1880 | } | |||
1881 | } else { | |||
1882 | for (ii=0; ii<bs; ii++,value+=stepval) { | |||
1883 | for (jj=0; jj<bs; jj++) { | |||
1884 | *bap++ = *value++; | |||
| ||||
1885 | } | |||
1886 | } | |||
1887 | } | |||
1888 | } | |||
1889 | noinsert2:; | |||
1890 | low = i; | |||
1891 | } | |||
1892 | ailen[row] = nrow; | |||
1893 | } | |||
1894 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1895 | } | |||
1896 | ||||
1897 | PetscErrorCode MatAssemblyEnd_SeqBAIJ(Mat A,MatAssemblyType mode) | |||
1898 | { | |||
1899 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1900 | PetscInt fshift = 0,i,*ai = a->i,*aj = a->j,*imax = a->imax; | |||
1901 | PetscInt m = A->rmap->N,*ip,N,*ailen = a->ilen; | |||
1902 | PetscErrorCode ierr; | |||
1903 | PetscInt mbs = a->mbs,bs2 = a->bs2,rmax = 0; | |||
1904 | MatScalar *aa = a->a,*ap; | |||
1905 | PetscReal ratio=0.6; | |||
1906 | ||||
1907 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1907; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1908 | if (mode == MAT_FLUSH_ASSEMBLY) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1909 | ||||
1910 | if (m) rmax = ailen[0]; | |||
1911 | for (i=1; i<mbs; i++) { | |||
1912 | /* move each row back by the amount of empty slots (fshift) before it*/ | |||
1913 | fshift += imax[i-1] - ailen[i-1]; | |||
1914 | rmax = PetscMax(rmax,ailen[i])(((rmax)<(ailen[i])) ? (ailen[i]) : (rmax)); | |||
1915 | if (fshift) { | |||
1916 | ip = aj + ai[i]; | |||
1917 | ap = aa + bs2*ai[i]; | |||
1918 | N = ailen[i]; | |||
1919 | ierr = PetscArraymove(ip-fshift,ip,N)((sizeof(*(ip-fshift)) != sizeof(*(ip))) || PetscMemmove(ip-fshift ,ip,(N)*sizeof(*(ip-fshift))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1919,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1920 | if (!A->structure_only) { | |||
1921 | ierr = PetscArraymove(ap-bs2*fshift,ap,bs2*N)((sizeof(*(ap-bs2*fshift)) != sizeof(*(ap))) || PetscMemmove( ap-bs2*fshift,ap,(bs2*N)*sizeof(*(ap-bs2*fshift))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1922 | } | |||
1923 | } | |||
1924 | ai[i] = ai[i-1] + ailen[i-1]; | |||
1925 | } | |||
1926 | if (mbs) { | |||
1927 | fshift += imax[mbs-1] - ailen[mbs-1]; | |||
1928 | ai[mbs] = ai[mbs-1] + ailen[mbs-1]; | |||
1929 | } | |||
1930 | ||||
1931 | /* reset ilen and imax for each row */ | |||
1932 | a->nonzerorowcnt = 0; | |||
1933 | if (A->structure_only) { | |||
1934 | ierr = PetscFree2(a->imax,a->ilen)PetscFreeA(2,1934,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,&(a->imax),&(a->ilen));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1934,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1935 | } else { /* !A->structure_only */ | |||
1936 | for (i=0; i<mbs; i++) { | |||
1937 | ailen[i] = imax[i] = ai[i+1] - ai[i]; | |||
1938 | a->nonzerorowcnt += ((ai[i+1] - ai[i]) > 0); | |||
1939 | } | |||
1940 | } | |||
1941 | a->nz = ai[mbs]; | |||
1942 | ||||
1943 | /* diagonals may have moved, so kill the diagonal pointers */ | |||
1944 | a->idiagvalid = PETSC_FALSE; | |||
1945 | if (fshift && a->diag) { | |||
1946 | ierr = PetscFree(a->diag)((*PetscTrFree)((void*)(a->diag),1946,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((a->diag) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1946,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1947 | ierr = PetscLogObjectMemory((PetscObject)A,-(mbs+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1947,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1948 | a->diag = 0; | |||
1949 | } | |||
1950 | if (fshift && a->nounused == -1) SETERRQ4(PETSC_COMM_SELF,PETSC_ERR_PLIB, "Unused space detected in matrix: %D X %D block size %D, %D unneeded", m, A->cmap->n, A->rmap->bs, fshift*bs2)return PetscError(((MPI_Comm)0x44000001),1950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,77,PETSC_ERROR_INITIAL,"Unused space detected in matrix: %D X %D block size %D, %D unneeded" ,m,A->cmap->n,A->rmap->bs,fshift*bs2); | |||
1951 | ierr = PetscInfo5(A,"Matrix size: %D X %D, block size %D; storage space: %D unneeded, %D used\n",m,A->cmap->n,A->rmap->bs,fshift*bs2,a->nz*bs2)PetscInfo_Private(__func__,A,"Matrix size: %D X %D, block size %D; storage space: %D unneeded, %D used\n" ,m,A->cmap->n,A->rmap->bs,fshift*bs2,a->nz*bs2 );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1951,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1952 | ierr = PetscInfo1(A,"Number of mallocs during MatSetValues is %D\n",a->reallocs)PetscInfo_Private(__func__,A,"Number of mallocs during MatSetValues is %D\n" ,a->reallocs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1952,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1953 | ierr = PetscInfo1(A,"Most nonzeros blocks in any row is %D\n",rmax)PetscInfo_Private(__func__,A,"Most nonzeros blocks in any row is %D\n" ,rmax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1953,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1954 | ||||
1955 | A->info.mallocs += a->reallocs; | |||
1956 | a->reallocs = 0; | |||
1957 | A->info.nz_unneeded = (PetscReal)fshift*bs2; | |||
1958 | a->rmax = rmax; | |||
1959 | ||||
1960 | if (!A->structure_only) { | |||
1961 | ierr = MatCheckCompressedRow(A,a->nonzerorowcnt,&a->compressedrow,a->i,mbs,ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1961,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1962 | } | |||
1963 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1964 | } | |||
1965 | ||||
1966 | /* | |||
1967 | This function returns an array of flags which indicate the locations of contiguous | |||
1968 | blocks that should be zeroed. for eg: if bs = 3 and is = [0,1,2,3,5,6,7,8,9] | |||
1969 | then the resulting sizes = [3,1,1,3,1] correspondig to sets [(0,1,2),(3),(5),(6,7,8),(9)] | |||
1970 | Assume: sizes should be long enough to hold all the values. | |||
1971 | */ | |||
1972 | static PetscErrorCode MatZeroRows_SeqBAIJ_Check_Blocks(PetscInt idx[],PetscInt n,PetscInt bs,PetscInt sizes[], PetscInt *bs_max) | |||
1973 | { | |||
1974 | PetscInt i,j,k,row; | |||
1975 | PetscBool flg; | |||
1976 | ||||
1977 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 1977; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1978 | for (i=0,j=0; i<n; j++) { | |||
1979 | row = idx[i]; | |||
1980 | if (row%bs!=0) { /* Not the begining of a block */ | |||
1981 | sizes[j] = 1; | |||
1982 | i++; | |||
1983 | } else if (i+bs > n) { /* complete block doesn't exist (at idx end) */ | |||
1984 | sizes[j] = 1; /* Also makes sure atleast 'bs' values exist for next else */ | |||
1985 | i++; | |||
1986 | } else { /* Begining of the block, so check if the complete block exists */ | |||
1987 | flg = PETSC_TRUE; | |||
1988 | for (k=1; k<bs; k++) { | |||
1989 | if (row+k != idx[i+k]) { /* break in the block */ | |||
1990 | flg = PETSC_FALSE; | |||
1991 | break; | |||
1992 | } | |||
1993 | } | |||
1994 | if (flg) { /* No break in the bs */ | |||
1995 | sizes[j] = bs; | |||
1996 | i += bs; | |||
1997 | } else { | |||
1998 | sizes[j] = 1; | |||
1999 | i++; | |||
2000 | } | |||
2001 | } | |||
2002 | } | |||
2003 | *bs_max = j; | |||
2004 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2005 | } | |||
2006 | ||||
2007 | PetscErrorCode MatZeroRows_SeqBAIJ(Mat A,PetscInt is_n,const PetscInt is_idx[],PetscScalar diag,Vec x, Vec b) | |||
2008 | { | |||
2009 | Mat_SeqBAIJ *baij=(Mat_SeqBAIJ*)A->data; | |||
2010 | PetscErrorCode ierr; | |||
2011 | PetscInt i,j,k,count,*rows; | |||
2012 | PetscInt bs=A->rmap->bs,bs2=baij->bs2,*sizes,row,bs_max; | |||
2013 | PetscScalar zero = 0.0; | |||
2014 | MatScalar *aa; | |||
2015 | const PetscScalar *xx; | |||
2016 | PetscScalar *bb; | |||
2017 | ||||
2018 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2018; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2019 | /* fix right hand side if needed */ | |||
2020 | if (x && b) { | |||
2021 | ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2021,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2022 | ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2022,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2023 | for (i=0; i<is_n; i++) { | |||
2024 | bb[is_idx[i]] = diag*xx[is_idx[i]]; | |||
2025 | } | |||
2026 | ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2026,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2027 | ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2027,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2028 | } | |||
2029 | ||||
2030 | /* Make a copy of the IS and sort it */ | |||
2031 | /* allocate memory for rows,sizes */ | |||
2032 | ierr = PetscMalloc2(is_n,&rows,2*is_n,&sizes)PetscMallocA(2,PETSC_FALSE,2032,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(is_n)*sizeof(**(&rows)),(&rows),(size_t)(2* is_n)*sizeof(**(&sizes)),(&sizes));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2032,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2033 | ||||
2034 | /* copy IS values to rows, and sort them */ | |||
2035 | for (i=0; i<is_n; i++) rows[i] = is_idx[i]; | |||
2036 | ierr = PetscSortInt(is_n,rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2036,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2037 | ||||
2038 | if (baij->keepnonzeropattern) { | |||
2039 | for (i=0; i<is_n; i++) sizes[i] = 1; | |||
2040 | bs_max = is_n; | |||
2041 | } else { | |||
2042 | ierr = MatZeroRows_SeqBAIJ_Check_Blocks(rows,is_n,bs,sizes,&bs_max);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2042,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2043 | A->nonzerostate++; | |||
2044 | } | |||
2045 | ||||
2046 | for (i=0,j=0; i<bs_max; j+=sizes[i],i++) { | |||
2047 | row = rows[j]; | |||
2048 | 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),2048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"row %D out of range",row); | |||
2049 | count = (baij->i[row/bs +1] - baij->i[row/bs])*bs; | |||
2050 | aa = ((MatScalar*)(baij->a)) + baij->i[row/bs]*bs2 + (row%bs); | |||
2051 | if (sizes[i] == bs && !baij->keepnonzeropattern) { | |||
2052 | if (diag != (PetscScalar)0.0) { | |||
2053 | if (baij->ilen[row/bs] > 0) { | |||
2054 | baij->ilen[row/bs] = 1; | |||
2055 | baij->j[baij->i[row/bs]] = row/bs; | |||
2056 | ||||
2057 | ierr = PetscArrayzero(aa,count*bs)PetscMemzero(aa,(count*bs)*sizeof(*(aa)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2057,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2058 | } | |||
2059 | /* Now insert all the diagonal values for this bs */ | |||
2060 | for (k=0; k<bs; k++) { | |||
2061 | ierr = (*A->ops->setvalues)(A,1,rows+j+k,1,rows+j+k,&diag,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2061,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2062 | } | |||
2063 | } else { /* (diag == 0.0) */ | |||
2064 | baij->ilen[row/bs] = 0; | |||
2065 | } /* end (diag == 0.0) */ | |||
2066 | } else { /* (sizes[i] != bs) */ | |||
2067 | #if defined(PETSC_USE_DEBUG1) | |||
2068 | if (sizes[i] != 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Internal Error. Value should be 1")return PetscError(((MPI_Comm)0x44000001),2068,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,77,PETSC_ERROR_INITIAL,"Internal Error. Value should be 1"); | |||
2069 | #endif | |||
2070 | for (k=0; k<count; k++) { | |||
2071 | aa[0] = zero; | |||
2072 | aa += bs; | |||
2073 | } | |||
2074 | if (diag != (PetscScalar)0.0) { | |||
2075 | ierr = (*A->ops->setvalues)(A,1,rows+j,1,rows+j,&diag,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2075,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2076 | } | |||
2077 | } | |||
2078 | } | |||
2079 | ||||
2080 | ierr = PetscFree2(rows,sizes)PetscFreeA(2,2080,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,&(rows),&(sizes));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2080,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2081 | ierr = MatAssemblyEnd_SeqBAIJ(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2081,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2082 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2083 | } | |||
2084 | ||||
2085 | PetscErrorCode MatZeroRowsColumns_SeqBAIJ(Mat A,PetscInt is_n,const PetscInt is_idx[],PetscScalar diag,Vec x, Vec b) | |||
2086 | { | |||
2087 | Mat_SeqBAIJ *baij=(Mat_SeqBAIJ*)A->data; | |||
2088 | PetscErrorCode ierr; | |||
2089 | PetscInt i,j,k,count; | |||
2090 | PetscInt bs =A->rmap->bs,bs2=baij->bs2,row,col; | |||
2091 | PetscScalar zero = 0.0; | |||
2092 | MatScalar *aa; | |||
2093 | const PetscScalar *xx; | |||
2094 | PetscScalar *bb; | |||
2095 | PetscBool *zeroed,vecs = PETSC_FALSE; | |||
2096 | ||||
2097 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2097; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2098 | /* fix right hand side if needed */ | |||
2099 | if (x && b) { | |||
2100 | ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2100,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2101 | ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2102 | vecs = PETSC_TRUE; | |||
2103 | } | |||
2104 | ||||
2105 | /* zero the columns */ | |||
2106 | ierr = PetscCalloc1(A->rmap->n,&zeroed)PetscMallocA(1,PETSC_TRUE,2106,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(A->rmap->n)*sizeof(**(&zeroed)),(&zeroed ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2106,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2107 | for (i=0; i<is_n; i++) { | |||
2108 | if (is_idx[i] < 0 || is_idx[i] >= A->rmap->N) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range",is_idx[i])return PetscError(((MPI_Comm)0x44000001),2108,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"row %D out of range",is_idx[i]); | |||
2109 | zeroed[is_idx[i]] = PETSC_TRUE; | |||
2110 | } | |||
2111 | for (i=0; i<A->rmap->N; i++) { | |||
2112 | if (!zeroed[i]) { | |||
2113 | row = i/bs; | |||
2114 | for (j=baij->i[row]; j<baij->i[row+1]; j++) { | |||
2115 | for (k=0; k<bs; k++) { | |||
2116 | col = bs*baij->j[j] + k; | |||
2117 | if (zeroed[col]) { | |||
2118 | aa = ((MatScalar*)(baij->a)) + j*bs2 + (i%bs) + bs*k; | |||
2119 | if (vecs) bb[i] -= aa[0]*xx[col]; | |||
2120 | aa[0] = 0.0; | |||
2121 | } | |||
2122 | } | |||
2123 | } | |||
2124 | } else if (vecs) bb[i] = diag*xx[i]; | |||
2125 | } | |||
2126 | ierr = PetscFree(zeroed)((*PetscTrFree)((void*)(zeroed),2126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((zeroed) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2127 | if (vecs) { | |||
2128 | ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2128,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2129 | ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2129,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2130 | } | |||
2131 | ||||
2132 | /* zero the rows */ | |||
2133 | for (i=0; i<is_n; i++) { | |||
2134 | row = is_idx[i]; | |||
2135 | count = (baij->i[row/bs +1] - baij->i[row/bs])*bs; | |||
2136 | aa = ((MatScalar*)(baij->a)) + baij->i[row/bs]*bs2 + (row%bs); | |||
2137 | for (k=0; k<count; k++) { | |||
2138 | aa[0] = zero; | |||
2139 | aa += bs; | |||
2140 | } | |||
2141 | if (diag != (PetscScalar)0.0) { | |||
2142 | ierr = (*A->ops->setvalues)(A,1,&row,1,&row,&diag,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2142,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2143 | } | |||
2144 | } | |||
2145 | ierr = MatAssemblyEnd_SeqBAIJ(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2145,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2146 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2147 | } | |||
2148 | ||||
2149 | PetscErrorCode MatSetValues_SeqBAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is) | |||
2150 | { | |||
2151 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2152 | PetscInt *rp,k,low,high,t,ii,row,nrow,i,col,l,rmax,N,lastcol = -1; | |||
2153 | PetscInt *imax=a->imax,*ai=a->i,*ailen=a->ilen; | |||
2154 | PetscInt *aj =a->j,nonew=a->nonew,bs=A->rmap->bs,brow,bcol; | |||
2155 | PetscErrorCode ierr; | |||
2156 | PetscInt ridx,cidx,bs2=a->bs2; | |||
2157 | PetscBool roworiented=a->roworiented; | |||
2158 | MatScalar *ap=NULL((void*)0),value=0.0,*aa=a->a,*bap; | |||
2159 | ||||
2160 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2160; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2161 | for (k=0; k<m; k++) { /* loop over added rows */ | |||
2162 | row = im[k]; | |||
2163 | brow = row/bs; | |||
2164 | if (row < 0) continue; | |||
2165 | #if defined(PETSC_USE_DEBUG1) | |||
2166 | if (row >= A->rmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",row,A->rmap->N-1)return PetscError(((MPI_Comm)0x44000001),2166,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Row too large: row %D max %D",row,A-> rmap->N-1); | |||
2167 | #endif | |||
2168 | rp = aj + ai[brow]; | |||
2169 | if (!A->structure_only) ap = aa + bs2*ai[brow]; | |||
2170 | rmax = imax[brow]; | |||
2171 | nrow = ailen[brow]; | |||
2172 | low = 0; | |||
2173 | high = nrow; | |||
2174 | for (l=0; l<n; l++) { /* loop over added columns */ | |||
2175 | if (in[l] < 0) continue; | |||
2176 | #if defined(PETSC_USE_DEBUG1) | |||
2177 | if (in[l] >= A->cmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",in[l],A->cmap->n-1)return PetscError(((MPI_Comm)0x44000001),2177,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Column too large: col %D max %D",in[ l],A->cmap->n-1); | |||
2178 | #endif | |||
2179 | col = in[l]; bcol = col/bs; | |||
2180 | ridx = row % bs; cidx = col % bs; | |||
2181 | if (!A->structure_only) { | |||
2182 | if (roworiented) { | |||
2183 | value = v[l + k*n]; | |||
2184 | } else { | |||
2185 | value = v[k + l*m]; | |||
2186 | } | |||
2187 | } | |||
2188 | if (col <= lastcol) low = 0; else high = nrow; | |||
2189 | lastcol = col; | |||
2190 | while (high-low > 7) { | |||
2191 | t = (low+high)/2; | |||
2192 | if (rp[t] > bcol) high = t; | |||
2193 | else low = t; | |||
2194 | } | |||
2195 | for (i=low; i<high; i++) { | |||
2196 | if (rp[i] > bcol) break; | |||
2197 | if (rp[i] == bcol) { | |||
2198 | bap = ap + bs2*i + bs*cidx + ridx; | |||
2199 | if (!A->structure_only) { | |||
2200 | if (is == ADD_VALUES) *bap += value; | |||
2201 | else *bap = value; | |||
2202 | } | |||
2203 | goto noinsert1; | |||
2204 | } | |||
2205 | } | |||
2206 | if (nonew == 1) goto noinsert1; | |||
2207 | if (nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero (%D, %D) in the matrix", row, col)return PetscError(((MPI_Comm)0x44000001),2207,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero (%D, %D) in the matrix" ,row,col); | |||
2208 | if (A->structure_only) { | |||
2209 | MatSeqXAIJReallocateAIJ_structure_only(A,a->mbs,bs2,nrow,brow,bcol,rmax,ai,aj,rp,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data ; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE, len,*new_i=0,*new_j=0; if (nonew == -2) return PetscError(((MPI_Comm )0x44000001),2209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,brow,bcol); ierr = PetscMallocA(1,PETSC_FALSE,2209,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(new_nz)*sizeof(**(&new_j)),(&new_j));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm) 0x44000001),2209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMallocA (1,PETSC_FALSE,2209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(a->mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow +1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs +1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j )) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[brow]+nrow)* sizeof(*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),2209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - ai[brow] - nrow); ierr = ((sizeof(*(new_j+ai[brow]+nrow+CHUNKSIZE )) != sizeof(*(aj+ai[brow]+nrow))) || PetscMemcpy(new_j+ai[brow ]+nrow+CHUNKSIZE,aj+ai[brow]+nrow,(len)*sizeof(*(new_j+ai[brow ]+nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),2209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),2209,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); Ain->a = ((void *)0); ai = Ain->i = new_i; aj = Ain->j = new_j; Ain-> singlemalloc = PETSC_FALSE; Ain->free_a = PETSC_FALSE; rp = aj + ai[brow]; rmax = imax[brow] = imax[brow] + CHUNKSIZE; Ain ->maxnz += bs2*CHUNKSIZE; Ain->reallocs++; }; | |||
2210 | } else { | |||
2211 | MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,brow,bcol,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data ; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE, len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) return PetscError(((MPI_Comm)0x44000001),2211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,2211,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a-> mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),2211,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow +1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs +1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j )) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[brow]+nrow)* sizeof(*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),2211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - ai[brow] - nrow); ierr = ((sizeof(*(new_j+ai[brow]+nrow+CHUNKSIZE )) != sizeof(*(aj+ai[brow]+nrow))) || PetscMemcpy(new_j+ai[brow ]+nrow+CHUNKSIZE,aj+ai[brow]+nrow,(len)*sizeof(*(new_j+ai[brow ]+nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),2211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*( new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[brow ]+nrow))*sizeof(*(new_a))));;do {if (__builtin_expect(!!(ierr ),0)) return PetscError(((MPI_Comm)0x44000001),2211,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero (new_a+bs2*(ai[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2 *(ai[brow]+nrow))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),2211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*( new_a+bs2*(ai[brow]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[ brow]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[brow]+nrow+CHUNKSIZE ),aa+bs2*(ai[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[brow ]+nrow+CHUNKSIZE)))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),2211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),2211,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain-> a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain-> j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[brow ]; ap = aa + bs2*ai[brow]; rmax = imax[brow] = imax[brow] + CHUNKSIZE ; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++; }; | |||
2212 | } | |||
2213 | N = nrow++ - 1; high++; | |||
2214 | /* shift up all the later entries in this row */ | |||
2215 | ierr = PetscArraymove(rp+i+1,rp+i,N-i+1)((sizeof(*(rp+i+1)) != sizeof(*(rp+i))) || PetscMemmove(rp+i+ 1,rp+i,(N-i+1)*sizeof(*(rp+i+1))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2216 | rp[i] = bcol; | |||
2217 | if (!A->structure_only) { | |||
2218 | ierr = PetscArraymove(ap+bs2*(i+1),ap+bs2*i,bs2*(N-i+1))((sizeof(*(ap+bs2*(i+1))) != sizeof(*(ap+bs2*i))) || PetscMemmove (ap+bs2*(i+1),ap+bs2*i,(bs2*(N-i+1))*sizeof(*(ap+bs2*(i+1)))) );;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2219 | ierr = PetscArrayzero(ap+bs2*i,bs2)PetscMemzero(ap+bs2*i,(bs2)*sizeof(*(ap+bs2*i)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2219,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2220 | ap[bs2*i + bs*cidx + ridx] = value; | |||
2221 | } | |||
2222 | a->nz++; | |||
2223 | A->nonzerostate++; | |||
2224 | noinsert1:; | |||
2225 | low = i; | |||
2226 | } | |||
2227 | ailen[brow] = nrow; | |||
2228 | } | |||
2229 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2230 | } | |||
2231 | ||||
2232 | PetscErrorCode MatILUFactor_SeqBAIJ(Mat inA,IS row,IS col,const MatFactorInfo *info) | |||
2233 | { | |||
2234 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)inA->data; | |||
2235 | Mat outA; | |||
2236 | PetscErrorCode ierr; | |||
2237 | PetscBool row_identity,col_identity; | |||
2238 | ||||
2239 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2239; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2240 | if (info->levels != 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only levels = 0 supported for in-place ILU")return PetscError(((MPI_Comm)0x44000001),2240,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"Only levels = 0 supported for in-place ILU" ); | |||
2241 | ierr = ISIdentity(row,&row_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2241,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2242 | ierr = ISIdentity(col,&col_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2243 | if (!row_identity || !col_identity) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Row and column permutations must be identity for in-place ILU")return PetscError(((MPI_Comm)0x44000001),2243,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"Row and column permutations must be identity for in-place ILU" ); | |||
2244 | ||||
2245 | outA = inA; | |||
2246 | inA->factortype = MAT_FACTOR_LU; | |||
2247 | ierr = PetscFree(inA->solvertype)((*PetscTrFree)((void*)(inA->solvertype),2247,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((inA->solvertype) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2247,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2248 | ierr = PetscStrallocpy(MATSOLVERPETSC"petsc",&inA->solvertype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2248,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2249 | ||||
2250 | ierr = MatMarkDiagonal_SeqBAIJ(inA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2250,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2251 | ||||
2252 | ierr = PetscObjectReference((PetscObject)row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2252,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2253 | ierr = ISDestroy(&a->row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2253,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2254 | a->row = row; | |||
2255 | ierr = PetscObjectReference((PetscObject)col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2255,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2256 | ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2256,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2257 | a->col = col; | |||
2258 | ||||
2259 | /* Create the invert permutation so that it can be used in MatLUFactorNumeric() */ | |||
2260 | ierr = ISDestroy(&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2260,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2261 | ierr = ISInvertPermutation(col,PETSC_DECIDE-1,&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2262 | ierr = PetscLogObjectParent((PetscObject)inA,(PetscObject)a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2263 | ||||
2264 | ierr = MatSeqBAIJSetNumericFactorization_inplace(inA,(PetscBool)(row_identity && col_identity));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2264,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2265 | if (!a->solve_work) { | |||
2266 | ierr = PetscMalloc1(inA->rmap->N+inA->rmap->bs,&a->solve_work)PetscMallocA(1,PETSC_FALSE,2266,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(inA->rmap->N+inA->rmap->bs)*sizeof(**(& a->solve_work)),(&a->solve_work));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2266,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2267 | ierr = PetscLogObjectMemory((PetscObject)inA,(inA->rmap->N+inA->rmap->bs)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2268 | } | |||
2269 | ierr = MatLUFactorNumeric(outA,inA,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2269,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2270 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2271 | } | |||
2272 | ||||
2273 | PetscErrorCode MatSeqBAIJSetColumnIndices_SeqBAIJ(Mat mat,PetscInt *indices) | |||
2274 | { | |||
2275 | Mat_SeqBAIJ *baij = (Mat_SeqBAIJ*)mat->data; | |||
2276 | PetscInt i,nz,mbs; | |||
2277 | ||||
2278 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2278; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2279 | nz = baij->maxnz; | |||
2280 | mbs = baij->mbs; | |||
2281 | for (i=0; i<nz; i++) { | |||
2282 | baij->j[i] = indices[i]; | |||
2283 | } | |||
2284 | baij->nz = nz; | |||
2285 | for (i=0; i<mbs; i++) { | |||
2286 | baij->ilen[i] = baij->imax[i]; | |||
2287 | } | |||
2288 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2289 | } | |||
2290 | ||||
2291 | /*@ | |||
2292 | MatSeqBAIJSetColumnIndices - Set the column indices for all the rows | |||
2293 | in the matrix. | |||
2294 | ||||
2295 | Input Parameters: | |||
2296 | + mat - the SeqBAIJ matrix | |||
2297 | - indices - the column indices | |||
2298 | ||||
2299 | Level: advanced | |||
2300 | ||||
2301 | Notes: | |||
2302 | This can be called if you have precomputed the nonzero structure of the | |||
2303 | matrix and want to provide it to the matrix object to improve the performance | |||
2304 | of the MatSetValues() operation. | |||
2305 | ||||
2306 | You MUST have set the correct numbers of nonzeros per row in the call to | |||
2307 | MatCreateSeqBAIJ(), and the columns indices MUST be sorted. | |||
2308 | ||||
2309 | MUST be called before any calls to MatSetValues(); | |||
2310 | ||||
2311 | @*/ | |||
2312 | PetscErrorCode MatSeqBAIJSetColumnIndices(Mat mat,PetscInt *indices) | |||
2313 | { | |||
2314 | PetscErrorCode ierr; | |||
2315 | ||||
2316 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2316; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2317 | PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),2317, __func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),2317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if (((PetscObject)(mat))->classid == -1) return PetscError(( (MPI_Comm)0x44000001),2317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),2317,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
2318 | PetscValidPointer(indices,2)do { if (!indices) return PetscError(((MPI_Comm)0x44000001),2318 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(indices,PETSC_CHAR)) return PetscError(( (MPI_Comm)0x44000001),2318,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
2319 | ierr = PetscUseMethod(mat,"MatSeqBAIJSetColumnIndices_C",(Mat,PetscInt*),(mat,indices))0; do { PetscErrorCode (*f)(Mat,PetscInt*), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)mat),("MatSeqBAIJSetColumnIndices_C"),(PetscVoidFunction *)(&f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),2319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(mat,indices);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),2319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} else return PetscError (PetscObjectComm((PetscObject)mat),2319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object" ,"MatSeqBAIJSetColumnIndices_C"); } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2320 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2321 | } | |||
2322 | ||||
2323 | PetscErrorCode MatGetRowMaxAbs_SeqBAIJ(Mat A,Vec v,PetscInt idx[]) | |||
2324 | { | |||
2325 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2326 | PetscErrorCode ierr; | |||
2327 | PetscInt i,j,n,row,bs,*ai,*aj,mbs; | |||
2328 | PetscReal atmp; | |||
2329 | PetscScalar *x,zero = 0.0; | |||
2330 | MatScalar *aa; | |||
2331 | PetscInt ncols,brow,krow,kcol; | |||
2332 | ||||
2333 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2333; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2334 | if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),2334,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,73,PETSC_ERROR_INITIAL,"Not for factored matrix"); | |||
2335 | bs = A->rmap->bs; | |||
2336 | aa = a->a; | |||
2337 | ai = a->i; | |||
2338 | aj = a->j; | |||
2339 | mbs = a->mbs; | |||
2340 | ||||
2341 | ierr = VecSet(v,zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2341,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2342 | ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2342,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2343 | ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2343,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2344 | if (n != A->rmap->N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),2344,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector"); | |||
2345 | for (i=0; i<mbs; i++) { | |||
2346 | ncols = ai[1] - ai[0]; ai++; | |||
2347 | brow = bs*i; | |||
2348 | for (j=0; j<ncols; j++) { | |||
2349 | for (kcol=0; kcol<bs; kcol++) { | |||
2350 | for (krow=0; krow<bs; krow++) { | |||
2351 | atmp = PetscAbsScalar(*aa);aa++; | |||
2352 | row = brow + krow; /* row index */ | |||
2353 | if (PetscAbsScalar(x[row]) < atmp) {x[row] = atmp; if (idx) idx[row] = bs*(*aj) + kcol;} | |||
2354 | } | |||
2355 | } | |||
2356 | aj++; | |||
2357 | } | |||
2358 | } | |||
2359 | ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2359,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2360 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2361 | } | |||
2362 | ||||
2363 | PetscErrorCode MatCopy_SeqBAIJ(Mat A,Mat B,MatStructure str) | |||
2364 | { | |||
2365 | PetscErrorCode ierr; | |||
2366 | ||||
2367 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2367; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2368 | /* If the two matrices have the same copy implementation, use fast copy. */ | |||
2369 | if (str == SAME_NONZERO_PATTERN && (A->ops->copy == B->ops->copy)) { | |||
2370 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2371 | Mat_SeqBAIJ *b = (Mat_SeqBAIJ*)B->data; | |||
2372 | PetscInt ambs=a->mbs,bmbs=b->mbs,abs=A->rmap->bs,bbs=B->rmap->bs,bs2=abs*abs; | |||
2373 | ||||
2374 | if (a->i[ambs] != b->i[bmbs]) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Number of nonzero blocks in matrices A %D and B %D are different",a->i[ambs],b->i[bmbs])return PetscError(((MPI_Comm)0x44000001),2374,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,75,PETSC_ERROR_INITIAL,"Number of nonzero blocks in matrices A %D and B %D are different" ,a->i[ambs],b->i[bmbs]); | |||
2375 | if (abs != bbs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Block size A %D and B %D are different",abs,bbs)return PetscError(((MPI_Comm)0x44000001),2375,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,75,PETSC_ERROR_INITIAL,"Block size A %D and B %D are different" ,abs,bbs); | |||
2376 | ierr = PetscArraycpy(b->a,a->a,bs2*a->i[ambs])((sizeof(*(b->a)) != sizeof(*(a->a))) || PetscMemcpy(b-> a,a->a,(bs2*a->i[ambs])*sizeof(*(b->a))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2376,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2377 | ierr = PetscObjectStateIncrease((PetscObject)B)(((PetscObject)B)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2377,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2378 | } else { | |||
2379 | ierr = MatCopy_Basic(A,B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2379,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2380 | } | |||
2381 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2382 | } | |||
2383 | ||||
2384 | PetscErrorCode MatSetUp_SeqBAIJ(Mat A) | |||
2385 | { | |||
2386 | PetscErrorCode ierr; | |||
2387 | ||||
2388 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2388; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2389 | ierr = MatSeqBAIJSetPreallocation(A,A->rmap->bs,PETSC_DEFAULT-2,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2390 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2391 | } | |||
2392 | ||||
2393 | PetscErrorCode MatSeqBAIJGetArray_SeqBAIJ(Mat A,PetscScalar *array[]) | |||
2394 | { | |||
2395 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2396 | ||||
2397 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2397; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2398 | *array = a->a; | |||
2399 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2400 | } | |||
2401 | ||||
2402 | PetscErrorCode MatSeqBAIJRestoreArray_SeqBAIJ(Mat A,PetscScalar *array[]) | |||
2403 | { | |||
2404 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2404; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2405 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2406 | } | |||
2407 | ||||
2408 | PetscErrorCode MatAXPYGetPreallocation_SeqBAIJ(Mat Y,Mat X,PetscInt *nnz) | |||
2409 | { | |||
2410 | PetscInt bs = Y->rmap->bs,mbs = Y->rmap->N/bs; | |||
2411 | Mat_SeqBAIJ *x = (Mat_SeqBAIJ*)X->data; | |||
2412 | Mat_SeqBAIJ *y = (Mat_SeqBAIJ*)Y->data; | |||
2413 | PetscErrorCode ierr; | |||
2414 | ||||
2415 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2415; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2416 | /* Set the number of nonzeros in the new matrix */ | |||
2417 | ierr = MatAXPYGetPreallocation_SeqX_private(mbs,x->i,x->j,y->i,y->j,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2417,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2418 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2419 | } | |||
2420 | ||||
2421 | PetscErrorCode MatAXPY_SeqBAIJ(Mat Y,PetscScalar a,Mat X,MatStructure str) | |||
2422 | { | |||
2423 | Mat_SeqBAIJ *x = (Mat_SeqBAIJ*)X->data,*y = (Mat_SeqBAIJ*)Y->data; | |||
2424 | PetscErrorCode ierr; | |||
2425 | PetscInt bs=Y->rmap->bs,bs2=bs*bs; | |||
2426 | PetscBLASInt one=1; | |||
2427 | ||||
2428 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2428; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2429 | if (str == SAME_NONZERO_PATTERN) { | |||
2430 | PetscScalar alpha = a; | |||
2431 | PetscBLASInt bnz; | |||
2432 | ierr = PetscBLASIntCast(x->nz*bs2,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2432,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2433 | PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&bnz,&alpha,x->a,&one,y->a,&one))do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "BLASaxpy"; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2433; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); daxpy_(&bnz,&alpha,x->a,&one,y->a,&one ); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(2433 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),2433,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.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); | |||
2434 | ierr = PetscObjectStateIncrease((PetscObject)Y)(((PetscObject)Y)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2434,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2435 | } else if (str == SUBSET_NONZERO_PATTERN) { /* nonzeros of X is a subset of Y's */ | |||
2436 | ierr = MatAXPY_Basic(Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2436,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2437 | } else { | |||
2438 | Mat B; | |||
2439 | PetscInt *nnz; | |||
2440 | if (bs != X->rmap->bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Matrices must have same block size")return PetscError(((MPI_Comm)0x44000001),2440,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,60,PETSC_ERROR_INITIAL,"Matrices must have same block size"); | |||
2441 | ierr = PetscMalloc1(Y->rmap->N,&nnz)PetscMallocA(1,PETSC_FALSE,2441,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(Y->rmap->N)*sizeof(**(&nnz)),(&nnz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2441,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2442 | ierr = MatCreate(PetscObjectComm((PetscObject)Y),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2442,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2443 | ierr = PetscObjectSetName((PetscObject)B,((PetscObject)Y)->name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2443,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2444 | ierr = MatSetSizes(B,Y->rmap->n,Y->cmap->n,Y->rmap->N,Y->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2444,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2445 | ierr = MatSetBlockSizesFromMats(B,Y,Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2445,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2446 | ierr = MatSetType(B,(MatType) ((PetscObject)Y)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2446,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2447 | ierr = MatAXPYGetPreallocation_SeqBAIJ(Y,X,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2447,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2448 | ierr = MatSeqBAIJSetPreallocation(B,bs,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2448,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2449 | ierr = MatAXPY_BasicWithPreallocation(B,Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2449,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2450 | ierr = MatHeaderReplace(Y,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2450,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2451 | ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),2451,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((nnz) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2451,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2452 | } | |||
2453 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2454 | } | |||
2455 | ||||
2456 | PetscErrorCode MatRealPart_SeqBAIJ(Mat A) | |||
2457 | { | |||
2458 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2459 | PetscInt i,nz = a->bs2*a->i[a->mbs]; | |||
2460 | MatScalar *aa = a->a; | |||
2461 | ||||
2462 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2462; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2463 | for (i=0; i<nz; i++) aa[i] = PetscRealPart(aa[i])(aa[i]); | |||
2464 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2465 | } | |||
2466 | ||||
2467 | PetscErrorCode MatImaginaryPart_SeqBAIJ(Mat A) | |||
2468 | { | |||
2469 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2470 | PetscInt i,nz = a->bs2*a->i[a->mbs]; | |||
2471 | MatScalar *aa = a->a; | |||
2472 | ||||
2473 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2473; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2474 | for (i=0; i<nz; i++) aa[i] = PetscImaginaryPart(aa[i])((PetscReal)0.); | |||
2475 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2476 | } | |||
2477 | ||||
2478 | /* | |||
2479 | Code almost idential to MatGetColumnIJ_SeqAIJ() should share common code | |||
2480 | */ | |||
2481 | PetscErrorCode MatGetColumnIJ_SeqBAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done) | |||
2482 | { | |||
2483 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2484 | PetscErrorCode ierr; | |||
2485 | PetscInt bs = A->rmap->bs,i,*collengths,*cia,*cja,n = A->cmap->n/bs,m = A->rmap->n/bs; | |||
2486 | PetscInt nz = a->i[m],row,*jj,mr,col; | |||
2487 | ||||
2488 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2488; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2489 | *nn = n; | |||
2490 | if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2491 | if (symmetric) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not for BAIJ matrices")return PetscError(((MPI_Comm)0x44000001),2491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"Not for BAIJ matrices"); | |||
2492 | else { | |||
2493 | ierr = PetscCalloc1(n,&collengths)PetscMallocA(1,PETSC_TRUE,2493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(n)*sizeof(**(&collengths)),(&collengths));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2494 | ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,2494,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(n+1)*sizeof(**(&cia)),(&cia));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2494,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2495 | ierr = PetscMalloc1(nz,&cja)PetscMallocA(1,PETSC_FALSE,2495,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(nz)*sizeof(**(&cja)),(&cja));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2495,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2496 | jj = a->j; | |||
2497 | for (i=0; i<nz; i++) { | |||
2498 | collengths[jj[i]]++; | |||
2499 | } | |||
2500 | cia[0] = oshift; | |||
2501 | for (i=0; i<n; i++) { | |||
2502 | cia[i+1] = cia[i] + collengths[i]; | |||
2503 | } | |||
2504 | ierr = PetscArrayzero(collengths,n)PetscMemzero(collengths,(n)*sizeof(*(collengths)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2504,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2505 | jj = a->j; | |||
2506 | for (row=0; row<m; row++) { | |||
2507 | mr = a->i[row+1] - a->i[row]; | |||
2508 | for (i=0; i<mr; i++) { | |||
2509 | col = *jj++; | |||
2510 | ||||
2511 | cja[cia[col] + collengths[col]++ - oshift] = row + oshift; | |||
2512 | } | |||
2513 | } | |||
2514 | ierr = PetscFree(collengths)((*PetscTrFree)((void*)(collengths),2514,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((collengths) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2514,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2515 | *ia = cia; *ja = cja; | |||
2516 | } | |||
2517 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2518 | } | |||
2519 | ||||
2520 | PetscErrorCode MatRestoreColumnIJ_SeqBAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done) | |||
2521 | { | |||
2522 | PetscErrorCode ierr; | |||
2523 | ||||
2524 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2524; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2525 | if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2526 | ierr = PetscFree(*ia)((*PetscTrFree)((void*)(*ia),2526,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((*ia) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2526,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2527 | ierr = PetscFree(*ja)((*PetscTrFree)((void*)(*ja),2527,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((*ja) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2527,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2528 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2529 | } | |||
2530 | ||||
2531 | /* | |||
2532 | MatGetColumnIJ_SeqBAIJ_Color() and MatRestoreColumnIJ_SeqBAIJ_Color() are customized from | |||
2533 | MatGetColumnIJ_SeqBAIJ() and MatRestoreColumnIJ_SeqBAIJ() by adding an output | |||
2534 | spidx[], index of a->a, to be used in MatTransposeColoringCreate() and MatFDColoringCreate() | |||
2535 | */ | |||
2536 | PetscErrorCode MatGetColumnIJ_SeqBAIJ_Color(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscInt *spidx[],PetscBool *done) | |||
2537 | { | |||
2538 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2539 | PetscErrorCode ierr; | |||
2540 | PetscInt i,*collengths,*cia,*cja,n=a->nbs,m=a->mbs; | |||
2541 | PetscInt nz = a->i[m],row,*jj,mr,col; | |||
2542 | PetscInt *cspidx; | |||
2543 | ||||
2544 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2544; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2545 | *nn = n; | |||
2546 | if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2547 | ||||
2548 | ierr = PetscCalloc1(n,&collengths)PetscMallocA(1,PETSC_TRUE,2548,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(n)*sizeof(**(&collengths)),(&collengths));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2548,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2549 | ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,2549,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(n+1)*sizeof(**(&cia)),(&cia));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2549,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2550 | ierr = PetscMalloc1(nz,&cja)PetscMallocA(1,PETSC_FALSE,2550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(nz)*sizeof(**(&cja)),(&cja));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2551 | ierr = PetscMalloc1(nz,&cspidx)PetscMallocA(1,PETSC_FALSE,2551,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(nz)*sizeof(**(&cspidx)),(&cspidx));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2551,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2552 | jj = a->j; | |||
2553 | for (i=0; i<nz; i++) { | |||
2554 | collengths[jj[i]]++; | |||
2555 | } | |||
2556 | cia[0] = oshift; | |||
2557 | for (i=0; i<n; i++) { | |||
2558 | cia[i+1] = cia[i] + collengths[i]; | |||
2559 | } | |||
2560 | ierr = PetscArrayzero(collengths,n)PetscMemzero(collengths,(n)*sizeof(*(collengths)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2560,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2561 | jj = a->j; | |||
2562 | for (row=0; row<m; row++) { | |||
2563 | mr = a->i[row+1] - a->i[row]; | |||
2564 | for (i=0; i<mr; i++) { | |||
2565 | col = *jj++; | |||
2566 | cspidx[cia[col] + collengths[col] - oshift] = a->i[row] + i; /* index of a->j */ | |||
2567 | cja[cia[col] + collengths[col]++ - oshift] = row + oshift; | |||
2568 | } | |||
2569 | } | |||
2570 | ierr = PetscFree(collengths)((*PetscTrFree)((void*)(collengths),2570,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((collengths) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2570,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2571 | *ia = cia; | |||
2572 | *ja = cja; | |||
2573 | *spidx = cspidx; | |||
2574 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2575 | } | |||
2576 | ||||
2577 | PetscErrorCode MatRestoreColumnIJ_SeqBAIJ_Color(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscInt *spidx[],PetscBool *done) | |||
2578 | { | |||
2579 | PetscErrorCode ierr; | |||
2580 | ||||
2581 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2581; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2582 | ierr = MatRestoreColumnIJ_SeqBAIJ(A,oshift,symmetric,inodecompressed,n,ia,ja,done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2582,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2583 | ierr = PetscFree(*spidx)((*PetscTrFree)((void*)(*spidx),2583,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((*spidx) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2583,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2584 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2585 | } | |||
2586 | ||||
2587 | PetscErrorCode MatShift_SeqBAIJ(Mat Y,PetscScalar a) | |||
2588 | { | |||
2589 | PetscErrorCode ierr; | |||
2590 | Mat_SeqBAIJ *aij = (Mat_SeqBAIJ*)Y->data; | |||
2591 | ||||
2592 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2592; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2593 | if (!Y->preallocated || !aij->nz) { | |||
2594 | ierr = MatSeqBAIJSetPreallocation(Y,Y->rmap->bs,1,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2594,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2595 | } | |||
2596 | ierr = MatShift_Basic(Y,a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2596,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2597 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2598 | } | |||
2599 | ||||
2600 | /* -------------------------------------------------------------------*/ | |||
2601 | static struct _MatOps MatOps_Values = {MatSetValues_SeqBAIJ, | |||
2602 | MatGetRow_SeqBAIJ, | |||
2603 | MatRestoreRow_SeqBAIJ, | |||
2604 | MatMult_SeqBAIJ_N, | |||
2605 | /* 4*/ MatMultAdd_SeqBAIJ_N, | |||
2606 | MatMultTranspose_SeqBAIJ, | |||
2607 | MatMultTransposeAdd_SeqBAIJ, | |||
2608 | 0, | |||
2609 | 0, | |||
2610 | 0, | |||
2611 | /* 10*/ 0, | |||
2612 | MatLUFactor_SeqBAIJ, | |||
2613 | 0, | |||
2614 | 0, | |||
2615 | MatTranspose_SeqBAIJ, | |||
2616 | /* 15*/ MatGetInfo_SeqBAIJ, | |||
2617 | MatEqual_SeqBAIJ, | |||
2618 | MatGetDiagonal_SeqBAIJ, | |||
2619 | MatDiagonalScale_SeqBAIJ, | |||
2620 | MatNorm_SeqBAIJ, | |||
2621 | /* 20*/ 0, | |||
2622 | MatAssemblyEnd_SeqBAIJ, | |||
2623 | MatSetOption_SeqBAIJ, | |||
2624 | MatZeroEntries_SeqBAIJ, | |||
2625 | /* 24*/ MatZeroRows_SeqBAIJ, | |||
2626 | 0, | |||
2627 | 0, | |||
2628 | 0, | |||
2629 | 0, | |||
2630 | /* 29*/ MatSetUp_SeqBAIJ, | |||
2631 | 0, | |||
2632 | 0, | |||
2633 | 0, | |||
2634 | 0, | |||
2635 | /* 34*/ MatDuplicate_SeqBAIJ, | |||
2636 | 0, | |||
2637 | 0, | |||
2638 | MatILUFactor_SeqBAIJ, | |||
2639 | 0, | |||
2640 | /* 39*/ MatAXPY_SeqBAIJ, | |||
2641 | MatCreateSubMatrices_SeqBAIJ, | |||
2642 | MatIncreaseOverlap_SeqBAIJ, | |||
2643 | MatGetValues_SeqBAIJ, | |||
2644 | MatCopy_SeqBAIJ, | |||
2645 | /* 44*/ 0, | |||
2646 | MatScale_SeqBAIJ, | |||
2647 | MatShift_SeqBAIJ, | |||
2648 | 0, | |||
2649 | MatZeroRowsColumns_SeqBAIJ, | |||
2650 | /* 49*/ 0, | |||
2651 | MatGetRowIJ_SeqBAIJ, | |||
2652 | MatRestoreRowIJ_SeqBAIJ, | |||
2653 | MatGetColumnIJ_SeqBAIJ, | |||
2654 | MatRestoreColumnIJ_SeqBAIJ, | |||
2655 | /* 54*/ MatFDColoringCreate_SeqXAIJ, | |||
2656 | 0, | |||
2657 | 0, | |||
2658 | 0, | |||
2659 | MatSetValuesBlocked_SeqBAIJ, | |||
2660 | /* 59*/ MatCreateSubMatrix_SeqBAIJ, | |||
2661 | MatDestroy_SeqBAIJ, | |||
2662 | MatView_SeqBAIJ, | |||
2663 | 0, | |||
2664 | 0, | |||
2665 | /* 64*/ 0, | |||
2666 | 0, | |||
2667 | 0, | |||
2668 | 0, | |||
2669 | 0, | |||
2670 | /* 69*/ MatGetRowMaxAbs_SeqBAIJ, | |||
2671 | 0, | |||
2672 | MatConvert_Basic, | |||
2673 | 0, | |||
2674 | 0, | |||
2675 | /* 74*/ 0, | |||
2676 | MatFDColoringApply_BAIJ, | |||
2677 | 0, | |||
2678 | 0, | |||
2679 | 0, | |||
2680 | /* 79*/ 0, | |||
2681 | 0, | |||
2682 | 0, | |||
2683 | 0, | |||
2684 | MatLoad_SeqBAIJ, | |||
2685 | /* 84*/ 0, | |||
2686 | 0, | |||
2687 | 0, | |||
2688 | 0, | |||
2689 | 0, | |||
2690 | /* 89*/ 0, | |||
2691 | 0, | |||
2692 | 0, | |||
2693 | 0, | |||
2694 | 0, | |||
2695 | /* 94*/ 0, | |||
2696 | 0, | |||
2697 | 0, | |||
2698 | 0, | |||
2699 | 0, | |||
2700 | /* 99*/ 0, | |||
2701 | 0, | |||
2702 | 0, | |||
2703 | 0, | |||
2704 | 0, | |||
2705 | /*104*/ 0, | |||
2706 | MatRealPart_SeqBAIJ, | |||
2707 | MatImaginaryPart_SeqBAIJ, | |||
2708 | 0, | |||
2709 | 0, | |||
2710 | /*109*/ 0, | |||
2711 | 0, | |||
2712 | 0, | |||
2713 | 0, | |||
2714 | MatMissingDiagonal_SeqBAIJ, | |||
2715 | /*114*/ 0, | |||
2716 | 0, | |||
2717 | 0, | |||
2718 | 0, | |||
2719 | 0, | |||
2720 | /*119*/ 0, | |||
2721 | 0, | |||
2722 | MatMultHermitianTranspose_SeqBAIJ, | |||
2723 | MatMultHermitianTransposeAdd_SeqBAIJ, | |||
2724 | 0, | |||
2725 | /*124*/ 0, | |||
2726 | 0, | |||
2727 | MatInvertBlockDiagonal_SeqBAIJ, | |||
2728 | 0, | |||
2729 | 0, | |||
2730 | /*129*/ 0, | |||
2731 | 0, | |||
2732 | 0, | |||
2733 | 0, | |||
2734 | 0, | |||
2735 | /*134*/ 0, | |||
2736 | 0, | |||
2737 | 0, | |||
2738 | 0, | |||
2739 | 0, | |||
2740 | /*139*/ MatSetBlockSizes_Default, | |||
2741 | 0, | |||
2742 | 0, | |||
2743 | MatFDColoringSetUp_SeqXAIJ, | |||
2744 | 0, | |||
2745 | /*144*/MatCreateMPIMatConcatenateSeqMat_SeqBAIJ, | |||
2746 | MatDestroySubMatrices_SeqBAIJ | |||
2747 | }; | |||
2748 | ||||
2749 | PetscErrorCode MatStoreValues_SeqBAIJ(Mat mat) | |||
2750 | { | |||
2751 | Mat_SeqBAIJ *aij = (Mat_SeqBAIJ*)mat->data; | |||
2752 | PetscInt nz = aij->i[aij->mbs]*aij->bs2; | |||
2753 | PetscErrorCode ierr; | |||
2754 | ||||
2755 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2755; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2756 | if (aij->nonew != 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first")return PetscError(((MPI_Comm)0x44000001),2756,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,58,PETSC_ERROR_INITIAL,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first" ); | |||
2757 | ||||
2758 | /* allocate space for values if not already there */ | |||
2759 | if (!aij->saved_values) { | |||
2760 | ierr = PetscMalloc1(nz+1,&aij->saved_values)PetscMallocA(1,PETSC_FALSE,2760,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(nz+1)*sizeof(**(&aij->saved_values)),(&aij ->saved_values));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2760,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2761 | ierr = PetscLogObjectMemory((PetscObject)mat,(nz+1)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2761,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2762 | } | |||
2763 | ||||
2764 | /* copy values over */ | |||
2765 | ierr = PetscArraycpy(aij->saved_values,aij->a,nz)((sizeof(*(aij->saved_values)) != sizeof(*(aij->a))) || PetscMemcpy(aij->saved_values,aij->a,(nz)*sizeof(*(aij ->saved_values))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2765,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2766 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2767 | } | |||
2768 | ||||
2769 | PetscErrorCode MatRetrieveValues_SeqBAIJ(Mat mat) | |||
2770 | { | |||
2771 | Mat_SeqBAIJ *aij = (Mat_SeqBAIJ*)mat->data; | |||
2772 | PetscErrorCode ierr; | |||
2773 | PetscInt nz = aij->i[aij->mbs]*aij->bs2; | |||
2774 | ||||
2775 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2775; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2776 | if (aij->nonew != 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first")return PetscError(((MPI_Comm)0x44000001),2776,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,58,PETSC_ERROR_INITIAL,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first" ); | |||
2777 | if (!aij->saved_values) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatStoreValues(A);first")return PetscError(((MPI_Comm)0x44000001),2777,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,58,PETSC_ERROR_INITIAL,"Must call MatStoreValues(A);first"); | |||
2778 | ||||
2779 | /* copy values over */ | |||
2780 | ierr = PetscArraycpy(aij->a,aij->saved_values,nz)((sizeof(*(aij->a)) != sizeof(*(aij->saved_values))) || PetscMemcpy(aij->a,aij->saved_values,(nz)*sizeof(*(aij ->a))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2780,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2781 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2782 | } | |||
2783 | ||||
2784 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqBAIJ_SeqAIJ(Mat, MatType,MatReuse,Mat*); | |||
2785 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqBAIJ_SeqSBAIJ(Mat, MatType,MatReuse,Mat*); | |||
2786 | ||||
2787 | PetscErrorCode MatSeqBAIJSetPreallocation_SeqBAIJ(Mat B,PetscInt bs,PetscInt nz,PetscInt *nnz) | |||
2788 | { | |||
2789 | Mat_SeqBAIJ *b; | |||
2790 | PetscErrorCode ierr; | |||
2791 | PetscInt i,mbs,nbs,bs2; | |||
2792 | PetscBool flg = PETSC_FALSE,skipallocation = PETSC_FALSE,realalloc = PETSC_FALSE; | |||
2793 | ||||
2794 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2794; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2795 | if (nz >= 0 || nnz) realalloc = PETSC_TRUE; | |||
2796 | if (nz == MAT_SKIP_ALLOCATION-4) { | |||
2797 | skipallocation = PETSC_TRUE; | |||
2798 | nz = 0; | |||
2799 | } | |||
2800 | ||||
2801 | ierr = MatSetBlockSize(B,PetscAbs(bs)(((bs) >= 0) ? (bs) : (-(bs))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2801,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2802 | ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2803 | ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2803,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2804 | ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2804,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2805 | ||||
2806 | B->preallocated = PETSC_TRUE; | |||
2807 | ||||
2808 | mbs = B->rmap->n/bs; | |||
2809 | nbs = B->cmap->n/bs; | |||
2810 | bs2 = bs*bs; | |||
2811 | ||||
2812 | if (mbs*bs!=B->rmap->n || nbs*bs!=B->cmap->n) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Number rows %D, cols %D must be divisible by blocksize %D",B->rmap->N,B->cmap->n,bs)return PetscError(((MPI_Comm)0x44000001),2812,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,60,PETSC_ERROR_INITIAL,"Number rows %D, cols %D must be divisible by blocksize %D" ,B->rmap->N,B->cmap->n,bs); | |||
2813 | ||||
2814 | if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 5; | |||
2815 | if (nz < 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"nz cannot be less than 0: value %D",nz)return PetscError(((MPI_Comm)0x44000001),2815,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"nz cannot be less than 0: value %D", nz); | |||
2816 | if (nnz) { | |||
2817 | for (i=0; i<mbs; i++) { | |||
2818 | if (nnz[i] < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"nnz cannot be less than 0: local row %D value %D",i,nnz[i])return PetscError(((MPI_Comm)0x44000001),2818,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"nnz cannot be less than 0: local row %D value %D" ,i,nnz[i]); | |||
2819 | if (nnz[i] > nbs) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"nnz cannot be greater than block row length: local row %D value %D rowlength %D",i,nnz[i],nbs)return PetscError(((MPI_Comm)0x44000001),2819,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"nnz cannot be greater than block row length: local row %D value %D rowlength %D" ,i,nnz[i],nbs); | |||
2820 | } | |||
2821 | } | |||
2822 | ||||
2823 | b = (Mat_SeqBAIJ*)B->data; | |||
2824 | ierr = PetscOptionsBegin(PetscObjectComm((PetscObject)B),NULL,"Optimize options for SEQBAIJ matrix 2 ","Mat")0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; PetscMemzero (PetscOptionsObject,sizeof(PetscOptionItems)); for (PetscOptionsObject ->count=(PetscOptionsPublish?-1:1); PetscOptionsObject-> count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr = PetscOptionsBegin_Private(PetscOptionsObject,PetscObjectComm ((PetscObject)B),((void*)0),"Optimize options for SEQBAIJ matrix 2 " ,"Mat");do {if (__builtin_expect(!!(_5_ierr),0)) return PetscError (((MPI_Comm)0x44000001),2824,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2824,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2825 | ierr = PetscOptionsBool("-mat_no_unroll","Do not optimize for block size (slow)",NULL,flg,&flg,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-mat_no_unroll", "Do not optimize for block size (slow)",((void*)0),flg,&flg ,((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2825,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2826 | ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if ( __builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm )0x44000001),2826,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2826,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2827 | ||||
2828 | if (!flg) { | |||
2829 | switch (bs) { | |||
2830 | case 1: | |||
2831 | B->ops->mult = MatMult_SeqBAIJ_1; | |||
2832 | B->ops->multadd = MatMultAdd_SeqBAIJ_1; | |||
2833 | break; | |||
2834 | case 2: | |||
2835 | B->ops->mult = MatMult_SeqBAIJ_2; | |||
2836 | B->ops->multadd = MatMultAdd_SeqBAIJ_2; | |||
2837 | break; | |||
2838 | case 3: | |||
2839 | B->ops->mult = MatMult_SeqBAIJ_3; | |||
2840 | B->ops->multadd = MatMultAdd_SeqBAIJ_3; | |||
2841 | break; | |||
2842 | case 4: | |||
2843 | B->ops->mult = MatMult_SeqBAIJ_4; | |||
2844 | B->ops->multadd = MatMultAdd_SeqBAIJ_4; | |||
2845 | break; | |||
2846 | case 5: | |||
2847 | B->ops->mult = MatMult_SeqBAIJ_5; | |||
2848 | B->ops->multadd = MatMultAdd_SeqBAIJ_5; | |||
2849 | break; | |||
2850 | case 6: | |||
2851 | B->ops->mult = MatMult_SeqBAIJ_6; | |||
2852 | B->ops->multadd = MatMultAdd_SeqBAIJ_6; | |||
2853 | break; | |||
2854 | case 7: | |||
2855 | B->ops->mult = MatMult_SeqBAIJ_7; | |||
2856 | B->ops->multadd = MatMultAdd_SeqBAIJ_7; | |||
2857 | break; | |||
2858 | case 9: | |||
2859 | #if defined(PETSC_HAVE_IMMINTRIN_H1) && defined(__AVX2__) && defined(__FMA__) && defined(PETSC_USE_REAL_DOUBLE1) && !defined(PETSC_USE_COMPLEX) && !defined(PETSC_USE_64BIT_INDICES) | |||
2860 | B->ops->mult = MatMult_SeqBAIJ_9_AVX2; | |||
2861 | B->ops->multadd = MatMultAdd_SeqBAIJ_9_AVX2; | |||
2862 | #else | |||
2863 | B->ops->mult = MatMult_SeqBAIJ_N; | |||
2864 | B->ops->multadd = MatMultAdd_SeqBAIJ_N; | |||
2865 | #endif | |||
2866 | break; | |||
2867 | case 11: | |||
2868 | B->ops->mult = MatMult_SeqBAIJ_11; | |||
2869 | B->ops->multadd = MatMultAdd_SeqBAIJ_11; | |||
2870 | break; | |||
2871 | case 15: | |||
2872 | B->ops->mult = MatMult_SeqBAIJ_15_ver1; | |||
2873 | B->ops->multadd = MatMultAdd_SeqBAIJ_N; | |||
2874 | break; | |||
2875 | default: | |||
2876 | B->ops->mult = MatMult_SeqBAIJ_N; | |||
2877 | B->ops->multadd = MatMultAdd_SeqBAIJ_N; | |||
2878 | break; | |||
2879 | } | |||
2880 | } | |||
2881 | B->ops->sor = MatSOR_SeqBAIJ; | |||
2882 | b->mbs = mbs; | |||
2883 | b->nbs = nbs; | |||
2884 | if (!skipallocation) { | |||
2885 | if (!b->imax) { | |||
2886 | ierr = PetscMalloc2(mbs,&b->imax,mbs,&b->ilen)PetscMallocA(2,PETSC_FALSE,2886,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(mbs)*sizeof(**(&b->imax)),(&b->imax), (size_t)(mbs)*sizeof(**(&b->ilen)),(&b->ilen));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2886,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2887 | ierr = PetscLogObjectMemory((PetscObject)B,2*mbs*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2887,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2888 | ||||
2889 | b->free_imax_ilen = PETSC_TRUE; | |||
2890 | } | |||
2891 | /* b->ilen will count nonzeros in each block row so far. */ | |||
2892 | for (i=0; i<mbs; i++) b->ilen[i] = 0; | |||
2893 | if (!nnz) { | |||
2894 | if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 5; | |||
2895 | else if (nz < 0) nz = 1; | |||
2896 | nz = PetscMin(nz,nbs)(((nz)<(nbs)) ? (nz) : (nbs)); | |||
2897 | for (i=0; i<mbs; i++) b->imax[i] = nz; | |||
2898 | nz = nz*mbs; | |||
2899 | } else { | |||
2900 | nz = 0; | |||
2901 | for (i=0; i<mbs; i++) {b->imax[i] = nnz[i]; nz += nnz[i];} | |||
2902 | } | |||
2903 | ||||
2904 | /* allocate the matrix space */ | |||
2905 | ierr = MatSeqXAIJFreeAIJ(B,&b->a,&b->j,&b->i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2905,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2906 | if (B->structure_only) { | |||
2907 | ierr = PetscMalloc1(nz,&b->j)PetscMallocA(1,PETSC_FALSE,2907,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(nz)*sizeof(**(&b->j)),(&b->j));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2907,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2908 | ierr = PetscMalloc1(B->rmap->N+1,&b->i)PetscMallocA(1,PETSC_FALSE,2908,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(B->rmap->N+1)*sizeof(**(&b->i)),(& b->i));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2908,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2909 | ierr = PetscLogObjectMemory((PetscObject)B,(B->rmap->N+1)*sizeof(PetscInt)+nz*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2909,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2910 | } else { | |||
2911 | ierr = PetscMalloc3(bs2*nz,&b->a,nz,&b->j,B->rmap->N+1,&b->i)PetscMallocA(3,PETSC_FALSE,2911,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(bs2*nz)*sizeof(**(&b->a)),(&b->a),(size_t )(nz)*sizeof(**(&b->j)),(&b->j),(size_t)(B-> rmap->N+1)*sizeof(**(&b->i)),(&b->i));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2911,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2912 | ierr = PetscLogObjectMemory((PetscObject)B,(B->rmap->N+1)*sizeof(PetscInt)+nz*(bs2*sizeof(PetscScalar)+sizeof(PetscInt)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2912,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2913 | ierr = PetscArrayzero(b->a,nz*bs2)PetscMemzero(b->a,(nz*bs2)*sizeof(*(b->a)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2913,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2914 | } | |||
2915 | ierr = PetscArrayzero(b->j,nz)PetscMemzero(b->j,(nz)*sizeof(*(b->j)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2915,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2916 | ||||
2917 | if (B->structure_only) { | |||
2918 | b->singlemalloc = PETSC_FALSE; | |||
2919 | b->free_a = PETSC_FALSE; | |||
2920 | } else { | |||
2921 | b->singlemalloc = PETSC_TRUE; | |||
2922 | b->free_a = PETSC_TRUE; | |||
2923 | } | |||
2924 | b->free_ij = PETSC_TRUE; | |||
2925 | ||||
2926 | b->i[0] = 0; | |||
2927 | for (i=1; i<mbs+1; i++) { | |||
2928 | b->i[i] = b->i[i-1] + b->imax[i-1]; | |||
2929 | } | |||
2930 | ||||
2931 | } else { | |||
2932 | b->free_a = PETSC_FALSE; | |||
2933 | b->free_ij = PETSC_FALSE; | |||
2934 | } | |||
2935 | ||||
2936 | b->bs2 = bs2; | |||
2937 | b->mbs = mbs; | |||
2938 | b->nz = 0; | |||
2939 | b->maxnz = nz; | |||
2940 | B->info.nz_unneeded = (PetscReal)b->maxnz*bs2; | |||
2941 | B->was_assembled = PETSC_FALSE; | |||
2942 | B->assembled = PETSC_FALSE; | |||
2943 | if (realalloc) {ierr = MatSetOption(B,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2943,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2944 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2945 | } | |||
2946 | ||||
2947 | PetscErrorCode MatSeqBAIJSetPreallocationCSR_SeqBAIJ(Mat B,PetscInt bs,const PetscInt ii[],const PetscInt jj[],const PetscScalar V[]) | |||
2948 | { | |||
2949 | PetscInt i,m,nz,nz_max=0,*nnz; | |||
2950 | PetscScalar *values=0; | |||
2951 | PetscBool roworiented = ((Mat_SeqBAIJ*)B->data)->roworiented; | |||
2952 | PetscErrorCode ierr; | |||
2953 | ||||
2954 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2954; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2955 | if (bs < 1) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Invalid block size specified, must be positive but it is %D",bs)return PetscError(((MPI_Comm)0x44000001),2955,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Invalid block size specified, must be positive but it is %D" ,bs); | |||
2956 | ierr = PetscLayoutSetBlockSize(B->rmap,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2956,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2957 | ierr = PetscLayoutSetBlockSize(B->cmap,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2957,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2958 | ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2958,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2959 | ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2959,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2960 | ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2960,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2961 | m = B->rmap->n/bs; | |||
2962 | ||||
2963 | if (ii[0] != 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE, "ii[0] must be 0 but it is %D",ii[0])return PetscError(((MPI_Comm)0x44000001),2963,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"ii[0] must be 0 but it is %D",ii[0]); | |||
2964 | ierr = PetscMalloc1(m+1, &nnz)PetscMallocA(1,PETSC_FALSE,2964,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(m+1)*sizeof(**(&nnz)),(&nnz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2964,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2965 | for (i=0; i<m; i++) { | |||
2966 | nz = ii[i+1]- ii[i]; | |||
2967 | if (nz < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE, "Local row %D has a negative number of columns %D",i,nz)return PetscError(((MPI_Comm)0x44000001),2967,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Local row %D has a negative number of columns %D" ,i,nz); | |||
2968 | nz_max = PetscMax(nz_max, nz)(((nz_max)<(nz)) ? (nz) : (nz_max)); | |||
2969 | nnz[i] = nz; | |||
2970 | } | |||
2971 | ierr = MatSeqBAIJSetPreallocation(B,bs,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2971,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2972 | ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),2972,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((nnz) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2972,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2973 | ||||
2974 | values = (PetscScalar*)V; | |||
2975 | if (!values) { | |||
2976 | ierr = PetscCalloc1(bs*bs*(nz_max+1),&values)PetscMallocA(1,PETSC_TRUE,2976,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(bs*bs*(nz_max+1))*sizeof(**(&values)),(&values ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2976,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2977 | } | |||
2978 | for (i=0; i<m; i++) { | |||
2979 | PetscInt ncols = ii[i+1] - ii[i]; | |||
2980 | const PetscInt *icols = jj + ii[i]; | |||
2981 | const PetscScalar *svals = values + (V ? (bs*bs*ii[i]) : 0); | |||
2982 | if (!roworiented) { | |||
2983 | ierr = MatSetValuesBlocked_SeqBAIJ(B,1,&i,ncols,icols,svals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2983,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2984 | } else { | |||
2985 | PetscInt j; | |||
2986 | for (j=0; j<ncols; j++) { | |||
2987 | const PetscScalar *svals = values + (V ? (bs*bs*(ii[i]+j)) : 0); | |||
2988 | ierr = MatSetValuesBlocked_SeqBAIJ(B,1,&i,1,&icols[j],svals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2988,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2989 | } | |||
2990 | } | |||
2991 | } | |||
2992 | if (!V) { ierr = PetscFree(values)((*PetscTrFree)((void*)(values),2992,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((values) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2992,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } | |||
2993 | ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2993,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2994 | ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2994,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2995 | ierr = MatSetOption(B,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2995,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2996 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2997 | } | |||
2998 | ||||
2999 | /*MC | |||
3000 | MATSEQBAIJ - MATSEQBAIJ = "seqbaij" - A matrix type to be used for sequential block sparse matrices, based on | |||
3001 | block sparse compressed row format. | |||
3002 | ||||
3003 | Options Database Keys: | |||
3004 | . -mat_type seqbaij - sets the matrix type to "seqbaij" during a call to MatSetFromOptions() | |||
3005 | ||||
3006 | Level: beginner | |||
3007 | ||||
3008 | .seealso: MatCreateSeqBAIJ() | |||
3009 | M*/ | |||
3010 | ||||
3011 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqBAIJ_SeqBSTRM(Mat, MatType,MatReuse,Mat*); | |||
3012 | ||||
3013 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_SeqBAIJ(Mat B) | |||
3014 | { | |||
3015 | PetscErrorCode ierr; | |||
3016 | PetscMPIInt size; | |||
3017 | Mat_SeqBAIJ *b; | |||
3018 | ||||
3019 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 3019; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3020 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3020,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3021 | if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Comm must be of size 1")return PetscError(((MPI_Comm)0x44000001),3021,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"Comm must be of size 1"); | |||
3022 | ||||
3023 | ierr = PetscNewLog(B,&b)(PetscMallocA(1,PETSC_TRUE,3023,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(1)*sizeof(**(((&b)))),(((&b)))) || PetscLogObjectMemory ((PetscObject)B,sizeof(**(&b))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3023,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3024 | B->data = (void*)b; | |||
3025 | ierr = PetscMemcpy(B->ops,&MatOps_Values,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3025,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3026 | ||||
3027 | b->row = 0; | |||
3028 | b->col = 0; | |||
3029 | b->icol = 0; | |||
3030 | b->reallocs = 0; | |||
3031 | b->saved_values = 0; | |||
3032 | ||||
3033 | b->roworiented = PETSC_TRUE; | |||
3034 | b->nonew = 0; | |||
3035 | b->diag = 0; | |||
3036 | B->spptr = 0; | |||
3037 | B->info.nz_unneeded = (PetscReal)b->maxnz*b->bs2; | |||
3038 | b->keepnonzeropattern = PETSC_FALSE; | |||
3039 | ||||
3040 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatInvertBlockDiagonal_C",MatInvertBlockDiagonal_SeqBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatInvertBlockDiagonal_C" ,(PetscVoidFunction)(MatInvertBlockDiagonal_SeqBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3040,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3041 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatStoreValues_C",MatStoreValues_SeqBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatStoreValues_C" ,(PetscVoidFunction)(MatStoreValues_SeqBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3041,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3042 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatRetrieveValues_C",MatRetrieveValues_SeqBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatRetrieveValues_C" ,(PetscVoidFunction)(MatRetrieveValues_SeqBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3042,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3043 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqBAIJSetColumnIndices_C",MatSeqBAIJSetColumnIndices_SeqBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqBAIJSetColumnIndices_C" ,(PetscVoidFunction)(MatSeqBAIJSetColumnIndices_SeqBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3043,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3044 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqbaij_seqaij_C",MatConvert_SeqBAIJ_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqbaij_seqaij_C" ,(PetscVoidFunction)(MatConvert_SeqBAIJ_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3044,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3045 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqbaij_seqsbaij_C",MatConvert_SeqBAIJ_SeqSBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqbaij_seqsbaij_C" ,(PetscVoidFunction)(MatConvert_SeqBAIJ_SeqSBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3045,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3046 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqBAIJSetPreallocation_C",MatSeqBAIJSetPreallocation_SeqBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqBAIJSetPreallocation_C" ,(PetscVoidFunction)(MatSeqBAIJSetPreallocation_SeqBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3046,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3047 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqBAIJSetPreallocationCSR_C",MatSeqBAIJSetPreallocationCSR_SeqBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqBAIJSetPreallocationCSR_C" ,(PetscVoidFunction)(MatSeqBAIJSetPreallocationCSR_SeqBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3047,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3048 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatIsTranspose_C",MatIsTranspose_SeqBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatIsTranspose_C" ,(PetscVoidFunction)(MatIsTranspose_SeqBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3049 | #if defined(PETSC_HAVE_HYPRE) | |||
3050 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqbaij_hypre_C",MatConvert_AIJ_HYPRE)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqbaij_hypre_C" ,(PetscVoidFunction)(MatConvert_AIJ_HYPRE));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3050,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3051 | #endif | |||
3052 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqbaij_is_C",MatConvert_XAIJ_IS)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqbaij_is_C" ,(PetscVoidFunction)(MatConvert_XAIJ_IS));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3052,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3053 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatPtAP_is_seqbaij_C",MatPtAP_IS_XAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatPtAP_is_seqbaij_C" ,(PetscVoidFunction)(MatPtAP_IS_XAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3053,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3054 | ierr = PetscObjectChangeTypeName((PetscObject)B,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3054,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3055 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3056 | } | |||
3057 | ||||
3058 | PetscErrorCode MatDuplicateNoCreate_SeqBAIJ(Mat C,Mat A,MatDuplicateOption cpvalues,PetscBool mallocmatspace) | |||
3059 | { | |||
3060 | Mat_SeqBAIJ *c = (Mat_SeqBAIJ*)C->data,*a = (Mat_SeqBAIJ*)A->data; | |||
3061 | PetscErrorCode ierr; | |||
3062 | PetscInt i,mbs = a->mbs,nz = a->nz,bs2 = a->bs2; | |||
3063 | ||||
3064 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 3064; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3065 | if (a->i[mbs] != nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Corrupt matrix")return PetscError(((MPI_Comm)0x44000001),3065,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,77,PETSC_ERROR_INITIAL,"Corrupt matrix"); | |||
3066 | ||||
3067 | if (cpvalues == MAT_SHARE_NONZERO_PATTERN) { | |||
3068 | c->imax = a->imax; | |||
3069 | c->ilen = a->ilen; | |||
3070 | c->free_imax_ilen = PETSC_FALSE; | |||
3071 | } else { | |||
3072 | ierr = PetscMalloc2(mbs,&c->imax,mbs,&c->ilen)PetscMallocA(2,PETSC_FALSE,3072,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(mbs)*sizeof(**(&c->imax)),(&c->imax), (size_t)(mbs)*sizeof(**(&c->ilen)),(&c->ilen));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3072,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3073 | ierr = PetscLogObjectMemory((PetscObject)C,2*mbs*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3073,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3074 | for (i=0; i<mbs; i++) { | |||
3075 | c->imax[i] = a->imax[i]; | |||
3076 | c->ilen[i] = a->ilen[i]; | |||
3077 | } | |||
3078 | c->free_imax_ilen = PETSC_TRUE; | |||
3079 | } | |||
3080 | ||||
3081 | /* allocate the matrix space */ | |||
3082 | if (mallocmatspace) { | |||
3083 | if (cpvalues == MAT_SHARE_NONZERO_PATTERN) { | |||
3084 | ierr = PetscCalloc1(bs2*nz,&c->a)PetscMallocA(1,PETSC_TRUE,3084,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(bs2*nz)*sizeof(**(&c->a)),(&c->a));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3084,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3085 | ierr = PetscLogObjectMemory((PetscObject)C,a->i[mbs]*bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3085,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3086 | ||||
3087 | c->i = a->i; | |||
3088 | c->j = a->j; | |||
3089 | c->singlemalloc = PETSC_FALSE; | |||
3090 | c->free_a = PETSC_TRUE; | |||
3091 | c->free_ij = PETSC_FALSE; | |||
3092 | c->parent = A; | |||
3093 | C->preallocated = PETSC_TRUE; | |||
3094 | C->assembled = PETSC_TRUE; | |||
3095 | ||||
3096 | ierr = PetscObjectReference((PetscObject)A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3096,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3097 | ierr = MatSetOption(A,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3097,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3098 | ierr = MatSetOption(C,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3098,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3099 | } else { | |||
3100 | ierr = PetscMalloc3(bs2*nz,&c->a,nz,&c->j,mbs+1,&c->i)PetscMallocA(3,PETSC_FALSE,3100,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(bs2*nz)*sizeof(**(&c->a)),(&c->a),(size_t )(nz)*sizeof(**(&c->j)),(&c->j),(size_t)(mbs+1) *sizeof(**(&c->i)),(&c->i));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3100,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3101 | ierr = PetscLogObjectMemory((PetscObject)C,a->i[mbs]*(bs2*sizeof(PetscScalar)+sizeof(PetscInt))+(mbs+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3102 | ||||
3103 | c->singlemalloc = PETSC_TRUE; | |||
3104 | c->free_a = PETSC_TRUE; | |||
3105 | c->free_ij = PETSC_TRUE; | |||
3106 | ||||
3107 | ierr = PetscArraycpy(c->i,a->i,mbs+1)((sizeof(*(c->i)) != sizeof(*(a->i))) || PetscMemcpy(c-> i,a->i,(mbs+1)*sizeof(*(c->i))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3107,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3108 | if (mbs > 0) { | |||
3109 | ierr = PetscArraycpy(c->j,a->j,nz)((sizeof(*(c->j)) != sizeof(*(a->j))) || PetscMemcpy(c-> j,a->j,(nz)*sizeof(*(c->j))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3109,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3110 | if (cpvalues == MAT_COPY_VALUES) { | |||
3111 | ierr = PetscArraycpy(c->a,a->a,bs2*nz)((sizeof(*(c->a)) != sizeof(*(a->a))) || PetscMemcpy(c-> a,a->a,(bs2*nz)*sizeof(*(c->a))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3111,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3112 | } else { | |||
3113 | ierr = PetscArrayzero(c->a,bs2*nz)PetscMemzero(c->a,(bs2*nz)*sizeof(*(c->a)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3113,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3114 | } | |||
3115 | } | |||
3116 | C->preallocated = PETSC_TRUE; | |||
3117 | C->assembled = PETSC_TRUE; | |||
3118 | } | |||
3119 | } | |||
3120 | ||||
3121 | c->roworiented = a->roworiented; | |||
3122 | c->nonew = a->nonew; | |||
3123 | ||||
3124 | ierr = PetscLayoutReference(A->rmap,&C->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3124,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3125 | ierr = PetscLayoutReference(A->cmap,&C->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3125,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3126 | ||||
3127 | c->bs2 = a->bs2; | |||
3128 | c->mbs = a->mbs; | |||
3129 | c->nbs = a->nbs; | |||
3130 | ||||
3131 | if (a->diag) { | |||
3132 | if (cpvalues == MAT_SHARE_NONZERO_PATTERN) { | |||
3133 | c->diag = a->diag; | |||
3134 | c->free_diag = PETSC_FALSE; | |||
3135 | } else { | |||
3136 | ierr = PetscMalloc1(mbs+1,&c->diag)PetscMallocA(1,PETSC_FALSE,3136,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(mbs+1)*sizeof(**(&c->diag)),(&c->diag ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3136,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3137 | ierr = PetscLogObjectMemory((PetscObject)C,(mbs+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3137,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3138 | for (i=0; i<mbs; i++) c->diag[i] = a->diag[i]; | |||
3139 | c->free_diag = PETSC_TRUE; | |||
3140 | } | |||
3141 | } else c->diag = 0; | |||
3142 | ||||
3143 | c->nz = a->nz; | |||
3144 | c->maxnz = a->nz; /* Since we allocate exactly the right amount */ | |||
3145 | c->solve_work = NULL((void*)0); | |||
3146 | c->mult_work = NULL((void*)0); | |||
3147 | c->sor_workt = NULL((void*)0); | |||
3148 | c->sor_work = NULL((void*)0); | |||
3149 | ||||
3150 | c->compressedrow.use = a->compressedrow.use; | |||
3151 | c->compressedrow.nrows = a->compressedrow.nrows; | |||
3152 | if (a->compressedrow.use) { | |||
3153 | i = a->compressedrow.nrows; | |||
3154 | ierr = PetscMalloc2(i+1,&c->compressedrow.i,i+1,&c->compressedrow.rindex)PetscMallocA(2,PETSC_FALSE,3154,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(i+1)*sizeof(**(&c->compressedrow.i)),(&c ->compressedrow.i),(size_t)(i+1)*sizeof(**(&c->compressedrow .rindex)),(&c->compressedrow.rindex));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3154,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3155 | ierr = PetscLogObjectMemory((PetscObject)C,(2*i+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3155,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3156 | ierr = PetscArraycpy(c->compressedrow.i,a->compressedrow.i,i+1)((sizeof(*(c->compressedrow.i)) != sizeof(*(a->compressedrow .i))) || PetscMemcpy(c->compressedrow.i,a->compressedrow .i,(i+1)*sizeof(*(c->compressedrow.i))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3156,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3157 | ierr = PetscArraycpy(c->compressedrow.rindex,a->compressedrow.rindex,i)((sizeof(*(c->compressedrow.rindex)) != sizeof(*(a->compressedrow .rindex))) || PetscMemcpy(c->compressedrow.rindex,a->compressedrow .rindex,(i)*sizeof(*(c->compressedrow.rindex))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3157,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3158 | } else { | |||
3159 | c->compressedrow.use = PETSC_FALSE; | |||
3160 | c->compressedrow.i = NULL((void*)0); | |||
3161 | c->compressedrow.rindex = NULL((void*)0); | |||
3162 | } | |||
3163 | C->nonzerostate = A->nonzerostate; | |||
3164 | ||||
3165 | ierr = PetscFunctionListDuplicate(((PetscObject)A)->qlist,&((PetscObject)C)->qlist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3166 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3167 | } | |||
3168 | ||||
3169 | PetscErrorCode MatDuplicate_SeqBAIJ(Mat A,MatDuplicateOption cpvalues,Mat *B) | |||
3170 | { | |||
3171 | PetscErrorCode ierr; | |||
3172 | ||||
3173 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 3173; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3174 | ierr = MatCreate(PetscObjectComm((PetscObject)A),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3174,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3175 | ierr = MatSetSizes(*B,A->rmap->N,A->cmap->n,A->rmap->N,A->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3175,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3176 | ierr = MatSetType(*B,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3176,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3177 | ierr = MatDuplicateNoCreate_SeqBAIJ(*B,A,cpvalues,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3177,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3178 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3179 | } | |||
3180 | ||||
3181 | PetscErrorCode MatLoad_SeqBAIJ(Mat newmat,PetscViewer viewer) | |||
3182 | { | |||
3183 | Mat_SeqBAIJ *a; | |||
3184 | PetscErrorCode ierr; | |||
3185 | PetscInt i,nz,header[4],*rowlengths=0,M,N,bs = newmat->rmap->bs; | |||
3186 | PetscInt *mask,mbs,*jj,j,rowcount,nzcount,k,*browlengths,maskcount; | |||
3187 | PetscInt kmax,jcount,block,idx,point,nzcountb,extra_rows,rows,cols; | |||
3188 | PetscInt *masked,nmask,tmp,bs2,ishift; | |||
3189 | PetscMPIInt size; | |||
3190 | int fd; | |||
3191 | PetscScalar *aa; | |||
3192 | MPI_Comm comm; | |||
3193 | PetscBool isbinary; | |||
3194 | ||||
3195 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 3195; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3196 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3197 | if (!isbinary) SETERRQ2(PetscObjectComm((PetscObject)newmat),PETSC_ERR_SUP,"Viewer type %s not yet supported for reading %s matrices",((PetscObject)viewer)->type_name,((PetscObject)newmat)->type_name)return PetscError(PetscObjectComm((PetscObject)newmat),3197,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"Viewer type %s not yet supported for reading %s matrices" ,((PetscObject)viewer)->type_name,((PetscObject)newmat)-> type_name); | |||
3198 | ||||
3199 | /* force binary viewer to load .info file if it has not yet done so */ | |||
3200 | ierr = PetscViewerSetUp(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3200,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3201 | ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3202 | ierr = PetscOptionsBegin(comm,NULL,"Options for loading SEQBAIJ matrix","Mat")0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; PetscMemzero (PetscOptionsObject,sizeof(PetscOptionItems)); for (PetscOptionsObject ->count=(PetscOptionsPublish?-1:1); PetscOptionsObject-> count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr = PetscOptionsBegin_Private(PetscOptionsObject,comm,((void*) 0),"Options for loading SEQBAIJ matrix","Mat");do {if (__builtin_expect (!!(_5_ierr),0)) return PetscError(((MPI_Comm)0x44000001),3202 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3203 | ierr = PetscOptionsInt("-matload_block_size","Set the blocksize used to store the matrix","MatLoad",bs,&bs,NULL)PetscOptionsInt_Private(PetscOptionsObject,"-matload_block_size" ,"Set the blocksize used to store the matrix","MatLoad",bs,& bs,((void*)0),(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3204 | ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if ( __builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm )0x44000001),3204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3205 | if (bs < 0) bs = 1; | |||
3206 | bs2 = bs*bs; | |||
3207 | ||||
3208 | ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3209 | if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"view must have one processor")return PetscError(((MPI_Comm)0x44000001),3209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"view must have one processor"); | |||
3210 | ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3210,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3211 | ierr = PetscBinaryRead(fd,header,4,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3212 | if (header[0] != MAT_FILE_CLASSID1211216) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"not Mat object")return PetscError(((MPI_Comm)0x44000001),3212,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,79,PETSC_ERROR_INITIAL,"not Mat object"); | |||
3213 | M = header[1]; N = header[2]; nz = header[3]; | |||
3214 | ||||
3215 | if (header[3] < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"Matrix stored in special format, cannot load as SeqBAIJ")return PetscError(((MPI_Comm)0x44000001),3215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,79,PETSC_ERROR_INITIAL,"Matrix stored in special format, cannot load as SeqBAIJ" ); | |||
3216 | if (M != N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Can only do square matrices")return PetscError(((MPI_Comm)0x44000001),3216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"Can only do square matrices"); | |||
3217 | ||||
3218 | /* | |||
3219 | This code adds extra rows to make sure the number of rows is | |||
3220 | divisible by the blocksize | |||
3221 | */ | |||
3222 | mbs = M/bs; | |||
3223 | extra_rows = bs - M + bs*(mbs); | |||
3224 | if (extra_rows == bs) extra_rows = 0; | |||
3225 | else mbs++; | |||
3226 | if (extra_rows) { | |||
3227 | ierr = PetscInfo(viewer,"Padding loaded matrix to match blocksize\n")PetscInfo_Private(__func__,viewer,"Padding loaded matrix to match blocksize\n" );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3227,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3228 | } | |||
3229 | ||||
3230 | /* Set global sizes if not already set */ | |||
3231 | if (newmat->rmap->n < 0 && newmat->rmap->N < 0 && newmat->cmap->n < 0 && newmat->cmap->N < 0) { | |||
3232 | ierr = MatSetSizes(newmat,PETSC_DECIDE-1,PETSC_DECIDE-1,M+extra_rows,N+extra_rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3232,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3233 | } else { /* Check if the matrix global sizes are correct */ | |||
3234 | ierr = MatGetSize(newmat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3235 | if (rows < 0 && cols < 0) { /* user might provide local size instead of global size */ | |||
3236 | ierr = MatGetLocalSize(newmat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3236,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3237 | } | |||
3238 | if (M != rows || N != cols) SETERRQ4(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"Matrix in file of different length (%d, %d) than the input matrix (%d, %d)",M,N,rows,cols)return PetscError(((MPI_Comm)0x44000001),3238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,79,PETSC_ERROR_INITIAL,"Matrix in file of different length (%d, %d) than the input matrix (%d, %d)" ,M,N,rows,cols); | |||
3239 | } | |||
3240 | ||||
3241 | /* read in row lengths */ | |||
3242 | ierr = PetscMalloc1(M+extra_rows,&rowlengths)PetscMallocA(1,PETSC_FALSE,3242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(M+extra_rows)*sizeof(**(&rowlengths)),(&rowlengths ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3243 | ierr = PetscBinaryRead(fd,rowlengths,M,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3243,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3244 | for (i=0; i<extra_rows; i++) rowlengths[M+i] = 1; | |||
3245 | ||||
3246 | /* read in column indices */ | |||
3247 | ierr = PetscMalloc1(nz+extra_rows,&jj)PetscMallocA(1,PETSC_FALSE,3247,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(nz+extra_rows)*sizeof(**(&jj)),(&jj));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3247,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3248 | ierr = PetscBinaryRead(fd,jj,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3248,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3249 | for (i=0; i<extra_rows; i++) jj[nz+i] = M+i; | |||
3250 | ||||
3251 | /* loop over row lengths determining block row lengths */ | |||
3252 | ierr = PetscCalloc1(mbs,&browlengths)PetscMallocA(1,PETSC_TRUE,3252,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(mbs)*sizeof(**(&browlengths)),(&browlengths ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3252,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3253 | ierr = PetscMalloc2(mbs,&mask,mbs,&masked)PetscMallocA(2,PETSC_FALSE,3253,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(mbs)*sizeof(**(&mask)),(&mask),(size_t)(mbs )*sizeof(**(&masked)),(&masked));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3253,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3254 | ierr = PetscArrayzero(mask,mbs)PetscMemzero(mask,(mbs)*sizeof(*(mask)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3254,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3255 | rowcount = 0; | |||
3256 | nzcount = 0; | |||
3257 | for (i=0; i<mbs; i++) { | |||
3258 | nmask = 0; | |||
3259 | for (j=0; j<bs; j++) { | |||
3260 | kmax = rowlengths[rowcount]; | |||
3261 | for (k=0; k<kmax; k++) { | |||
3262 | tmp = jj[nzcount++]/bs; | |||
3263 | if (!mask[tmp]) {masked[nmask++] = tmp; mask[tmp] = 1;} | |||
3264 | } | |||
3265 | rowcount++; | |||
3266 | } | |||
3267 | browlengths[i] += nmask; | |||
3268 | /* zero out the mask elements we set */ | |||
3269 | for (j=0; j<nmask; j++) mask[masked[j]] = 0; | |||
3270 | } | |||
3271 | ||||
3272 | /* Do preallocation */ | |||
3273 | ierr = MatSeqBAIJSetPreallocation(newmat,bs,0,browlengths);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3273,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3274 | a = (Mat_SeqBAIJ*)newmat->data; | |||
3275 | ||||
3276 | /* set matrix "i" values */ | |||
3277 | a->i[0] = 0; | |||
3278 | for (i=1; i<= mbs; i++) { | |||
3279 | a->i[i] = a->i[i-1] + browlengths[i-1]; | |||
3280 | a->ilen[i-1] = browlengths[i-1]; | |||
3281 | } | |||
3282 | a->nz = 0; | |||
3283 | for (i=0; i<mbs; i++) a->nz += browlengths[i]; | |||
3284 | ||||
3285 | /* read in nonzero values */ | |||
3286 | ierr = PetscMalloc1(nz+extra_rows,&aa)PetscMallocA(1,PETSC_FALSE,3286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(nz+extra_rows)*sizeof(**(&aa)),(&aa));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3287 | ierr = PetscBinaryRead(fd,aa,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3287,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3288 | for (i=0; i<extra_rows; i++) aa[nz+i] = 1.0; | |||
3289 | ||||
3290 | /* set "a" and "j" values into matrix */ | |||
3291 | nzcount = 0; jcount = 0; | |||
3292 | for (i=0; i<mbs; i++) { | |||
3293 | nzcountb = nzcount; | |||
3294 | nmask = 0; | |||
3295 | for (j=0; j<bs; j++) { | |||
3296 | kmax = rowlengths[i*bs+j]; | |||
3297 | for (k=0; k<kmax; k++) { | |||
3298 | tmp = jj[nzcount++]/bs; | |||
3299 | if (!mask[tmp]) { masked[nmask++] = tmp; mask[tmp] = 1;} | |||
3300 | } | |||
3301 | } | |||
3302 | /* sort the masked values */ | |||
3303 | ierr = PetscSortInt(nmask,masked);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3303,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3304 | ||||
3305 | /* set "j" values into matrix */ | |||
3306 | maskcount = 1; | |||
3307 | for (j=0; j<nmask; j++) { | |||
3308 | a->j[jcount++] = masked[j]; | |||
3309 | mask[masked[j]] = maskcount++; | |||
3310 | } | |||
3311 | /* set "a" values into matrix */ | |||
3312 | ishift = bs2*a->i[i]; | |||
3313 | for (j=0; j<bs; j++) { | |||
3314 | kmax = rowlengths[i*bs+j]; | |||
3315 | for (k=0; k<kmax; k++) { | |||
3316 | tmp = jj[nzcountb]/bs; | |||
3317 | block = mask[tmp] - 1; | |||
3318 | point = jj[nzcountb] - bs*tmp; | |||
3319 | idx = ishift + bs2*block + j + bs*point; | |||
3320 | a->a[idx] = (MatScalar)aa[nzcountb++]; | |||
3321 | } | |||
3322 | } | |||
3323 | /* zero out the mask elements we set */ | |||
3324 | for (j=0; j<nmask; j++) mask[masked[j]] = 0; | |||
3325 | } | |||
3326 | if (jcount != a->nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"Bad binary matrix")return PetscError(((MPI_Comm)0x44000001),3326,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,79,PETSC_ERROR_INITIAL,"Bad binary matrix"); | |||
3327 | ||||
3328 | ierr = PetscFree(rowlengths)((*PetscTrFree)((void*)(rowlengths),3328,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((rowlengths) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3328,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3329 | ierr = PetscFree(browlengths)((*PetscTrFree)((void*)(browlengths),3329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((browlengths) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3330 | ierr = PetscFree(aa)((*PetscTrFree)((void*)(aa),3330,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((aa) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3330,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3331 | ierr = PetscFree(jj)((*PetscTrFree)((void*)(jj),3331,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((jj) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3331,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3332 | ierr = PetscFree2(mask,masked)PetscFreeA(2,3332,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,&(mask),&(masked));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3332,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3333 | ||||
3334 | ierr = MatAssemblyBegin(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3334,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3335 | ierr = MatAssemblyEnd(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3335,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3336 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3337 | } | |||
3338 | ||||
3339 | /*@C | |||
3340 | MatCreateSeqBAIJ - Creates a sparse matrix in block AIJ (block | |||
3341 | compressed row) format. For good matrix assembly performance the | |||
3342 | user should preallocate the matrix storage by setting the parameter nz | |||
3343 | (or the array nnz). By setting these parameters accurately, performance | |||
3344 | during matrix assembly can be increased by more than a factor of 50. | |||
3345 | ||||
3346 | Collective | |||
3347 | ||||
3348 | Input Parameters: | |||
3349 | + comm - MPI communicator, set to PETSC_COMM_SELF | |||
3350 | . bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row | |||
3351 | blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() | |||
3352 | . m - number of rows | |||
3353 | . n - number of columns | |||
3354 | . nz - number of nonzero blocks per block row (same for all rows) | |||
3355 | - nnz - array containing the number of nonzero blocks in the various block rows | |||
3356 | (possibly different for each block row) or NULL | |||
3357 | ||||
3358 | Output Parameter: | |||
3359 | . A - the matrix | |||
3360 | ||||
3361 | It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(), | |||
3362 | MatXXXXSetPreallocation() paradigm instead of this routine directly. | |||
3363 | [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation] | |||
3364 | ||||
3365 | Options Database Keys: | |||
3366 | . -mat_no_unroll - uses code that does not unroll the loops in the | |||
3367 | block calculations (much slower) | |||
3368 | . -mat_block_size - size of the blocks to use | |||
3369 | ||||
3370 | Level: intermediate | |||
3371 | ||||
3372 | Notes: | |||
3373 | The number of rows and columns must be divisible by blocksize. | |||
3374 | ||||
3375 | If the nnz parameter is given then the nz parameter is ignored | |||
3376 | ||||
3377 | A nonzero block is any block that as 1 or more nonzeros in it | |||
3378 | ||||
3379 | The block AIJ format is fully compatible with standard Fortran 77 | |||
3380 | storage. That is, the stored row and column indices can begin at | |||
3381 | either one (as in Fortran) or zero. See the users' manual for details. | |||
3382 | ||||
3383 | Specify the preallocated storage with either nz or nnz (not both). | |||
3384 | Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory | |||
3385 | allocation. See Users-Manual: ch_mat for details. | |||
3386 | matrices. | |||
3387 | ||||
3388 | .seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ() | |||
3389 | @*/ | |||
3390 | PetscErrorCode MatCreateSeqBAIJ(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[],Mat *A) | |||
3391 | { | |||
3392 | PetscErrorCode ierr; | |||
3393 | ||||
3394 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 3394; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3395 | ierr = MatCreate(comm,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3395,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3396 | ierr = MatSetSizes(*A,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3396,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3397 | ierr = MatSetType(*A,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3397,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3398 | ierr = MatSeqBAIJSetPreallocation(*A,bs,nz,(PetscInt*)nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3398,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3399 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3400 | } | |||
3401 | ||||
3402 | /*@C | |||
3403 | MatSeqBAIJSetPreallocation - Sets the block size and expected nonzeros | |||
3404 | per row in the matrix. For good matrix assembly performance the | |||
3405 | user should preallocate the matrix storage by setting the parameter nz | |||
3406 | (or the array nnz). By setting these parameters accurately, performance | |||
3407 | during matrix assembly can be increased by more than a factor of 50. | |||
3408 | ||||
3409 | Collective | |||
3410 | ||||
3411 | Input Parameters: | |||
3412 | + B - the matrix | |||
3413 | . bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row | |||
3414 | blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() | |||
3415 | . nz - number of block nonzeros per block row (same for all rows) | |||
3416 | - nnz - array containing the number of block nonzeros in the various block rows | |||
3417 | (possibly different for each block row) or NULL | |||
3418 | ||||
3419 | Options Database Keys: | |||
3420 | . -mat_no_unroll - uses code that does not unroll the loops in the | |||
3421 | block calculations (much slower) | |||
3422 | . -mat_block_size - size of the blocks to use | |||
3423 | ||||
3424 | Level: intermediate | |||
3425 | ||||
3426 | Notes: | |||
3427 | If the nnz parameter is given then the nz parameter is ignored | |||
3428 | ||||
3429 | You can call MatGetInfo() to get information on how effective the preallocation was; | |||
3430 | for example the fields mallocs,nz_allocated,nz_used,nz_unneeded; | |||
3431 | You can also run with the option -info and look for messages with the string | |||
3432 | malloc in them to see if additional memory allocation was needed. | |||
3433 | ||||
3434 | The block AIJ format is fully compatible with standard Fortran 77 | |||
3435 | storage. That is, the stored row and column indices can begin at | |||
3436 | either one (as in Fortran) or zero. See the users' manual for details. | |||
3437 | ||||
3438 | Specify the preallocated storage with either nz or nnz (not both). | |||
3439 | Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory | |||
3440 | allocation. See Users-Manual: ch_mat for details. | |||
3441 | ||||
3442 | .seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ(), MatGetInfo() | |||
3443 | @*/ | |||
3444 | PetscErrorCode MatSeqBAIJSetPreallocation(Mat B,PetscInt bs,PetscInt nz,const PetscInt nnz[]) | |||
3445 | { | |||
3446 | PetscErrorCode ierr; | |||
3447 | ||||
3448 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 3448; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3449 | PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3449,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),3449,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if ( ((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm )0x44000001),3449,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),3449,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
3450 | PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) return PetscError(( (MPI_Comm)0x44000001),3450,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,73,PETSC_ERROR_INITIAL,"%s object's type is not set: Argument # %d" ,((PetscObject)B)->class_name,1); } while (0); | |||
3451 | PetscValidLogicalCollectiveInt(B,bs,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -bs ; b1[1] = bs; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm ((PetscObject)B),2,3451,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)B))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )B)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),3451,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)B),3451,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d" ,2); } while (0); | |||
3452 | ierr = PetscTryMethod(B,"MatSeqBAIJSetPreallocation_C",(Mat,PetscInt,PetscInt,const PetscInt[]),(B,bs,nz,nnz))0; do { PetscErrorCode (*f)(Mat,PetscInt,PetscInt,const PetscInt []), __ierr; __ierr = PetscObjectQueryFunction_Private(((PetscObject )B),("MatSeqBAIJSetPreallocation_C"),(PetscVoidFunction*)(& f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),3452,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(B,bs,nz,nnz);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),3452,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3452,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3453 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3454 | } | |||
3455 | ||||
3456 | /*@C | |||
3457 | MatSeqBAIJSetPreallocationCSR - Allocates memory for a sparse sequential matrix in AIJ format | |||
3458 | (the default sequential PETSc format). | |||
3459 | ||||
3460 | Collective | |||
3461 | ||||
3462 | Input Parameters: | |||
3463 | + B - the matrix | |||
3464 | . i - the indices into j for the start of each local row (starts with zero) | |||
3465 | . j - the column indices for each local row (starts with zero) these must be sorted for each row | |||
3466 | - v - optional values in the matrix | |||
3467 | ||||
3468 | Level: developer | |||
3469 | ||||
3470 | Notes: | |||
3471 | The order of the entries in values is specified by the MatOption MAT_ROW_ORIENTED. For example, C programs | |||
3472 | may want to use the default MAT_ROW_ORIENTED=PETSC_TRUE and use an array v[nnz][bs][bs] where the second index is | |||
3473 | over rows within a block and the last index is over columns within a block row. Fortran programs will likely set | |||
3474 | MAT_ROW_ORIENTED=PETSC_FALSE and use a Fortran array v(bs,bs,nnz) in which the first index is over rows within a | |||
3475 | block column and the second index is over columns within a block. | |||
3476 | ||||
3477 | .seealso: MatCreate(), MatCreateSeqBAIJ(), MatSetValues(), MatSeqBAIJSetPreallocation(), MATSEQBAIJ | |||
3478 | @*/ | |||
3479 | PetscErrorCode MatSeqBAIJSetPreallocationCSR(Mat B,PetscInt bs,const PetscInt i[],const PetscInt j[], const PetscScalar v[]) | |||
3480 | { | |||
3481 | PetscErrorCode ierr; | |||
3482 | ||||
3483 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 3483; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3484 | PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3484,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),3484,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if ( ((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm )0x44000001),3484,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),3484,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
3485 | PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) return PetscError(( (MPI_Comm)0x44000001),3485,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,73,PETSC_ERROR_INITIAL,"%s object's type is not set: Argument # %d" ,((PetscObject)B)->class_name,1); } while (0); | |||
3486 | PetscValidLogicalCollectiveInt(B,bs,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -bs ; b1[1] = bs; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm ((PetscObject)B),2,3486,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)B))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )B)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),3486,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)B),3486,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d" ,2); } while (0); | |||
3487 | ierr = PetscTryMethod(B,"MatSeqBAIJSetPreallocationCSR_C",(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]),(B,bs,i,j,v))0; do { PetscErrorCode (*f)(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)B),("MatSeqBAIJSetPreallocationCSR_C"),(PetscVoidFunction *)(&f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),3487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(B,bs,i,j,v);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),3487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3488 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3489 | } | |||
3490 | ||||
3491 | ||||
3492 | /*@ | |||
3493 | MatCreateSeqBAIJWithArrays - Creates an sequential BAIJ matrix using matrix elements provided by the user. | |||
3494 | ||||
3495 | Collective | |||
3496 | ||||
3497 | Input Parameters: | |||
3498 | + comm - must be an MPI communicator of size 1 | |||
3499 | . bs - size of block | |||
3500 | . m - number of rows | |||
3501 | . n - number of columns | |||
3502 | . i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row block row of the matrix | |||
3503 | . j - column indices | |||
3504 | - a - matrix values | |||
3505 | ||||
3506 | Output Parameter: | |||
3507 | . mat - the matrix | |||
3508 | ||||
3509 | Level: advanced | |||
3510 | ||||
3511 | Notes: | |||
3512 | The i, j, and a arrays are not copied by this routine, the user must free these arrays | |||
3513 | once the matrix is destroyed | |||
3514 | ||||
3515 | You cannot set new nonzero locations into this matrix, that will generate an error. | |||
3516 | ||||
3517 | The i and j indices are 0 based | |||
3518 | ||||
3519 | When block size is greater than 1 the matrix values must be stored using the BAIJ storage format (see the BAIJ code to determine this). | |||
3520 | ||||
3521 | The order of the entries in values is the same as the block compressed sparse row storage format; that is, it is | |||
3522 | the same as a three dimensional array in Fortran values(bs,bs,nnz) that contains the first column of the first | |||
3523 | block, followed by the second column of the first block etc etc. That is, the blocks are contiguous in memory | |||
3524 | with column-major ordering within blocks. | |||
3525 | ||||
3526 | .seealso: MatCreate(), MatCreateBAIJ(), MatCreateSeqBAIJ() | |||
3527 | ||||
3528 | @*/ | |||
3529 | PetscErrorCode MatCreateSeqBAIJWithArrays(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt i[],PetscInt j[],PetscScalar a[],Mat *mat) | |||
3530 | { | |||
3531 | PetscErrorCode ierr; | |||
3532 | PetscInt ii; | |||
3533 | Mat_SeqBAIJ *baij; | |||
3534 | ||||
3535 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 3535; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3536 | if (bs != 1) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"block size %D > 1 is not supported yet",bs)return PetscError(((MPI_Comm)0x44000001),3536,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"block size %D > 1 is not supported yet" ,bs); | |||
3537 | if (m > 0 && i[0]) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"i (row indices) must start with 0")return PetscError(((MPI_Comm)0x44000001),3537,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"i (row indices) must start with 0"); | |||
3538 | ||||
3539 | ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3539,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3540 | ierr = MatSetSizes(*mat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3540,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3541 | ierr = MatSetType(*mat,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3542 | ierr = MatSeqBAIJSetPreallocation(*mat,bs,MAT_SKIP_ALLOCATION-4,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3542,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3543 | baij = (Mat_SeqBAIJ*)(*mat)->data; | |||
3544 | ierr = PetscMalloc2(m,&baij->imax,m,&baij->ilen)PetscMallocA(2,PETSC_FALSE,3544,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,(size_t)(m)*sizeof(**(&baij->imax)),(&baij->imax ),(size_t)(m)*sizeof(**(&baij->ilen)),(&baij->ilen ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3544,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3545 | ierr = PetscLogObjectMemory((PetscObject)*mat,2*m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3545,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3546 | ||||
3547 | baij->i = i; | |||
3548 | baij->j = j; | |||
3549 | baij->a = a; | |||
3550 | ||||
3551 | baij->singlemalloc = PETSC_FALSE; | |||
3552 | baij->nonew = -1; /*this indicates that inserting a new value in the matrix that generates a new nonzero is an error*/ | |||
3553 | baij->free_a = PETSC_FALSE; | |||
3554 | baij->free_ij = PETSC_FALSE; | |||
3555 | ||||
3556 | for (ii=0; ii<m; ii++) { | |||
3557 | baij->ilen[ii] = baij->imax[ii] = i[ii+1] - i[ii]; | |||
3558 | #if defined(PETSC_USE_DEBUG1) | |||
3559 | if (i[ii+1] - i[ii] < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row length in i (row indices) row = %d length = %d",ii,i[ii+1] - i[ii])return PetscError(((MPI_Comm)0x44000001),3559,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Negative row length in i (row indices) row = %d length = %d" ,ii,i[ii+1] - i[ii]); | |||
3560 | #endif | |||
3561 | } | |||
3562 | #if defined(PETSC_USE_DEBUG1) | |||
3563 | for (ii=0; ii<baij->i[m]; ii++) { | |||
3564 | if (j[ii] < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column index at location = %d index = %d",ii,j[ii])return PetscError(((MPI_Comm)0x44000001),3564,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Negative column index at location = %d index = %d" ,ii,j[ii]); | |||
3565 | if (j[ii] > n - 1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column index to large at location = %d index = %d",ii,j[ii])return PetscError(((MPI_Comm)0x44000001),3565,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Column index to large at location = %d index = %d" ,ii,j[ii]); | |||
3566 | } | |||
3567 | #endif | |||
3568 | ||||
3569 | ierr = MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3569,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3570 | ierr = MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3570,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3571 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3572 | } | |||
3573 | ||||
3574 | PetscErrorCode MatCreateMPIMatConcatenateSeqMat_SeqBAIJ(MPI_Comm comm,Mat inmat,PetscInt n,MatReuse scall,Mat *outmat) | |||
3575 | { | |||
3576 | PetscErrorCode ierr; | |||
3577 | PetscMPIInt size; | |||
3578 | ||||
3579 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 3579; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3580 | ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3580,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3581 | if (size == 1 && scall == MAT_REUSE_MATRIX) { | |||
3582 | ierr = MatCopy(inmat,*outmat,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3582,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3583 | } else { | |||
3584 | ierr = MatCreateMPIMatConcatenateSeqMat_MPIBAIJ(comm,inmat,n,scall,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3584,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3585 | } | |||
3586 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3587 | } |