File: | mat/impls/baij/seq/baij.c |
Warning: | line 1563, column 3 Null pointer passed as an argument to a 'nonnull' parameter |
[?] 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 | PetscInt n; | |||
1051 | n = PetscMin(a->mbs, a->nbs)(((a->mbs)<(a->nbs)) ? (a->mbs) : (a->nbs)); | |||
1052 | diag = a->diag; | |||
1053 | for (i=0; i<n; i++) { | |||
1054 | if (diag[i] >= ii[i+1]) { | |||
1055 | *missing = PETSC_TRUE; | |||
1056 | if (d) *d = i; | |||
1057 | 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),1057,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1058 | break; | |||
1059 | } | |||
1060 | } | |||
1061 | } | |||
1062 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1063 | } | |||
1064 | ||||
1065 | PetscErrorCode MatMarkDiagonal_SeqBAIJ(Mat A) | |||
1066 | { | |||
1067 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1068 | PetscErrorCode ierr; | |||
1069 | PetscInt i,j,m = a->mbs; | |||
1070 | ||||
1071 | 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] = 1071; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1072 | if (!a->diag) { | |||
1073 | ierr = PetscMalloc1(m,&a->diag)PetscMallocA(1,PETSC_FALSE,1073,__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),1073,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1074 | ierr = PetscLogObjectMemory((PetscObject)A,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1074,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1075 | a->free_diag = PETSC_TRUE; | |||
1076 | } | |||
1077 | for (i=0; i<m; i++) { | |||
1078 | a->diag[i] = a->i[i+1]; | |||
1079 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1080 | if (a->j[j] == i) { | |||
1081 | a->diag[i] = j; | |||
1082 | break; | |||
1083 | } | |||
1084 | } | |||
1085 | } | |||
1086 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1087 | } | |||
1088 | ||||
1089 | ||||
1090 | static PetscErrorCode MatGetRowIJ_SeqBAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool blockcompressed,PetscInt *nn,const PetscInt *inia[],const PetscInt *inja[],PetscBool *done) | |||
1091 | { | |||
1092 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1093 | PetscErrorCode ierr; | |||
1094 | PetscInt i,j,n = a->mbs,nz = a->i[n],*tia,*tja,bs = A->rmap->bs,k,l,cnt; | |||
1095 | PetscInt **ia = (PetscInt**)inia,**ja = (PetscInt**)inja; | |||
1096 | ||||
1097 | 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] = 1097; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1098 | *nn = n; | |||
1099 | 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); | |||
1100 | if (symmetric) { | |||
1101 | 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),1101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1102 | nz = tia[n]; | |||
1103 | } else { | |||
1104 | tia = a->i; tja = a->j; | |||
1105 | } | |||
1106 | ||||
1107 | if (!blockcompressed && bs > 1) { | |||
1108 | (*nn) *= bs; | |||
1109 | /* malloc & create the natural set of indices */ | |||
1110 | ierr = PetscMalloc1((n+1)*bs,ia)PetscMallocA(1,PETSC_FALSE,1110,__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),1110,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1111 | if (n) { | |||
1112 | (*ia)[0] = oshift; | |||
1113 | for (j=1; j<bs; j++) { | |||
1114 | (*ia)[j] = (tia[1]-tia[0])*bs+(*ia)[j-1]; | |||
1115 | } | |||
1116 | } | |||
1117 | ||||
1118 | for (i=1; i<n; i++) { | |||
1119 | (*ia)[i*bs] = (tia[i]-tia[i-1])*bs + (*ia)[i*bs-1]; | |||
1120 | for (j=1; j<bs; j++) { | |||
1121 | (*ia)[i*bs+j] = (tia[i+1]-tia[i])*bs + (*ia)[i*bs+j-1]; | |||
1122 | } | |||
1123 | } | |||
1124 | if (n) { | |||
1125 | (*ia)[n*bs] = (tia[n]-tia[n-1])*bs + (*ia)[n*bs-1]; | |||
1126 | } | |||
1127 | ||||
1128 | if (inja) { | |||
1129 | ierr = PetscMalloc1(nz*bs*bs,ja)PetscMallocA(1,PETSC_FALSE,1129,__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),1129,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1130 | cnt = 0; | |||
1131 | for (i=0; i<n; i++) { | |||
1132 | for (j=0; j<bs; j++) { | |||
1133 | for (k=tia[i]; k<tia[i+1]; k++) { | |||
1134 | for (l=0; l<bs; l++) { | |||
1135 | (*ja)[cnt++] = bs*tja[k] + l; | |||
1136 | } | |||
1137 | } | |||
1138 | } | |||
1139 | } | |||
1140 | } | |||
1141 | ||||
1142 | if (symmetric) { /* deallocate memory allocated in MatToSymmetricIJ_SeqAIJ() */ | |||
1143 | ierr = PetscFree(tia)((*PetscTrFree)((void*)(tia),1143,__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),1143,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1144 | ierr = PetscFree(tja)((*PetscTrFree)((void*)(tja),1144,__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),1144,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1145 | } | |||
1146 | } else if (oshift == 1) { | |||
1147 | if (symmetric) { | |||
1148 | nz = tia[A->rmap->n/bs]; | |||
1149 | /* add 1 to i and j indices */ | |||
1150 | for (i=0; i<A->rmap->n/bs+1; i++) tia[i] = tia[i] + 1; | |||
1151 | *ia = tia; | |||
1152 | if (ja) { | |||
1153 | for (i=0; i<nz; i++) tja[i] = tja[i] + 1; | |||
1154 | *ja = tja; | |||
1155 | } | |||
1156 | } else { | |||
1157 | nz = a->i[A->rmap->n/bs]; | |||
1158 | /* malloc space and add 1 to i and j indices */ | |||
1159 | ierr = PetscMalloc1(A->rmap->n/bs+1,ia)PetscMallocA(1,PETSC_FALSE,1159,__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),1159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1160 | for (i=0; i<A->rmap->n/bs+1; i++) (*ia)[i] = a->i[i] + 1; | |||
1161 | if (ja) { | |||
1162 | ierr = PetscMalloc1(nz,ja)PetscMallocA(1,PETSC_FALSE,1162,__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),1162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1163 | for (i=0; i<nz; i++) (*ja)[i] = a->j[i] + 1; | |||
1164 | } | |||
1165 | } | |||
1166 | } else { | |||
1167 | *ia = tia; | |||
1168 | if (ja) *ja = tja; | |||
1169 | } | |||
1170 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1171 | } | |||
1172 | ||||
1173 | static PetscErrorCode MatRestoreRowIJ_SeqBAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool blockcompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done) | |||
1174 | { | |||
1175 | PetscErrorCode ierr; | |||
1176 | ||||
1177 | 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] = 1177; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1178 | 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); | |||
1179 | if ((!blockcompressed && A->rmap->bs > 1) || (symmetric || oshift == 1)) { | |||
1180 | ierr = PetscFree(*ia)((*PetscTrFree)((void*)(*ia),1180,__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),1180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1181 | if (ja) {ierr = PetscFree(*ja)((*PetscTrFree)((void*)(*ja),1181,__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),1181,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1182 | } | |||
1183 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1184 | } | |||
1185 | ||||
1186 | PetscErrorCode MatDestroy_SeqBAIJ(Mat A) | |||
1187 | { | |||
1188 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1189 | PetscErrorCode ierr; | |||
1190 | ||||
1191 | 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] = 1191; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1192 | #if defined(PETSC_USE_LOG1) | |||
1193 | PetscLogObjectState((PetscObject)A,"Rows=%D, Cols=%D, NZ=%D",A->rmap->N,A->cmap->n,a->nz); | |||
1194 | #endif | |||
1195 | ierr = MatSeqXAIJFreeAIJ(A,&a->a,&a->j,&a->i);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 | ierr = ISDestroy(&a->row);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 = ISDestroy(&a->col);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_diag) {ierr = PetscFree(a->diag)((*PetscTrFree)((void*)(a->diag),1198,__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),1198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1199 | ierr = PetscFree(a->idiag)((*PetscTrFree)((void*)(a->idiag),1199,__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),1199,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1200 | if (a->free_imax_ilen) {ierr = PetscFree2(a->imax,a->ilen)PetscFreeA(2,1200,__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),1200,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1201 | ierr = PetscFree(a->solve_work)((*PetscTrFree)((void*)(a->solve_work),1201,__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),1201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1202 | ierr = PetscFree(a->mult_work)((*PetscTrFree)((void*)(a->mult_work),1202,__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),1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1203 | ierr = PetscFree(a->sor_workt)((*PetscTrFree)((void*)(a->sor_workt),1203,__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),1203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1204 | ierr = PetscFree(a->sor_work)((*PetscTrFree)((void*)(a->sor_work),1204,__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),1204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1205 | ierr = ISDestroy(&a->icol);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 | ierr = PetscFree(a->saved_values)((*PetscTrFree)((void*)(a->saved_values),1206,__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),1206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1207 | ierr = PetscFree2(a->compressedrow.i,a->compressedrow.rindex)PetscFreeA(2,1207,__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),1207,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1208 | ||||
1209 | ierr = MatDestroy(&a->sbaijMat);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 | ierr = MatDestroy(&a->parent);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1210,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1211 | ierr = PetscFree(A->data)((*PetscTrFree)((void*)(A->data),1211,__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),1211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1212 | ||||
1213 | ierr = PetscObjectChangeTypeName((PetscObject)A,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,"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),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,"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),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,"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),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,"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),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,"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),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,"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),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,"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),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,"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),1221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1222 | 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),1222,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1223 | 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),1223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1224 | #if defined(PETSC_HAVE_HYPRE) | |||
1225 | 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),1225,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1226 | #endif | |||
1227 | 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),1227,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1228 | 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),1228,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1229 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1230 | } | |||
1231 | ||||
1232 | PetscErrorCode MatSetOption_SeqBAIJ(Mat A,MatOption op,PetscBool flg) | |||
1233 | { | |||
1234 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1235 | PetscErrorCode ierr; | |||
1236 | ||||
1237 | 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] = 1237; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1238 | switch (op) { | |||
1239 | case MAT_ROW_ORIENTED: | |||
1240 | a->roworiented = flg; | |||
1241 | break; | |||
1242 | case MAT_KEEP_NONZERO_PATTERN: | |||
1243 | a->keepnonzeropattern = flg; | |||
1244 | break; | |||
1245 | case MAT_NEW_NONZERO_LOCATIONS: | |||
1246 | a->nonew = (flg ? 0 : 1); | |||
1247 | break; | |||
1248 | case MAT_NEW_NONZERO_LOCATION_ERR: | |||
1249 | a->nonew = (flg ? -1 : 0); | |||
1250 | break; | |||
1251 | case MAT_NEW_NONZERO_ALLOCATION_ERR: | |||
1252 | a->nonew = (flg ? -2 : 0); | |||
1253 | break; | |||
1254 | case MAT_UNUSED_NONZERO_LOCATION_ERR: | |||
1255 | a->nounused = (flg ? -1 : 0); | |||
1256 | break; | |||
1257 | case MAT_NEW_DIAGONALS: | |||
1258 | case MAT_IGNORE_OFF_PROC_ENTRIES: | |||
1259 | case MAT_USE_HASH_TABLE: | |||
1260 | case MAT_SORTED_FULL: | |||
1261 | 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),1261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1262 | break; | |||
1263 | case MAT_SPD: | |||
1264 | case MAT_SYMMETRIC: | |||
1265 | case MAT_STRUCTURALLY_SYMMETRIC: | |||
1266 | case MAT_HERMITIAN: | |||
1267 | case MAT_SYMMETRY_ETERNAL: | |||
1268 | case MAT_SUBMAT_SINGLEIS: | |||
1269 | case MAT_STRUCTURE_ONLY: | |||
1270 | /* These options are handled directly by MatSetOption() */ | |||
1271 | break; | |||
1272 | default: | |||
1273 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unknown option %d",op)return PetscError(((MPI_Comm)0x44000001),1273,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"unknown option %d",op); | |||
1274 | } | |||
1275 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1276 | } | |||
1277 | ||||
1278 | /* used for both SeqBAIJ and SeqSBAIJ matrices */ | |||
1279 | PetscErrorCode MatGetRow_SeqBAIJ_private(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v,PetscInt *ai,PetscInt *aj,PetscScalar *aa) | |||
1280 | { | |||
1281 | PetscErrorCode ierr; | |||
1282 | PetscInt itmp,i,j,k,M,bn,bp,*idx_i,bs,bs2; | |||
1283 | MatScalar *aa_i; | |||
1284 | PetscScalar *v_i; | |||
1285 | ||||
1286 | 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] = 1286; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1287 | bs = A->rmap->bs; | |||
1288 | bs2 = bs*bs; | |||
1289 | 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),1289,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Row %D out of range",row); | |||
1290 | ||||
1291 | bn = row/bs; /* Block number */ | |||
1292 | bp = row % bs; /* Block Position */ | |||
1293 | M = ai[bn+1] - ai[bn]; | |||
1294 | *nz = bs*M; | |||
1295 | ||||
1296 | if (v) { | |||
1297 | *v = 0; | |||
1298 | if (*nz) { | |||
1299 | ierr = PetscMalloc1(*nz,v)PetscMallocA(1,PETSC_FALSE,1299,__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),1299,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1300 | for (i=0; i<M; i++) { /* for each block in the block row */ | |||
1301 | v_i = *v + i*bs; | |||
1302 | aa_i = aa + bs2*(ai[bn] + i); | |||
1303 | for (j=bp,k=0; j<bs2; j+=bs,k++) v_i[k] = aa_i[j]; | |||
1304 | } | |||
1305 | } | |||
1306 | } | |||
1307 | ||||
1308 | if (idx) { | |||
1309 | *idx = 0; | |||
1310 | if (*nz) { | |||
1311 | ierr = PetscMalloc1(*nz,idx)PetscMallocA(1,PETSC_FALSE,1311,__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),1311,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1312 | for (i=0; i<M; i++) { /* for each block in the block row */ | |||
1313 | idx_i = *idx + i*bs; | |||
1314 | itmp = bs*aj[ai[bn] + i]; | |||
1315 | for (j=0; j<bs; j++) idx_i[j] = itmp++; | |||
1316 | } | |||
1317 | } | |||
1318 | } | |||
1319 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1320 | } | |||
1321 | ||||
1322 | PetscErrorCode MatGetRow_SeqBAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v) | |||
1323 | { | |||
1324 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1325 | PetscErrorCode ierr; | |||
1326 | ||||
1327 | 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] = 1327; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1328 | 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),1328,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1329 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1330 | } | |||
1331 | ||||
1332 | PetscErrorCode MatRestoreRow_SeqBAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v) | |||
1333 | { | |||
1334 | PetscErrorCode ierr; | |||
1335 | ||||
1336 | 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] = 1336; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1337 | if (idx) {ierr = PetscFree(*idx)((*PetscTrFree)((void*)(*idx),1337,__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),1337,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1338 | if (v) {ierr = PetscFree(*v)((*PetscTrFree)((void*)(*v),1338,__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),1338,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1339 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1340 | } | |||
1341 | ||||
1342 | PetscErrorCode MatTranspose_SeqBAIJ(Mat A,MatReuse reuse,Mat *B) | |||
1343 | { | |||
1344 | Mat_SeqBAIJ *a=(Mat_SeqBAIJ*)A->data,*at; | |||
1345 | Mat C; | |||
1346 | PetscErrorCode ierr; | |||
1347 | PetscInt i,j,k,*aj=a->j,*ai=a->i,bs=A->rmap->bs,mbs=a->mbs,nbs=a->nbs,*atfill; | |||
1348 | PetscInt bs2=a->bs2,*ati,*atj,anzj,kr; | |||
1349 | MatScalar *ata,*aa=a->a; | |||
1350 | ||||
1351 | 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] = 1351; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1352 | ierr = PetscCalloc1(1+nbs,&atfill)PetscMallocA(1,PETSC_TRUE,1352,__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),1352,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1353 | if (reuse == MAT_INITIAL_MATRIX || reuse == MAT_INPLACE_MATRIX) { | |||
1354 | for (i=0; i<ai[mbs]; i++) atfill[aj[i]] += 1; /* count num of non-zeros in row aj[i] */ | |||
1355 | ||||
1356 | ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);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 = 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),1357,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1358 | ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1358,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1359 | ierr = MatSeqBAIJSetPreallocation(C,bs,0,atfill);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1359,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1360 | ||||
1361 | at = (Mat_SeqBAIJ*)C->data; | |||
1362 | ati = at->i; | |||
1363 | for (i=0; i<nbs; i++) at->ilen[i] = at->imax[i] = ati[i+1] - ati[i]; | |||
1364 | } else { | |||
1365 | C = *B; | |||
1366 | at = (Mat_SeqBAIJ*)C->data; | |||
1367 | ati = at->i; | |||
1368 | } | |||
1369 | ||||
1370 | atj = at->j; | |||
1371 | ata = at->a; | |||
1372 | ||||
1373 | /* Copy ati into atfill so we have locations of the next free space in atj */ | |||
1374 | 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),1374,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1375 | ||||
1376 | /* Walk through A row-wise and mark nonzero entries of A^T. */ | |||
1377 | for (i=0; i<mbs; i++) { | |||
1378 | anzj = ai[i+1] - ai[i]; | |||
1379 | for (j=0; j<anzj; j++) { | |||
1380 | atj[atfill[*aj]] = i; | |||
1381 | for (kr=0; kr<bs; kr++) { | |||
1382 | for (k=0; k<bs; k++) { | |||
1383 | ata[bs2*atfill[*aj]+k*bs+kr] = *aa++; | |||
1384 | } | |||
1385 | } | |||
1386 | atfill[*aj++] += 1; | |||
1387 | } | |||
1388 | } | |||
1389 | ierr = MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1390 | ierr = MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1390,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1391 | ||||
1392 | /* Clean up temporary space and complete requests. */ | |||
1393 | ierr = PetscFree(atfill)((*PetscTrFree)((void*)(atfill),1393,__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),1393,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1394 | ||||
1395 | if (reuse == MAT_INITIAL_MATRIX || reuse == MAT_REUSE_MATRIX) { | |||
1396 | 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),1396,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1397 | *B = C; | |||
1398 | } else { | |||
1399 | ierr = MatHeaderMerge(A,&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1399,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1400 | } | |||
1401 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1402 | } | |||
1403 | ||||
1404 | PetscErrorCode MatIsTranspose_SeqBAIJ(Mat A,Mat B,PetscReal tol,PetscBool *f) | |||
1405 | { | |||
1406 | PetscErrorCode ierr; | |||
1407 | Mat Btrans; | |||
1408 | ||||
1409 | 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] = 1409; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1410 | *f = PETSC_FALSE; | |||
1411 | ierr = MatTranspose_SeqBAIJ(A,MAT_INITIAL_MATRIX,&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 | ierr = MatEqual_SeqBAIJ(B,Btrans,f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1412,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1413 | ierr = MatDestroy(&Btrans);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1413,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1414 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1415 | } | |||
1416 | ||||
1417 | static PetscErrorCode MatView_SeqBAIJ_Binary(Mat A,PetscViewer viewer) | |||
1418 | { | |||
1419 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1420 | PetscErrorCode ierr; | |||
1421 | PetscInt i,*col_lens,bs = A->rmap->bs,count,*jj,j,k,l,bs2=a->bs2; | |||
1422 | int fd; | |||
1423 | PetscScalar *aa; | |||
1424 | FILE *file; | |||
1425 | ||||
1426 | 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] = 1426; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1427 | ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1427,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1428 | ierr = PetscMalloc1(4+A->rmap->N,&col_lens)PetscMallocA(1,PETSC_FALSE,1428,__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),1428,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1429 | col_lens[0] = MAT_FILE_CLASSID1211216; | |||
1430 | ||||
1431 | col_lens[1] = A->rmap->N; | |||
1432 | col_lens[2] = A->cmap->n; | |||
1433 | col_lens[3] = a->nz*bs2; | |||
1434 | ||||
1435 | /* store lengths of each row and write (including header) to file */ | |||
1436 | count = 0; | |||
1437 | for (i=0; i<a->mbs; i++) { | |||
1438 | for (j=0; j<bs; j++) { | |||
1439 | col_lens[4+count++] = bs*(a->i[i+1] - a->i[i]); | |||
1440 | } | |||
1441 | } | |||
1442 | 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),1442,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1443 | ierr = PetscFree(col_lens)((*PetscTrFree)((void*)(col_lens),1443,__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),1443,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1444 | ||||
1445 | /* store column indices (zero start index) */ | |||
1446 | ierr = PetscMalloc1((a->nz+1)*bs2,&jj)PetscMallocA(1,PETSC_FALSE,1446,__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),1446,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1447 | count = 0; | |||
1448 | for (i=0; i<a->mbs; i++) { | |||
1449 | for (j=0; j<bs; j++) { | |||
1450 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
1451 | for (l=0; l<bs; l++) { | |||
1452 | jj[count++] = bs*a->j[k] + l; | |||
1453 | } | |||
1454 | } | |||
1455 | } | |||
1456 | } | |||
1457 | ierr = PetscBinaryWrite(fd,jj,bs2*a->nz,PETSC_INT,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1457,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1458 | ierr = PetscFree(jj)((*PetscTrFree)((void*)(jj),1458,__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),1458,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1459 | ||||
1460 | /* store nonzero values */ | |||
1461 | ierr = PetscMalloc1((a->nz+1)*bs2,&aa)PetscMallocA(1,PETSC_FALSE,1461,__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),1461,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1462 | count = 0; | |||
1463 | for (i=0; i<a->mbs; i++) { | |||
1464 | for (j=0; j<bs; j++) { | |||
1465 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
1466 | for (l=0; l<bs; l++) { | |||
1467 | aa[count++] = a->a[bs2*k + l*bs + j]; | |||
1468 | } | |||
1469 | } | |||
1470 | } | |||
1471 | } | |||
1472 | 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),1472,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1473 | ierr = PetscFree(aa)((*PetscTrFree)((void*)(aa),1473,__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),1473,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1474 | ||||
1475 | ierr = PetscViewerBinaryGetInfoPointer(viewer,&file);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1475,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1476 | if (file) { | |||
1477 | fprintf(file,"-matload_block_size %d\n",(int)A->rmap->bs); | |||
1478 | } | |||
1479 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1480 | } | |||
1481 | ||||
1482 | static PetscErrorCode MatView_SeqBAIJ_ASCII_structonly(Mat A,PetscViewer viewer) | |||
1483 | { | |||
1484 | PetscErrorCode ierr; | |||
1485 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1486 | PetscInt i,bs = A->rmap->bs,k; | |||
1487 | ||||
1488 | 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] = 1488; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1489 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);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 (i=0; i<a->mbs; i++) { | |||
1491 | 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),1491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1492 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
1493 | 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),1493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1494 | } | |||
1495 | ierr = PetscViewerASCIIPrintf(viewer,"\n");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 | } | |||
1497 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1497,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1498 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1499 | } | |||
1500 | ||||
1501 | static PetscErrorCode MatView_SeqBAIJ_ASCII(Mat A,PetscViewer viewer) | |||
1502 | { | |||
1503 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1504 | PetscErrorCode ierr; | |||
1505 | PetscInt i,j,bs = A->rmap->bs,k,l,bs2=a->bs2; | |||
1506 | PetscViewerFormat format; | |||
1507 | ||||
1508 | 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] = 1508; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1509 | if (A->structure_only) { | |||
1510 | ierr = MatView_SeqBAIJ_ASCII_structonly(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1510,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1511 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1512 | } | |||
1513 | ||||
1514 | ierr = PetscViewerGetFormat(viewer,&format);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 | if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) { | |||
1516 | ierr = PetscViewerASCIIPrintf(viewer," block size is %D\n",bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1516,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1517 | } else if (format == PETSC_VIEWER_ASCII_MATLAB) { | |||
1518 | const char *matname; | |||
1519 | Mat aij; | |||
1520 | ierr = MatConvert(A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&aij);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 = PetscObjectGetName((PetscObject)A,&matname);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 = PetscObjectSetName((PetscObject)aij,matname);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 | ierr = MatView(aij,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1523,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1524 | ierr = MatDestroy(&aij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1524,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1525 | } else if (format == PETSC_VIEWER_ASCII_FACTOR_INFO) { | |||
1526 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1527 | } else if (format == PETSC_VIEWER_ASCII_COMMON) { | |||
1528 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1528,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1529 | for (i=0; i<a->mbs; i++) { | |||
1530 | for (j=0; j<bs; j++) { | |||
1531 | ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i*bs+j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1531,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1532 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
1533 | for (l=0; l<bs; l++) { | |||
1534 | #if defined(PETSC_USE_COMPLEX) | |||
1535 | 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) { | |||
1536 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %gi) ",bs*a->j[k]+l, | |||
1537 | (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),1537,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1538 | } 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) { | |||
1539 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %gi) ",bs*a->j[k]+l, | |||
1540 | (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),1540,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1541 | } else if (PetscRealPart(a->a[bs2*k + l*bs + j])(a->a[bs2*k + l*bs + j]) != 0.0) { | |||
1542 | 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),1542,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1543 | } | |||
1544 | #else | |||
1545 | if (a->a[bs2*k + l*bs + j] != 0.0) { | |||
1546 | 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),1546,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1547 | } | |||
1548 | #endif | |||
1549 | } | |||
1550 | } | |||
1551 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1551,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1552 | } | |||
1553 | } | |||
1554 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);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 | } else { | |||
1556 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1556,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1557 | for (i=0; i<a->mbs; i++) { | |||
1558 | for (j=0; j<bs; j++) { | |||
1559 | ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i*bs+j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1559,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1560 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
1561 | for (l=0; l<bs; l++) { | |||
1562 | #if defined(PETSC_USE_COMPLEX) | |||
1563 | if (PetscImaginaryPart(a->a[bs2*k + l*bs + j])((PetscReal)0.) > 0.0) { | |||
1564 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i) ",bs*a->j[k]+l, | |||
1565 | (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),1565,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1566 | } else if (PetscImaginaryPart(a->a[bs2*k + l*bs + j])((PetscReal)0.) < 0.0) { | |||
1567 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i) ",bs*a->j[k]+l, | |||
1568 | (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),1568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1569 | } else { | |||
1570 | 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),1570,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1571 | } | |||
1572 | #else | |||
1573 | 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),1573,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1574 | #endif | |||
1575 | } | |||
1576 | } | |||
1577 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1577,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1578 | } | |||
1579 | } | |||
1580 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);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 | } | |||
1582 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1582,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1583 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1584 | } | |||
1585 | ||||
1586 | #include <petscdraw.h> | |||
1587 | static PetscErrorCode MatView_SeqBAIJ_Draw_Zoom(PetscDraw draw,void *Aa) | |||
1588 | { | |||
1589 | Mat A = (Mat) Aa; | |||
1590 | Mat_SeqBAIJ *a=(Mat_SeqBAIJ*)A->data; | |||
1591 | PetscErrorCode ierr; | |||
1592 | PetscInt row,i,j,k,l,mbs=a->mbs,color,bs=A->rmap->bs,bs2=a->bs2; | |||
1593 | PetscReal xl,yl,xr,yr,x_l,x_r,y_l,y_r; | |||
1594 | MatScalar *aa; | |||
1595 | PetscViewer viewer; | |||
1596 | PetscViewerFormat format; | |||
1597 | ||||
1598 | 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] = 1598; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1599 | ierr = PetscObjectQuery((PetscObject)A,"Zoomviewer",(PetscObject*)&viewer);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 | ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1600,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1601 | ierr = PetscDrawGetCoordinates(draw,&xl,&yl,&xr,&yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1601,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1602 | ||||
1603 | /* loop over matrix elements drawing boxes */ | |||
1604 | ||||
1605 | if (format != PETSC_VIEWER_DRAW_CONTOUR) { | |||
1606 | 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),1606,__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),1606,__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),1606,__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) ,1606,__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) ,1606,__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) ,1606,__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),1606,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1607 | /* Blue for negative, Cyan for zero and Red for positive */ | |||
1608 | color = PETSC_DRAW_BLUE5; | |||
1609 | for (i=0,row=0; i<mbs; i++,row+=bs) { | |||
1610 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1611 | y_l = A->rmap->N - row - 1.0; y_r = y_l + 1.0; | |||
1612 | x_l = a->j[j]*bs; x_r = x_l + 1.0; | |||
1613 | aa = a->a + j*bs2; | |||
1614 | for (k=0; k<bs; k++) { | |||
1615 | for (l=0; l<bs; l++) { | |||
1616 | if (PetscRealPart(*aa++)(*aa++) >= 0.) continue; | |||
1617 | 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),1617,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1618 | } | |||
1619 | } | |||
1620 | } | |||
1621 | } | |||
1622 | color = PETSC_DRAW_CYAN4; | |||
1623 | for (i=0,row=0; i<mbs; i++,row+=bs) { | |||
1624 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1625 | y_l = A->rmap->N - row - 1.0; y_r = y_l + 1.0; | |||
1626 | x_l = a->j[j]*bs; x_r = x_l + 1.0; | |||
1627 | aa = a->a + j*bs2; | |||
1628 | for (k=0; k<bs; k++) { | |||
1629 | for (l=0; l<bs; l++) { | |||
1630 | if (PetscRealPart(*aa++)(*aa++) != 0.) continue; | |||
1631 | 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),1631,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1632 | } | |||
1633 | } | |||
1634 | } | |||
1635 | } | |||
1636 | color = PETSC_DRAW_RED2; | |||
1637 | for (i=0,row=0; i<mbs; i++,row+=bs) { | |||
1638 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1639 | y_l = A->rmap->N - row - 1.0; y_r = y_l + 1.0; | |||
1640 | x_l = a->j[j]*bs; x_r = x_l + 1.0; | |||
1641 | aa = a->a + j*bs2; | |||
1642 | for (k=0; k<bs; k++) { | |||
1643 | for (l=0; l<bs; l++) { | |||
1644 | if (PetscRealPart(*aa++)(*aa++) <= 0.) continue; | |||
1645 | 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),1645,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1646 | } | |||
1647 | } | |||
1648 | } | |||
1649 | } | |||
1650 | 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),1650,__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) ,1650,__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) ,1650,__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),1650,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1651 | } else { | |||
1652 | /* use contour shading to indicate magnitude of values */ | |||
1653 | /* first determine max of all nonzero values */ | |||
1654 | PetscReal minv = 0.0, maxv = 0.0; | |||
1655 | PetscDraw popup; | |||
1656 | ||||
1657 | for (i=0; i<a->nz*a->bs2; i++) { | |||
1658 | if (PetscAbsScalar(a->a[i]) > maxv) maxv = PetscAbsScalar(a->a[i]); | |||
1659 | } | |||
1660 | if (minv >= maxv) maxv = minv + PETSC_SMALL1.e-10; | |||
1661 | ierr = PetscDrawGetPopup(draw,&popup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1661,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1662 | ierr = PetscDrawScalePopup(popup,0.0,maxv);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 | ||||
1664 | 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),1664,__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),1664,__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),1664,__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) ,1664,__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) ,1664,__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) ,1664,__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),1664,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1665 | for (i=0,row=0; i<mbs; i++,row+=bs) { | |||
1666 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1667 | y_l = A->rmap->N - row - 1.0; y_r = y_l + 1.0; | |||
1668 | x_l = a->j[j]*bs; x_r = x_l + 1.0; | |||
1669 | aa = a->a + j*bs2; | |||
1670 | for (k=0; k<bs; k++) { | |||
1671 | for (l=0; l<bs; l++) { | |||
1672 | MatScalar v = *aa++; | |||
1673 | color = PetscDrawRealToColor(PetscAbsScalar(v),minv,maxv); | |||
1674 | 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),1674,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1675 | } | |||
1676 | } | |||
1677 | } | |||
1678 | } | |||
1679 | 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),1679,__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) ,1679,__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) ,1679,__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),1679,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1680 | } | |||
1681 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1682 | } | |||
1683 | ||||
1684 | static PetscErrorCode MatView_SeqBAIJ_Draw(Mat A,PetscViewer viewer) | |||
1685 | { | |||
1686 | PetscErrorCode ierr; | |||
1687 | PetscReal xl,yl,xr,yr,w,h; | |||
1688 | PetscDraw draw; | |||
1689 | PetscBool isnull; | |||
1690 | ||||
1691 | 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] = 1691; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1692 | ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1692,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1693 | ierr = PetscDrawIsNull(draw,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1693,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1694 | 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); | |||
1695 | ||||
1696 | xr = A->cmap->n; yr = A->rmap->N; h = yr/10.0; w = xr/10.0; | |||
1697 | xr += w; yr += h; xl = -w; yl = -h; | |||
1698 | ierr = PetscDrawSetCoordinates(draw,xl,yl,xr,yr);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",(PetscObject)viewer);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 = PetscDrawZoom(draw,MatView_SeqBAIJ_Draw_Zoom,A);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 | ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1701,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1702 | ierr = PetscDrawSave(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1702,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1703 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1704 | } | |||
1705 | ||||
1706 | PetscErrorCode MatView_SeqBAIJ(Mat A,PetscViewer viewer) | |||
1707 | { | |||
1708 | PetscErrorCode ierr; | |||
1709 | PetscBool iascii,isbinary,isdraw; | |||
1710 | ||||
1711 | 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] = 1711; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1712 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);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 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1713,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1714 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);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 | if (iascii) { | |||
1716 | ierr = MatView_SeqBAIJ_ASCII(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 (isbinary) { | |||
1718 | ierr = MatView_SeqBAIJ_Binary(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 if (isdraw) { | |||
1720 | ierr = MatView_SeqBAIJ_Draw(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1720,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1721 | } else { | |||
1722 | Mat B; | |||
1723 | ierr = MatConvert(A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&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 | ierr = MatView(B,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1724,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1725 | ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1725,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1726 | } | |||
1727 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1728 | } | |||
1729 | ||||
1730 | ||||
1731 | PetscErrorCode MatGetValues_SeqBAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],PetscScalar v[]) | |||
1732 | { | |||
1733 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1734 | PetscInt *rp,k,low,high,t,row,nrow,i,col,l,*aj = a->j; | |||
1735 | PetscInt *ai = a->i,*ailen = a->ilen; | |||
1736 | PetscInt brow,bcol,ridx,cidx,bs=A->rmap->bs,bs2=a->bs2; | |||
1737 | MatScalar *ap,*aa = a->a; | |||
1738 | ||||
1739 | 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] = 1739; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1740 | for (k=0; k<m; k++) { /* loop over rows */ | |||
1741 | row = im[k]; brow = row/bs; | |||
1742 | if (row < 0) {v += n; continue;} /* SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row"); */ | |||
1743 | if (row >= A->rmap->N) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row %D too large", row)return PetscError(((MPI_Comm)0x44000001),1743,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Row %D too large",row); | |||
1744 | rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; | |||
1745 | nrow = ailen[brow]; | |||
1746 | for (l=0; l<n; l++) { /* loop over columns */ | |||
1747 | if (in[l] < 0) {v++; continue;} /* SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column"); */ | |||
1748 | 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),1748,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"Column %D too large",in[l]); | |||
1749 | col = in[l]; | |||
1750 | bcol = col/bs; | |||
1751 | cidx = col%bs; | |||
1752 | ridx = row%bs; | |||
1753 | high = nrow; | |||
1754 | low = 0; /* assume unsorted */ | |||
1755 | while (high-low > 5) { | |||
1756 | t = (low+high)/2; | |||
1757 | if (rp[t] > bcol) high = t; | |||
1758 | else low = t; | |||
1759 | } | |||
1760 | for (i=low; i<high; i++) { | |||
1761 | if (rp[i] > bcol) break; | |||
1762 | if (rp[i] == bcol) { | |||
1763 | *v++ = ap[bs2*i+bs*cidx+ridx]; | |||
1764 | goto finished; | |||
1765 | } | |||
1766 | } | |||
1767 | *v++ = 0.0; | |||
1768 | finished:; | |||
1769 | } | |||
1770 | } | |||
1771 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1772 | } | |||
1773 | ||||
1774 | PetscErrorCode MatSetValuesBlocked_SeqBAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is) | |||
1775 | { | |||
1776 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1777 | PetscInt *rp,k,low,high,t,ii,jj,row,nrow,i,col,l,rmax,N,lastcol = -1; | |||
1778 | PetscInt *imax=a->imax,*ai=a->i,*ailen=a->ilen; | |||
1779 | PetscErrorCode ierr; | |||
1780 | PetscInt *aj =a->j,nonew=a->nonew,bs2=a->bs2,bs=A->rmap->bs,stepval; | |||
1781 | PetscBool roworiented=a->roworiented; | |||
1782 | const PetscScalar *value = v; | |||
1783 | MatScalar *ap=NULL((void*)0),*aa = a->a,*bap; | |||
1784 | ||||
1785 | 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] = 1785; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1786 | if (roworiented) { | |||
1787 | stepval = (n-1)*bs; | |||
1788 | } else { | |||
1789 | stepval = (m-1)*bs; | |||
1790 | } | |||
1791 | for (k=0; k<m; k++) { /* loop over added rows */ | |||
1792 | row = im[k]; | |||
1793 | if (row < 0) continue; | |||
1794 | #if defined(PETSC_USE_DEBUG1) | |||
1795 | 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),1795,__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); | |||
1796 | #endif | |||
1797 | rp = aj + ai[row]; | |||
1798 | if (!A->structure_only) ap = aa + bs2*ai[row]; | |||
1799 | rmax = imax[row]; | |||
1800 | nrow = ailen[row]; | |||
1801 | low = 0; | |||
1802 | high = nrow; | |||
1803 | for (l=0; l<n; l++) { /* loop over added columns */ | |||
1804 | if (in[l] < 0) continue; | |||
1805 | #if defined(PETSC_USE_DEBUG1) | |||
1806 | 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),1806,__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); | |||
1807 | #endif | |||
1808 | col = in[l]; | |||
1809 | if (!A->structure_only) { | |||
1810 | if (roworiented) { | |||
1811 | value = v + (k*(stepval+bs) + l)*bs; | |||
1812 | } else { | |||
1813 | value = v + (l*(stepval+bs) + k)*bs; | |||
1814 | } | |||
1815 | } | |||
1816 | if (col <= lastcol) low = 0; | |||
1817 | else high = nrow; | |||
1818 | lastcol = col; | |||
1819 | while (high-low > 7) { | |||
1820 | t = (low+high)/2; | |||
1821 | if (rp[t] > col) high = t; | |||
1822 | else low = t; | |||
1823 | } | |||
1824 | for (i=low; i<high; i++) { | |||
1825 | if (rp[i] > col) break; | |||
1826 | if (rp[i] == col) { | |||
1827 | if (A->structure_only) goto noinsert2; | |||
1828 | bap = ap + bs2*i; | |||
1829 | if (roworiented) { | |||
1830 | if (is == ADD_VALUES) { | |||
1831 | for (ii=0; ii<bs; ii++,value+=stepval) { | |||
1832 | for (jj=ii; jj<bs2; jj+=bs) { | |||
1833 | bap[jj] += *value++; | |||
1834 | } | |||
1835 | } | |||
1836 | } else { | |||
1837 | for (ii=0; ii<bs; ii++,value+=stepval) { | |||
1838 | for (jj=ii; jj<bs2; jj+=bs) { | |||
1839 | bap[jj] = *value++; | |||
1840 | } | |||
1841 | } | |||
1842 | } | |||
1843 | } else { | |||
1844 | if (is == ADD_VALUES) { | |||
1845 | for (ii=0; ii<bs; ii++,value+=bs+stepval) { | |||
1846 | for (jj=0; jj<bs; jj++) { | |||
1847 | bap[jj] += value[jj]; | |||
1848 | } | |||
1849 | bap += bs; | |||
1850 | } | |||
1851 | } else { | |||
1852 | for (ii=0; ii<bs; ii++,value+=bs+stepval) { | |||
1853 | for (jj=0; jj<bs; jj++) { | |||
1854 | bap[jj] = value[jj]; | |||
1855 | } | |||
1856 | bap += bs; | |||
1857 | } | |||
1858 | } | |||
1859 | } | |||
1860 | goto noinsert2; | |||
1861 | } | |||
1862 | } | |||
1863 | if (nonew == 1) goto noinsert2; | |||
1864 | 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),1864,__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); | |||
1865 | if (A->structure_only) { | |||
1866 | 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),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(1,PETSC_FALSE,1866,__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),1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMallocA (1,PETSC_FALSE,1866,__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),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 = 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); 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++; }; | |||
1867 | } else { | |||
1868 | 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),1868,__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,1868,__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),1868,__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),1868,__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),1868,__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),1868,__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),1868,__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),1868,__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),1868,__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++; }; | |||
1869 | } | |||
1870 | N = nrow++ - 1; high++; | |||
1871 | /* shift up all the later entries in this row */ | |||
1872 | 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),1872,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1873 | rp[i] = col; | |||
1874 | if (!A->structure_only) { | |||
1875 | 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),1875,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1876 | bap = ap + bs2*i; | |||
1877 | if (roworiented) { | |||
1878 | for (ii=0; ii<bs; ii++,value+=stepval) { | |||
1879 | for (jj=ii; jj<bs2; jj+=bs) { | |||
1880 | bap[jj] = *value++; | |||
1881 | } | |||
1882 | } | |||
1883 | } else { | |||
1884 | for (ii=0; ii<bs; ii++,value+=stepval) { | |||
1885 | for (jj=0; jj<bs; jj++) { | |||
1886 | *bap++ = *value++; | |||
1887 | } | |||
1888 | } | |||
1889 | } | |||
1890 | } | |||
1891 | noinsert2:; | |||
1892 | low = i; | |||
1893 | } | |||
1894 | ailen[row] = nrow; | |||
1895 | } | |||
1896 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1897 | } | |||
1898 | ||||
1899 | PetscErrorCode MatAssemblyEnd_SeqBAIJ(Mat A,MatAssemblyType mode) | |||
1900 | { | |||
1901 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
1902 | PetscInt fshift = 0,i,*ai = a->i,*aj = a->j,*imax = a->imax; | |||
1903 | PetscInt m = A->rmap->N,*ip,N,*ailen = a->ilen; | |||
1904 | PetscErrorCode ierr; | |||
1905 | PetscInt mbs = a->mbs,bs2 = a->bs2,rmax = 0; | |||
1906 | MatScalar *aa = a->a,*ap; | |||
1907 | PetscReal ratio=0.6; | |||
1908 | ||||
1909 | 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] = 1909; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1910 | 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); | |||
1911 | ||||
1912 | if (m) rmax = ailen[0]; | |||
1913 | for (i=1; i<mbs; i++) { | |||
1914 | /* move each row back by the amount of empty slots (fshift) before it*/ | |||
1915 | fshift += imax[i-1] - ailen[i-1]; | |||
1916 | rmax = PetscMax(rmax,ailen[i])(((rmax)<(ailen[i])) ? (ailen[i]) : (rmax)); | |||
1917 | if (fshift) { | |||
1918 | ip = aj + ai[i]; | |||
1919 | ap = aa + bs2*ai[i]; | |||
1920 | N = ailen[i]; | |||
1921 | 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),1921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1922 | if (!A->structure_only) { | |||
1923 | 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),1923,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1924 | } | |||
1925 | } | |||
1926 | ai[i] = ai[i-1] + ailen[i-1]; | |||
1927 | } | |||
1928 | if (mbs) { | |||
1929 | fshift += imax[mbs-1] - ailen[mbs-1]; | |||
1930 | ai[mbs] = ai[mbs-1] + ailen[mbs-1]; | |||
1931 | } | |||
1932 | ||||
1933 | /* reset ilen and imax for each row */ | |||
1934 | a->nonzerorowcnt = 0; | |||
1935 | if (A->structure_only) { | |||
1936 | ierr = PetscFree2(a->imax,a->ilen)PetscFreeA(2,1936,__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),1936,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1937 | } else { /* !A->structure_only */ | |||
1938 | for (i=0; i<mbs; i++) { | |||
1939 | ailen[i] = imax[i] = ai[i+1] - ai[i]; | |||
1940 | a->nonzerorowcnt += ((ai[i+1] - ai[i]) > 0); | |||
1941 | } | |||
1942 | } | |||
1943 | a->nz = ai[mbs]; | |||
1944 | ||||
1945 | /* diagonals may have moved, so kill the diagonal pointers */ | |||
1946 | a->idiagvalid = PETSC_FALSE; | |||
1947 | if (fshift && a->diag) { | |||
1948 | ierr = PetscFree(a->diag)((*PetscTrFree)((void*)(a->diag),1948,__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),1948,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1949 | ierr = PetscLogObjectMemory((PetscObject)A,-(mbs+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1949,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1950 | a->diag = 0; | |||
1951 | } | |||
1952 | 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),1952,__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); | |||
1953 | 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),1953,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1954 | 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),1954,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1955 | 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),1955,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1956 | ||||
1957 | A->info.mallocs += a->reallocs; | |||
1958 | a->reallocs = 0; | |||
1959 | A->info.nz_unneeded = (PetscReal)fshift*bs2; | |||
1960 | a->rmax = rmax; | |||
1961 | ||||
1962 | if (!A->structure_only) { | |||
1963 | ierr = MatCheckCompressedRow(A,a->nonzerorowcnt,&a->compressedrow,a->i,mbs,ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1963,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1964 | } | |||
1965 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1966 | } | |||
1967 | ||||
1968 | /* | |||
1969 | This function returns an array of flags which indicate the locations of contiguous | |||
1970 | blocks that should be zeroed. for eg: if bs = 3 and is = [0,1,2,3,5,6,7,8,9] | |||
1971 | then the resulting sizes = [3,1,1,3,1] correspondig to sets [(0,1,2),(3),(5),(6,7,8),(9)] | |||
1972 | Assume: sizes should be long enough to hold all the values. | |||
1973 | */ | |||
1974 | static PetscErrorCode MatZeroRows_SeqBAIJ_Check_Blocks(PetscInt idx[],PetscInt n,PetscInt bs,PetscInt sizes[], PetscInt *bs_max) | |||
1975 | { | |||
1976 | PetscInt i,j,k,row; | |||
1977 | PetscBool flg; | |||
1978 | ||||
1979 | 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] = 1979; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1980 | for (i=0,j=0; i<n; j++) { | |||
1981 | row = idx[i]; | |||
1982 | if (row%bs!=0) { /* Not the begining of a block */ | |||
1983 | sizes[j] = 1; | |||
1984 | i++; | |||
1985 | } else if (i+bs > n) { /* complete block doesn't exist (at idx end) */ | |||
1986 | sizes[j] = 1; /* Also makes sure atleast 'bs' values exist for next else */ | |||
1987 | i++; | |||
1988 | } else { /* Begining of the block, so check if the complete block exists */ | |||
1989 | flg = PETSC_TRUE; | |||
1990 | for (k=1; k<bs; k++) { | |||
1991 | if (row+k != idx[i+k]) { /* break in the block */ | |||
1992 | flg = PETSC_FALSE; | |||
1993 | break; | |||
1994 | } | |||
1995 | } | |||
1996 | if (flg) { /* No break in the bs */ | |||
1997 | sizes[j] = bs; | |||
1998 | i += bs; | |||
1999 | } else { | |||
2000 | sizes[j] = 1; | |||
2001 | i++; | |||
2002 | } | |||
2003 | } | |||
2004 | } | |||
2005 | *bs_max = j; | |||
2006 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2007 | } | |||
2008 | ||||
2009 | PetscErrorCode MatZeroRows_SeqBAIJ(Mat A,PetscInt is_n,const PetscInt is_idx[],PetscScalar diag,Vec x, Vec b) | |||
2010 | { | |||
2011 | Mat_SeqBAIJ *baij=(Mat_SeqBAIJ*)A->data; | |||
2012 | PetscErrorCode ierr; | |||
2013 | PetscInt i,j,k,count,*rows; | |||
2014 | PetscInt bs=A->rmap->bs,bs2=baij->bs2,*sizes,row,bs_max; | |||
2015 | PetscScalar zero = 0.0; | |||
2016 | MatScalar *aa; | |||
2017 | const PetscScalar *xx; | |||
2018 | PetscScalar *bb; | |||
2019 | ||||
2020 | 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] = 2020; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2021 | /* fix right hand side if needed */ | |||
2022 | if (x && b) { | |||
2023 | ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2023,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2024 | ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2024,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2025 | for (i=0; i<is_n; i++) { | |||
2026 | bb[is_idx[i]] = diag*xx[is_idx[i]]; | |||
2027 | } | |||
2028 | ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2028,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2029 | ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2029,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2030 | } | |||
2031 | ||||
2032 | /* Make a copy of the IS and sort it */ | |||
2033 | /* allocate memory for rows,sizes */ | |||
2034 | ierr = PetscMalloc2(is_n,&rows,2*is_n,&sizes)PetscMallocA(2,PETSC_FALSE,2034,__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),2034,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2035 | ||||
2036 | /* copy IS values to rows, and sort them */ | |||
2037 | for (i=0; i<is_n; i++) rows[i] = is_idx[i]; | |||
2038 | ierr = PetscSortInt(is_n,rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2038,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2039 | ||||
2040 | if (baij->keepnonzeropattern) { | |||
2041 | for (i=0; i<is_n; i++) sizes[i] = 1; | |||
2042 | bs_max = is_n; | |||
2043 | } else { | |||
2044 | 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),2044,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2045 | A->nonzerostate++; | |||
2046 | } | |||
2047 | ||||
2048 | for (i=0,j=0; i<bs_max; j+=sizes[i],i++) { | |||
2049 | row = rows[j]; | |||
2050 | 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),2050,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"row %D out of range",row); | |||
2051 | count = (baij->i[row/bs +1] - baij->i[row/bs])*bs; | |||
2052 | aa = ((MatScalar*)(baij->a)) + baij->i[row/bs]*bs2 + (row%bs); | |||
2053 | if (sizes[i] == bs && !baij->keepnonzeropattern) { | |||
2054 | if (diag != (PetscScalar)0.0) { | |||
2055 | if (baij->ilen[row/bs] > 0) { | |||
2056 | baij->ilen[row/bs] = 1; | |||
2057 | baij->j[baij->i[row/bs]] = row/bs; | |||
2058 | ||||
2059 | ierr = PetscArrayzero(aa,count*bs)PetscMemzero(aa,(count*bs)*sizeof(*(aa)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2059,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2060 | } | |||
2061 | /* Now insert all the diagonal values for this bs */ | |||
2062 | for (k=0; k<bs; k++) { | |||
2063 | 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),2063,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2064 | } | |||
2065 | } else { /* (diag == 0.0) */ | |||
2066 | baij->ilen[row/bs] = 0; | |||
2067 | } /* end (diag == 0.0) */ | |||
2068 | } else { /* (sizes[i] != bs) */ | |||
2069 | #if defined(PETSC_USE_DEBUG1) | |||
2070 | if (sizes[i] != 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Internal Error. Value should be 1")return PetscError(((MPI_Comm)0x44000001),2070,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,77,PETSC_ERROR_INITIAL,"Internal Error. Value should be 1"); | |||
2071 | #endif | |||
2072 | for (k=0; k<count; k++) { | |||
2073 | aa[0] = zero; | |||
2074 | aa += bs; | |||
2075 | } | |||
2076 | if (diag != (PetscScalar)0.0) { | |||
2077 | 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),2077,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2078 | } | |||
2079 | } | |||
2080 | } | |||
2081 | ||||
2082 | ierr = PetscFree2(rows,sizes)PetscFreeA(2,2082,__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),2082,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2083 | ierr = MatAssemblyEnd_SeqBAIJ(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2083,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2084 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2085 | } | |||
2086 | ||||
2087 | PetscErrorCode MatZeroRowsColumns_SeqBAIJ(Mat A,PetscInt is_n,const PetscInt is_idx[],PetscScalar diag,Vec x, Vec b) | |||
2088 | { | |||
2089 | Mat_SeqBAIJ *baij=(Mat_SeqBAIJ*)A->data; | |||
2090 | PetscErrorCode ierr; | |||
2091 | PetscInt i,j,k,count; | |||
2092 | PetscInt bs =A->rmap->bs,bs2=baij->bs2,row,col; | |||
2093 | PetscScalar zero = 0.0; | |||
2094 | MatScalar *aa; | |||
2095 | const PetscScalar *xx; | |||
2096 | PetscScalar *bb; | |||
2097 | PetscBool *zeroed,vecs = PETSC_FALSE; | |||
2098 | ||||
2099 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ; petscstack->line[petscstack->currentsize] = 2099; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2100 | /* fix right hand side if needed */ | |||
2101 | if (x && b) { | |||
2102 | ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2102,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2103 | ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2103,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2104 | vecs = PETSC_TRUE; | |||
2105 | } | |||
2106 | ||||
2107 | /* zero the columns */ | |||
2108 | ierr = PetscCalloc1(A->rmap->n,&zeroed)PetscMallocA(1,PETSC_TRUE,2108,__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),2108,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2109 | for (i=0; i<is_n; i++) { | |||
2110 | 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),2110,__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]); | |||
2111 | zeroed[is_idx[i]] = PETSC_TRUE; | |||
2112 | } | |||
2113 | for (i=0; i<A->rmap->N; i++) { | |||
2114 | if (!zeroed[i]) { | |||
2115 | row = i/bs; | |||
2116 | for (j=baij->i[row]; j<baij->i[row+1]; j++) { | |||
2117 | for (k=0; k<bs; k++) { | |||
2118 | col = bs*baij->j[j] + k; | |||
2119 | if (zeroed[col]) { | |||
2120 | aa = ((MatScalar*)(baij->a)) + j*bs2 + (i%bs) + bs*k; | |||
2121 | if (vecs) bb[i] -= aa[0]*xx[col]; | |||
2122 | aa[0] = 0.0; | |||
2123 | } | |||
2124 | } | |||
2125 | } | |||
2126 | } else if (vecs) bb[i] = diag*xx[i]; | |||
2127 | } | |||
2128 | ierr = PetscFree(zeroed)((*PetscTrFree)((void*)(zeroed),2128,__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),2128,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2129 | if (vecs) { | |||
2130 | ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2130,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2131 | ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2131,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2132 | } | |||
2133 | ||||
2134 | /* zero the rows */ | |||
2135 | for (i=0; i<is_n; i++) { | |||
2136 | row = is_idx[i]; | |||
2137 | count = (baij->i[row/bs +1] - baij->i[row/bs])*bs; | |||
2138 | aa = ((MatScalar*)(baij->a)) + baij->i[row/bs]*bs2 + (row%bs); | |||
2139 | for (k=0; k<count; k++) { | |||
2140 | aa[0] = zero; | |||
2141 | aa += bs; | |||
2142 | } | |||
2143 | if (diag != (PetscScalar)0.0) { | |||
2144 | 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),2144,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2145 | } | |||
2146 | } | |||
2147 | ierr = MatAssemblyEnd_SeqBAIJ(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2147,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2148 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2149 | } | |||
2150 | ||||
2151 | PetscErrorCode MatSetValues_SeqBAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is) | |||
2152 | { | |||
2153 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2154 | PetscInt *rp,k,low,high,t,ii,row,nrow,i,col,l,rmax,N,lastcol = -1; | |||
2155 | PetscInt *imax=a->imax,*ai=a->i,*ailen=a->ilen; | |||
2156 | PetscInt *aj =a->j,nonew=a->nonew,bs=A->rmap->bs,brow,bcol; | |||
2157 | PetscErrorCode ierr; | |||
2158 | PetscInt ridx,cidx,bs2=a->bs2; | |||
2159 | PetscBool roworiented=a->roworiented; | |||
2160 | MatScalar *ap=NULL((void*)0),value=0.0,*aa=a->a,*bap; | |||
2161 | ||||
2162 | 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] = 2162; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2163 | for (k=0; k<m; k++) { /* loop over added rows */ | |||
| ||||
2164 | row = im[k]; | |||
2165 | brow = row/bs; | |||
2166 | if (row < 0) continue; | |||
2167 | #if defined(PETSC_USE_DEBUG1) | |||
2168 | 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),2168,__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); | |||
2169 | #endif | |||
2170 | rp = aj + ai[brow]; | |||
2171 | if (!A->structure_only) ap = aa + bs2*ai[brow]; | |||
2172 | rmax = imax[brow]; | |||
2173 | nrow = ailen[brow]; | |||
2174 | low = 0; | |||
2175 | high = nrow; | |||
2176 | for (l=0; l<n; l++) { /* loop over added columns */ | |||
2177 | if (in[l] < 0) continue; | |||
2178 | #if defined(PETSC_USE_DEBUG1) | |||
2179 | 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),2179,__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); | |||
2180 | #endif | |||
2181 | col = in[l]; bcol = col/bs; | |||
2182 | ridx = row % bs; cidx = col % bs; | |||
2183 | if (!A->structure_only) { | |||
2184 | if (roworiented) { | |||
2185 | value = v[l + k*n]; | |||
2186 | } else { | |||
2187 | value = v[k + l*m]; | |||
2188 | } | |||
2189 | } | |||
2190 | if (col <= lastcol) low = 0; else high = nrow; | |||
2191 | lastcol = col; | |||
2192 | while (high-low > 7) { | |||
2193 | t = (low+high)/2; | |||
2194 | if (rp[t] > bcol) high = t; | |||
2195 | else low = t; | |||
2196 | } | |||
2197 | for (i=low; i<high; i++) { | |||
2198 | if (rp[i] > bcol) break; | |||
2199 | if (rp[i] == bcol) { | |||
2200 | bap = ap + bs2*i + bs*cidx + ridx; | |||
2201 | if (!A->structure_only) { | |||
2202 | if (is == ADD_VALUES) *bap += value; | |||
2203 | else *bap = value; | |||
2204 | } | |||
2205 | goto noinsert1; | |||
2206 | } | |||
2207 | } | |||
2208 | if (nonew == 1) goto noinsert1; | |||
2209 | 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),2209,__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); | |||
2210 | if (A->structure_only) { | |||
2211 | 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),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(1,PETSC_FALSE,2211,__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),2211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMallocA (1,PETSC_FALSE,2211,__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),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 = 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); 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++; }; | |||
2212 | } else { | |||
2213 | 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),2213,__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,2213,__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),2213,__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),2213,__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),2213,__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),2213,__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),2213,__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),2213,__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),2213,__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++; }; | |||
2214 | } | |||
2215 | N = nrow++ - 1; high++; | |||
2216 | /* shift up all the later entries in this row */ | |||
2217 | 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),2217,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2218 | rp[i] = bcol; | |||
2219 | if (!A->structure_only) { | |||
2220 | 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),2220,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2221 | 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),2221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2222 | ap[bs2*i + bs*cidx + ridx] = value; | |||
2223 | } | |||
2224 | a->nz++; | |||
2225 | A->nonzerostate++; | |||
2226 | noinsert1:; | |||
2227 | low = i; | |||
2228 | } | |||
2229 | ailen[brow] = nrow; | |||
2230 | } | |||
2231 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2232 | } | |||
2233 | ||||
2234 | PetscErrorCode MatILUFactor_SeqBAIJ(Mat inA,IS row,IS col,const MatFactorInfo *info) | |||
2235 | { | |||
2236 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)inA->data; | |||
2237 | Mat outA; | |||
2238 | PetscErrorCode ierr; | |||
2239 | PetscBool row_identity,col_identity; | |||
2240 | ||||
2241 | 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] = 2241; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2242 | if (info->levels != 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only levels = 0 supported for in-place ILU")return PetscError(((MPI_Comm)0x44000001),2242,__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" ); | |||
2243 | ierr = ISIdentity(row,&row_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2243,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2244 | ierr = ISIdentity(col,&col_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2244,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2245 | 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),2245,__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" ); | |||
2246 | ||||
2247 | outA = inA; | |||
2248 | inA->factortype = MAT_FACTOR_LU; | |||
2249 | ierr = PetscFree(inA->solvertype)((*PetscTrFree)((void*)(inA->solvertype),2249,__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),2249,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2250 | ierr = PetscStrallocpy(MATSOLVERPETSC"petsc",&inA->solvertype);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 = MatMarkDiagonal_SeqBAIJ(inA);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 | ||||
2254 | ierr = PetscObjectReference((PetscObject)row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2254,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2255 | ierr = ISDestroy(&a->row);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 | a->row = row; | |||
2257 | ierr = PetscObjectReference((PetscObject)col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2257,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2258 | ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2258,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2259 | a->col = col; | |||
2260 | ||||
2261 | /* Create the invert permutation so that it can be used in MatLUFactorNumeric() */ | |||
2262 | ierr = ISDestroy(&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 | ierr = ISInvertPermutation(col,PETSC_DECIDE-1,&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2263,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2264 | ierr = PetscLogObjectParent((PetscObject)inA,(PetscObject)a->icol);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 | ||||
2266 | ierr = MatSeqBAIJSetNumericFactorization_inplace(inA,(PetscBool)(row_identity && col_identity));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 | if (!a->solve_work) { | |||
2268 | ierr = PetscMalloc1(inA->rmap->N+inA->rmap->bs,&a->solve_work)PetscMallocA(1,PETSC_FALSE,2268,__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),2268,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2269 | 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),2269,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2270 | } | |||
2271 | ierr = MatLUFactorNumeric(outA,inA,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2271,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2272 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2273 | } | |||
2274 | ||||
2275 | PetscErrorCode MatSeqBAIJSetColumnIndices_SeqBAIJ(Mat mat,PetscInt *indices) | |||
2276 | { | |||
2277 | Mat_SeqBAIJ *baij = (Mat_SeqBAIJ*)mat->data; | |||
2278 | PetscInt i,nz,mbs; | |||
2279 | ||||
2280 | 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] = 2280; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2281 | nz = baij->maxnz; | |||
2282 | mbs = baij->mbs; | |||
2283 | for (i=0; i<nz; i++) { | |||
2284 | baij->j[i] = indices[i]; | |||
2285 | } | |||
2286 | baij->nz = nz; | |||
2287 | for (i=0; i<mbs; i++) { | |||
2288 | baij->ilen[i] = baij->imax[i]; | |||
2289 | } | |||
2290 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2291 | } | |||
2292 | ||||
2293 | /*@ | |||
2294 | MatSeqBAIJSetColumnIndices - Set the column indices for all the rows | |||
2295 | in the matrix. | |||
2296 | ||||
2297 | Input Parameters: | |||
2298 | + mat - the SeqBAIJ matrix | |||
2299 | - indices - the column indices | |||
2300 | ||||
2301 | Level: advanced | |||
2302 | ||||
2303 | Notes: | |||
2304 | This can be called if you have precomputed the nonzero structure of the | |||
2305 | matrix and want to provide it to the matrix object to improve the performance | |||
2306 | of the MatSetValues() operation. | |||
2307 | ||||
2308 | You MUST have set the correct numbers of nonzeros per row in the call to | |||
2309 | MatCreateSeqBAIJ(), and the columns indices MUST be sorted. | |||
2310 | ||||
2311 | MUST be called before any calls to MatSetValues(); | |||
2312 | ||||
2313 | @*/ | |||
2314 | PetscErrorCode MatSeqBAIJSetColumnIndices(Mat mat,PetscInt *indices) | |||
2315 | { | |||
2316 | PetscErrorCode ierr; | |||
2317 | ||||
2318 | 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] = 2318; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2319 | PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),2319, __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),2319,__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),2319,__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),2319,__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); | |||
2320 | PetscValidPointer(indices,2)do { if (!indices) return PetscError(((MPI_Comm)0x44000001),2320 ,__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),2320,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
2321 | ierr = PetscUseMethod(mat,"MatSeqBAIJSetColumnIndices_C",(Mat,PetscInt*),(mat,indices))0; do { PetscErrorCode (*_7_f)(Mat,PetscInt*), _7_ierr; _7_ierr = PetscObjectQueryFunction_Private(((PetscObject)(mat)),("MatSeqBAIJSetColumnIndices_C" ),(PetscVoidFunction*)(&_7_f));do {if (__builtin_expect(! !(_7_ierr),0)) return PetscError(((MPI_Comm)0x44000001),2321, __func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_7_f) {_7_ierr = (*_7_f)(mat,indices);do {if (__builtin_expect(!!(_7_ierr), 0)) return PetscError(((MPI_Comm)0x44000001),2321,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} else return PetscError (PetscObjectComm((PetscObject)(mat)),2321,__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),2321,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2322 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2323 | } | |||
2324 | ||||
2325 | PetscErrorCode MatGetRowMaxAbs_SeqBAIJ(Mat A,Vec v,PetscInt idx[]) | |||
2326 | { | |||
2327 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2328 | PetscErrorCode ierr; | |||
2329 | PetscInt i,j,n,row,bs,*ai,*aj,mbs; | |||
2330 | PetscReal atmp; | |||
2331 | PetscScalar *x,zero = 0.0; | |||
2332 | MatScalar *aa; | |||
2333 | PetscInt ncols,brow,krow,kcol; | |||
2334 | ||||
2335 | 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] = 2335; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2336 | if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),2336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,73,PETSC_ERROR_INITIAL,"Not for factored matrix"); | |||
2337 | bs = A->rmap->bs; | |||
2338 | aa = a->a; | |||
2339 | ai = a->i; | |||
2340 | aj = a->j; | |||
2341 | mbs = a->mbs; | |||
2342 | ||||
2343 | ierr = VecSet(v,zero);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 | ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2344,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2345 | ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2345,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2346 | if (n != A->rmap->N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),2346,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector"); | |||
2347 | for (i=0; i<mbs; i++) { | |||
2348 | ncols = ai[1] - ai[0]; ai++; | |||
2349 | brow = bs*i; | |||
2350 | for (j=0; j<ncols; j++) { | |||
2351 | for (kcol=0; kcol<bs; kcol++) { | |||
2352 | for (krow=0; krow<bs; krow++) { | |||
2353 | atmp = PetscAbsScalar(*aa);aa++; | |||
2354 | row = brow + krow; /* row index */ | |||
2355 | if (PetscAbsScalar(x[row]) < atmp) {x[row] = atmp; if (idx) idx[row] = bs*(*aj) + kcol;} | |||
2356 | } | |||
2357 | } | |||
2358 | aj++; | |||
2359 | } | |||
2360 | } | |||
2361 | ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2362 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2363 | } | |||
2364 | ||||
2365 | PetscErrorCode MatCopy_SeqBAIJ(Mat A,Mat B,MatStructure str) | |||
2366 | { | |||
2367 | PetscErrorCode ierr; | |||
2368 | ||||
2369 | 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] = 2369; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2370 | /* If the two matrices have the same copy implementation, use fast copy. */ | |||
2371 | if (str == SAME_NONZERO_PATTERN && (A->ops->copy == B->ops->copy)) { | |||
2372 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2373 | Mat_SeqBAIJ *b = (Mat_SeqBAIJ*)B->data; | |||
2374 | PetscInt ambs=a->mbs,bmbs=b->mbs,abs=A->rmap->bs,bbs=B->rmap->bs,bs2=abs*abs; | |||
2375 | ||||
2376 | 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),2376,__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]); | |||
2377 | 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),2377,__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); | |||
2378 | 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),2378,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2379 | ierr = PetscObjectStateIncrease((PetscObject)B)(((PetscObject)B)->state++,0);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 | } else { | |||
2381 | ierr = MatCopy_Basic(A,B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2381,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2382 | } | |||
2383 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2384 | } | |||
2385 | ||||
2386 | PetscErrorCode MatSetUp_SeqBAIJ(Mat A) | |||
2387 | { | |||
2388 | PetscErrorCode ierr; | |||
2389 | ||||
2390 | 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] = 2390; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2391 | ierr = MatSeqBAIJSetPreallocation(A,A->rmap->bs,PETSC_DEFAULT-2,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2391,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2392 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2393 | } | |||
2394 | ||||
2395 | PetscErrorCode MatSeqBAIJGetArray_SeqBAIJ(Mat A,PetscScalar *array[]) | |||
2396 | { | |||
2397 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2398 | ||||
2399 | 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] = 2399; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2400 | *array = a->a; | |||
2401 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2402 | } | |||
2403 | ||||
2404 | PetscErrorCode MatSeqBAIJRestoreArray_SeqBAIJ(Mat A,PetscScalar *array[]) | |||
2405 | { | |||
2406 | 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] = 2406; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2407 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2408 | } | |||
2409 | ||||
2410 | PetscErrorCode MatAXPYGetPreallocation_SeqBAIJ(Mat Y,Mat X,PetscInt *nnz) | |||
2411 | { | |||
2412 | PetscInt bs = Y->rmap->bs,mbs = Y->rmap->N/bs; | |||
2413 | Mat_SeqBAIJ *x = (Mat_SeqBAIJ*)X->data; | |||
2414 | Mat_SeqBAIJ *y = (Mat_SeqBAIJ*)Y->data; | |||
2415 | PetscErrorCode ierr; | |||
2416 | ||||
2417 | 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] = 2417; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2418 | /* Set the number of nonzeros in the new matrix */ | |||
2419 | 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),2419,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2420 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2421 | } | |||
2422 | ||||
2423 | PetscErrorCode MatAXPY_SeqBAIJ(Mat Y,PetscScalar a,Mat X,MatStructure str) | |||
2424 | { | |||
2425 | Mat_SeqBAIJ *x = (Mat_SeqBAIJ*)X->data,*y = (Mat_SeqBAIJ*)Y->data; | |||
2426 | PetscErrorCode ierr; | |||
2427 | PetscInt bs=Y->rmap->bs,bs2=bs*bs; | |||
2428 | PetscBLASInt one=1; | |||
2429 | ||||
2430 | 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] = 2430; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2431 | if (str == SAME_NONZERO_PATTERN) { | |||
2432 | PetscScalar alpha = a; | |||
2433 | PetscBLASInt bnz; | |||
2434 | ierr = PetscBLASIntCast(x->nz*bs2,&bnz);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 | 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] = 2435; 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(2435 ,__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),2435,__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); | |||
2436 | ierr = PetscObjectStateIncrease((PetscObject)Y)(((PetscObject)Y)->state++,0);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 if (str == SUBSET_NONZERO_PATTERN) { /* nonzeros of X is a subset of Y's */ | |||
2438 | ierr = MatAXPY_Basic(Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2438,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2439 | } else { | |||
2440 | Mat B; | |||
2441 | PetscInt *nnz; | |||
2442 | if (bs != X->rmap->bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Matrices must have same block size")return PetscError(((MPI_Comm)0x44000001),2442,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,60,PETSC_ERROR_INITIAL,"Matrices must have same block size"); | |||
2443 | ierr = PetscMalloc1(Y->rmap->N,&nnz)PetscMallocA(1,PETSC_FALSE,2443,__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),2443,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2444 | ierr = MatCreate(PetscObjectComm((PetscObject)Y),&B);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 = PetscObjectSetName((PetscObject)B,((PetscObject)Y)->name);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 = 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),2446,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2447 | ierr = MatSetBlockSizesFromMats(B,Y,Y);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 = MatSetType(B,(MatType) ((PetscObject)Y)->type_name);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 = MatAXPYGetPreallocation_SeqBAIJ(Y,X,nnz);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 = MatSeqBAIJSetPreallocation(B,bs,0,nnz);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 = MatAXPY_BasicWithPreallocation(B,Y,a,X,str);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 | ierr = MatHeaderReplace(Y,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2452,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2453 | ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),2453,__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),2453,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2454 | } | |||
2455 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2456 | } | |||
2457 | ||||
2458 | PetscErrorCode MatRealPart_SeqBAIJ(Mat A) | |||
2459 | { | |||
2460 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2461 | PetscInt i,nz = a->bs2*a->i[a->mbs]; | |||
2462 | MatScalar *aa = a->a; | |||
2463 | ||||
2464 | 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] = 2464; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2465 | for (i=0; i<nz; i++) aa[i] = PetscRealPart(aa[i])(aa[i]); | |||
2466 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2467 | } | |||
2468 | ||||
2469 | PetscErrorCode MatImaginaryPart_SeqBAIJ(Mat A) | |||
2470 | { | |||
2471 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2472 | PetscInt i,nz = a->bs2*a->i[a->mbs]; | |||
2473 | MatScalar *aa = a->a; | |||
2474 | ||||
2475 | 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] = 2475; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2476 | for (i=0; i<nz; i++) aa[i] = PetscImaginaryPart(aa[i])((PetscReal)0.); | |||
2477 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2478 | } | |||
2479 | ||||
2480 | /* | |||
2481 | Code almost idential to MatGetColumnIJ_SeqAIJ() should share common code | |||
2482 | */ | |||
2483 | PetscErrorCode MatGetColumnIJ_SeqBAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done) | |||
2484 | { | |||
2485 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2486 | PetscErrorCode ierr; | |||
2487 | PetscInt bs = A->rmap->bs,i,*collengths,*cia,*cja,n = A->cmap->n/bs,m = A->rmap->n/bs; | |||
2488 | PetscInt nz = a->i[m],row,*jj,mr,col; | |||
2489 | ||||
2490 | 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] = 2490; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2491 | *nn = n; | |||
2492 | 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); | |||
2493 | if (symmetric) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not for BAIJ matrices")return PetscError(((MPI_Comm)0x44000001),2493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"Not for BAIJ matrices"); | |||
2494 | else { | |||
2495 | ierr = PetscCalloc1(n,&collengths)PetscMallocA(1,PETSC_TRUE,2495,__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),2495,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2496 | ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,2496,__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),2496,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2497 | ierr = PetscMalloc1(nz,&cja)PetscMallocA(1,PETSC_FALSE,2497,__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),2497,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2498 | jj = a->j; | |||
2499 | for (i=0; i<nz; i++) { | |||
2500 | collengths[jj[i]]++; | |||
2501 | } | |||
2502 | cia[0] = oshift; | |||
2503 | for (i=0; i<n; i++) { | |||
2504 | cia[i+1] = cia[i] + collengths[i]; | |||
2505 | } | |||
2506 | ierr = PetscArrayzero(collengths,n)PetscMemzero(collengths,(n)*sizeof(*(collengths)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2506,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2507 | jj = a->j; | |||
2508 | for (row=0; row<m; row++) { | |||
2509 | mr = a->i[row+1] - a->i[row]; | |||
2510 | for (i=0; i<mr; i++) { | |||
2511 | col = *jj++; | |||
2512 | ||||
2513 | cja[cia[col] + collengths[col]++ - oshift] = row + oshift; | |||
2514 | } | |||
2515 | } | |||
2516 | ierr = PetscFree(collengths)((*PetscTrFree)((void*)(collengths),2516,__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),2516,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2517 | *ia = cia; *ja = cja; | |||
2518 | } | |||
2519 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2520 | } | |||
2521 | ||||
2522 | PetscErrorCode MatRestoreColumnIJ_SeqBAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done) | |||
2523 | { | |||
2524 | PetscErrorCode ierr; | |||
2525 | ||||
2526 | 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] = 2526; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2527 | 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); | |||
2528 | ierr = PetscFree(*ia)((*PetscTrFree)((void*)(*ia),2528,__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),2528,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2529 | ierr = PetscFree(*ja)((*PetscTrFree)((void*)(*ja),2529,__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),2529,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2530 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2531 | } | |||
2532 | ||||
2533 | /* | |||
2534 | MatGetColumnIJ_SeqBAIJ_Color() and MatRestoreColumnIJ_SeqBAIJ_Color() are customized from | |||
2535 | MatGetColumnIJ_SeqBAIJ() and MatRestoreColumnIJ_SeqBAIJ() by adding an output | |||
2536 | spidx[], index of a->a, to be used in MatTransposeColoringCreate() and MatFDColoringCreate() | |||
2537 | */ | |||
2538 | PetscErrorCode MatGetColumnIJ_SeqBAIJ_Color(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscInt *spidx[],PetscBool *done) | |||
2539 | { | |||
2540 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
2541 | PetscErrorCode ierr; | |||
2542 | PetscInt i,*collengths,*cia,*cja,n=a->nbs,m=a->mbs; | |||
2543 | PetscInt nz = a->i[m],row,*jj,mr,col; | |||
2544 | PetscInt *cspidx; | |||
2545 | ||||
2546 | 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] = 2546; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2547 | *nn = n; | |||
2548 | 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); | |||
2549 | ||||
2550 | ierr = PetscCalloc1(n,&collengths)PetscMallocA(1,PETSC_TRUE,2550,__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),2550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2551 | ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,2551,__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),2551,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2552 | ierr = PetscMalloc1(nz,&cja)PetscMallocA(1,PETSC_FALSE,2552,__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),2552,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2553 | ierr = PetscMalloc1(nz,&cspidx)PetscMallocA(1,PETSC_FALSE,2553,__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),2553,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2554 | jj = a->j; | |||
2555 | for (i=0; i<nz; i++) { | |||
2556 | collengths[jj[i]]++; | |||
2557 | } | |||
2558 | cia[0] = oshift; | |||
2559 | for (i=0; i<n; i++) { | |||
2560 | cia[i+1] = cia[i] + collengths[i]; | |||
2561 | } | |||
2562 | ierr = PetscArrayzero(collengths,n)PetscMemzero(collengths,(n)*sizeof(*(collengths)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2562,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2563 | jj = a->j; | |||
2564 | for (row=0; row<m; row++) { | |||
2565 | mr = a->i[row+1] - a->i[row]; | |||
2566 | for (i=0; i<mr; i++) { | |||
2567 | col = *jj++; | |||
2568 | cspidx[cia[col] + collengths[col] - oshift] = a->i[row] + i; /* index of a->j */ | |||
2569 | cja[cia[col] + collengths[col]++ - oshift] = row + oshift; | |||
2570 | } | |||
2571 | } | |||
2572 | ierr = PetscFree(collengths)((*PetscTrFree)((void*)(collengths),2572,__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),2572,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2573 | *ia = cia; | |||
2574 | *ja = cja; | |||
2575 | *spidx = cspidx; | |||
2576 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2577 | } | |||
2578 | ||||
2579 | PetscErrorCode MatRestoreColumnIJ_SeqBAIJ_Color(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscInt *spidx[],PetscBool *done) | |||
2580 | { | |||
2581 | PetscErrorCode ierr; | |||
2582 | ||||
2583 | 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] = 2583; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2584 | ierr = MatRestoreColumnIJ_SeqBAIJ(A,oshift,symmetric,inodecompressed,n,ia,ja,done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2584,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2585 | ierr = PetscFree(*spidx)((*PetscTrFree)((void*)(*spidx),2585,__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),2585,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2586 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2587 | } | |||
2588 | ||||
2589 | PetscErrorCode MatShift_SeqBAIJ(Mat Y,PetscScalar a) | |||
2590 | { | |||
2591 | PetscErrorCode ierr; | |||
2592 | Mat_SeqBAIJ *aij = (Mat_SeqBAIJ*)Y->data; | |||
2593 | ||||
2594 | 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] = 2594; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2595 | if (!Y->preallocated || !aij->nz) { | |||
2596 | ierr = MatSeqBAIJSetPreallocation(Y,Y->rmap->bs,1,NULL((void*)0));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 | } | |||
2598 | ierr = MatShift_Basic(Y,a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2598,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2599 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2600 | } | |||
2601 | ||||
2602 | /* -------------------------------------------------------------------*/ | |||
2603 | static struct _MatOps MatOps_Values = {MatSetValues_SeqBAIJ, | |||
2604 | MatGetRow_SeqBAIJ, | |||
2605 | MatRestoreRow_SeqBAIJ, | |||
2606 | MatMult_SeqBAIJ_N, | |||
2607 | /* 4*/ MatMultAdd_SeqBAIJ_N, | |||
2608 | MatMultTranspose_SeqBAIJ, | |||
2609 | MatMultTransposeAdd_SeqBAIJ, | |||
2610 | 0, | |||
2611 | 0, | |||
2612 | 0, | |||
2613 | /* 10*/ 0, | |||
2614 | MatLUFactor_SeqBAIJ, | |||
2615 | 0, | |||
2616 | 0, | |||
2617 | MatTranspose_SeqBAIJ, | |||
2618 | /* 15*/ MatGetInfo_SeqBAIJ, | |||
2619 | MatEqual_SeqBAIJ, | |||
2620 | MatGetDiagonal_SeqBAIJ, | |||
2621 | MatDiagonalScale_SeqBAIJ, | |||
2622 | MatNorm_SeqBAIJ, | |||
2623 | /* 20*/ 0, | |||
2624 | MatAssemblyEnd_SeqBAIJ, | |||
2625 | MatSetOption_SeqBAIJ, | |||
2626 | MatZeroEntries_SeqBAIJ, | |||
2627 | /* 24*/ MatZeroRows_SeqBAIJ, | |||
2628 | 0, | |||
2629 | 0, | |||
2630 | 0, | |||
2631 | 0, | |||
2632 | /* 29*/ MatSetUp_SeqBAIJ, | |||
2633 | 0, | |||
2634 | 0, | |||
2635 | 0, | |||
2636 | 0, | |||
2637 | /* 34*/ MatDuplicate_SeqBAIJ, | |||
2638 | 0, | |||
2639 | 0, | |||
2640 | MatILUFactor_SeqBAIJ, | |||
2641 | 0, | |||
2642 | /* 39*/ MatAXPY_SeqBAIJ, | |||
2643 | MatCreateSubMatrices_SeqBAIJ, | |||
2644 | MatIncreaseOverlap_SeqBAIJ, | |||
2645 | MatGetValues_SeqBAIJ, | |||
2646 | MatCopy_SeqBAIJ, | |||
2647 | /* 44*/ 0, | |||
2648 | MatScale_SeqBAIJ, | |||
2649 | MatShift_SeqBAIJ, | |||
2650 | 0, | |||
2651 | MatZeroRowsColumns_SeqBAIJ, | |||
2652 | /* 49*/ 0, | |||
2653 | MatGetRowIJ_SeqBAIJ, | |||
2654 | MatRestoreRowIJ_SeqBAIJ, | |||
2655 | MatGetColumnIJ_SeqBAIJ, | |||
2656 | MatRestoreColumnIJ_SeqBAIJ, | |||
2657 | /* 54*/ MatFDColoringCreate_SeqXAIJ, | |||
2658 | 0, | |||
2659 | 0, | |||
2660 | 0, | |||
2661 | MatSetValuesBlocked_SeqBAIJ, | |||
2662 | /* 59*/ MatCreateSubMatrix_SeqBAIJ, | |||
2663 | MatDestroy_SeqBAIJ, | |||
2664 | MatView_SeqBAIJ, | |||
2665 | 0, | |||
2666 | 0, | |||
2667 | /* 64*/ 0, | |||
2668 | 0, | |||
2669 | 0, | |||
2670 | 0, | |||
2671 | 0, | |||
2672 | /* 69*/ MatGetRowMaxAbs_SeqBAIJ, | |||
2673 | 0, | |||
2674 | MatConvert_Basic, | |||
2675 | 0, | |||
2676 | 0, | |||
2677 | /* 74*/ 0, | |||
2678 | MatFDColoringApply_BAIJ, | |||
2679 | 0, | |||
2680 | 0, | |||
2681 | 0, | |||
2682 | /* 79*/ 0, | |||
2683 | 0, | |||
2684 | 0, | |||
2685 | 0, | |||
2686 | MatLoad_SeqBAIJ, | |||
2687 | /* 84*/ 0, | |||
2688 | 0, | |||
2689 | 0, | |||
2690 | 0, | |||
2691 | 0, | |||
2692 | /* 89*/ 0, | |||
2693 | 0, | |||
2694 | 0, | |||
2695 | 0, | |||
2696 | 0, | |||
2697 | /* 94*/ 0, | |||
2698 | 0, | |||
2699 | 0, | |||
2700 | 0, | |||
2701 | 0, | |||
2702 | /* 99*/ 0, | |||
2703 | 0, | |||
2704 | 0, | |||
2705 | 0, | |||
2706 | 0, | |||
2707 | /*104*/ 0, | |||
2708 | MatRealPart_SeqBAIJ, | |||
2709 | MatImaginaryPart_SeqBAIJ, | |||
2710 | 0, | |||
2711 | 0, | |||
2712 | /*109*/ 0, | |||
2713 | 0, | |||
2714 | 0, | |||
2715 | 0, | |||
2716 | MatMissingDiagonal_SeqBAIJ, | |||
2717 | /*114*/ 0, | |||
2718 | 0, | |||
2719 | 0, | |||
2720 | 0, | |||
2721 | 0, | |||
2722 | /*119*/ 0, | |||
2723 | 0, | |||
2724 | MatMultHermitianTranspose_SeqBAIJ, | |||
2725 | MatMultHermitianTransposeAdd_SeqBAIJ, | |||
2726 | 0, | |||
2727 | /*124*/ 0, | |||
2728 | 0, | |||
2729 | MatInvertBlockDiagonal_SeqBAIJ, | |||
2730 | 0, | |||
2731 | 0, | |||
2732 | /*129*/ 0, | |||
2733 | 0, | |||
2734 | 0, | |||
2735 | 0, | |||
2736 | 0, | |||
2737 | /*134*/ 0, | |||
2738 | 0, | |||
2739 | 0, | |||
2740 | 0, | |||
2741 | 0, | |||
2742 | /*139*/ MatSetBlockSizes_Default, | |||
2743 | 0, | |||
2744 | 0, | |||
2745 | MatFDColoringSetUp_SeqXAIJ, | |||
2746 | 0, | |||
2747 | /*144*/MatCreateMPIMatConcatenateSeqMat_SeqBAIJ, | |||
2748 | MatDestroySubMatrices_SeqBAIJ | |||
2749 | }; | |||
2750 | ||||
2751 | PetscErrorCode MatStoreValues_SeqBAIJ(Mat mat) | |||
2752 | { | |||
2753 | Mat_SeqBAIJ *aij = (Mat_SeqBAIJ*)mat->data; | |||
2754 | PetscInt nz = aij->i[aij->mbs]*aij->bs2; | |||
2755 | PetscErrorCode ierr; | |||
2756 | ||||
2757 | 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] = 2757; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2758 | 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),2758,__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" ); | |||
2759 | ||||
2760 | /* allocate space for values if not already there */ | |||
2761 | if (!aij->saved_values) { | |||
2762 | ierr = PetscMalloc1(nz+1,&aij->saved_values)PetscMallocA(1,PETSC_FALSE,2762,__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),2762,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2763 | ierr = PetscLogObjectMemory((PetscObject)mat,(nz+1)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2763,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2764 | } | |||
2765 | ||||
2766 | /* copy values over */ | |||
2767 | 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),2767,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2768 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2769 | } | |||
2770 | ||||
2771 | PetscErrorCode MatRetrieveValues_SeqBAIJ(Mat mat) | |||
2772 | { | |||
2773 | Mat_SeqBAIJ *aij = (Mat_SeqBAIJ*)mat->data; | |||
2774 | PetscErrorCode ierr; | |||
2775 | PetscInt nz = aij->i[aij->mbs]*aij->bs2; | |||
2776 | ||||
2777 | 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] = 2777; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2778 | 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),2778,__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" ); | |||
2779 | if (!aij->saved_values) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatStoreValues(A);first")return PetscError(((MPI_Comm)0x44000001),2779,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,58,PETSC_ERROR_INITIAL,"Must call MatStoreValues(A);first"); | |||
2780 | ||||
2781 | /* copy values over */ | |||
2782 | 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),2782,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2783 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2784 | } | |||
2785 | ||||
2786 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqBAIJ_SeqAIJ(Mat, MatType,MatReuse,Mat*); | |||
2787 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqBAIJ_SeqSBAIJ(Mat, MatType,MatReuse,Mat*); | |||
2788 | ||||
2789 | PetscErrorCode MatSeqBAIJSetPreallocation_SeqBAIJ(Mat B,PetscInt bs,PetscInt nz,PetscInt *nnz) | |||
2790 | { | |||
2791 | Mat_SeqBAIJ *b; | |||
2792 | PetscErrorCode ierr; | |||
2793 | PetscInt i,mbs,nbs,bs2; | |||
2794 | PetscBool flg = PETSC_FALSE,skipallocation = PETSC_FALSE,realalloc = PETSC_FALSE; | |||
2795 | ||||
2796 | 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] = 2796; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2797 | if (nz >= 0 || nnz) realalloc = PETSC_TRUE; | |||
2798 | if (nz == MAT_SKIP_ALLOCATION-4) { | |||
2799 | skipallocation = PETSC_TRUE; | |||
2800 | nz = 0; | |||
2801 | } | |||
2802 | ||||
2803 | ierr = MatSetBlockSize(B,PetscAbs(bs)(((bs) >= 0) ? (bs) : (-(bs))));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 = PetscLayoutSetUp(B->rmap);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 | ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2805,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2806 | ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2806,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2807 | ||||
2808 | B->preallocated = PETSC_TRUE; | |||
2809 | ||||
2810 | mbs = B->rmap->n/bs; | |||
2811 | nbs = B->cmap->n/bs; | |||
2812 | bs2 = bs*bs; | |||
2813 | ||||
2814 | 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),2814,__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); | |||
2815 | ||||
2816 | if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 5; | |||
2817 | 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),2817,__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); | |||
2818 | if (nnz) { | |||
2819 | for (i=0; i<mbs; i++) { | |||
2820 | 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),2820,__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]); | |||
2821 | 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),2821,__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); | |||
2822 | } | |||
2823 | } | |||
2824 | ||||
2825 | b = (Mat_SeqBAIJ*)B->data; | |||
2826 | 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),2826,__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),2826,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2827 | 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),2827,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2828 | ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if ( __builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm )0x44000001),2828,__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),2828,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2829 | ||||
2830 | if (!flg) { | |||
2831 | switch (bs) { | |||
2832 | case 1: | |||
2833 | B->ops->mult = MatMult_SeqBAIJ_1; | |||
2834 | B->ops->multadd = MatMultAdd_SeqBAIJ_1; | |||
2835 | break; | |||
2836 | case 2: | |||
2837 | B->ops->mult = MatMult_SeqBAIJ_2; | |||
2838 | B->ops->multadd = MatMultAdd_SeqBAIJ_2; | |||
2839 | break; | |||
2840 | case 3: | |||
2841 | B->ops->mult = MatMult_SeqBAIJ_3; | |||
2842 | B->ops->multadd = MatMultAdd_SeqBAIJ_3; | |||
2843 | break; | |||
2844 | case 4: | |||
2845 | B->ops->mult = MatMult_SeqBAIJ_4; | |||
2846 | B->ops->multadd = MatMultAdd_SeqBAIJ_4; | |||
2847 | break; | |||
2848 | case 5: | |||
2849 | B->ops->mult = MatMult_SeqBAIJ_5; | |||
2850 | B->ops->multadd = MatMultAdd_SeqBAIJ_5; | |||
2851 | break; | |||
2852 | case 6: | |||
2853 | B->ops->mult = MatMult_SeqBAIJ_6; | |||
2854 | B->ops->multadd = MatMultAdd_SeqBAIJ_6; | |||
2855 | break; | |||
2856 | case 7: | |||
2857 | B->ops->mult = MatMult_SeqBAIJ_7; | |||
2858 | B->ops->multadd = MatMultAdd_SeqBAIJ_7; | |||
2859 | break; | |||
2860 | case 9: | |||
2861 | #if defined(PETSC_HAVE_IMMINTRIN_H1) && defined(__AVX2__) && defined(__FMA__) && defined(PETSC_USE_REAL_DOUBLE1) && !defined(PETSC_USE_COMPLEX) && !defined(PETSC_USE_64BIT_INDICES) | |||
2862 | B->ops->mult = MatMult_SeqBAIJ_9_AVX2; | |||
2863 | B->ops->multadd = MatMultAdd_SeqBAIJ_9_AVX2; | |||
2864 | #else | |||
2865 | B->ops->mult = MatMult_SeqBAIJ_N; | |||
2866 | B->ops->multadd = MatMultAdd_SeqBAIJ_N; | |||
2867 | #endif | |||
2868 | break; | |||
2869 | case 11: | |||
2870 | B->ops->mult = MatMult_SeqBAIJ_11; | |||
2871 | B->ops->multadd = MatMultAdd_SeqBAIJ_11; | |||
2872 | break; | |||
2873 | case 15: | |||
2874 | B->ops->mult = MatMult_SeqBAIJ_15_ver1; | |||
2875 | B->ops->multadd = MatMultAdd_SeqBAIJ_N; | |||
2876 | break; | |||
2877 | default: | |||
2878 | B->ops->mult = MatMult_SeqBAIJ_N; | |||
2879 | B->ops->multadd = MatMultAdd_SeqBAIJ_N; | |||
2880 | break; | |||
2881 | } | |||
2882 | } | |||
2883 | B->ops->sor = MatSOR_SeqBAIJ; | |||
2884 | b->mbs = mbs; | |||
2885 | b->nbs = nbs; | |||
2886 | if (!skipallocation) { | |||
2887 | if (!b->imax) { | |||
2888 | ierr = PetscMalloc2(mbs,&b->imax,mbs,&b->ilen)PetscMallocA(2,PETSC_FALSE,2888,__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),2888,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2889 | ierr = PetscLogObjectMemory((PetscObject)B,2*mbs*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2889,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2890 | ||||
2891 | b->free_imax_ilen = PETSC_TRUE; | |||
2892 | } | |||
2893 | /* b->ilen will count nonzeros in each block row so far. */ | |||
2894 | for (i=0; i<mbs; i++) b->ilen[i] = 0; | |||
2895 | if (!nnz) { | |||
2896 | if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 5; | |||
2897 | else if (nz < 0) nz = 1; | |||
2898 | nz = PetscMin(nz,nbs)(((nz)<(nbs)) ? (nz) : (nbs)); | |||
2899 | for (i=0; i<mbs; i++) b->imax[i] = nz; | |||
2900 | nz = nz*mbs; | |||
2901 | } else { | |||
2902 | nz = 0; | |||
2903 | for (i=0; i<mbs; i++) {b->imax[i] = nnz[i]; nz += nnz[i];} | |||
2904 | } | |||
2905 | ||||
2906 | /* allocate the matrix space */ | |||
2907 | ierr = MatSeqXAIJFreeAIJ(B,&b->a,&b->j,&b->i);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 | if (B->structure_only) { | |||
2909 | ierr = PetscMalloc1(nz,&b->j)PetscMallocA(1,PETSC_FALSE,2909,__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),2909,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2910 | ierr = PetscMalloc1(B->rmap->N+1,&b->i)PetscMallocA(1,PETSC_FALSE,2910,__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),2910,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2911 | 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),2911,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2912 | } else { | |||
2913 | ierr = PetscMalloc3(bs2*nz,&b->a,nz,&b->j,B->rmap->N+1,&b->i)PetscMallocA(3,PETSC_FALSE,2913,__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),2913,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2914 | 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),2914,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2915 | 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),2915,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2916 | } | |||
2917 | 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),2917,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2918 | ||||
2919 | if (B->structure_only) { | |||
2920 | b->singlemalloc = PETSC_FALSE; | |||
2921 | b->free_a = PETSC_FALSE; | |||
2922 | } else { | |||
2923 | b->singlemalloc = PETSC_TRUE; | |||
2924 | b->free_a = PETSC_TRUE; | |||
2925 | } | |||
2926 | b->free_ij = PETSC_TRUE; | |||
2927 | ||||
2928 | b->i[0] = 0; | |||
2929 | for (i=1; i<mbs+1; i++) { | |||
2930 | b->i[i] = b->i[i-1] + b->imax[i-1]; | |||
2931 | } | |||
2932 | ||||
2933 | } else { | |||
2934 | b->free_a = PETSC_FALSE; | |||
2935 | b->free_ij = PETSC_FALSE; | |||
2936 | } | |||
2937 | ||||
2938 | b->bs2 = bs2; | |||
2939 | b->mbs = mbs; | |||
2940 | b->nz = 0; | |||
2941 | b->maxnz = nz; | |||
2942 | B->info.nz_unneeded = (PetscReal)b->maxnz*bs2; | |||
2943 | B->was_assembled = PETSC_FALSE; | |||
2944 | B->assembled = PETSC_FALSE; | |||
2945 | 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),2945,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2946 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2947 | } | |||
2948 | ||||
2949 | PetscErrorCode MatSeqBAIJSetPreallocationCSR_SeqBAIJ(Mat B,PetscInt bs,const PetscInt ii[],const PetscInt jj[],const PetscScalar V[]) | |||
2950 | { | |||
2951 | PetscInt i,m,nz,nz_max=0,*nnz; | |||
2952 | PetscScalar *values=0; | |||
2953 | PetscBool roworiented = ((Mat_SeqBAIJ*)B->data)->roworiented; | |||
2954 | PetscErrorCode ierr; | |||
2955 | ||||
2956 | 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] = 2956; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2957 | 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),2957,__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); | |||
2958 | ierr = PetscLayoutSetBlockSize(B->rmap,bs);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 = PetscLayoutSetBlockSize(B->cmap,bs);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 = PetscLayoutSetUp(B->rmap);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 | ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2961,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2962 | ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2962,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2963 | m = B->rmap->n/bs; | |||
2964 | ||||
2965 | 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),2965,__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]); | |||
2966 | ierr = PetscMalloc1(m+1, &nnz)PetscMallocA(1,PETSC_FALSE,2966,__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),2966,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2967 | for (i=0; i<m; i++) { | |||
2968 | nz = ii[i+1]- ii[i]; | |||
2969 | 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),2969,__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); | |||
2970 | nz_max = PetscMax(nz_max, nz)(((nz_max)<(nz)) ? (nz) : (nz_max)); | |||
2971 | nnz[i] = nz; | |||
2972 | } | |||
2973 | ierr = MatSeqBAIJSetPreallocation(B,bs,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2973,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2974 | ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),2974,__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),2974,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2975 | ||||
2976 | values = (PetscScalar*)V; | |||
2977 | if (!values) { | |||
2978 | ierr = PetscCalloc1(bs*bs*(nz_max+1),&values)PetscMallocA(1,PETSC_TRUE,2978,__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),2978,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2979 | } | |||
2980 | for (i=0; i<m; i++) { | |||
2981 | PetscInt ncols = ii[i+1] - ii[i]; | |||
2982 | const PetscInt *icols = jj + ii[i]; | |||
2983 | const PetscScalar *svals = values + (V ? (bs*bs*ii[i]) : 0); | |||
2984 | if (!roworiented) { | |||
2985 | ierr = MatSetValuesBlocked_SeqBAIJ(B,1,&i,ncols,icols,svals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2985,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2986 | } else { | |||
2987 | PetscInt j; | |||
2988 | for (j=0; j<ncols; j++) { | |||
2989 | const PetscScalar *svals = values + (V ? (bs*bs*(ii[i]+j)) : 0); | |||
2990 | 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),2990,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2991 | } | |||
2992 | } | |||
2993 | } | |||
2994 | if (!V) { ierr = PetscFree(values)((*PetscTrFree)((void*)(values),2994,__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),2994,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } | |||
2995 | ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);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 | ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2996,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2997 | ierr = MatSetOption(B,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2998 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2999 | } | |||
3000 | ||||
3001 | /*MC | |||
3002 | MATSEQBAIJ - MATSEQBAIJ = "seqbaij" - A matrix type to be used for sequential block sparse matrices, based on | |||
3003 | block sparse compressed row format. | |||
3004 | ||||
3005 | Options Database Keys: | |||
3006 | . -mat_type seqbaij - sets the matrix type to "seqbaij" during a call to MatSetFromOptions() | |||
3007 | ||||
3008 | Level: beginner | |||
3009 | ||||
3010 | .seealso: MatCreateSeqBAIJ() | |||
3011 | M*/ | |||
3012 | ||||
3013 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqBAIJ_SeqBSTRM(Mat, MatType,MatReuse,Mat*); | |||
3014 | ||||
3015 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_SeqBAIJ(Mat B) | |||
3016 | { | |||
3017 | PetscErrorCode ierr; | |||
3018 | PetscMPIInt size; | |||
3019 | Mat_SeqBAIJ *b; | |||
3020 | ||||
3021 | 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] = 3021; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3022 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3022,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3023 | if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Comm must be of size 1")return PetscError(((MPI_Comm)0x44000001),3023,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"Comm must be of size 1"); | |||
3024 | ||||
3025 | ierr = PetscNewLog(B,&b)(PetscMallocA(1,PETSC_TRUE,3025,__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),3025,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3026 | B->data = (void*)b; | |||
3027 | ierr = PetscMemcpy(B->ops,&MatOps_Values,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3027,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3028 | ||||
3029 | b->row = 0; | |||
3030 | b->col = 0; | |||
3031 | b->icol = 0; | |||
3032 | b->reallocs = 0; | |||
3033 | b->saved_values = 0; | |||
3034 | ||||
3035 | b->roworiented = PETSC_TRUE; | |||
3036 | b->nonew = 0; | |||
3037 | b->diag = 0; | |||
3038 | B->spptr = 0; | |||
3039 | B->info.nz_unneeded = (PetscReal)b->maxnz*b->bs2; | |||
3040 | b->keepnonzeropattern = PETSC_FALSE; | |||
3041 | ||||
3042 | 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),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,"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),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,"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),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,"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),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,"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),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,"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),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,"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),3048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3049 | 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),3049,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3050 | 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),3050,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3051 | #if defined(PETSC_HAVE_HYPRE) | |||
3052 | 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),3052,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3053 | #endif | |||
3054 | 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),3054,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3055 | 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),3055,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3056 | ierr = PetscObjectChangeTypeName((PetscObject)B,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3056,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3057 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3058 | } | |||
3059 | ||||
3060 | PetscErrorCode MatDuplicateNoCreate_SeqBAIJ(Mat C,Mat A,MatDuplicateOption cpvalues,PetscBool mallocmatspace) | |||
3061 | { | |||
3062 | Mat_SeqBAIJ *c = (Mat_SeqBAIJ*)C->data,*a = (Mat_SeqBAIJ*)A->data; | |||
3063 | PetscErrorCode ierr; | |||
3064 | PetscInt i,mbs = a->mbs,nz = a->nz,bs2 = a->bs2; | |||
3065 | ||||
3066 | 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] = 3066; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3067 | if (a->i[mbs] != nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Corrupt matrix")return PetscError(((MPI_Comm)0x44000001),3067,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,77,PETSC_ERROR_INITIAL,"Corrupt matrix"); | |||
3068 | ||||
3069 | if (cpvalues == MAT_SHARE_NONZERO_PATTERN) { | |||
3070 | c->imax = a->imax; | |||
3071 | c->ilen = a->ilen; | |||
3072 | c->free_imax_ilen = PETSC_FALSE; | |||
3073 | } else { | |||
3074 | ierr = PetscMalloc2(mbs,&c->imax,mbs,&c->ilen)PetscMallocA(2,PETSC_FALSE,3074,__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),3074,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3075 | ierr = PetscLogObjectMemory((PetscObject)C,2*mbs*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3075,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3076 | for (i=0; i<mbs; i++) { | |||
3077 | c->imax[i] = a->imax[i]; | |||
3078 | c->ilen[i] = a->ilen[i]; | |||
3079 | } | |||
3080 | c->free_imax_ilen = PETSC_TRUE; | |||
3081 | } | |||
3082 | ||||
3083 | /* allocate the matrix space */ | |||
3084 | if (mallocmatspace) { | |||
3085 | if (cpvalues == MAT_SHARE_NONZERO_PATTERN) { | |||
3086 | ierr = PetscCalloc1(bs2*nz,&c->a)PetscMallocA(1,PETSC_TRUE,3086,__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),3086,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3087 | ierr = PetscLogObjectMemory((PetscObject)C,a->i[mbs]*bs2*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3087,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3088 | ||||
3089 | c->i = a->i; | |||
3090 | c->j = a->j; | |||
3091 | c->singlemalloc = PETSC_FALSE; | |||
3092 | c->free_a = PETSC_TRUE; | |||
3093 | c->free_ij = PETSC_FALSE; | |||
3094 | c->parent = A; | |||
3095 | C->preallocated = PETSC_TRUE; | |||
3096 | C->assembled = PETSC_TRUE; | |||
3097 | ||||
3098 | ierr = PetscObjectReference((PetscObject)A);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 | ierr = MatSetOption(A,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3099,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3100 | ierr = MatSetOption(C,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);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 | } else { | |||
3102 | ierr = PetscMalloc3(bs2*nz,&c->a,nz,&c->j,mbs+1,&c->i)PetscMallocA(3,PETSC_FALSE,3102,__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),3102,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3103 | 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),3103,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3104 | ||||
3105 | c->singlemalloc = PETSC_TRUE; | |||
3106 | c->free_a = PETSC_TRUE; | |||
3107 | c->free_ij = PETSC_TRUE; | |||
3108 | ||||
3109 | 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),3109,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3110 | if (mbs > 0) { | |||
3111 | 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),3111,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3112 | if (cpvalues == MAT_COPY_VALUES) { | |||
3113 | 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),3113,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3114 | } else { | |||
3115 | 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),3115,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3116 | } | |||
3117 | } | |||
3118 | C->preallocated = PETSC_TRUE; | |||
3119 | C->assembled = PETSC_TRUE; | |||
3120 | } | |||
3121 | } | |||
3122 | ||||
3123 | c->roworiented = a->roworiented; | |||
3124 | c->nonew = a->nonew; | |||
3125 | ||||
3126 | ierr = PetscLayoutReference(A->rmap,&C->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3127 | ierr = PetscLayoutReference(A->cmap,&C->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3128 | ||||
3129 | c->bs2 = a->bs2; | |||
3130 | c->mbs = a->mbs; | |||
3131 | c->nbs = a->nbs; | |||
3132 | ||||
3133 | if (a->diag) { | |||
3134 | if (cpvalues == MAT_SHARE_NONZERO_PATTERN) { | |||
3135 | c->diag = a->diag; | |||
3136 | c->free_diag = PETSC_FALSE; | |||
3137 | } else { | |||
3138 | ierr = PetscMalloc1(mbs+1,&c->diag)PetscMallocA(1,PETSC_FALSE,3138,__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),3138,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3139 | ierr = PetscLogObjectMemory((PetscObject)C,(mbs+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3140 | for (i=0; i<mbs; i++) c->diag[i] = a->diag[i]; | |||
3141 | c->free_diag = PETSC_TRUE; | |||
3142 | } | |||
3143 | } else c->diag = 0; | |||
3144 | ||||
3145 | c->nz = a->nz; | |||
3146 | c->maxnz = a->nz; /* Since we allocate exactly the right amount */ | |||
3147 | c->solve_work = NULL((void*)0); | |||
3148 | c->mult_work = NULL((void*)0); | |||
3149 | c->sor_workt = NULL((void*)0); | |||
3150 | c->sor_work = NULL((void*)0); | |||
3151 | ||||
3152 | c->compressedrow.use = a->compressedrow.use; | |||
3153 | c->compressedrow.nrows = a->compressedrow.nrows; | |||
3154 | if (a->compressedrow.use) { | |||
3155 | i = a->compressedrow.nrows; | |||
3156 | ierr = PetscMalloc2(i+1,&c->compressedrow.i,i+1,&c->compressedrow.rindex)PetscMallocA(2,PETSC_FALSE,3156,__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),3156,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3157 | ierr = PetscLogObjectMemory((PetscObject)C,(2*i+1)*sizeof(PetscInt));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 | 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),3158,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3159 | 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),3159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3160 | } else { | |||
3161 | c->compressedrow.use = PETSC_FALSE; | |||
3162 | c->compressedrow.i = NULL((void*)0); | |||
3163 | c->compressedrow.rindex = NULL((void*)0); | |||
3164 | } | |||
3165 | C->nonzerostate = A->nonzerostate; | |||
3166 | ||||
3167 | ierr = PetscFunctionListDuplicate(((PetscObject)A)->qlist,&((PetscObject)C)->qlist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3167,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3168 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3169 | } | |||
3170 | ||||
3171 | PetscErrorCode MatDuplicate_SeqBAIJ(Mat A,MatDuplicateOption cpvalues,Mat *B) | |||
3172 | { | |||
3173 | PetscErrorCode ierr; | |||
3174 | ||||
3175 | 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] = 3175; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3176 | ierr = MatCreate(PetscObjectComm((PetscObject)A),B);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 = 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),3177,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3178 | ierr = MatSetType(*B,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3179 | ierr = MatDuplicateNoCreate_SeqBAIJ(*B,A,cpvalues,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3180 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3181 | } | |||
3182 | ||||
3183 | PetscErrorCode MatLoad_SeqBAIJ(Mat newmat,PetscViewer viewer) | |||
3184 | { | |||
3185 | Mat_SeqBAIJ *a; | |||
3186 | PetscErrorCode ierr; | |||
3187 | PetscInt i,nz,header[4],*rowlengths=0,M,N,bs = newmat->rmap->bs; | |||
3188 | PetscInt *mask,mbs,*jj,j,rowcount,nzcount,k,*browlengths,maskcount; | |||
3189 | PetscInt kmax,jcount,block,idx,point,nzcountb,extra_rows,rows,cols; | |||
3190 | PetscInt *masked,nmask,tmp,bs2,ishift; | |||
3191 | PetscMPIInt size; | |||
3192 | int fd; | |||
3193 | PetscScalar *aa; | |||
3194 | MPI_Comm comm; | |||
3195 | PetscBool isbinary; | |||
3196 | ||||
3197 | 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] = 3197; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3198 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3199 | 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),3199,__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); | |||
3200 | ||||
3201 | /* force binary viewer to load .info file if it has not yet done so */ | |||
3202 | ierr = PetscViewerSetUp(viewer);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 = PetscObjectGetComm((PetscObject)viewer,&comm);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 = 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),3204 ,__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),3204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3205 | 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),3205,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3206 | ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if ( __builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm )0x44000001),3206,__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),3206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3207 | if (bs < 0) bs = 1; | |||
3208 | bs2 = bs*bs; | |||
3209 | ||||
3210 | ierr = MPI_Comm_size(comm,&size);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 | if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"view must have one processor")return PetscError(((MPI_Comm)0x44000001),3211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,62,PETSC_ERROR_INITIAL,"view must have one processor"); | |||
3212 | ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3212,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3213 | ierr = PetscBinaryRead(fd,header,4,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3214 | if (header[0] != MAT_FILE_CLASSID1211216) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"not Mat object")return PetscError(((MPI_Comm)0x44000001),3214,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,79,PETSC_ERROR_INITIAL,"not Mat object"); | |||
3215 | M = header[1]; N = header[2]; nz = header[3]; | |||
3216 | ||||
3217 | 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),3217,__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" ); | |||
3218 | if (M != N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Can only do square matrices")return PetscError(((MPI_Comm)0x44000001),3218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,56,PETSC_ERROR_INITIAL,"Can only do square matrices"); | |||
3219 | ||||
3220 | /* | |||
3221 | This code adds extra rows to make sure the number of rows is | |||
3222 | divisible by the blocksize | |||
3223 | */ | |||
3224 | mbs = M/bs; | |||
3225 | extra_rows = bs - M + bs*(mbs); | |||
3226 | if (extra_rows == bs) extra_rows = 0; | |||
3227 | else mbs++; | |||
3228 | if (extra_rows) { | |||
3229 | 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),3229,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3230 | } | |||
3231 | ||||
3232 | /* Set global sizes if not already set */ | |||
3233 | if (newmat->rmap->n < 0 && newmat->rmap->N < 0 && newmat->cmap->n < 0 && newmat->cmap->N < 0) { | |||
3234 | 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),3234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3235 | } else { /* Check if the matrix global sizes are correct */ | |||
3236 | ierr = MatGetSize(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 | if (rows < 0 && cols < 0) { /* user might provide local size instead of global size */ | |||
3238 | ierr = MatGetLocalSize(newmat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3239 | } | |||
3240 | 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),3240,__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); | |||
3241 | } | |||
3242 | ||||
3243 | /* read in row lengths */ | |||
3244 | ierr = PetscMalloc1(M+extra_rows,&rowlengths)PetscMallocA(1,PETSC_FALSE,3244,__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),3244,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3245 | ierr = PetscBinaryRead(fd,rowlengths,M,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3245,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3246 | for (i=0; i<extra_rows; i++) rowlengths[M+i] = 1; | |||
3247 | ||||
3248 | /* read in column indices */ | |||
3249 | ierr = PetscMalloc1(nz+extra_rows,&jj)PetscMallocA(1,PETSC_FALSE,3249,__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),3249,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3250 | ierr = PetscBinaryRead(fd,jj,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3250,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3251 | for (i=0; i<extra_rows; i++) jj[nz+i] = M+i; | |||
3252 | ||||
3253 | /* loop over row lengths determining block row lengths */ | |||
3254 | ierr = PetscCalloc1(mbs,&browlengths)PetscMallocA(1,PETSC_TRUE,3254,__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),3254,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3255 | ierr = PetscMalloc2(mbs,&mask,mbs,&masked)PetscMallocA(2,PETSC_FALSE,3255,__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),3255,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3256 | ierr = PetscArrayzero(mask,mbs)PetscMemzero(mask,(mbs)*sizeof(*(mask)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3256,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3257 | rowcount = 0; | |||
3258 | nzcount = 0; | |||
3259 | for (i=0; i<mbs; i++) { | |||
3260 | nmask = 0; | |||
3261 | for (j=0; j<bs; j++) { | |||
3262 | kmax = rowlengths[rowcount]; | |||
3263 | for (k=0; k<kmax; k++) { | |||
3264 | tmp = jj[nzcount++]/bs; | |||
3265 | if (!mask[tmp]) {masked[nmask++] = tmp; mask[tmp] = 1;} | |||
3266 | } | |||
3267 | rowcount++; | |||
3268 | } | |||
3269 | browlengths[i] += nmask; | |||
3270 | /* zero out the mask elements we set */ | |||
3271 | for (j=0; j<nmask; j++) mask[masked[j]] = 0; | |||
3272 | } | |||
3273 | ||||
3274 | /* Do preallocation */ | |||
3275 | ierr = MatSeqBAIJSetPreallocation(newmat,bs,0,browlengths);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3275,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3276 | a = (Mat_SeqBAIJ*)newmat->data; | |||
3277 | ||||
3278 | /* set matrix "i" values */ | |||
3279 | a->i[0] = 0; | |||
3280 | for (i=1; i<= mbs; i++) { | |||
3281 | a->i[i] = a->i[i-1] + browlengths[i-1]; | |||
3282 | a->ilen[i-1] = browlengths[i-1]; | |||
3283 | } | |||
3284 | a->nz = 0; | |||
3285 | for (i=0; i<mbs; i++) a->nz += browlengths[i]; | |||
3286 | ||||
3287 | /* read in nonzero values */ | |||
3288 | ierr = PetscMalloc1(nz+extra_rows,&aa)PetscMallocA(1,PETSC_FALSE,3288,__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),3288,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3289 | ierr = PetscBinaryRead(fd,aa,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3289,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3290 | for (i=0; i<extra_rows; i++) aa[nz+i] = 1.0; | |||
3291 | ||||
3292 | /* set "a" and "j" values into matrix */ | |||
3293 | nzcount = 0; jcount = 0; | |||
3294 | for (i=0; i<mbs; i++) { | |||
3295 | nzcountb = nzcount; | |||
3296 | nmask = 0; | |||
3297 | for (j=0; j<bs; j++) { | |||
3298 | kmax = rowlengths[i*bs+j]; | |||
3299 | for (k=0; k<kmax; k++) { | |||
3300 | tmp = jj[nzcount++]/bs; | |||
3301 | if (!mask[tmp]) { masked[nmask++] = tmp; mask[tmp] = 1;} | |||
3302 | } | |||
3303 | } | |||
3304 | /* sort the masked values */ | |||
3305 | ierr = PetscSortInt(nmask,masked);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3305,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3306 | ||||
3307 | /* set "j" values into matrix */ | |||
3308 | maskcount = 1; | |||
3309 | for (j=0; j<nmask; j++) { | |||
3310 | a->j[jcount++] = masked[j]; | |||
3311 | mask[masked[j]] = maskcount++; | |||
3312 | } | |||
3313 | /* set "a" values into matrix */ | |||
3314 | ishift = bs2*a->i[i]; | |||
3315 | for (j=0; j<bs; j++) { | |||
3316 | kmax = rowlengths[i*bs+j]; | |||
3317 | for (k=0; k<kmax; k++) { | |||
3318 | tmp = jj[nzcountb]/bs; | |||
3319 | block = mask[tmp] - 1; | |||
3320 | point = jj[nzcountb] - bs*tmp; | |||
3321 | idx = ishift + bs2*block + j + bs*point; | |||
3322 | a->a[idx] = (MatScalar)aa[nzcountb++]; | |||
3323 | } | |||
3324 | } | |||
3325 | /* zero out the mask elements we set */ | |||
3326 | for (j=0; j<nmask; j++) mask[masked[j]] = 0; | |||
3327 | } | |||
3328 | if (jcount != a->nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"Bad binary matrix")return PetscError(((MPI_Comm)0x44000001),3328,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,79,PETSC_ERROR_INITIAL,"Bad binary matrix"); | |||
3329 | ||||
3330 | ierr = PetscFree(rowlengths)((*PetscTrFree)((void*)(rowlengths),3330,__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),3330,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3331 | ierr = PetscFree(browlengths)((*PetscTrFree)((void*)(browlengths),3331,__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),3331,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3332 | ierr = PetscFree(aa)((*PetscTrFree)((void*)(aa),3332,__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),3332,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3333 | ierr = PetscFree(jj)((*PetscTrFree)((void*)(jj),3333,__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),3333,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3334 | ierr = PetscFree2(mask,masked)PetscFreeA(2,3334,__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),3334,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3335 | ||||
3336 | ierr = MatAssemblyBegin(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3337 | ierr = MatAssemblyEnd(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3337,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3338 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3339 | } | |||
3340 | ||||
3341 | /*@C | |||
3342 | MatCreateSeqBAIJ - Creates a sparse matrix in block AIJ (block | |||
3343 | compressed row) format. For good matrix assembly performance the | |||
3344 | user should preallocate the matrix storage by setting the parameter nz | |||
3345 | (or the array nnz). By setting these parameters accurately, performance | |||
3346 | during matrix assembly can be increased by more than a factor of 50. | |||
3347 | ||||
3348 | Collective | |||
3349 | ||||
3350 | Input Parameters: | |||
3351 | + comm - MPI communicator, set to PETSC_COMM_SELF | |||
3352 | . bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row | |||
3353 | blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() | |||
3354 | . m - number of rows | |||
3355 | . n - number of columns | |||
3356 | . nz - number of nonzero blocks per block row (same for all rows) | |||
3357 | - nnz - array containing the number of nonzero blocks in the various block rows | |||
3358 | (possibly different for each block row) or NULL | |||
3359 | ||||
3360 | Output Parameter: | |||
3361 | . A - the matrix | |||
3362 | ||||
3363 | It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(), | |||
3364 | MatXXXXSetPreallocation() paradigm instead of this routine directly. | |||
3365 | [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation] | |||
3366 | ||||
3367 | Options Database Keys: | |||
3368 | + -mat_no_unroll - uses code that does not unroll the loops in the | |||
3369 | block calculations (much slower) | |||
3370 | - -mat_block_size - size of the blocks to use | |||
3371 | ||||
3372 | Level: intermediate | |||
3373 | ||||
3374 | Notes: | |||
3375 | The number of rows and columns must be divisible by blocksize. | |||
3376 | ||||
3377 | If the nnz parameter is given then the nz parameter is ignored | |||
3378 | ||||
3379 | A nonzero block is any block that as 1 or more nonzeros in it | |||
3380 | ||||
3381 | The block AIJ format is fully compatible with standard Fortran 77 | |||
3382 | storage. That is, the stored row and column indices can begin at | |||
3383 | either one (as in Fortran) or zero. See the users' manual for details. | |||
3384 | ||||
3385 | Specify the preallocated storage with either nz or nnz (not both). | |||
3386 | Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory | |||
3387 | allocation. See Users-Manual: ch_mat for details. | |||
3388 | matrices. | |||
3389 | ||||
3390 | .seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ() | |||
3391 | @*/ | |||
3392 | PetscErrorCode MatCreateSeqBAIJ(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[],Mat *A) | |||
3393 | { | |||
3394 | PetscErrorCode ierr; | |||
3395 | ||||
3396 | 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] = 3396; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3397 | ierr = MatCreate(comm,A);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 = MatSetSizes(*A,m,n,m,n);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 | ierr = MatSetType(*A,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3399,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3400 | ierr = MatSeqBAIJSetPreallocation(*A,bs,nz,(PetscInt*)nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3400,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3401 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3402 | } | |||
3403 | ||||
3404 | /*@C | |||
3405 | MatSeqBAIJSetPreallocation - Sets the block size and expected nonzeros | |||
3406 | per row in the matrix. For good matrix assembly performance the | |||
3407 | user should preallocate the matrix storage by setting the parameter nz | |||
3408 | (or the array nnz). By setting these parameters accurately, performance | |||
3409 | during matrix assembly can be increased by more than a factor of 50. | |||
3410 | ||||
3411 | Collective | |||
3412 | ||||
3413 | Input Parameters: | |||
3414 | + B - the matrix | |||
3415 | . bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row | |||
3416 | blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() | |||
3417 | . nz - number of block nonzeros per block row (same for all rows) | |||
3418 | - nnz - array containing the number of block nonzeros in the various block rows | |||
3419 | (possibly different for each block row) or NULL | |||
3420 | ||||
3421 | Options Database Keys: | |||
3422 | + -mat_no_unroll - uses code that does not unroll the loops in the | |||
3423 | block calculations (much slower) | |||
3424 | - -mat_block_size - size of the blocks to use | |||
3425 | ||||
3426 | Level: intermediate | |||
3427 | ||||
3428 | Notes: | |||
3429 | If the nnz parameter is given then the nz parameter is ignored | |||
3430 | ||||
3431 | You can call MatGetInfo() to get information on how effective the preallocation was; | |||
3432 | for example the fields mallocs,nz_allocated,nz_used,nz_unneeded; | |||
3433 | You can also run with the option -info and look for messages with the string | |||
3434 | malloc in them to see if additional memory allocation was needed. | |||
3435 | ||||
3436 | The block AIJ format is fully compatible with standard Fortran 77 | |||
3437 | storage. That is, the stored row and column indices can begin at | |||
3438 | either one (as in Fortran) or zero. See the users' manual for details. | |||
3439 | ||||
3440 | Specify the preallocated storage with either nz or nnz (not both). | |||
3441 | Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory | |||
3442 | allocation. See Users-Manual: ch_mat for details. | |||
3443 | ||||
3444 | .seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ(), MatGetInfo() | |||
3445 | @*/ | |||
3446 | PetscErrorCode MatSeqBAIJSetPreallocation(Mat B,PetscInt bs,PetscInt nz,const PetscInt nnz[]) | |||
3447 | { | |||
3448 | PetscErrorCode ierr; | |||
3449 | ||||
3450 | 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] = 3450; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3451 | PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3451,__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),3451,__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),3451,__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),3451,__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); | |||
3452 | PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) return PetscError(( (MPI_Comm)0x44000001),3452,__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); | |||
3453 | 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,3453,__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),3453,__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),3453,__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); | |||
3454 | ierr = PetscTryMethod(B,"MatSeqBAIJSetPreallocation_C",(Mat,PetscInt,PetscInt,const PetscInt[]),(B,bs,nz,nnz))0; do { PetscErrorCode (*_7_f)(Mat,PetscInt,PetscInt,const PetscInt []), _7_ierr; _7_ierr = PetscObjectQueryFunction_Private(((PetscObject )(B)),("MatSeqBAIJSetPreallocation_C"),(PetscVoidFunction*)(& _7_f));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),3454,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_7_f) {_7_ierr = (*_7_f)(B,bs,nz,nnz);do {if (__builtin_expect(!!(_7_ierr), 0)) return PetscError(((MPI_Comm)0x44000001),3454,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3454,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3455 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3456 | } | |||
3457 | ||||
3458 | /*@C | |||
3459 | MatSeqBAIJSetPreallocationCSR - Allocates memory for a sparse sequential matrix in AIJ format | |||
3460 | (the default sequential PETSc format). | |||
3461 | ||||
3462 | Collective | |||
3463 | ||||
3464 | Input Parameters: | |||
3465 | + B - the matrix | |||
3466 | . i - the indices into j for the start of each local row (starts with zero) | |||
3467 | . j - the column indices for each local row (starts with zero) these must be sorted for each row | |||
3468 | - v - optional values in the matrix | |||
3469 | ||||
3470 | Level: developer | |||
3471 | ||||
3472 | Notes: | |||
3473 | The order of the entries in values is specified by the MatOption MAT_ROW_ORIENTED. For example, C programs | |||
3474 | may want to use the default MAT_ROW_ORIENTED=PETSC_TRUE and use an array v[nnz][bs][bs] where the second index is | |||
3475 | over rows within a block and the last index is over columns within a block row. Fortran programs will likely set | |||
3476 | MAT_ROW_ORIENTED=PETSC_FALSE and use a Fortran array v(bs,bs,nnz) in which the first index is over rows within a | |||
3477 | block column and the second index is over columns within a block. | |||
3478 | ||||
3479 | .seealso: MatCreate(), MatCreateSeqBAIJ(), MatSetValues(), MatSeqBAIJSetPreallocation(), MATSEQBAIJ | |||
3480 | @*/ | |||
3481 | PetscErrorCode MatSeqBAIJSetPreallocationCSR(Mat B,PetscInt bs,const PetscInt i[],const PetscInt j[], const PetscScalar v[]) | |||
3482 | { | |||
3483 | PetscErrorCode ierr; | |||
3484 | ||||
3485 | 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] = 3485; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3486 | PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3486,__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),3486,__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),3486,__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),3486,__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); | |||
3487 | PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) return PetscError(( (MPI_Comm)0x44000001),3487,__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); | |||
3488 | 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,3488,__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),3488,__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),3488,__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); | |||
3489 | ierr = PetscTryMethod(B,"MatSeqBAIJSetPreallocationCSR_C",(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]),(B,bs,i,j,v))0; do { PetscErrorCode (*_7_f)(Mat,PetscInt,const PetscInt[], const PetscInt[],const PetscScalar[]), _7_ierr; _7_ierr = PetscObjectQueryFunction_Private (((PetscObject)(B)),("MatSeqBAIJSetPreallocationCSR_C"),(PetscVoidFunction *)(&_7_f));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(((MPI_Comm)0x44000001),3489,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_7_f) {_7_ierr = (*_7_f)(B,bs,i,j,v);do {if (__builtin_expect(!!(_7_ierr),0 )) return PetscError(((MPI_Comm)0x44000001),3489,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3489,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3490 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3491 | } | |||
3492 | ||||
3493 | ||||
3494 | /*@ | |||
3495 | MatCreateSeqBAIJWithArrays - Creates an sequential BAIJ matrix using matrix elements provided by the user. | |||
3496 | ||||
3497 | Collective | |||
3498 | ||||
3499 | Input Parameters: | |||
3500 | + comm - must be an MPI communicator of size 1 | |||
3501 | . bs - size of block | |||
3502 | . m - number of rows | |||
3503 | . n - number of columns | |||
3504 | . i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row block row of the matrix | |||
3505 | . j - column indices | |||
3506 | - a - matrix values | |||
3507 | ||||
3508 | Output Parameter: | |||
3509 | . mat - the matrix | |||
3510 | ||||
3511 | Level: advanced | |||
3512 | ||||
3513 | Notes: | |||
3514 | The i, j, and a arrays are not copied by this routine, the user must free these arrays | |||
3515 | once the matrix is destroyed | |||
3516 | ||||
3517 | You cannot set new nonzero locations into this matrix, that will generate an error. | |||
3518 | ||||
3519 | The i and j indices are 0 based | |||
3520 | ||||
3521 | 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). | |||
3522 | ||||
3523 | The order of the entries in values is the same as the block compressed sparse row storage format; that is, it is | |||
3524 | the same as a three dimensional array in Fortran values(bs,bs,nnz) that contains the first column of the first | |||
3525 | block, followed by the second column of the first block etc etc. That is, the blocks are contiguous in memory | |||
3526 | with column-major ordering within blocks. | |||
3527 | ||||
3528 | .seealso: MatCreate(), MatCreateBAIJ(), MatCreateSeqBAIJ() | |||
3529 | ||||
3530 | @*/ | |||
3531 | PetscErrorCode MatCreateSeqBAIJWithArrays(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt i[],PetscInt j[],PetscScalar a[],Mat *mat) | |||
3532 | { | |||
3533 | PetscErrorCode ierr; | |||
3534 | PetscInt ii; | |||
3535 | Mat_SeqBAIJ *baij; | |||
3536 | ||||
3537 | 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] = 3537; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3538 | if (bs != 1) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"block size %D > 1 is not supported yet",bs)return PetscError(((MPI_Comm)0x44000001),3538,__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); | |||
3539 | 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),3539,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,63,PETSC_ERROR_INITIAL,"i (row indices) must start with 0"); | |||
3540 | ||||
3541 | ierr = MatCreate(comm,mat);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 = MatSetSizes(*mat,m,n,m,n);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 | ierr = MatSetType(*mat,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3543,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3544 | ierr = MatSeqBAIJSetPreallocation(*mat,bs,MAT_SKIP_ALLOCATION-4,0);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 | baij = (Mat_SeqBAIJ*)(*mat)->data; | |||
3546 | ierr = PetscMalloc2(m,&baij->imax,m,&baij->ilen)PetscMallocA(2,PETSC_FALSE,3546,__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),3546,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3547 | ierr = PetscLogObjectMemory((PetscObject)*mat,2*m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3547,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3548 | ||||
3549 | baij->i = i; | |||
3550 | baij->j = j; | |||
3551 | baij->a = a; | |||
3552 | ||||
3553 | baij->singlemalloc = PETSC_FALSE; | |||
3554 | baij->nonew = -1; /*this indicates that inserting a new value in the matrix that generates a new nonzero is an error*/ | |||
3555 | baij->free_a = PETSC_FALSE; | |||
3556 | baij->free_ij = PETSC_FALSE; | |||
3557 | ||||
3558 | for (ii=0; ii<m; ii++) { | |||
3559 | baij->ilen[ii] = baij->imax[ii] = i[ii+1] - i[ii]; | |||
3560 | #if defined(PETSC_USE_DEBUG1) | |||
3561 | 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),3561,__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]); | |||
3562 | #endif | |||
3563 | } | |||
3564 | #if defined(PETSC_USE_DEBUG1) | |||
3565 | for (ii=0; ii<baij->i[m]; ii++) { | |||
3566 | 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),3566,__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]); | |||
3567 | 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),3567,__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]); | |||
3568 | } | |||
3569 | #endif | |||
3570 | ||||
3571 | ierr = MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3571,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3572 | ierr = MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3572,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3573 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3574 | } | |||
3575 | ||||
3576 | PetscErrorCode MatCreateMPIMatConcatenateSeqMat_SeqBAIJ(MPI_Comm comm,Mat inmat,PetscInt n,MatReuse scall,Mat *outmat) | |||
3577 | { | |||
3578 | PetscErrorCode ierr; | |||
3579 | PetscMPIInt size; | |||
3580 | ||||
3581 | 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] = 3581; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3582 | ierr = MPI_Comm_size(comm,&size);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 | if (size == 1 && scall == MAT_REUSE_MATRIX) { | |||
3584 | ierr = MatCopy(inmat,*outmat,SAME_NONZERO_PATTERN);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 | } else { | |||
3586 | ierr = MatCreateMPIMatConcatenateSeqMat_MPIBAIJ(comm,inmat,n,scall,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3586,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/baij/seq/baij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3587 | } | |||
3588 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3589 | } |
1 | /* | |||
2 | This is the main PETSc include file (for C and C++). It is included by all | |||
3 | other PETSc include files, so it almost never has to be specifically included. | |||
4 | */ | |||
5 | #if !defined(PETSCSYS_H) | |||
6 | #define PETSCSYS_H | |||
7 | /* ========================================================================== */ | |||
8 | /* | |||
9 | petscconf.h is contained in ${PETSC_ARCH}/include/petscconf.h it is | |||
10 | found automatically by the compiler due to the -I${PETSC_DIR}/${PETSC_ARCH}/include. | |||
11 | For --prefix installs the ${PETSC_ARCH}/ does not exist and petscconf.h is in the same | |||
12 | directory as the other PETSc include files. | |||
13 | */ | |||
14 | #include <petscconf.h> | |||
15 | #include <petscfix.h> | |||
16 | ||||
17 | #if defined(PETSC_DESIRE_FEATURE_TEST_MACROS) | |||
18 | /* | |||
19 | Feature test macros must be included before headers defined by IEEE Std 1003.1-2001 | |||
20 | We only turn these in PETSc source files that require them by setting PETSC_DESIRE_FEATURE_TEST_MACROS | |||
21 | */ | |||
22 | # if defined(PETSC__POSIX_C_SOURCE_200112L) && !defined(_POSIX_C_SOURCE200809L) | |||
23 | # define _POSIX_C_SOURCE200809L 200112L | |||
24 | # endif | |||
25 | # if defined(PETSC__BSD_SOURCE1) && !defined(_BSD_SOURCE1) | |||
26 | # define _BSD_SOURCE1 | |||
27 | # endif | |||
28 | # if defined(PETSC__DEFAULT_SOURCE1) && !defined(_DEFAULT_SOURCE1) | |||
29 | # define _DEFAULT_SOURCE1 | |||
30 | # endif | |||
31 | # if defined(PETSC__GNU_SOURCE1) && !defined(_GNU_SOURCE) | |||
32 | # define _GNU_SOURCE | |||
33 | # endif | |||
34 | #endif | |||
35 | ||||
36 | #include <petscsystypes.h> | |||
37 | ||||
38 | /* ========================================================================== */ | |||
39 | /* | |||
40 | This facilitates using the C version of PETSc from C++ and the C++ version from C. | |||
41 | */ | |||
42 | #if defined(__cplusplus) | |||
43 | # define PETSC_FUNCTION_NAME__func__ PETSC_FUNCTION_NAME_CXX__func__ | |||
44 | #else | |||
45 | # define PETSC_FUNCTION_NAME__func__ PETSC_FUNCTION_NAME_C__func__ | |||
46 | #endif | |||
47 | ||||
48 | /* ========================================================================== */ | |||
49 | /* | |||
50 | Since PETSc manages its own extern "C" handling users should never include PETSc include | |||
51 | files within extern "C". This will generate a compiler error if a user does put the include | |||
52 | file within an extern "C". | |||
53 | */ | |||
54 | #if defined(__cplusplus) | |||
55 | void assert_never_put_petsc_headers_inside_an_extern_c(int); void assert_never_put_petsc_headers_inside_an_extern_c(double); | |||
56 | #endif | |||
57 | ||||
58 | #if defined(__cplusplus) | |||
59 | # define PETSC_RESTRICT__restrict PETSC_CXX_RESTRICT__restrict | |||
60 | #else | |||
61 | # define PETSC_RESTRICT__restrict PETSC_C_RESTRICT__restrict | |||
62 | #endif | |||
63 | ||||
64 | #if defined(__cplusplus) | |||
65 | # define PETSC_INLINEinline PETSC_CXX_INLINEinline | |||
66 | #else | |||
67 | # define PETSC_INLINEinline PETSC_C_INLINEinline | |||
68 | #endif | |||
69 | ||||
70 | #define PETSC_STATIC_INLINEstatic inline static PETSC_INLINEinline | |||
71 | ||||
72 | #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES1) /* For Win32 shared libraries */ | |||
73 | # define PETSC_DLLEXPORT__attribute__((visibility ("default"))) __declspec(dllexport) | |||
74 | # define PETSC_DLLIMPORT__attribute__((visibility ("default"))) __declspec(dllimport) | |||
75 | # define PETSC_VISIBILITY_INTERNAL__attribute__((visibility ("hidden"))) | |||
76 | #elif defined(PETSC_USE_VISIBILITY_CXX1) && defined(__cplusplus) | |||
77 | # define PETSC_DLLEXPORT__attribute__((visibility ("default"))) __attribute__((visibility ("default"))) | |||
78 | # define PETSC_DLLIMPORT__attribute__((visibility ("default"))) __attribute__((visibility ("default"))) | |||
79 | # define PETSC_VISIBILITY_INTERNAL__attribute__((visibility ("hidden"))) __attribute__((visibility ("hidden"))) | |||
80 | #elif defined(PETSC_USE_VISIBILITY_C1) && !defined(__cplusplus) | |||
81 | # define PETSC_DLLEXPORT__attribute__((visibility ("default"))) __attribute__((visibility ("default"))) | |||
82 | # define PETSC_DLLIMPORT__attribute__((visibility ("default"))) __attribute__((visibility ("default"))) | |||
83 | # define PETSC_VISIBILITY_INTERNAL__attribute__((visibility ("hidden"))) __attribute__((visibility ("hidden"))) | |||
84 | #else | |||
85 | # define PETSC_DLLEXPORT__attribute__((visibility ("default"))) | |||
86 | # define PETSC_DLLIMPORT__attribute__((visibility ("default"))) | |||
87 | # define PETSC_VISIBILITY_INTERNAL__attribute__((visibility ("hidden"))) | |||
88 | #endif | |||
89 | ||||
90 | #if defined(petsc_EXPORTS) /* CMake defines this when building the shared library */ | |||
91 | # define PETSC_VISIBILITY_PUBLIC__attribute__((visibility ("default"))) PETSC_DLLEXPORT__attribute__((visibility ("default"))) | |||
92 | #else /* Win32 users need this to import symbols from petsc.dll */ | |||
93 | # define PETSC_VISIBILITY_PUBLIC__attribute__((visibility ("default"))) PETSC_DLLIMPORT__attribute__((visibility ("default"))) | |||
94 | #endif | |||
95 | ||||
96 | /* | |||
97 | Functions tagged with PETSC_EXTERN in the header files are | |||
98 | always defined as extern "C" when compiled with C++ so they may be | |||
99 | used from C and are always visible in the shared libraries | |||
100 | */ | |||
101 | #if defined(__cplusplus) | |||
102 | # define PETSC_EXTERNextern __attribute__((visibility ("default"))) extern "C" PETSC_VISIBILITY_PUBLIC__attribute__((visibility ("default"))) | |||
103 | # define PETSC_EXTERN_TYPEDEF extern "C" | |||
104 | # define PETSC_INTERNextern __attribute__((visibility ("hidden"))) extern "C" PETSC_VISIBILITY_INTERNAL__attribute__((visibility ("hidden"))) | |||
105 | #else | |||
106 | # define PETSC_EXTERNextern __attribute__((visibility ("default"))) extern PETSC_VISIBILITY_PUBLIC__attribute__((visibility ("default"))) | |||
107 | # define PETSC_EXTERN_TYPEDEF | |||
108 | # define PETSC_INTERNextern __attribute__((visibility ("hidden"))) extern PETSC_VISIBILITY_INTERNAL__attribute__((visibility ("hidden"))) | |||
109 | #endif | |||
110 | ||||
111 | #include <petscversion.h> | |||
112 | #define PETSC_AUTHOR_INFO" The PETSc Team\n [email protected]\n https://www.mcs.anl.gov/petsc/\n" " The PETSc Team\n [email protected]\n https://www.mcs.anl.gov/petsc/\n" | |||
113 | ||||
114 | /* ========================================================================== */ | |||
115 | ||||
116 | /* | |||
117 | Defines the interface to MPI allowing the use of all MPI functions. | |||
118 | ||||
119 | PETSc does not use the C++ binding of MPI at ALL. The following flag | |||
120 | makes sure the C++ bindings are not included. The C++ bindings REQUIRE | |||
121 | putting mpi.h before ANY C++ include files, we cannot control this | |||
122 | with all PETSc users. Users who want to use the MPI C++ bindings can include | |||
123 | mpicxx.h directly in their code | |||
124 | */ | |||
125 | #if !defined(MPICH_SKIP_MPICXX1) | |||
126 | # define MPICH_SKIP_MPICXX1 1 | |||
127 | #endif | |||
128 | #if !defined(OMPI_SKIP_MPICXX1) | |||
129 | # define OMPI_SKIP_MPICXX1 1 | |||
130 | #endif | |||
131 | #if defined(PETSC_HAVE_MPIUNI) | |||
132 | # include <petsc/mpiuni/mpi.h> | |||
133 | #else | |||
134 | # include <mpi.h> | |||
135 | #endif | |||
136 | ||||
137 | /* | |||
138 | Perform various sanity checks that the correct mpi.h is being included at compile time. | |||
139 | This usually happens because | |||
140 | * either an unexpected mpi.h is in the default compiler path (i.e. in /usr/include) or | |||
141 | * an extra include path -I/something (which contains the unexpected mpi.h) is being passed to the compiler | |||
142 | */ | |||
143 | #if defined(PETSC_HAVE_MPIUNI) | |||
144 | # if !defined(MPIUNI_H) | |||
145 | # error "PETSc was configured with --with-mpi=0 but now appears to be compiling using a different mpi.h" | |||
146 | # endif | |||
147 | #elif defined(PETSC_HAVE_I_MPI_NUMVERSION) | |||
148 | # if !defined(I_MPI_NUMVERSION) | |||
149 | # error "PETSc was configured with I_MPI but now appears to be compiling using a non-I_MPI mpi.h" | |||
150 | # elif I_MPI_NUMVERSION != PETSC_HAVE_I_MPI_NUMVERSION | |||
151 | # error "PETSc was configured with one I_MPI mpi.h version but now appears to be compiling using a different I_MPI mpi.h version" | |||
152 | # endif | |||
153 | #elif defined(PETSC_HAVE_MVAPICH2_NUMVERSION) | |||
154 | # if !defined(MVAPICH2_NUMVERSION) | |||
155 | # error "PETSc was configured with MVAPICH2 but now appears to be compiling using a non-MVAPICH2 mpi.h" | |||
156 | # elif MVAPICH2_NUMVERSION != PETSC_HAVE_MVAPICH2_NUMVERSION | |||
157 | # error "PETSc was configured with one MVAPICH2 mpi.h version but now appears to be compiling using a different MVAPICH2 mpi.h version" | |||
158 | # endif | |||
159 | #elif defined(PETSC_HAVE_MPICH_NUMVERSION30301300) | |||
160 | # if !defined(MPICH_NUMVERSION30301300) || defined(MVAPICH2_NUMVERSION) || defined(I_MPI_NUMVERSION) | |||
161 | # error "PETSc was configured with MPICH but now appears to be compiling using a non-MPICH mpi.h" | |||
162 | # elif (MPICH_NUMVERSION30301300/100000 != PETSC_HAVE_MPICH_NUMVERSION30301300/100000) || (MPICH_NUMVERSION30301300%100000/1000 < PETSC_HAVE_MPICH_NUMVERSION30301300%100000/1000) | |||
163 | # error "PETSc was configured with one MPICH mpi.h version but now appears to be compiling using a different MPICH mpi.h version" | |||
164 | # endif | |||
165 | #elif defined(PETSC_HAVE_OMPI_MAJOR_VERSION) | |||
166 | # if !defined(OMPI_MAJOR_VERSION) | |||
167 | # error "PETSc was configured with OpenMPI but now appears to be compiling using a non-OpenMPI mpi.h" | |||
168 | # elif (OMPI_MAJOR_VERSION != PETSC_HAVE_OMPI_MAJOR_VERSION) || (OMPI_MINOR_VERSION != PETSC_HAVE_OMPI_MINOR_VERSION) || (OMPI_RELEASE_VERSION < PETSC_HAVE_OMPI_RELEASE_VERSION) | |||
169 | # error "PETSc was configured with one OpenMPI mpi.h version but now appears to be compiling using a different OpenMPI mpi.h version" | |||
170 | # endif | |||
171 | #elif defined(OMPI_MAJOR_VERSION) || defined(MPICH_NUMVERSION30301300) | |||
172 | # error "PETSc was configured with undetermined MPI - but now appears to be compiling using either of OpenMPI or a MPICH variant" | |||
173 | #endif | |||
174 | ||||
175 | /* | |||
176 | Need to put stdio.h AFTER mpi.h for MPICH2 with C++ compiler | |||
177 | see the top of mpicxx.h in the MPICH2 distribution. | |||
178 | */ | |||
179 | #include <stdio.h> | |||
180 | ||||
181 | /* MSMPI on 32bit windows requires this yukky hack - that breaks MPI standard compliance */ | |||
182 | #if !defined(MPIAPI) | |||
183 | #define MPIAPI | |||
184 | #endif | |||
185 | ||||
186 | /* | |||
187 | Support for Clang (>=3.2) matching type tag arguments with void* buffer types. | |||
188 | This allows the compiler to detect cases where the MPI datatype argument passed to a MPI routine | |||
189 | does not match the actual type of the argument being passed in | |||
190 | */ | |||
191 | #if defined(__has_attribute)0 && defined(works_with_const_which_is_not_true) | |||
192 | # if __has_attribute(argument_with_type_tag)1 && __has_attribute(pointer_with_type_tag)1 && __has_attribute(type_tag_for_datatype)1 | |||
193 | # define PetscAttrMPIPointerWithType(bufno,typeno) __attribute__((pointer_with_type_tag(MPI,bufno,typeno))) | |||
194 | # define PetscAttrMPITypeTag(type) __attribute__((type_tag_for_datatype(MPI,type))) | |||
195 | # define PetscAttrMPITypeTagLayoutCompatible(type) __attribute__((type_tag_for_datatype(MPI,type,layout_compatible))) | |||
196 | # endif | |||
197 | #endif | |||
198 | #if !defined(PetscAttrMPIPointerWithType) | |||
199 | # define PetscAttrMPIPointerWithType(bufno,typeno) | |||
200 | # define PetscAttrMPITypeTag(type) | |||
201 | # define PetscAttrMPITypeTagLayoutCompatible(type) | |||
202 | #endif | |||
203 | ||||
204 | PETSC_EXTERNextern __attribute__((visibility ("default"))) MPI_Datatype MPIU_ENUM PetscAttrMPITypeTag(PetscEnum); | |||
205 | PETSC_EXTERNextern __attribute__((visibility ("default"))) MPI_Datatype MPIU_BOOL PetscAttrMPITypeTag(PetscBool); | |||
206 | ||||
207 | /*MC | |||
208 | MPIU_INT - MPI datatype corresponding to PetscInt | |||
209 | ||||
210 | Notes: | |||
211 | In MPI calls that require an MPI datatype that matches a PetscInt or array of PetscInt values, pass this value. | |||
212 | ||||
213 | Level: beginner | |||
214 | ||||
215 | .seealso: PetscReal, PetscScalar, PetscComplex, PetscInt, MPIU_REAL, MPIU_SCALAR, MPIU_COMPLEX | |||
216 | M*/ | |||
217 | ||||
218 | #if defined(PETSC_HAVE_STDINT_H1) && defined(PETSC_HAVE_INTTYPES_H1) && defined(PETSC_HAVE_MPI_INT64_T1) /* MPI_INT64_T is not guaranteed to be a macro */ | |||
219 | # define MPIU_INT64((MPI_Datatype)0x4c00083a) MPI_INT64_T((MPI_Datatype)0x4c00083a) | |||
220 | # define PetscInt64_FMT"l" "d" PRId64"l" "d" | |||
221 | #elif (PETSC_SIZEOF_LONG_LONG8 == 8) | |||
222 | # define MPIU_INT64((MPI_Datatype)0x4c00083a) MPI_LONG_LONG_INT((MPI_Datatype)0x4c000809) | |||
223 | # define PetscInt64_FMT"l" "d" "lld" | |||
224 | #elif defined(PETSC_HAVE___INT64) | |||
225 | # define MPIU_INT64((MPI_Datatype)0x4c00083a) MPI_INT64_T((MPI_Datatype)0x4c00083a) | |||
226 | # define PetscInt64_FMT"l" "d" "ld" | |||
227 | #else | |||
228 | # error "cannot determine PetscInt64 type" | |||
229 | #endif | |||
230 | ||||
231 | PETSC_EXTERNextern __attribute__((visibility ("default"))) MPI_Datatype MPIU_FORTRANADDR; | |||
232 | ||||
233 | #if defined(PETSC_USE_64BIT_INDICES) | |||
234 | # define MPIU_INT((MPI_Datatype)0x4c000405) MPIU_INT64((MPI_Datatype)0x4c00083a) | |||
235 | # define PetscInt_FMT"d" PetscInt64_FMT"l" "d" | |||
236 | #else | |||
237 | # define MPIU_INT((MPI_Datatype)0x4c000405) MPI_INT((MPI_Datatype)0x4c000405) | |||
238 | # define PetscInt_FMT"d" "d" | |||
239 | #endif | |||
240 | ||||
241 | /* | |||
242 | For the rare cases when one needs to send a size_t object with MPI | |||
243 | */ | |||
244 | PETSC_EXTERNextern __attribute__((visibility ("default"))) MPI_Datatype MPIU_SIZE_T; | |||
245 | ||||
246 | /* | |||
247 | You can use PETSC_STDOUT as a replacement of stdout. You can also change | |||
248 | the value of PETSC_STDOUT to redirect all standard output elsewhere | |||
249 | */ | |||
250 | PETSC_EXTERNextern __attribute__((visibility ("default"))) FILE* PETSC_STDOUT; | |||
251 | ||||
252 | /* | |||
253 | You can use PETSC_STDERR as a replacement of stderr. You can also change | |||
254 | the value of PETSC_STDERR to redirect all standard error elsewhere | |||
255 | */ | |||
256 | PETSC_EXTERNextern __attribute__((visibility ("default"))) FILE* PETSC_STDERR; | |||
257 | ||||
258 | /*MC | |||
259 | PetscUnlikely - hints the compiler that the given condition is usually FALSE | |||
260 | ||||
261 | Synopsis: | |||
262 | #include <petscsys.h> | |||
263 | PetscBool PetscUnlikely(PetscBool cond) | |||
264 | ||||
265 | Not Collective | |||
266 | ||||
267 | Input Parameters: | |||
268 | . cond - condition or expression | |||
269 | ||||
270 | Notes: | |||
271 | This returns the same truth value, it is only a hint to compilers that the resulting | |||
272 | branch is unlikely. | |||
273 | ||||
274 | Level: advanced | |||
275 | ||||
276 | .seealso: PetscLikely(), CHKERRQ | |||
277 | M*/ | |||
278 | ||||
279 | /*MC | |||
280 | PetscLikely - hints the compiler that the given condition is usually TRUE | |||
281 | ||||
282 | Synopsis: | |||
283 | #include <petscsys.h> | |||
284 | PetscBool PetscLikely(PetscBool cond) | |||
285 | ||||
286 | Not Collective | |||
287 | ||||
288 | Input Parameters: | |||
289 | . cond - condition or expression | |||
290 | ||||
291 | Notes: | |||
292 | This returns the same truth value, it is only a hint to compilers that the resulting | |||
293 | branch is likely. | |||
294 | ||||
295 | Level: advanced | |||
296 | ||||
297 | .seealso: PetscUnlikely() | |||
298 | M*/ | |||
299 | #if defined(PETSC_HAVE_BUILTIN_EXPECT1) | |||
300 | # define PetscUnlikely(cond)__builtin_expect(!!(cond),0) __builtin_expect(!!(cond),0) | |||
301 | # define PetscLikely(cond)__builtin_expect(!!(cond),1) __builtin_expect(!!(cond),1) | |||
302 | #else | |||
303 | # define PetscUnlikely(cond)__builtin_expect(!!(cond),0) (cond) | |||
304 | # define PetscLikely(cond)__builtin_expect(!!(cond),1) (cond) | |||
305 | #endif | |||
306 | ||||
307 | /* | |||
308 | Declare extern C stuff after including external header files | |||
309 | */ | |||
310 | ||||
311 | PETSC_EXTERNextern __attribute__((visibility ("default"))) const char *const PetscBools[]; | |||
312 | ||||
313 | /* | |||
314 | Defines elementary mathematics functions and constants. | |||
315 | */ | |||
316 | #include <petscmath.h> | |||
317 | ||||
318 | PETSC_EXTERNextern __attribute__((visibility ("default"))) const char *const PetscCopyModes[]; | |||
319 | ||||
320 | /*MC | |||
321 | PETSC_IGNORE - same as NULL, means PETSc will ignore this argument | |||
322 | ||||
323 | Level: beginner | |||
324 | ||||
325 | Note: | |||
326 | Accepted by many PETSc functions to not set a parameter and instead use | |||
327 | some default | |||
328 | ||||
329 | Fortran Notes: | |||
330 | This macro does not exist in Fortran; you must use PETSC_NULL_INTEGER, | |||
331 | PETSC_NULL_DOUBLE_PRECISION etc | |||
332 | ||||
333 | .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_DETERMINE | |||
334 | ||||
335 | M*/ | |||
336 | #define PETSC_IGNORE((void*)0) NULL((void*)0) | |||
337 | ||||
338 | /* This is deprecated */ | |||
339 | #define PETSC_NULL((void*)0) NULL((void*)0) | |||
340 | ||||
341 | /*MC | |||
342 | PETSC_DECIDE - standard way of passing in integer or floating point parameter | |||
343 | where you wish PETSc to use the default. | |||
344 | ||||
345 | Level: beginner | |||
346 | ||||
347 | .seealso: PETSC_DEFAULT, PETSC_IGNORE, PETSC_DETERMINE | |||
348 | ||||
349 | M*/ | |||
350 | #define PETSC_DECIDE-1 -1 | |||
351 | ||||
352 | /*MC | |||
353 | PETSC_DETERMINE - standard way of passing in integer or floating point parameter | |||
354 | where you wish PETSc to compute the required value. | |||
355 | ||||
356 | Level: beginner | |||
357 | ||||
358 | Developer Note: | |||
359 | I would like to use const PetscInt PETSC_DETERMINE = PETSC_DECIDE; but for | |||
360 | some reason this is not allowed by the standard even though PETSC_DECIDE is a constant value. | |||
361 | ||||
362 | .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_IGNORE, VecSetSizes() | |||
363 | ||||
364 | M*/ | |||
365 | #define PETSC_DETERMINE-1 PETSC_DECIDE-1 | |||
366 | ||||
367 | /*MC | |||
368 | PETSC_DEFAULT - standard way of passing in integer or floating point parameter | |||
369 | where you wish PETSc to use the default. | |||
370 | ||||
371 | Level: beginner | |||
372 | ||||
373 | Fortran Notes: | |||
374 | You need to use PETSC_DEFAULT_INTEGER or PETSC_DEFAULT_REAL. | |||
375 | ||||
376 | .seealso: PETSC_DECIDE, PETSC_IGNORE, PETSC_DETERMINE | |||
377 | ||||
378 | M*/ | |||
379 | #define PETSC_DEFAULT-2 -2 | |||
380 | ||||
381 | /*MC | |||
382 | PETSC_COMM_WORLD - the equivalent of the MPI_COMM_WORLD communicator which represents | |||
383 | all the processes that PETSc knows about. | |||
384 | ||||
385 | Level: beginner | |||
386 | ||||
387 | Notes: | |||
388 | By default PETSC_COMM_WORLD and MPI_COMM_WORLD are identical unless you wish to | |||
389 | run PETSc on ONLY a subset of MPI_COMM_WORLD. In that case create your new (smaller) | |||
390 | communicator, call it, say comm, and set PETSC_COMM_WORLD = comm BEFORE calling | |||
391 | PetscInitialize(), but after MPI_Init() has been called. | |||
392 | ||||
393 | The value of PETSC_COMM_WORLD should never be USED/accessed before PetscInitialize() | |||
394 | is called because it may not have a valid value yet. | |||
395 | ||||
396 | .seealso: PETSC_COMM_SELF | |||
397 | ||||
398 | M*/ | |||
399 | PETSC_EXTERNextern __attribute__((visibility ("default"))) MPI_Comm PETSC_COMM_WORLD; | |||
400 | ||||
401 | /*MC | |||
402 | PETSC_COMM_SELF - This is always MPI_COMM_SELF | |||
403 | ||||
404 | Level: beginner | |||
405 | ||||
406 | Notes: | |||
407 | Do not USE/access or set this variable before PetscInitialize() has been called. | |||
408 | ||||
409 | .seealso: PETSC_COMM_WORLD | |||
410 | ||||
411 | M*/ | |||
412 | #define PETSC_COMM_SELF((MPI_Comm)0x44000001) MPI_COMM_SELF((MPI_Comm)0x44000001) | |||
413 | ||||
414 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscBool PetscBeganMPI; | |||
415 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscBool PetscInitializeCalled; | |||
416 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscBool PetscFinalizeCalled; | |||
417 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscBool PetscViennaCLSynchronize; | |||
418 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscBool PetscCUDASynchronize; | |||
419 | ||||
420 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSetHelpVersionFunctions(PetscErrorCode (*)(MPI_Comm),PetscErrorCode (*)(MPI_Comm)); | |||
421 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscCommDuplicate(MPI_Comm,MPI_Comm*,int*); | |||
422 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscCommDestroy(MPI_Comm*); | |||
423 | ||||
424 | #if defined(PETSC_HAVE_CUDA) | |||
425 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscCUDAInitialize(MPI_Comm); | |||
426 | #endif | |||
427 | ||||
428 | /*MC | |||
429 | PetscMalloc - Allocates memory, One should use PetscNew(), PetscMalloc1() or PetscCalloc1() usually instead of this | |||
430 | ||||
431 | Synopsis: | |||
432 | #include <petscsys.h> | |||
433 | PetscErrorCode PetscMalloc(size_t m,void **result) | |||
434 | ||||
435 | Not Collective | |||
436 | ||||
437 | Input Parameter: | |||
438 | . m - number of bytes to allocate | |||
439 | ||||
440 | Output Parameter: | |||
441 | . result - memory allocated | |||
442 | ||||
443 | Level: beginner | |||
444 | ||||
445 | Notes: | |||
446 | Memory is always allocated at least double aligned | |||
447 | ||||
448 | It is safe to allocate size 0 and pass the resulting pointer (which may or may not be NULL) to PetscFree(). | |||
449 | ||||
450 | .seealso: PetscFree(), PetscNew() | |||
451 | ||||
452 | M*/ | |||
453 | #define PetscMalloc(a,b)((*PetscTrMalloc)((a),PETSC_FALSE,453,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(void**)(b))) ((*PetscTrMalloc)((a),PETSC_FALSE,__LINE__453,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(void**)(b))) | |||
454 | ||||
455 | /*MC | |||
456 | PetscRealloc - Rellocates memory | |||
457 | ||||
458 | Synopsis: | |||
459 | #include <petscsys.h> | |||
460 | PetscErrorCode PetscRealloc(size_t m,void **result) | |||
461 | ||||
462 | Not Collective | |||
463 | ||||
464 | Input Parameters: | |||
465 | + m - number of bytes to allocate | |||
466 | - result - initial memory allocated | |||
467 | ||||
468 | Output Parameter: | |||
469 | . result - new memory allocated | |||
470 | ||||
471 | Level: developer | |||
472 | ||||
473 | Notes: | |||
474 | Memory is always allocated at least double aligned | |||
475 | ||||
476 | .seealso: PetscMalloc(), PetscFree(), PetscNew() | |||
477 | ||||
478 | M*/ | |||
479 | #define PetscRealloc(a,b)((*PetscTrRealloc)((a),479,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(void**)(b))) ((*PetscTrRealloc)((a),__LINE__479,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(void**)(b))) | |||
480 | ||||
481 | /*MC | |||
482 | PetscAddrAlign - Rounds up an address to PETSC_MEMALIGN alignment | |||
483 | ||||
484 | Synopsis: | |||
485 | #include <petscsys.h> | |||
486 | void *PetscAddrAlign(void *addr) | |||
487 | ||||
488 | Not Collective | |||
489 | ||||
490 | Input Parameters: | |||
491 | . addr - address to align (any pointer type) | |||
492 | ||||
493 | Level: developer | |||
494 | ||||
495 | .seealso: PetscMallocAlign() | |||
496 | ||||
497 | M*/ | |||
498 | #define PetscAddrAlign(a)(void*)((((uintptr_t)(a))+(16 -1)) & ~(16 -1)) (void*)((((PETSC_UINTPTR_Tuintptr_t)(a))+(PETSC_MEMALIGN16-1)) & ~(PETSC_MEMALIGN16-1)) | |||
499 | ||||
500 | /*MC | |||
501 | PetscMalloc1 - Allocates an array of memory aligned to PETSC_MEMALIGN | |||
502 | ||||
503 | Synopsis: | |||
504 | #include <petscsys.h> | |||
505 | PetscErrorCode PetscMalloc1(size_t m1,type **r1) | |||
506 | ||||
507 | Not Collective | |||
508 | ||||
509 | Input Parameter: | |||
510 | . m1 - number of elements to allocate (may be zero) | |||
511 | ||||
512 | Output Parameter: | |||
513 | . r1 - memory allocated in first chunk | |||
514 | ||||
515 | Note: | |||
516 | This uses the sizeof() of the memory type requested to determine the total memory to be allocated, therefore you should not | |||
517 | multiply the number of elements requested by the sizeof() the type. For example use | |||
518 | $ PetscInt *id; | |||
519 | $ PetscMalloc1(10,&id); | |||
520 | not | |||
521 | $ PetscInt *id; | |||
522 | $ PetscMalloc1(10*sizeof(PetscInt),&id); | |||
523 | ||||
524 | Does not zero the memory allocatd, used PetscCalloc1() to obtain memory that has been zeroed. | |||
525 | ||||
526 | Level: beginner | |||
527 | ||||
528 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscCalloc1(), PetscMalloc2() | |||
529 | ||||
530 | M*/ | |||
531 | #define PetscMalloc1(m1,r1)PetscMallocA(1,PETSC_FALSE,531,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1)) PetscMallocA(1,PETSC_FALSE,__LINE__531,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1)) | |||
532 | ||||
533 | /*MC | |||
534 | PetscCalloc1 - Allocates a cleared (zeroed) array of memory aligned to PETSC_MEMALIGN | |||
535 | ||||
536 | Synopsis: | |||
537 | #include <petscsys.h> | |||
538 | PetscErrorCode PetscCalloc1(size_t m1,type **r1) | |||
539 | ||||
540 | Not Collective | |||
541 | ||||
542 | Input Parameter: | |||
543 | . m1 - number of elements to allocate in 1st chunk (may be zero) | |||
544 | ||||
545 | Output Parameter: | |||
546 | . r1 - memory allocated in first chunk | |||
547 | ||||
548 | Notes: | |||
549 | See PetsMalloc1() for more details on usage. | |||
550 | ||||
551 | Level: beginner | |||
552 | ||||
553 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc1(), PetscCalloc2() | |||
554 | ||||
555 | M*/ | |||
556 | #define PetscCalloc1(m1,r1)PetscMallocA(1,PETSC_TRUE,556,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1)) PetscMallocA(1,PETSC_TRUE,__LINE__556,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1)) | |||
557 | ||||
558 | /*MC | |||
559 | PetscMalloc2 - Allocates 2 arrays of memory both aligned to PETSC_MEMALIGN | |||
560 | ||||
561 | Synopsis: | |||
562 | #include <petscsys.h> | |||
563 | PetscErrorCode PetscMalloc2(size_t m1,type **r1,size_t m2,type **r2) | |||
564 | ||||
565 | Not Collective | |||
566 | ||||
567 | Input Parameter: | |||
568 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
569 | - m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
570 | ||||
571 | Output Parameter: | |||
572 | + r1 - memory allocated in first chunk | |||
573 | - r2 - memory allocated in second chunk | |||
574 | ||||
575 | Level: developer | |||
576 | ||||
577 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc1(), PetscCalloc2() | |||
578 | ||||
579 | M*/ | |||
580 | #define PetscMalloc2(m1,r1,m2,r2)PetscMallocA(2,PETSC_FALSE,580,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2)) PetscMallocA(2,PETSC_FALSE,__LINE__580,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2)) | |||
581 | ||||
582 | /*MC | |||
583 | PetscCalloc2 - Allocates 2 cleared (zeroed) arrays of memory both aligned to PETSC_MEMALIGN | |||
584 | ||||
585 | Synopsis: | |||
586 | #include <petscsys.h> | |||
587 | PetscErrorCode PetscCalloc2(size_t m1,type **r1,size_t m2,type **r2) | |||
588 | ||||
589 | Not Collective | |||
590 | ||||
591 | Input Parameter: | |||
592 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
593 | - m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
594 | ||||
595 | Output Parameter: | |||
596 | + r1 - memory allocated in first chunk | |||
597 | - r2 - memory allocated in second chunk | |||
598 | ||||
599 | Level: developer | |||
600 | ||||
601 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscCalloc1(), PetscMalloc2() | |||
602 | ||||
603 | M*/ | |||
604 | #define PetscCalloc2(m1,r1,m2,r2)PetscMallocA(2,PETSC_TRUE,604,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2)) PetscMallocA(2,PETSC_TRUE,__LINE__604,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2)) | |||
605 | ||||
606 | /*MC | |||
607 | PetscMalloc3 - Allocates 3 arrays of memory, all aligned to PETSC_MEMALIGN | |||
608 | ||||
609 | Synopsis: | |||
610 | #include <petscsys.h> | |||
611 | PetscErrorCode PetscMalloc3(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3) | |||
612 | ||||
613 | Not Collective | |||
614 | ||||
615 | Input Parameter: | |||
616 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
617 | . m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
618 | - m3 - number of elements to allocate in 3rd chunk (may be zero) | |||
619 | ||||
620 | Output Parameter: | |||
621 | + r1 - memory allocated in first chunk | |||
622 | . r2 - memory allocated in second chunk | |||
623 | - r3 - memory allocated in third chunk | |||
624 | ||||
625 | Level: developer | |||
626 | ||||
627 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscCalloc3(), PetscFree3() | |||
628 | ||||
629 | M*/ | |||
630 | #define PetscMalloc3(m1,r1,m2,r2,m3,r3)PetscMallocA(3,PETSC_FALSE,630,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2),(size_t)(m3)*sizeof(**(r3)),(r3)) PetscMallocA(3,PETSC_FALSE,__LINE__630,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2),(size_t)(m3)*sizeof(**(r3)),(r3)) | |||
631 | ||||
632 | /*MC | |||
633 | PetscCalloc3 - Allocates 3 cleared (zeroed) arrays of memory, all aligned to PETSC_MEMALIGN | |||
634 | ||||
635 | Synopsis: | |||
636 | #include <petscsys.h> | |||
637 | PetscErrorCode PetscCalloc3(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3) | |||
638 | ||||
639 | Not Collective | |||
640 | ||||
641 | Input Parameter: | |||
642 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
643 | . m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
644 | - m3 - number of elements to allocate in 3rd chunk (may be zero) | |||
645 | ||||
646 | Output Parameter: | |||
647 | + r1 - memory allocated in first chunk | |||
648 | . r2 - memory allocated in second chunk | |||
649 | - r3 - memory allocated in third chunk | |||
650 | ||||
651 | Level: developer | |||
652 | ||||
653 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscCalloc2(), PetscMalloc3(), PetscFree3() | |||
654 | ||||
655 | M*/ | |||
656 | #define PetscCalloc3(m1,r1,m2,r2,m3,r3)PetscMallocA(3,PETSC_TRUE,656,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2),(size_t)(m3)*sizeof(**(r3)),(r3)) PetscMallocA(3,PETSC_TRUE,__LINE__656,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2),(size_t)(m3)*sizeof(**(r3)),(r3)) | |||
657 | ||||
658 | /*MC | |||
659 | PetscMalloc4 - Allocates 4 arrays of memory, all aligned to PETSC_MEMALIGN | |||
660 | ||||
661 | Synopsis: | |||
662 | #include <petscsys.h> | |||
663 | PetscErrorCode PetscMalloc4(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3,size_t m4,type **r4) | |||
664 | ||||
665 | Not Collective | |||
666 | ||||
667 | Input Parameter: | |||
668 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
669 | . m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
670 | . m3 - number of elements to allocate in 3rd chunk (may be zero) | |||
671 | - m4 - number of elements to allocate in 4th chunk (may be zero) | |||
672 | ||||
673 | Output Parameter: | |||
674 | + r1 - memory allocated in first chunk | |||
675 | . r2 - memory allocated in second chunk | |||
676 | . r3 - memory allocated in third chunk | |||
677 | - r4 - memory allocated in fourth chunk | |||
678 | ||||
679 | Level: developer | |||
680 | ||||
681 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscCalloc4(), PetscFree4() | |||
682 | ||||
683 | M*/ | |||
684 | #define PetscMalloc4(m1,r1,m2,r2,m3,r3,m4,r4)PetscMallocA(4,PETSC_FALSE,684,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(** (r4)),(r4)) PetscMallocA(4,PETSC_FALSE,__LINE__684,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(**(r4)),(r4)) | |||
685 | ||||
686 | /*MC | |||
687 | PetscCalloc4 - Allocates 4 cleared (zeroed) arrays of memory, all aligned to PETSC_MEMALIGN | |||
688 | ||||
689 | Synopsis: | |||
690 | #include <petscsys.h> | |||
691 | PetscErrorCode PetscCalloc4(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3,size_t m4,type **r4) | |||
692 | ||||
693 | Not Collective | |||
694 | ||||
695 | Input Parameters: | |||
696 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
697 | . m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
698 | . m3 - number of elements to allocate in 3rd chunk (may be zero) | |||
699 | - m4 - number of elements to allocate in 4th chunk (may be zero) | |||
700 | ||||
701 | Output Parameters: | |||
702 | + r1 - memory allocated in first chunk | |||
703 | . r2 - memory allocated in second chunk | |||
704 | . r3 - memory allocated in third chunk | |||
705 | - r4 - memory allocated in fourth chunk | |||
706 | ||||
707 | Level: developer | |||
708 | ||||
709 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscCalloc4(), PetscFree4() | |||
710 | ||||
711 | M*/ | |||
712 | #define PetscCalloc4(m1,r1,m2,r2,m3,r3,m4,r4)PetscMallocA(4,PETSC_TRUE,712,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(** (r4)),(r4)) PetscMallocA(4,PETSC_TRUE,__LINE__712,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(**(r4)),(r4)) | |||
713 | ||||
714 | /*MC | |||
715 | PetscMalloc5 - Allocates 5 arrays of memory, all aligned to PETSC_MEMALIGN | |||
716 | ||||
717 | Synopsis: | |||
718 | #include <petscsys.h> | |||
719 | PetscErrorCode PetscMalloc5(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3,size_t m4,type **r4,size_t m5,type **r5) | |||
720 | ||||
721 | Not Collective | |||
722 | ||||
723 | Input Parameters: | |||
724 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
725 | . m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
726 | . m3 - number of elements to allocate in 3rd chunk (may be zero) | |||
727 | . m4 - number of elements to allocate in 4th chunk (may be zero) | |||
728 | - m5 - number of elements to allocate in 5th chunk (may be zero) | |||
729 | ||||
730 | Output Parameters: | |||
731 | + r1 - memory allocated in first chunk | |||
732 | . r2 - memory allocated in second chunk | |||
733 | . r3 - memory allocated in third chunk | |||
734 | . r4 - memory allocated in fourth chunk | |||
735 | - r5 - memory allocated in fifth chunk | |||
736 | ||||
737 | Level: developer | |||
738 | ||||
739 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscCalloc5(), PetscFree5() | |||
740 | ||||
741 | M*/ | |||
742 | #define PetscMalloc5(m1,r1,m2,r2,m3,r3,m4,r4,m5,r5)PetscMallocA(5,PETSC_FALSE,742,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(** (r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5)) PetscMallocA(5,PETSC_FALSE,__LINE__742,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(**(r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5)) | |||
743 | ||||
744 | /*MC | |||
745 | PetscCalloc5 - Allocates 5 cleared (zeroed) arrays of memory, all aligned to PETSC_MEMALIGN | |||
746 | ||||
747 | Synopsis: | |||
748 | #include <petscsys.h> | |||
749 | PetscErrorCode PetscCalloc5(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3,size_t m4,type **r4,size_t m5,type **r5) | |||
750 | ||||
751 | Not Collective | |||
752 | ||||
753 | Input Parameters: | |||
754 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
755 | . m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
756 | . m3 - number of elements to allocate in 3rd chunk (may be zero) | |||
757 | . m4 - number of elements to allocate in 4th chunk (may be zero) | |||
758 | - m5 - number of elements to allocate in 5th chunk (may be zero) | |||
759 | ||||
760 | Output Parameters: | |||
761 | + r1 - memory allocated in first chunk | |||
762 | . r2 - memory allocated in second chunk | |||
763 | . r3 - memory allocated in third chunk | |||
764 | . r4 - memory allocated in fourth chunk | |||
765 | - r5 - memory allocated in fifth chunk | |||
766 | ||||
767 | Level: developer | |||
768 | ||||
769 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc5(), PetscFree5() | |||
770 | ||||
771 | M*/ | |||
772 | #define PetscCalloc5(m1,r1,m2,r2,m3,r3,m4,r4,m5,r5)PetscMallocA(5,PETSC_TRUE,772,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(** (r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5)) PetscMallocA(5,PETSC_TRUE,__LINE__772,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(**(r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5)) | |||
773 | ||||
774 | /*MC | |||
775 | PetscMalloc6 - Allocates 6 arrays of memory, all aligned to PETSC_MEMALIGN | |||
776 | ||||
777 | Synopsis: | |||
778 | #include <petscsys.h> | |||
779 | PetscErrorCode PetscMalloc6(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3,size_t m4,type **r4,size_t m5,type **r5,size_t m6,type **r6) | |||
780 | ||||
781 | Not Collective | |||
782 | ||||
783 | Input Parameters: | |||
784 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
785 | . m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
786 | . m3 - number of elements to allocate in 3rd chunk (may be zero) | |||
787 | . m4 - number of elements to allocate in 4th chunk (may be zero) | |||
788 | . m5 - number of elements to allocate in 5th chunk (may be zero) | |||
789 | - m6 - number of elements to allocate in 6th chunk (may be zero) | |||
790 | ||||
791 | Output Parameteasr: | |||
792 | + r1 - memory allocated in first chunk | |||
793 | . r2 - memory allocated in second chunk | |||
794 | . r3 - memory allocated in third chunk | |||
795 | . r4 - memory allocated in fourth chunk | |||
796 | . r5 - memory allocated in fifth chunk | |||
797 | - r6 - memory allocated in sixth chunk | |||
798 | ||||
799 | Level: developer | |||
800 | ||||
801 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscCalloc6(), PetscFree3(), PetscFree4(), PetscFree5(), PetscFree6() | |||
802 | ||||
803 | M*/ | |||
804 | #define PetscMalloc6(m1,r1,m2,r2,m3,r3,m4,r4,m5,r5,m6,r6)PetscMallocA(6,PETSC_FALSE,804,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(** (r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5),(size_t)(m6)*sizeof (**(r6)),(r6)) PetscMallocA(6,PETSC_FALSE,__LINE__804,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(**(r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5),(size_t)(m6)*sizeof(**(r6)),(r6)) | |||
805 | ||||
806 | /*MC | |||
807 | PetscCalloc6 - Allocates 6 cleared (zeroed) arrays of memory, all aligned to PETSC_MEMALIGN | |||
808 | ||||
809 | Synopsis: | |||
810 | #include <petscsys.h> | |||
811 | PetscErrorCode PetscCalloc6(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3,size_t m4,type **r4,size_t m5,type **r5,size_t m6,type **r6) | |||
812 | ||||
813 | Not Collective | |||
814 | ||||
815 | Input Parameters: | |||
816 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
817 | . m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
818 | . m3 - number of elements to allocate in 3rd chunk (may be zero) | |||
819 | . m4 - number of elements to allocate in 4th chunk (may be zero) | |||
820 | . m5 - number of elements to allocate in 5th chunk (may be zero) | |||
821 | - m6 - number of elements to allocate in 6th chunk (may be zero) | |||
822 | ||||
823 | Output Parameters: | |||
824 | + r1 - memory allocated in first chunk | |||
825 | . r2 - memory allocated in second chunk | |||
826 | . r3 - memory allocated in third chunk | |||
827 | . r4 - memory allocated in fourth chunk | |||
828 | . r5 - memory allocated in fifth chunk | |||
829 | - r6 - memory allocated in sixth chunk | |||
830 | ||||
831 | Level: developer | |||
832 | ||||
833 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscMalloc6(), PetscFree6() | |||
834 | ||||
835 | M*/ | |||
836 | #define PetscCalloc6(m1,r1,m2,r2,m3,r3,m4,r4,m5,r5,m6,r6)PetscMallocA(6,PETSC_TRUE,836,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(** (r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5),(size_t)(m6)*sizeof (**(r6)),(r6)) PetscMallocA(6,PETSC_TRUE,__LINE__836,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(**(r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5),(size_t)(m6)*sizeof(**(r6)),(r6)) | |||
837 | ||||
838 | /*MC | |||
839 | PetscMalloc7 - Allocates 7 arrays of memory, all aligned to PETSC_MEMALIGN | |||
840 | ||||
841 | Synopsis: | |||
842 | #include <petscsys.h> | |||
843 | PetscErrorCode PetscMalloc7(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3,size_t m4,type **r4,size_t m5,type **r5,size_t m6,type **r6,size_t m7,type **r7) | |||
844 | ||||
845 | Not Collective | |||
846 | ||||
847 | Input Parameters: | |||
848 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
849 | . m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
850 | . m3 - number of elements to allocate in 3rd chunk (may be zero) | |||
851 | . m4 - number of elements to allocate in 4th chunk (may be zero) | |||
852 | . m5 - number of elements to allocate in 5th chunk (may be zero) | |||
853 | . m6 - number of elements to allocate in 6th chunk (may be zero) | |||
854 | - m7 - number of elements to allocate in 7th chunk (may be zero) | |||
855 | ||||
856 | Output Parameters: | |||
857 | + r1 - memory allocated in first chunk | |||
858 | . r2 - memory allocated in second chunk | |||
859 | . r3 - memory allocated in third chunk | |||
860 | . r4 - memory allocated in fourth chunk | |||
861 | . r5 - memory allocated in fifth chunk | |||
862 | . r6 - memory allocated in sixth chunk | |||
863 | - r7 - memory allocated in seventh chunk | |||
864 | ||||
865 | Level: developer | |||
866 | ||||
867 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscCalloc7(), PetscFree7() | |||
868 | ||||
869 | M*/ | |||
870 | #define PetscMalloc7(m1,r1,m2,r2,m3,r3,m4,r4,m5,r5,m6,r6,m7,r7)PetscMallocA(7,PETSC_FALSE,870,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(** (r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5),(size_t)(m6)*sizeof (**(r6)),(r6),(size_t)(m7)*sizeof(**(r7)),(r7)) PetscMallocA(7,PETSC_FALSE,__LINE__870,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(**(r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5),(size_t)(m6)*sizeof(**(r6)),(r6),(size_t)(m7)*sizeof(**(r7)),(r7)) | |||
871 | ||||
872 | /*MC | |||
873 | PetscCalloc7 - Allocates 7 cleared (zeroed) arrays of memory, all aligned to PETSC_MEMALIGN | |||
874 | ||||
875 | Synopsis: | |||
876 | #include <petscsys.h> | |||
877 | PetscErrorCode PetscCalloc7(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3,size_t m4,type **r4,size_t m5,type **r5,size_t m6,type **r6,size_t m7,type **r7) | |||
878 | ||||
879 | Not Collective | |||
880 | ||||
881 | Input Parameters: | |||
882 | + m1 - number of elements to allocate in 1st chunk (may be zero) | |||
883 | . m2 - number of elements to allocate in 2nd chunk (may be zero) | |||
884 | . m3 - number of elements to allocate in 3rd chunk (may be zero) | |||
885 | . m4 - number of elements to allocate in 4th chunk (may be zero) | |||
886 | . m5 - number of elements to allocate in 5th chunk (may be zero) | |||
887 | . m6 - number of elements to allocate in 6th chunk (may be zero) | |||
888 | - m7 - number of elements to allocate in 7th chunk (may be zero) | |||
889 | ||||
890 | Output Parameters: | |||
891 | + r1 - memory allocated in first chunk | |||
892 | . r2 - memory allocated in second chunk | |||
893 | . r3 - memory allocated in third chunk | |||
894 | . r4 - memory allocated in fourth chunk | |||
895 | . r5 - memory allocated in fifth chunk | |||
896 | . r6 - memory allocated in sixth chunk | |||
897 | - r7 - memory allocated in seventh chunk | |||
898 | ||||
899 | Level: developer | |||
900 | ||||
901 | .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscMalloc7(), PetscFree7() | |||
902 | ||||
903 | M*/ | |||
904 | #define PetscCalloc7(m1,r1,m2,r2,m3,r3,m4,r4,m5,r5,m6,r6,m7,r7)PetscMallocA(7,PETSC_TRUE,904,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)) ,(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(** (r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5),(size_t)(m6)*sizeof (**(r6)),(r6),(size_t)(m7)*sizeof(**(r7)),(r7)) PetscMallocA(7,PETSC_TRUE,__LINE__904,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",(size_t)(m1)*sizeof(**(r1)),(r1),(size_t)(m2)*sizeof(**(r2)),(r2),(size_t)(m3)*sizeof(**(r3)),(r3),(size_t)(m4)*sizeof(**(r4)),(r4),(size_t)(m5)*sizeof(**(r5)),(r5),(size_t)(m6)*sizeof(**(r6)),(r6),(size_t)(m7)*sizeof(**(r7)),(r7)) | |||
905 | ||||
906 | /*MC | |||
907 | PetscNew - Allocates memory of a particular type, zeros the memory! Aligned to PETSC_MEMALIGN | |||
908 | ||||
909 | Synopsis: | |||
910 | #include <petscsys.h> | |||
911 | PetscErrorCode PetscNew(type **result) | |||
912 | ||||
913 | Not Collective | |||
914 | ||||
915 | Output Parameter: | |||
916 | . result - memory allocated, sized to match pointer type | |||
917 | ||||
918 | Level: beginner | |||
919 | ||||
920 | .seealso: PetscFree(), PetscMalloc(), PetscNewLog(), PetscCalloc1(), PetscMalloc1() | |||
921 | ||||
922 | M*/ | |||
923 | #define PetscNew(b)PetscMallocA(1,PETSC_TRUE,923,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(1)*sizeof(**((b))),((b))) PetscCalloc1(1,(b))PetscMallocA(1,PETSC_TRUE,923,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(1)*sizeof(**((b))),((b))) | |||
924 | ||||
925 | /*MC | |||
926 | PetscNewLog - Allocates memory of a type matching pointer, zeros the memory! Aligned to PETSC_MEMALIGN. Associates the memory allocated | |||
927 | with the given object using PetscLogObjectMemory(). | |||
928 | ||||
929 | Synopsis: | |||
930 | #include <petscsys.h> | |||
931 | PetscErrorCode PetscNewLog(PetscObject obj,type **result) | |||
932 | ||||
933 | Not Collective | |||
934 | ||||
935 | Input Parameter: | |||
936 | . obj - object memory is logged to | |||
937 | ||||
938 | Output Parameter: | |||
939 | . result - memory allocated, sized to match pointer type | |||
940 | ||||
941 | Level: developer | |||
942 | ||||
943 | .seealso: PetscFree(), PetscMalloc(), PetscNew(), PetscLogObjectMemory(), PetscCalloc1(), PetscMalloc1() | |||
944 | ||||
945 | M*/ | |||
946 | #define PetscNewLog(o,b)(PetscMallocA(1,PETSC_TRUE,946,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(1)*sizeof(**(((b)))),(((b)))) || PetscLogObjectMemory ((PetscObject)o,sizeof(**(b)))) (PetscNew((b))PetscMallocA(1,PETSC_TRUE,946,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,(size_t)(1)*sizeof(**(((b)))),(((b)))) || PetscLogObjectMemory((PetscObject)o,sizeof(**(b)))) | |||
947 | ||||
948 | /*MC | |||
949 | PetscFree - Frees memory | |||
950 | ||||
951 | Synopsis: | |||
952 | #include <petscsys.h> | |||
953 | PetscErrorCode PetscFree(void *memory) | |||
954 | ||||
955 | Not Collective | |||
956 | ||||
957 | Input Parameter: | |||
958 | . memory - memory to free (the pointer is ALWAYS set to NULL upon sucess) | |||
959 | ||||
960 | Level: beginner | |||
961 | ||||
962 | Notes: | |||
963 | Do not free memory obtained with PetscMalloc2(), PetscCalloc2() etc, they must be freed with PetscFree2() etc. | |||
964 | ||||
965 | It is safe to call PetscFree() on a NULL pointer. | |||
966 | ||||
967 | .seealso: PetscNew(), PetscMalloc(), PetscNewLog(), PetscMalloc1(), PetscCalloc1() | |||
968 | ||||
969 | M*/ | |||
970 | #define PetscFree(a)((*PetscTrFree)((void*)(a),970,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ) || ((a) = 0,0)) ((*PetscTrFree)((void*)(a),__LINE__970,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h") || ((a) = 0,0)) | |||
971 | ||||
972 | /*MC | |||
973 | PetscFree2 - Frees 2 chunks of memory obtained with PetscMalloc2() | |||
974 | ||||
975 | Synopsis: | |||
976 | #include <petscsys.h> | |||
977 | PetscErrorCode PetscFree2(void *memory1,void *memory2) | |||
978 | ||||
979 | Not Collective | |||
980 | ||||
981 | Input Parameters: | |||
982 | + memory1 - memory to free | |||
983 | - memory2 - 2nd memory to free | |||
984 | ||||
985 | Level: developer | |||
986 | ||||
987 | Notes: | |||
988 | Memory must have been obtained with PetscMalloc2() | |||
989 | ||||
990 | .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree() | |||
991 | ||||
992 | M*/ | |||
993 | #define PetscFree2(m1,m2)PetscFreeA(2,993,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,&(m1),&(m2)) PetscFreeA(2,__LINE__993,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",&(m1),&(m2)) | |||
994 | ||||
995 | /*MC | |||
996 | PetscFree3 - Frees 3 chunks of memory obtained with PetscMalloc3() | |||
997 | ||||
998 | Synopsis: | |||
999 | #include <petscsys.h> | |||
1000 | PetscErrorCode PetscFree3(void *memory1,void *memory2,void *memory3) | |||
1001 | ||||
1002 | Not Collective | |||
1003 | ||||
1004 | Input Parameters: | |||
1005 | + memory1 - memory to free | |||
1006 | . memory2 - 2nd memory to free | |||
1007 | - memory3 - 3rd memory to free | |||
1008 | ||||
1009 | Level: developer | |||
1010 | ||||
1011 | Notes: | |||
1012 | Memory must have been obtained with PetscMalloc3() | |||
1013 | ||||
1014 | .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3() | |||
1015 | ||||
1016 | M*/ | |||
1017 | #define PetscFree3(m1,m2,m3)PetscFreeA(3,1017,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,&(m1),&(m2),&(m3)) PetscFreeA(3,__LINE__1017,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",&(m1),&(m2),&(m3)) | |||
1018 | ||||
1019 | /*MC | |||
1020 | PetscFree4 - Frees 4 chunks of memory obtained with PetscMalloc4() | |||
1021 | ||||
1022 | Synopsis: | |||
1023 | #include <petscsys.h> | |||
1024 | PetscErrorCode PetscFree4(void *m1,void *m2,void *m3,void *m4) | |||
1025 | ||||
1026 | Not Collective | |||
1027 | ||||
1028 | Input Parameters: | |||
1029 | + m1 - memory to free | |||
1030 | . m2 - 2nd memory to free | |||
1031 | . m3 - 3rd memory to free | |||
1032 | - m4 - 4th memory to free | |||
1033 | ||||
1034 | Level: developer | |||
1035 | ||||
1036 | Notes: | |||
1037 | Memory must have been obtained with PetscMalloc4() | |||
1038 | ||||
1039 | .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4() | |||
1040 | ||||
1041 | M*/ | |||
1042 | #define PetscFree4(m1,m2,m3,m4)PetscFreeA(4,1042,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,&(m1),&(m2),&(m3),&(m4)) PetscFreeA(4,__LINE__1042,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",&(m1),&(m2),&(m3),&(m4)) | |||
1043 | ||||
1044 | /*MC | |||
1045 | PetscFree5 - Frees 5 chunks of memory obtained with PetscMalloc5() | |||
1046 | ||||
1047 | Synopsis: | |||
1048 | #include <petscsys.h> | |||
1049 | PetscErrorCode PetscFree5(void *m1,void *m2,void *m3,void *m4,void *m5) | |||
1050 | ||||
1051 | Not Collective | |||
1052 | ||||
1053 | Input Parameters: | |||
1054 | + m1 - memory to free | |||
1055 | . m2 - 2nd memory to free | |||
1056 | . m3 - 3rd memory to free | |||
1057 | . m4 - 4th memory to free | |||
1058 | - m5 - 5th memory to free | |||
1059 | ||||
1060 | Level: developer | |||
1061 | ||||
1062 | Notes: | |||
1063 | Memory must have been obtained with PetscMalloc5() | |||
1064 | ||||
1065 | .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5() | |||
1066 | ||||
1067 | M*/ | |||
1068 | #define PetscFree5(m1,m2,m3,m4,m5)PetscFreeA(5,1068,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,&(m1),&(m2),&(m3),&(m4),&(m5)) PetscFreeA(5,__LINE__1068,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",&(m1),&(m2),&(m3),&(m4),&(m5)) | |||
1069 | ||||
1070 | /*MC | |||
1071 | PetscFree6 - Frees 6 chunks of memory obtained with PetscMalloc6() | |||
1072 | ||||
1073 | Synopsis: | |||
1074 | #include <petscsys.h> | |||
1075 | PetscErrorCode PetscFree6(void *m1,void *m2,void *m3,void *m4,void *m5,void *m6) | |||
1076 | ||||
1077 | Not Collective | |||
1078 | ||||
1079 | Input Parameters: | |||
1080 | + m1 - memory to free | |||
1081 | . m2 - 2nd memory to free | |||
1082 | . m3 - 3rd memory to free | |||
1083 | . m4 - 4th memory to free | |||
1084 | . m5 - 5th memory to free | |||
1085 | - m6 - 6th memory to free | |||
1086 | ||||
1087 | ||||
1088 | Level: developer | |||
1089 | ||||
1090 | Notes: | |||
1091 | Memory must have been obtained with PetscMalloc6() | |||
1092 | ||||
1093 | .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5(), PetscMalloc6() | |||
1094 | ||||
1095 | M*/ | |||
1096 | #define PetscFree6(m1,m2,m3,m4,m5,m6)PetscFreeA(6,1096,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,&(m1),&(m2),&(m3),&(m4),&(m5),&(m6)) PetscFreeA(6,__LINE__1096,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",&(m1),&(m2),&(m3),&(m4),&(m5),&(m6)) | |||
1097 | ||||
1098 | /*MC | |||
1099 | PetscFree7 - Frees 7 chunks of memory obtained with PetscMalloc7() | |||
1100 | ||||
1101 | Synopsis: | |||
1102 | #include <petscsys.h> | |||
1103 | PetscErrorCode PetscFree7(void *m1,void *m2,void *m3,void *m4,void *m5,void *m6,void *m7) | |||
1104 | ||||
1105 | Not Collective | |||
1106 | ||||
1107 | Input Parameters: | |||
1108 | + m1 - memory to free | |||
1109 | . m2 - 2nd memory to free | |||
1110 | . m3 - 3rd memory to free | |||
1111 | . m4 - 4th memory to free | |||
1112 | . m5 - 5th memory to free | |||
1113 | . m6 - 6th memory to free | |||
1114 | - m7 - 7th memory to free | |||
1115 | ||||
1116 | ||||
1117 | Level: developer | |||
1118 | ||||
1119 | Notes: | |||
1120 | Memory must have been obtained with PetscMalloc7() | |||
1121 | ||||
1122 | .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5(), PetscMalloc6(), | |||
1123 | PetscMalloc7() | |||
1124 | ||||
1125 | M*/ | |||
1126 | #define PetscFree7(m1,m2,m3,m4,m5,m6,m7)PetscFreeA(7,1126,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,&(m1),&(m2),&(m3),&(m4),&(m5),&(m6), &(m7)) PetscFreeA(7,__LINE__1126,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h",&(m1),&(m2),&(m3),&(m4),&(m5),&(m6),&(m7)) | |||
1127 | ||||
1128 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocA(int,PetscBool,int,const char *,const char *,size_t,void *,...); | |||
1129 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFreeA(int,int,const char *,const char *,void *,...); | |||
1130 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode (*PetscTrMalloc)(size_t,PetscBool,int,const char[],const char[],void**); | |||
1131 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode (*PetscTrFree)(void*,int,const char[],const char[]); | |||
1132 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode (*PetscTrRealloc)(size_t,int,const char[],const char[],void**); | |||
1133 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocSetCoalesce(PetscBool); | |||
1134 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocSet(PetscErrorCode (*)(size_t,PetscBool,int,const char[],const char[],void**),PetscErrorCode (*)(void*,int,const char[],const char[])); | |||
1135 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocClear(void); | |||
1136 | ||||
1137 | /* | |||
1138 | Unlike PetscMallocSet and PetscMallocClear which overwrite the existing settings, these two functions save the previous choice of allocator, and should be used in pair. | |||
1139 | */ | |||
1140 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocSetDRAM(void); | |||
1141 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocResetDRAM(void); | |||
1142 | ||||
1143 | #define MPIU_PETSCLOGDOUBLE((MPI_Datatype)0x4c00080b) MPI_DOUBLE((MPI_Datatype)0x4c00080b) | |||
1144 | #define MPIU_2PETSCLOGDOUBLE((MPI_Datatype)1275072547) MPI_2DOUBLE_PRECISION((MPI_Datatype)1275072547) | |||
1145 | ||||
1146 | /* | |||
1147 | Routines for tracing memory corruption/bleeding with default PETSc memory allocation | |||
1148 | */ | |||
1149 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocDump(FILE *); | |||
1150 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocDumpLog(FILE *); | |||
1151 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocGetCurrentUsage(PetscLogDouble *); | |||
1152 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocGetMaximumUsage(PetscLogDouble *); | |||
1153 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocPushMaximumUsage(int); | |||
1154 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocPopMaximumUsage(int,PetscLogDouble*); | |||
1155 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocDebug(PetscBool); | |||
1156 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocGetDebug(PetscBool*); | |||
1157 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocValidate(int,const char[],const char[]); | |||
1158 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocSetDumpLog(void); | |||
1159 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocSetDumpLogThreshold(PetscLogDouble); | |||
1160 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocGetDumpLog(PetscBool*); | |||
1161 | ||||
1162 | PETSC_EXTERNextern __attribute__((visibility ("default"))) const char *const PetscDataTypes[]; | |||
1163 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDataTypeToMPIDataType(PetscDataType,MPI_Datatype*); | |||
1164 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMPIDataTypeToPetscDataType(MPI_Datatype,PetscDataType*); | |||
1165 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDataTypeGetSize(PetscDataType,size_t*); | |||
1166 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDataTypeFromString(const char*,PetscDataType*,PetscBool*); | |||
1167 | ||||
1168 | /* | |||
1169 | Basic memory and string operations. These are usually simple wrappers | |||
1170 | around the basic Unix system calls, but a few of them have additional | |||
1171 | functionality and/or error checking. | |||
1172 | */ | |||
1173 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBitMemcpy(void*,PetscInt,const void*,PetscInt,PetscInt,PetscDataType); | |||
1174 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMemcmp(const void*,const void*,size_t,PetscBool *); | |||
1175 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrlen(const char[],size_t*); | |||
1176 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrToArray(const char[],char,int*,char ***); | |||
1177 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrToArrayDestroy(int,char **); | |||
1178 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrcmp(const char[],const char[],PetscBool *); | |||
1179 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrgrt(const char[],const char[],PetscBool *); | |||
1180 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrcasecmp(const char[],const char[],PetscBool *); | |||
1181 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrncmp(const char[],const char[],size_t,PetscBool *); | |||
1182 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrcpy(char[],const char[]); | |||
1183 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrcat(char[],const char[]); | |||
1184 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrlcat(char[],const char[],size_t); | |||
1185 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrncpy(char[],const char[],size_t); | |||
1186 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrchr(const char[],char,char *[]); | |||
1187 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrtolower(char[]); | |||
1188 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrtoupper(char[]); | |||
1189 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrrchr(const char[],char,char *[]); | |||
1190 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrstr(const char[],const char[],char *[]); | |||
1191 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrrstr(const char[],const char[],char *[]); | |||
1192 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrendswith(const char[],const char[],PetscBool*); | |||
1193 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrbeginswith(const char[],const char[],PetscBool*); | |||
1194 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrendswithwhich(const char[],const char *const*,PetscInt*); | |||
1195 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrallocpy(const char[],char *[]); | |||
1196 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrArrayallocpy(const char *const*,char***); | |||
1197 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrArrayDestroy(char***); | |||
1198 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrNArrayallocpy(PetscInt,const char *const*,char***); | |||
1199 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrNArrayDestroy(PetscInt,char***); | |||
1200 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrreplace(MPI_Comm,const char[],char[],size_t); | |||
1201 | ||||
1202 | PETSC_EXTERNextern __attribute__((visibility ("default"))) void PetscStrcmpNoError(const char[],const char[],PetscBool *); | |||
1203 | ||||
1204 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTokenCreate(const char[],const char,PetscToken*); | |||
1205 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTokenFind(PetscToken,char *[]); | |||
1206 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTokenDestroy(PetscToken*); | |||
1207 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStrInList(const char[],const char[],char,PetscBool*); | |||
1208 | ||||
1209 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscEListFind(PetscInt,const char *const*,const char*,PetscInt*,PetscBool*); | |||
1210 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscEnumFind(const char *const*,const char*,PetscEnum*,PetscBool*); | |||
1211 | ||||
1212 | /* | |||
1213 | These are MPI operations for MPI_Allreduce() etc | |||
1214 | */ | |||
1215 | PETSC_EXTERNextern __attribute__((visibility ("default"))) MPI_Op MPIU_MAXSUM_OP; | |||
1216 | #if (defined(PETSC_HAVE_COMPLEX1) && !defined(PETSC_HAVE_MPI_C_DOUBLE_COMPLEX1)) || defined(PETSC_USE_REAL___FLOAT128) || defined(PETSC_USE_REAL___FP16) | |||
1217 | PETSC_EXTERNextern __attribute__((visibility ("default"))) MPI_Op MPIU_SUM(MPI_Op)(0x58000003); | |||
1218 | #else | |||
1219 | #define MPIU_SUM(MPI_Op)(0x58000003) MPI_SUM(MPI_Op)(0x58000003) | |||
1220 | #endif | |||
1221 | #if defined(PETSC_USE_REAL___FLOAT128) || defined(PETSC_USE_REAL___FP16) | |||
1222 | PETSC_EXTERNextern __attribute__((visibility ("default"))) MPI_Op MPIU_MAX(MPI_Op)(0x58000001); | |||
1223 | PETSC_EXTERNextern __attribute__((visibility ("default"))) MPI_Op MPIU_MIN(MPI_Op)(0x58000002); | |||
1224 | #else | |||
1225 | #define MPIU_MAX(MPI_Op)(0x58000001) MPI_MAX(MPI_Op)(0x58000001) | |||
1226 | #define MPIU_MIN(MPI_Op)(0x58000002) MPI_MIN(MPI_Op)(0x58000002) | |||
1227 | #endif | |||
1228 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMaxSum(MPI_Comm,const PetscInt[],PetscInt*,PetscInt*); | |||
1229 | ||||
1230 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MPIULong_Send(void*,PetscInt,MPI_Datatype,PetscMPIInt,PetscMPIInt,MPI_Comm); | |||
1231 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MPIULong_Recv(void*,PetscInt,MPI_Datatype,PetscMPIInt,PetscMPIInt,MPI_Comm); | |||
1232 | ||||
1233 | PETSC_EXTERNextern __attribute__((visibility ("default"))) const char *const PetscFileModes[]; | |||
1234 | ||||
1235 | /* | |||
1236 | Defines PETSc error handling. | |||
1237 | */ | |||
1238 | #include <petscerror.h> | |||
1239 | ||||
1240 | #define PETSC_SMALLEST_CLASSID1211211 1211211 | |||
1241 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscClassId PETSC_LARGEST_CLASSID; | |||
1242 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscClassId PETSC_OBJECT_CLASSID; | |||
1243 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscClassIdRegister(const char[],PetscClassId *); | |||
1244 | ||||
1245 | /* | |||
1246 | Routines that get memory usage information from the OS | |||
1247 | */ | |||
1248 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMemoryGetCurrentUsage(PetscLogDouble *); | |||
1249 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMemoryGetMaximumUsage(PetscLogDouble *); | |||
1250 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMemorySetGetMaximumUsage(void); | |||
1251 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMemoryTrace(const char[]); | |||
1252 | ||||
1253 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscInfoAllow(PetscBool ,const char []); | |||
1254 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSleep(PetscReal); | |||
1255 | ||||
1256 | /* | |||
1257 | Initialization of PETSc | |||
1258 | */ | |||
1259 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscInitialize(int*,char***,const char[],const char[]); | |||
1260 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscInitializeNoPointers(int,char**,const char[],const char[]); | |||
1261 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscInitializeNoArguments(void); | |||
1262 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscInitialized(PetscBool *); | |||
1263 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFinalized(PetscBool *); | |||
1264 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFinalize(void); | |||
1265 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscInitializeFortran(void); | |||
1266 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetArgs(int*,char ***); | |||
1267 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetArguments(char ***); | |||
1268 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFreeArguments(char **); | |||
1269 | ||||
1270 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscEnd(void); | |||
1271 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSysInitializePackage(void); | |||
1272 | ||||
1273 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPythonInitialize(const char[],const char[]); | |||
1274 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPythonFinalize(void); | |||
1275 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPythonPrintError(void); | |||
1276 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPythonMonitorSet(PetscObject,const char[]); | |||
1277 | ||||
1278 | /* | |||
1279 | These are so that in extern C code we can caste function pointers to non-extern C | |||
1280 | function pointers. Since the regular C++ code expects its function pointers to be C++ | |||
1281 | */ | |||
1282 | PETSC_EXTERN_TYPEDEF typedef void (**PetscVoidStarFunction)(void); | |||
1283 | PETSC_EXTERN_TYPEDEF typedef void (*PetscVoidFunction)(void); | |||
1284 | PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*PetscErrorCodeFunction)(void); | |||
1285 | ||||
1286 | /* | |||
1287 | Functions that can act on any PETSc object. | |||
1288 | */ | |||
1289 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectDestroy(PetscObject*); | |||
1290 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectGetComm(PetscObject,MPI_Comm *); | |||
1291 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectGetClassId(PetscObject,PetscClassId *); | |||
1292 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectGetClassName(PetscObject,const char *[]); | |||
1293 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSetType(PetscObject,const char []); | |||
1294 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectGetType(PetscObject,const char *[]); | |||
1295 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSetName(PetscObject,const char[]); | |||
1296 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectGetName(PetscObject,const char*[]); | |||
1297 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSetTabLevel(PetscObject,PetscInt); | |||
1298 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectGetTabLevel(PetscObject,PetscInt*); | |||
1299 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectIncrementTabLevel(PetscObject,PetscObject,PetscInt); | |||
1300 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectReference(PetscObject); | |||
1301 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectGetReference(PetscObject,PetscInt*); | |||
1302 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectDereference(PetscObject); | |||
1303 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectGetNewTag(PetscObject,PetscMPIInt *); | |||
1304 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectCompose(PetscObject,const char[],PetscObject); | |||
1305 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectRemoveReference(PetscObject,const char[]); | |||
1306 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectQuery(PetscObject,const char[],PetscObject *); | |||
1307 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectComposeFunction_Private(PetscObject,const char[],void (*)(void)); | |||
1308 | #define PetscObjectComposeFunction(a,b,d)PetscObjectComposeFunction_Private(a,b,(PetscVoidFunction)(d) ) PetscObjectComposeFunction_Private(a,b,(PetscVoidFunction)(d)) | |||
1309 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSetFromOptions(PetscObject); | |||
1310 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSetUp(PetscObject); | |||
1311 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSetPrintedOptions(PetscObject); | |||
1312 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectInheritPrintedOptions(PetscObject,PetscObject); | |||
1313 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscCommGetNewTag(MPI_Comm,PetscMPIInt *); | |||
1314 | ||||
1315 | #include <petscviewertypes.h> | |||
1316 | #include <petscoptions.h> | |||
1317 | ||||
1318 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectsListGetGlobalNumbering(MPI_Comm,PetscInt,PetscObject*,PetscInt*,PetscInt*); | |||
1319 | ||||
1320 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMemoryShowUsage(PetscViewer,const char[]); | |||
1321 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMemoryView(PetscViewer,const char[]); | |||
1322 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectPrintClassNamePrefixType(PetscObject,PetscViewer); | |||
1323 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectView(PetscObject,PetscViewer); | |||
1324 | #define PetscObjectQueryFunction(obj,name,fptr)PetscObjectQueryFunction_Private((obj),(name),(PetscVoidFunction *)(fptr)) PetscObjectQueryFunction_Private((obj),(name),(PetscVoidFunction*)(fptr)) | |||
1325 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectQueryFunction_Private(PetscObject,const char[],void (**)(void)); | |||
1326 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSetOptionsPrefix(PetscObject,const char[]); | |||
1327 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectAppendOptionsPrefix(PetscObject,const char[]); | |||
1328 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectPrependOptionsPrefix(PetscObject,const char[]); | |||
1329 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectGetOptionsPrefix(PetscObject,const char*[]); | |||
1330 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectChangeTypeName(PetscObject,const char[]); | |||
1331 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectRegisterDestroy(PetscObject); | |||
1332 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectRegisterDestroyAll(void); | |||
1333 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectViewFromOptions(PetscObject,PetscObject,const char[]); | |||
1334 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectName(PetscObject); | |||
1335 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectTypeCompare(PetscObject,const char[],PetscBool *); | |||
1336 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectBaseTypeCompare(PetscObject,const char[],PetscBool *); | |||
1337 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectTypeCompareAny(PetscObject,PetscBool*,const char[],...); | |||
1338 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectBaseTypeCompareAny(PetscObject,PetscBool*,const char[],...); | |||
1339 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRegisterFinalize(PetscErrorCode (*)(void)); | |||
1340 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRegisterFinalizeAll(void); | |||
1341 | ||||
1342 | #if defined(PETSC_HAVE_SAWS) | |||
1343 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSAWsBlock(void); | |||
1344 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSAWsViewOff(PetscObject)0; | |||
1345 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSAWsSetBlock(PetscObject,PetscBool)0; | |||
1346 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSAWsBlock(PetscObject)0; | |||
1347 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSAWsGrantAccess(PetscObject)0; | |||
1348 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectSAWsTakeAccess(PetscObject)0; | |||
1349 | PETSC_EXTERNextern __attribute__((visibility ("default"))) void PetscStackSAWsGrantAccess(void); | |||
1350 | PETSC_EXTERNextern __attribute__((visibility ("default"))) void PetscStackSAWsTakeAccess(void); | |||
1351 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStackViewSAWs(void); | |||
1352 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStackSAWsViewOff(void); | |||
1353 | ||||
1354 | #else | |||
1355 | #define PetscSAWsBlock()0 0 | |||
1356 | #define PetscObjectSAWsViewOff(obj)0 0 | |||
1357 | #define PetscObjectSAWsSetBlock(obj,flg)0 0 | |||
1358 | #define PetscObjectSAWsBlock(obj)0 0 | |||
1359 | #define PetscObjectSAWsGrantAccess(obj)0 0 | |||
1360 | #define PetscObjectSAWsTakeAccess(obj)0 0 | |||
1361 | #define PetscStackViewSAWs()0 0 | |||
1362 | #define PetscStackSAWsViewOff()0 0 | |||
1363 | #define PetscStackSAWsTakeAccess() | |||
1364 | #define PetscStackSAWsGrantAccess() | |||
1365 | ||||
1366 | #endif | |||
1367 | ||||
1368 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDLOpen(const char[],PetscDLMode,PetscDLHandle *); | |||
1369 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDLClose(PetscDLHandle *); | |||
1370 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDLSym(PetscDLHandle,const char[],void **); | |||
1371 | ||||
1372 | #if defined(PETSC_USE_DEBUG1) | |||
1373 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMallocGetStack(void*,PetscStack**); | |||
1374 | #endif | |||
1375 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectsDump(FILE*,PetscBool); | |||
1376 | ||||
1377 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectListDestroy(PetscObjectList*); | |||
1378 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectListFind(PetscObjectList,const char[],PetscObject*); | |||
1379 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectListReverseFind(PetscObjectList,PetscObject,char**,PetscBool*); | |||
1380 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectListAdd(PetscObjectList *,const char[],PetscObject); | |||
1381 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectListRemoveReference(PetscObjectList *,const char[]); | |||
1382 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscObjectListDuplicate(PetscObjectList,PetscObjectList *); | |||
1383 | ||||
1384 | /* | |||
1385 | Dynamic library lists. Lists of names of routines in objects or in dynamic | |||
1386 | link libraries that will be loaded as needed. | |||
1387 | */ | |||
1388 | ||||
1389 | #define PetscFunctionListAdd(list,name,fptr)PetscFunctionListAdd_Private((list),(name),(PetscVoidFunction )(fptr)) PetscFunctionListAdd_Private((list),(name),(PetscVoidFunction)(fptr)) | |||
1390 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFunctionListAdd_Private(PetscFunctionList*,const char[],void (*)(void)); | |||
1391 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFunctionListDestroy(PetscFunctionList*); | |||
1392 | #define PetscFunctionListFind(list,name,fptr)PetscFunctionListFind_Private((list),(name),(PetscVoidFunction *)(fptr)) PetscFunctionListFind_Private((list),(name),(PetscVoidFunction*)(fptr)) | |||
1393 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFunctionListFind_Private(PetscFunctionList,const char[],void (**)(void)); | |||
1394 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFunctionListPrintTypes(MPI_Comm,FILE*,const char[],const char[],const char[],const char[],PetscFunctionList,const char[],const char[]); | |||
1395 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFunctionListDuplicate(PetscFunctionList,PetscFunctionList *); | |||
1396 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFunctionListView(PetscFunctionList,PetscViewer); | |||
1397 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFunctionListGet(PetscFunctionList,const char ***,int*); | |||
1398 | ||||
1399 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscDLLibrary PetscDLLibrariesLoaded; | |||
1400 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDLLibraryAppend(MPI_Comm,PetscDLLibrary *,const char[]); | |||
1401 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDLLibraryPrepend(MPI_Comm,PetscDLLibrary *,const char[]); | |||
1402 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDLLibrarySym(MPI_Comm,PetscDLLibrary *,const char[],const char[],void **); | |||
1403 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDLLibraryPrintPath(PetscDLLibrary); | |||
1404 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDLLibraryRetrieve(MPI_Comm,const char[],char *,size_t,PetscBool *); | |||
1405 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDLLibraryOpen(MPI_Comm,const char[],PetscDLLibrary *); | |||
1406 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDLLibraryClose(PetscDLLibrary); | |||
1407 | ||||
1408 | /* | |||
1409 | Useful utility routines | |||
1410 | */ | |||
1411 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSplitOwnership(MPI_Comm,PetscInt*,PetscInt*); | |||
1412 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSplitOwnershipBlock(MPI_Comm,PetscInt,PetscInt*,PetscInt*); | |||
1413 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm,PetscMPIInt); | |||
1414 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSequentialPhaseEnd(MPI_Comm,PetscMPIInt); | |||
1415 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBarrier(PetscObject); | |||
1416 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMPIDump(FILE*); | |||
1417 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGlobalMinMaxInt(MPI_Comm,PetscInt[],PetscInt[]); | |||
1418 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGlobalMinMaxReal(MPI_Comm,PetscReal[],PetscReal[]); | |||
1419 | ||||
1420 | /*MC | |||
1421 | PetscNot - negates a logical type value and returns result as a PetscBool | |||
1422 | ||||
1423 | Notes: | |||
1424 | This is useful in cases like | |||
1425 | $ int *a; | |||
1426 | $ PetscBool flag = PetscNot(a) | |||
1427 | where !a would not return a PetscBool because we cannot provide a cast from int to PetscBool in C. | |||
1428 | ||||
1429 | Level: beginner | |||
1430 | ||||
1431 | .seealso : PetscBool, PETSC_TRUE, PETSC_FALSE | |||
1432 | M*/ | |||
1433 | #define PetscNot(a)((a) ? PETSC_FALSE : PETSC_TRUE) ((a) ? PETSC_FALSE : PETSC_TRUE) | |||
1434 | ||||
1435 | /*MC | |||
1436 | PetscHelpPrintf - Prints help messages. | |||
1437 | ||||
1438 | Synopsis: | |||
1439 | #include <petscsys.h> | |||
1440 | PetscErrorCode (*PetscHelpPrintf)(const char format[],...); | |||
1441 | ||||
1442 | Not Collective | |||
1443 | ||||
1444 | Input Parameters: | |||
1445 | . format - the usual printf() format string | |||
1446 | ||||
1447 | Level: developer | |||
1448 | ||||
1449 | Fortran Note: | |||
1450 | This routine is not supported in Fortran. | |||
1451 | ||||
1452 | ||||
1453 | .seealso: PetscFPrintf(), PetscSynchronizedPrintf(), PetscErrorPrintf() | |||
1454 | M*/ | |||
1455 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode (*PetscHelpPrintf)(MPI_Comm,const char[],...); | |||
1456 | ||||
1457 | /* | |||
1458 | Defines PETSc profiling. | |||
1459 | */ | |||
1460 | #include <petsclog.h> | |||
1461 | ||||
1462 | /* | |||
1463 | Simple PETSc parallel IO for ASCII printing | |||
1464 | */ | |||
1465 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFixFilename(const char[],char[]); | |||
1466 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFOpen(MPI_Comm,const char[],const char[],FILE**); | |||
1467 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFClose(MPI_Comm,FILE*); | |||
1468 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFPrintf(MPI_Comm,FILE*,const char[],...); | |||
1469 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPrintf(MPI_Comm,const char[],...); | |||
1470 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSNPrintf(char*,size_t,const char [],...); | |||
1471 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSNPrintfCount(char*,size_t,const char [],size_t*,...); | |||
1472 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFormatRealArray(char[],size_t,const char*,PetscInt,const PetscReal[]); | |||
1473 | ||||
1474 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscErrorPrintfDefault(const char [],...); | |||
1475 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscErrorPrintfNone(const char [],...); | |||
1476 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscHelpPrintfDefault(MPI_Comm,const char [],...); | |||
1477 | ||||
1478 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFormatConvertGetSize(const char*,size_t*); | |||
1479 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFormatConvert(const char*,char *); | |||
1480 | ||||
1481 | #if defined(PETSC_HAVE_POPEN1) | |||
1482 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPOpen(MPI_Comm,const char[],const char[],const char[],FILE **); | |||
1483 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPClose(MPI_Comm,FILE*); | |||
1484 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPOpenSetMachine(const char[]); | |||
1485 | #endif | |||
1486 | ||||
1487 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSynchronizedPrintf(MPI_Comm,const char[],...); | |||
1488 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSynchronizedFPrintf(MPI_Comm,FILE*,const char[],...); | |||
1489 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSynchronizedFlush(MPI_Comm,FILE*); | |||
1490 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSynchronizedFGets(MPI_Comm,FILE*,size_t,char[]); | |||
1491 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStartMatlab(MPI_Comm,const char[],const char[],FILE**); | |||
1492 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStartJava(MPI_Comm,const char[],const char[],FILE**); | |||
1493 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetPetscDir(const char*[]); | |||
1494 | ||||
1495 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscClassId PETSC_CONTAINER_CLASSID; | |||
1496 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscContainerGetPointer(PetscContainer,void **); | |||
1497 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscContainerSetPointer(PetscContainer,void *); | |||
1498 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscContainerDestroy(PetscContainer*); | |||
1499 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscContainerCreate(MPI_Comm,PetscContainer *); | |||
1500 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscContainerSetUserDestroy(PetscContainer, PetscErrorCode (*)(void*)); | |||
1501 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscContainerUserDestroyDefault(void*); | |||
1502 | ||||
1503 | /* | |||
1504 | For use in debuggers | |||
1505 | */ | |||
1506 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscMPIInt PetscGlobalRank; | |||
1507 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscMPIInt PetscGlobalSize; | |||
1508 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscIntView(PetscInt,const PetscInt[],PetscViewer); | |||
1509 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRealView(PetscInt,const PetscReal[],PetscViewer); | |||
1510 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscScalarView(PetscInt,const PetscScalar[],PetscViewer); | |||
1511 | ||||
1512 | #include <stddef.h> | |||
1513 | #include <string.h> /* for memcpy, memset */ | |||
1514 | #include <stdlib.h> | |||
1515 | ||||
1516 | #if defined(PETSC_HAVE_XMMINTRIN_H1) && !defined(__CUDACC__) | |||
1517 | #include <xmmintrin.h> | |||
1518 | #endif | |||
1519 | ||||
1520 | /*@C | |||
1521 | PetscMemmove - Copies n bytes, beginning at location b, to the space | |||
1522 | beginning at location a. Copying between regions that overlap will | |||
1523 | take place correctly. Use PetscMemcpy() if the locations do not overlap | |||
1524 | ||||
1525 | Not Collective | |||
1526 | ||||
1527 | Input Parameters: | |||
1528 | + b - pointer to initial memory space | |||
1529 | . a - pointer to copy space | |||
1530 | - n - length (in bytes) of space to copy | |||
1531 | ||||
1532 | Level: intermediate | |||
1533 | ||||
1534 | Note: | |||
1535 | PetscArraymove() is preferred | |||
1536 | This routine is analogous to memmove(). | |||
1537 | ||||
1538 | Developers Note: This is inlined for performance | |||
1539 | ||||
1540 | .seealso: PetscMemcpy(), PetscMemcmp(), PetscArrayzero(), PetscMemzero(), PetscArraycmp(), PetscArraycpy(), PetscStrallocpy(), | |||
1541 | PetscArraymove() | |||
1542 | @*/ | |||
1543 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscMemmove(void *a,const void *b,size_t n) | |||
1544 | { | |||
1545 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscsys.h"; petscstack ->line[petscstack->currentsize] = 1545; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1546 | if (n > 0 && !a) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NULL,"Trying to copy to null pointer")return PetscError(((MPI_Comm)0x44000001),1546,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,85,PETSC_ERROR_INITIAL,"Trying to copy to null pointer"); | |||
1547 | if (n > 0 && !b) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NULL,"Trying to copy from a null pointer")return PetscError(((MPI_Comm)0x44000001),1547,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,85,PETSC_ERROR_INITIAL,"Trying to copy from a null pointer"); | |||
1548 | #if !defined(PETSC_HAVE_MEMMOVE1) | |||
1549 | if (a < b) { | |||
1550 | if (a <= b - n) memcpy(a,b,n); | |||
1551 | else { | |||
1552 | memcpy(a,b,(int)(b - a)); | |||
1553 | PetscMemmove(b,b + (int)(b - a),n - (int)(b - a)); | |||
1554 | } | |||
1555 | } else { | |||
1556 | if (b <= a - n) memcpy(a,b,n); | |||
1557 | else { | |||
1558 | memcpy(b + n,b + (n - (int)(a - b)),(int)(a - b)); | |||
1559 | PetscMemmove(a,b,n - (int)(a - b)); | |||
1560 | } | |||
1561 | } | |||
1562 | #else | |||
1563 | memmove((char*)(a),(char*)(b),n); | |||
| ||||
1564 | #endif | |||
1565 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1566 | } | |||
1567 | ||||
1568 | /*@C | |||
1569 | PetscMemcpy - Copies n bytes, beginning at location b, to the space | |||
1570 | beginning at location a. The two memory regions CANNOT overlap, use | |||
1571 | PetscMemmove() in that case. | |||
1572 | ||||
1573 | Not Collective | |||
1574 | ||||
1575 | Input Parameters: | |||
1576 | + b - pointer to initial memory space | |||
1577 | - n - length (in bytes) of space to copy | |||
1578 | ||||
1579 | Output Parameter: | |||
1580 | . a - pointer to copy space | |||
1581 | ||||
1582 | Level: intermediate | |||
1583 | ||||
1584 | Compile Option: | |||
1585 | PETSC_PREFER_DCOPY_FOR_MEMCPY will cause the BLAS dcopy() routine to be used | |||
1586 | for memory copies on double precision values. | |||
1587 | PETSC_PREFER_COPY_FOR_MEMCPY will cause C code to be used | |||
1588 | for memory copies on double precision values. | |||
1589 | PETSC_PREFER_FORTRAN_FORMEMCPY will cause Fortran code to be used | |||
1590 | for memory copies on double precision values. | |||
1591 | ||||
1592 | Note: | |||
1593 | Prefer PetscArraycpy() | |||
1594 | This routine is analogous to memcpy(). | |||
1595 | Not available from Fortran | |||
1596 | ||||
1597 | Developer Note: this is inlined for fastest performance | |||
1598 | ||||
1599 | .seealso: PetscMemzero(), PetscMemcmp(), PetscArrayzero(), PetscArraycmp(), PetscArraycpy(), PetscMemmove(), PetscStrallocpy() | |||
1600 | ||||
1601 | @*/ | |||
1602 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscMemcpy(void *a,const void *b,size_t n) | |||
1603 | { | |||
1604 | #if defined(PETSC_USE_DEBUG1) | |||
1605 | size_t al = (size_t) a,bl = (size_t) b; | |||
1606 | size_t nl = (size_t) n; | |||
1607 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscsys.h"; petscstack ->line[petscstack->currentsize] = 1607; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1608 | if (n > 0 && !b) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NULL,"Trying to copy from a null pointer")return PetscError(((MPI_Comm)0x44000001),1608,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,85,PETSC_ERROR_INITIAL,"Trying to copy from a null pointer"); | |||
1609 | if (n > 0 && !a) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NULL,"Trying to copy to a null pointer")return PetscError(((MPI_Comm)0x44000001),1609,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,85,PETSC_ERROR_INITIAL,"Trying to copy to a null pointer"); | |||
1610 | #else | |||
1611 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscsys.h"; petscstack ->line[petscstack->currentsize] = 1611; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1612 | #endif | |||
1613 | if (a != b && n > 0) { | |||
1614 | #if defined(PETSC_USE_DEBUG1) | |||
1615 | if ((al > bl && (al - bl) < nl) || (bl - al) < nl) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Memory regions overlap: either use PetscMemmov()\n\return PetscError(((MPI_Comm)0x44000001),1617,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,75,PETSC_ERROR_INITIAL,"Memory regions overlap: either use PetscMemmov()\n or make sure your copy regions and lengths are correct. \n Length (bytes) %ld first address %ld second address %ld" ,nl,al,bl) | |||
1616 | or make sure your copy regions and lengths are correct. \n\return PetscError(((MPI_Comm)0x44000001),1617,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,75,PETSC_ERROR_INITIAL,"Memory regions overlap: either use PetscMemmov()\n or make sure your copy regions and lengths are correct. \n Length (bytes) %ld first address %ld second address %ld" ,nl,al,bl) | |||
1617 | Length (bytes) %ld first address %ld second address %ld",nl,al,bl)return PetscError(((MPI_Comm)0x44000001),1617,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,75,PETSC_ERROR_INITIAL,"Memory regions overlap: either use PetscMemmov()\n or make sure your copy regions and lengths are correct. \n Length (bytes) %ld first address %ld second address %ld" ,nl,al,bl); | |||
1618 | #endif | |||
1619 | #if (defined(PETSC_PREFER_DCOPY_FOR_MEMCPY) || defined(PETSC_PREFER_COPY_FOR_MEMCPY) || defined(PETSC_PREFER_FORTRAN_FORMEMCPY)) | |||
1620 | if (!(a % sizeof(PetscScalar)) && !(n % sizeof(PetscScalar))) { | |||
1621 | size_t len = n/sizeof(PetscScalar); | |||
1622 | #if defined(PETSC_PREFER_DCOPY_FOR_MEMCPY) | |||
1623 | PetscBLASInt one = 1,blen; | |||
1624 | PetscErrorCode ierr; | |||
1625 | ierr = PetscBLASIntCast(len,&blen);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1625,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1626 | PetscStackCallBLAS("BLAScopy",BLAScopy_(&blen,(PetscScalar *)b,&one,(PetscScalar *)a,&one))do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "BLAScopy"; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/include/petscsys.h"; petscstack ->line[petscstack->currentsize] = 1626; petscstack-> petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); dcopy_(&blen,(PetscScalar *)b,&one,(PetscScalar *)a, &one); do { do {PetscErrorCode _7_ierr = PetscMallocValidate (1626,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),1626,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,_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); | |||
1627 | #elif defined(PETSC_PREFER_FORTRAN_FORMEMCPY) | |||
1628 | fortrancopy_(&len,(PetscScalar*)b,(PetscScalar*)a); | |||
1629 | #else | |||
1630 | size_t i; | |||
1631 | PetscScalar *x = (PetscScalar*)b, *y = (PetscScalar*)a; | |||
1632 | for (i=0; i<len; i++) y[i] = x[i]; | |||
1633 | #endif | |||
1634 | } else { | |||
1635 | memcpy((char*)(a),(char*)(b),n); | |||
1636 | } | |||
1637 | #else | |||
1638 | memcpy((char*)(a),(char*)(b),n); | |||
1639 | #endif | |||
1640 | } | |||
1641 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1642 | } | |||
1643 | ||||
1644 | /*@C | |||
1645 | PetscMemzero - Zeros the specified memory. | |||
1646 | ||||
1647 | Not Collective | |||
1648 | ||||
1649 | Input Parameters: | |||
1650 | + a - pointer to beginning memory location | |||
1651 | - n - length (in bytes) of memory to initialize | |||
1652 | ||||
1653 | Level: intermediate | |||
1654 | ||||
1655 | Compile Option: | |||
1656 | PETSC_PREFER_BZERO - on certain machines (the IBM RS6000) the bzero() routine happens | |||
1657 | to be faster than the memset() routine. This flag causes the bzero() routine to be used. | |||
1658 | ||||
1659 | Not available from Fortran | |||
1660 | Prefer PetscArrayzero() | |||
1661 | ||||
1662 | Developer Note: this is inlined for fastest performance | |||
1663 | ||||
1664 | .seealso: PetscMemcpy(), PetscMemcmp(), PetscArrayzero(), PetscArraycmp(), PetscArraycpy(), PetscMemmove(), PetscStrallocpy() | |||
1665 | @*/ | |||
1666 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscMemzero(void *a,size_t n) | |||
1667 | { | |||
1668 | if (n > 0) { | |||
1669 | #if defined(PETSC_USE_DEBUG1) | |||
1670 | if (!a) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NULL,"Trying to zero at a null pointer")return PetscError(((MPI_Comm)0x44000001),1670,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,85,PETSC_ERROR_INITIAL,"Trying to zero at a null pointer"); | |||
1671 | #endif | |||
1672 | #if defined(PETSC_PREFER_ZERO_FOR_MEMZERO) | |||
1673 | if (!(((long) a) % sizeof(PetscScalar)) && !(n % sizeof(PetscScalar))) { | |||
1674 | size_t i,len = n/sizeof(PetscScalar); | |||
1675 | PetscScalar *x = (PetscScalar*)a; | |||
1676 | for (i=0; i<len; i++) x[i] = 0.0; | |||
1677 | } else { | |||
1678 | #elif defined(PETSC_PREFER_FORTRAN_FOR_MEMZERO) | |||
1679 | if (!(((long) a) % sizeof(PetscScalar)) && !(n % sizeof(PetscScalar))) { | |||
1680 | PetscInt len = n/sizeof(PetscScalar); | |||
1681 | fortranzero_(&len,(PetscScalar*)a); | |||
1682 | } else { | |||
1683 | #endif | |||
1684 | #if defined(PETSC_PREFER_BZERO) | |||
1685 | bzero((char *)a,n); | |||
1686 | #else | |||
1687 | memset((char*)a,0,n); | |||
1688 | #endif | |||
1689 | #if defined(PETSC_PREFER_ZERO_FOR_MEMZERO) || defined(PETSC_PREFER_FORTRAN_FOR_MEMZERO) | |||
1690 | } | |||
1691 | #endif | |||
1692 | } | |||
1693 | return 0; | |||
1694 | } | |||
1695 | ||||
1696 | /*MC | |||
1697 | PetscArraycmp - Compares two arrays in memory. | |||
1698 | ||||
1699 | Synopsis: | |||
1700 | #include <petscsys.h> | |||
1701 | PetscErrorCode PetscArraycmp(const anytype *str1,const anytype *str2,size_t cnt,PetscBool *e) | |||
1702 | ||||
1703 | Not Collective | |||
1704 | ||||
1705 | Input Parameters: | |||
1706 | + str1 - First array | |||
1707 | . str2 - Second array | |||
1708 | - cnt - Count of the array, not in bytes, but number of entries in the arrays | |||
1709 | ||||
1710 | Output Parameters: | |||
1711 | . e - PETSC_TRUE if equal else PETSC_FALSE. | |||
1712 | ||||
1713 | Level: intermediate | |||
1714 | ||||
1715 | Note: | |||
1716 | This routine is a preferred replacement to PetscMemcmp() | |||
1717 | The arrays must be of the same type | |||
1718 | ||||
1719 | .seealso: PetscMemcpy(), PetscMemcmp(), PetscArrayzero(), PetscMemzero(), PetscArraycpy(), PetscMemmove(), PetscStrallocpy(), | |||
1720 | PetscArraymove() | |||
1721 | M*/ | |||
1722 | #define PetscArraycmp(str1,str2,cnt,e)((sizeof(*(str1)) != sizeof(*(str2))) || PetscMemcmp(str1,str2 ,(cnt)*sizeof(*(str1)),e)) ((sizeof(*(str1)) != sizeof(*(str2))) || PetscMemcmp(str1,str2,(cnt)*sizeof(*(str1)),e)) | |||
1723 | ||||
1724 | /*MC | |||
1725 | PetscArraymove - Copies from one array in memory to another, the arrays may overlap. Use PetscArraycpy() when the arrays | |||
1726 | do not overlap | |||
1727 | ||||
1728 | Synopsis: | |||
1729 | #include <petscsys.h> | |||
1730 | PetscErrorCode PetscArraymove(anytype *str1,const anytype *str2,size_t cnt) | |||
1731 | ||||
1732 | Not Collective | |||
1733 | ||||
1734 | Input Parameters: | |||
1735 | + str1 - First array | |||
1736 | . str2 - Second array | |||
1737 | - cnt - Count of the array, not in bytes, but number of entries in the arrays | |||
1738 | ||||
1739 | Level: intermediate | |||
1740 | ||||
1741 | Note: | |||
1742 | This routine is a preferred replacement to PetscMemmove() | |||
1743 | The arrays must be of the same type | |||
1744 | ||||
1745 | .seealso: PetscMemcpy(), PetscMemcmp(), PetscArrayzero(), PetscMemzero(), PetscArraycpy(), PetscMemmove(), PetscArraycmp(), PetscStrallocpy() | |||
1746 | M*/ | |||
1747 | #define PetscArraymove(str1,str2,cnt)((sizeof(*(str1)) != sizeof(*(str2))) || PetscMemmove(str1,str2 ,(cnt)*sizeof(*(str1)))) ((sizeof(*(str1)) != sizeof(*(str2))) || PetscMemmove(str1,str2,(cnt)*sizeof(*(str1)))) | |||
1748 | ||||
1749 | /*MC | |||
1750 | PetscArraycpy - Copies from one array in memory to another | |||
1751 | ||||
1752 | Synopsis: | |||
1753 | #include <petscsys.h> | |||
1754 | PetscErrorCode PetscArraycpy(anytype *str1,const anytype *str2,size_t cnt) | |||
1755 | ||||
1756 | Not Collective | |||
1757 | ||||
1758 | Input Parameters: | |||
1759 | + str1 - First array (destination) | |||
1760 | . str2 - Second array (source) | |||
1761 | - cnt - Count of the array, not in bytes, but number of entries in the arrays | |||
1762 | ||||
1763 | Level: intermediate | |||
1764 | ||||
1765 | Note: | |||
1766 | This routine is a preferred replacement to PetscMemcpy() | |||
1767 | The arrays must be of the same type | |||
1768 | ||||
1769 | .seealso: PetscMemcpy(), PetscMemcmp(), PetscArrayzero(), PetscMemzero(), PetscArraymove(), PetscMemmove(), PetscArraycmp(), PetscStrallocpy() | |||
1770 | M*/ | |||
1771 | #define PetscArraycpy(str1,str2,cnt)((sizeof(*(str1)) != sizeof(*(str2))) || PetscMemcpy(str1,str2 ,(cnt)*sizeof(*(str1)))) ((sizeof(*(str1)) != sizeof(*(str2))) || PetscMemcpy(str1,str2,(cnt)*sizeof(*(str1)))) | |||
1772 | ||||
1773 | /*MC | |||
1774 | PetscArrayzero - Zeros an array in memory. | |||
1775 | ||||
1776 | Synopsis: | |||
1777 | #include <petscsys.h> | |||
1778 | PetscErrorCode PetscArrayzero(anytype *str1,size_t cnt) | |||
1779 | ||||
1780 | Not Collective | |||
1781 | ||||
1782 | Input Parameters: | |||
1783 | + str1 - array | |||
1784 | - cnt - Count of the array, not in bytes, but number of entries in the array | |||
1785 | ||||
1786 | Level: intermediate | |||
1787 | ||||
1788 | Note: | |||
1789 | This routine is a preferred replacement to PetscMemzero() | |||
1790 | ||||
1791 | .seealso: PetscMemcpy(), PetscMemcmp(), PetscMemzero(), PetscArraycmp(), PetscArraycpy(), PetscMemmove(), PetscStrallocpy(), PetscArraymove() | |||
1792 | M*/ | |||
1793 | #define PetscArrayzero(str1,cnt)PetscMemzero(str1,(cnt)*sizeof(*(str1))) PetscMemzero(str1,(cnt)*sizeof(*(str1))) | |||
1794 | ||||
1795 | /*MC | |||
1796 | PetscPrefetchBlock - Prefetches a block of memory | |||
1797 | ||||
1798 | Synopsis: | |||
1799 | #include <petscsys.h> | |||
1800 | void PetscPrefetchBlock(const anytype *a,size_t n,int rw,int t) | |||
1801 | ||||
1802 | Not Collective | |||
1803 | ||||
1804 | Input Parameters: | |||
1805 | + a - pointer to first element to fetch (any type but usually PetscInt or PetscScalar) | |||
1806 | . n - number of elements to fetch | |||
1807 | . rw - 1 if the memory will be written to, otherwise 0 (ignored by many processors) | |||
1808 | - t - temporal locality (PETSC_PREFETCH_HINT_{NTA,T0,T1,T2}), see note | |||
1809 | ||||
1810 | Level: developer | |||
1811 | ||||
1812 | Notes: | |||
1813 | The last two arguments (rw and t) must be compile-time constants. | |||
1814 | ||||
1815 | Adopting Intel's x86/x86-64 conventions, there are four levels of temporal locality. Not all architectures offer | |||
1816 | equivalent locality hints, but the following macros are always defined to their closest analogue. | |||
1817 | + PETSC_PREFETCH_HINT_NTA - Non-temporal. Prefetches directly to L1, evicts to memory (skips higher level cache unless it was already there when prefetched). | |||
1818 | . PETSC_PREFETCH_HINT_T0 - Fetch to all levels of cache and evict to the closest level. Use this when the memory will be reused regularly despite necessary eviction from L1. | |||
1819 | . PETSC_PREFETCH_HINT_T1 - Fetch to level 2 and higher (not L1). | |||
1820 | - PETSC_PREFETCH_HINT_T2 - Fetch to high-level cache only. (On many systems, T0 and T1 are equivalent.) | |||
1821 | ||||
1822 | This function does nothing on architectures that do not support prefetch and never errors (even if passed an invalid | |||
1823 | address). | |||
1824 | ||||
1825 | M*/ | |||
1826 | #define PetscPrefetchBlock(a,n,rw,t)do { const char *_p = (const char*)(a),*_end = (const char*)( (a)+(n)); for ( ; _p < _end; _p += 64) (__builtin_prefetch ((void *)((const char*)(_p)), ((((t))) >> 2) & 1, ( ((t))) & 0x3)); } while (0) do { \ | |||
1827 | const char *_p = (const char*)(a),*_end = (const char*)((a)+(n)); \ | |||
1828 | for ( ; _p < _end; _p += PETSC_LEVEL1_DCACHE_LINESIZE64) PETSC_Prefetch(_p,(rw),(t))(__builtin_prefetch((void *)((const char*)(_p)), ((((t))) >> 2) & 1, (((t))) & 0x3)); \ | |||
1829 | } while (0) | |||
1830 | ||||
1831 | /* | |||
1832 | Determine if some of the kernel computation routines use | |||
1833 | Fortran (rather than C) for the numerical calculations. On some machines | |||
1834 | and compilers (like complex numbers) the Fortran version of the routines | |||
1835 | is faster than the C/C++ versions. The flag --with-fortran-kernels | |||
1836 | should be used with ./configure to turn these on. | |||
1837 | */ | |||
1838 | #if defined(PETSC_USE_FORTRAN_KERNELS) | |||
1839 | ||||
1840 | #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTCRL) | |||
1841 | #define PETSC_USE_FORTRAN_KERNEL_MULTCRL | |||
1842 | #endif | |||
1843 | ||||
1844 | #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTAIJPERM) | |||
1845 | #define PETSC_USE_FORTRAN_KERNEL_MULTAIJPERM | |||
1846 | #endif | |||
1847 | ||||
1848 | #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTAIJ) | |||
1849 | #define PETSC_USE_FORTRAN_KERNEL_MULTAIJ | |||
1850 | #endif | |||
1851 | ||||
1852 | #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ) | |||
1853 | #define PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ | |||
1854 | #endif | |||
1855 | ||||
1856 | #if !defined(PETSC_USE_FORTRAN_KERNEL_NORM) | |||
1857 | #define PETSC_USE_FORTRAN_KERNEL_NORM | |||
1858 | #endif | |||
1859 | ||||
1860 | #if !defined(PETSC_USE_FORTRAN_KERNEL_MAXPY) | |||
1861 | #define PETSC_USE_FORTRAN_KERNEL_MAXPY | |||
1862 | #endif | |||
1863 | ||||
1864 | #if !defined(PETSC_USE_FORTRAN_KERNEL_SOLVEAIJ) | |||
1865 | #define PETSC_USE_FORTRAN_KERNEL_SOLVEAIJ | |||
1866 | #endif | |||
1867 | ||||
1868 | #if !defined(PETSC_USE_FORTRAN_KERNEL_RELAXAIJ) | |||
1869 | #define PETSC_USE_FORTRAN_KERNEL_RELAXAIJ | |||
1870 | #endif | |||
1871 | ||||
1872 | #if !defined(PETSC_USE_FORTRAN_KERNEL_SOLVEBAIJ) | |||
1873 | #define PETSC_USE_FORTRAN_KERNEL_SOLVEBAIJ | |||
1874 | #endif | |||
1875 | ||||
1876 | #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ) | |||
1877 | #define PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ | |||
1878 | #endif | |||
1879 | ||||
1880 | #if !defined(PETSC_USE_FORTRAN_KERNEL_MDOT) | |||
1881 | #define PETSC_USE_FORTRAN_KERNEL_MDOT | |||
1882 | #endif | |||
1883 | ||||
1884 | #if !defined(PETSC_USE_FORTRAN_KERNEL_XTIMESY) | |||
1885 | #define PETSC_USE_FORTRAN_KERNEL_XTIMESY | |||
1886 | #endif | |||
1887 | ||||
1888 | #if !defined(PETSC_USE_FORTRAN_KERNEL_AYPX) | |||
1889 | #define PETSC_USE_FORTRAN_KERNEL_AYPX | |||
1890 | #endif | |||
1891 | ||||
1892 | #if !defined(PETSC_USE_FORTRAN_KERNEL_WAXPY) | |||
1893 | #define PETSC_USE_FORTRAN_KERNEL_WAXPY | |||
1894 | #endif | |||
1895 | ||||
1896 | #endif | |||
1897 | ||||
1898 | /* | |||
1899 | Macros for indicating code that should be compiled with a C interface, | |||
1900 | rather than a C++ interface. Any routines that are dynamically loaded | |||
1901 | (such as the PCCreate_XXX() routines) must be wrapped so that the name | |||
1902 | mangler does not change the functions symbol name. This just hides the | |||
1903 | ugly extern "C" {} wrappers. | |||
1904 | */ | |||
1905 | #if defined(__cplusplus) | |||
1906 | # define EXTERN_C_BEGIN extern "C" { | |||
1907 | # define EXTERN_C_END } | |||
1908 | #else | |||
1909 | # define EXTERN_C_BEGIN | |||
1910 | # define EXTERN_C_END | |||
1911 | #endif | |||
1912 | ||||
1913 | /* --------------------------------------------------------------------*/ | |||
1914 | ||||
1915 | /*MC | |||
1916 | MPI_Comm - the basic object used by MPI to determine which processes are involved in a | |||
1917 | communication | |||
1918 | ||||
1919 | Level: beginner | |||
1920 | ||||
1921 | Note: This manual page is a place-holder because MPICH does not have a manual page for MPI_Comm | |||
1922 | ||||
1923 | .seealso: PETSC_COMM_WORLD, PETSC_COMM_SELF | |||
1924 | M*/ | |||
1925 | ||||
1926 | #if defined(PETSC_HAVE_MPIIO1) | |||
1927 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MPIU_File_write_all(MPI_File,void*,PetscMPIInt,MPI_Datatype,MPI_Status*); | |||
1928 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MPIU_File_read_all(MPI_File,void*,PetscMPIInt,MPI_Datatype,MPI_Status*); | |||
1929 | #endif | |||
1930 | ||||
1931 | /* the following petsc_static_inline require petscerror.h */ | |||
1932 | ||||
1933 | /* Limit MPI to 32-bits */ | |||
1934 | #define PETSC_MPI_INT_MAX2147483647 2147483647 | |||
1935 | #define PETSC_MPI_INT_MIN-2147483647 -2147483647 | |||
1936 | /* Limit BLAS to 32-bits */ | |||
1937 | #define PETSC_BLAS_INT_MAX2147483647 2147483647 | |||
1938 | #define PETSC_BLAS_INT_MIN-2147483647 -2147483647 | |||
1939 | ||||
1940 | /*@C | |||
1941 | PetscBLASIntCast - casts a PetscInt (which may be 64 bits in size) to a PetscBLASInt (which may be 32 bits in size), generates an | |||
1942 | error if the PetscBLASInt is not large enough to hold the number. | |||
1943 | ||||
1944 | Not Collective | |||
1945 | ||||
1946 | Input Parameter: | |||
1947 | . a - the PetscInt value | |||
1948 | ||||
1949 | Output Parameter: | |||
1950 | . b - the resulting PetscBLASInt value | |||
1951 | ||||
1952 | Level: advanced | |||
1953 | ||||
1954 | Not available from Fortran | |||
1955 | ||||
1956 | .seealso: PetscBLASInt, PetscMPIInt, PetscInt, PetscMPIIntCast() | |||
1957 | @*/ | |||
1958 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscBLASIntCast(PetscInt a,PetscBLASInt *b) | |||
1959 | { | |||
1960 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscsys.h"; petscstack ->line[petscstack->currentsize] = 1960; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1961 | *b = (PetscBLASInt)(a); | |||
1962 | #if defined(PETSC_USE_64BIT_INDICES) && !defined(PETSC_HAVE_64BIT_BLAS_INDICES) | |||
1963 | if ((a) > PETSC_BLAS_INT_MAX2147483647) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Array too long for BLAS/LAPACK")return PetscError(((MPI_Comm)0x44000001),1963,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,63,PETSC_ERROR_INITIAL,"Array too long for BLAS/LAPACK"); | |||
1964 | #endif | |||
1965 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1966 | } | |||
1967 | ||||
1968 | /*@C | |||
1969 | PetscMPIIntCast - casts a PetscInt (which may be 64 bits in size) to a PetscMPIInt (which may be 32 bits in size), generates an | |||
1970 | error if the PetscMPIInt is not large enough to hold the number. | |||
1971 | ||||
1972 | Not Collective | |||
1973 | ||||
1974 | Input Parameter: | |||
1975 | . a - the PetscInt value | |||
1976 | ||||
1977 | Output Parameter: | |||
1978 | . b - the resulting PetscMPIInt value | |||
1979 | ||||
1980 | Level: advanced | |||
1981 | ||||
1982 | Not available from Fortran | |||
1983 | ||||
1984 | .seealso: PetscBLASInt, PetscMPIInt, PetscInt, PetscBLASIntCast() | |||
1985 | @*/ | |||
1986 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscMPIIntCast(PetscInt a,PetscMPIInt *b) | |||
1987 | { | |||
1988 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscsys.h"; petscstack ->line[petscstack->currentsize] = 1988; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1989 | *b = (PetscMPIInt)(a); | |||
1990 | #if defined(PETSC_USE_64BIT_INDICES) | |||
1991 | if ((a) > PETSC_MPI_INT_MAX2147483647) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Array too long for MPI")return PetscError(((MPI_Comm)0x44000001),1991,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,63,PETSC_ERROR_INITIAL,"Array too long for MPI"); | |||
1992 | #endif | |||
1993 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1994 | } | |||
1995 | ||||
1996 | #define PetscInt64Mult(a,b)((PetscInt64)(a))*((PetscInt64)(b)) ((PetscInt64)(a))*((PetscInt64)(b)) | |||
1997 | ||||
1998 | /*@C | |||
1999 | ||||
2000 | PetscRealIntMultTruncate - Computes the product of a positive PetscReal and a positive PetscInt and truncates the value to slightly less than the maximal possible value | |||
2001 | ||||
2002 | Not Collective | |||
2003 | ||||
2004 | Input Parameter: | |||
2005 | + a - the PetscReal value | |||
2006 | - b - the second value | |||
2007 | ||||
2008 | Returns: | |||
2009 | the result as a PetscInt value | |||
2010 | ||||
2011 | Use PetscInt64Mult() to compute the product of two PetscInt as a PetscInt64 | |||
2012 | Use PetscIntMultTruncate() to compute the product of two positive PetscInt and truncate to fit a PetscInt | |||
2013 | Use PetscIntMultError() to compute the product of two PetscInt if you wish to generate an error if the result will not fit in a PetscInt | |||
2014 | ||||
2015 | Developers Note: | |||
2016 | We currently assume that PetscInt addition can never overflow, this is obviously wrong but requires many more checks. | |||
2017 | ||||
2018 | This is used where we compute approximate sizes for workspace and need to insure the workspace is index-able. | |||
2019 | ||||
2020 | Not available from Fortran | |||
2021 | ||||
2022 | Level: advanced | |||
2023 | ||||
2024 | .seealso: PetscBLASInt, PetscMPIInt, PetscInt, PetscBLASIntCast(), PetscInt64Mult() | |||
2025 | @*/ | |||
2026 | PETSC_STATIC_INLINEstatic inline PetscInt PetscRealIntMultTruncate(PetscReal a,PetscInt b) | |||
2027 | { | |||
2028 | PetscInt64 r; | |||
2029 | ||||
2030 | r = (PetscInt64) (a*(PetscReal)b); | |||
2031 | if (r > PETSC_MAX_INT2147483647 - 100) r = PETSC_MAX_INT2147483647 - 100; | |||
2032 | return (PetscInt) r; | |||
2033 | } | |||
2034 | ||||
2035 | /*@C | |||
2036 | ||||
2037 | PetscIntMultTruncate - Computes the product of two positive PetscInt and truncates the value to slightly less than the maximal possible value | |||
2038 | ||||
2039 | Not Collective | |||
2040 | ||||
2041 | Input Parameter: | |||
2042 | + a - the PetscInt value | |||
2043 | - b - the second value | |||
2044 | ||||
2045 | Returns: | |||
2046 | the result as a PetscInt value | |||
2047 | ||||
2048 | Use PetscInt64Mult() to compute the product of two PetscInt as a PetscInt64 | |||
2049 | Use PetscRealIntMultTruncate() to compute the product of a PetscReal and a PetscInt and truncate to fit a PetscInt | |||
2050 | Use PetscIntMultError() to compute the product of two PetscInt if you wish to generate an error if the result will not fit in a PetscInt | |||
2051 | ||||
2052 | Not available from Fortran | |||
2053 | ||||
2054 | Developers Note: We currently assume that PetscInt addition can never overflow, this is obviously wrong but requires many more checks. | |||
2055 | ||||
2056 | This is used where we compute approximate sizes for workspace and need to insure the workspace is index-able. | |||
2057 | ||||
2058 | Level: advanced | |||
2059 | ||||
2060 | .seealso: PetscBLASInt, PetscMPIInt, PetscInt, PetscBLASIntCast(), PetscInt64Mult() | |||
2061 | @*/ | |||
2062 | PETSC_STATIC_INLINEstatic inline PetscInt PetscIntMultTruncate(PetscInt a,PetscInt b) | |||
2063 | { | |||
2064 | PetscInt64 r; | |||
2065 | ||||
2066 | r = PetscInt64Mult(a,b)((PetscInt64)(a))*((PetscInt64)(b)); | |||
2067 | if (r > PETSC_MAX_INT2147483647 - 100) r = PETSC_MAX_INT2147483647 - 100; | |||
2068 | return (PetscInt) r; | |||
2069 | } | |||
2070 | ||||
2071 | /*@C | |||
2072 | ||||
2073 | PetscIntSumTruncate - Computes the sum of two positive PetscInt and truncates the value to slightly less than the maximal possible value | |||
2074 | ||||
2075 | Not Collective | |||
2076 | ||||
2077 | Input Parameter: | |||
2078 | + a - the PetscInt value | |||
2079 | - b - the second value | |||
2080 | ||||
2081 | Returns: | |||
2082 | the result as a PetscInt value | |||
2083 | ||||
2084 | Use PetscInt64Mult() to compute the product of two PetscInt as a PetscInt64 | |||
2085 | Use PetscRealIntMultTruncate() to compute the product of a PetscReal and a PetscInt and truncate to fit a PetscInt | |||
2086 | Use PetscIntMultError() to compute the product of two PetscInt if you wish to generate an error if the result will not fit in a PetscInt | |||
2087 | ||||
2088 | This is used where we compute approximate sizes for workspace and need to insure the workspace is index-able. | |||
2089 | ||||
2090 | Not available from Fortran | |||
2091 | ||||
2092 | Level: advanced | |||
2093 | ||||
2094 | .seealso: PetscBLASInt, PetscMPIInt, PetscInt, PetscBLASIntCast(), PetscInt64Mult() | |||
2095 | @*/ | |||
2096 | PETSC_STATIC_INLINEstatic inline PetscInt PetscIntSumTruncate(PetscInt a,PetscInt b) | |||
2097 | { | |||
2098 | PetscInt64 r; | |||
2099 | ||||
2100 | r = ((PetscInt64)a) + ((PetscInt64)b); | |||
2101 | if (r > PETSC_MAX_INT2147483647 - 100) r = PETSC_MAX_INT2147483647 - 100; | |||
2102 | return (PetscInt) r; | |||
2103 | } | |||
2104 | ||||
2105 | /*@C | |||
2106 | ||||
2107 | PetscIntMultError - Computes the product of two positive PetscInt and generates an error with overflow. | |||
2108 | ||||
2109 | Not Collective | |||
2110 | ||||
2111 | Input Parameter: | |||
2112 | + a - the PetscInt value | |||
2113 | - b - the second value | |||
2114 | ||||
2115 | Output Parameter:ma | |||
2116 | . result - the result as a PetscInt value, or NULL if you do not want the result, you just want to check if it overflows | |||
2117 | ||||
2118 | Use PetscInt64Mult() to compute the product of two 32 bit PetscInt and store in a PetscInt64 | |||
2119 | Use PetscIntMultTruncate() to compute the product of two PetscInt and truncate it to fit in a PetscInt | |||
2120 | ||||
2121 | Not available from Fortran | |||
2122 | ||||
2123 | Developers Note: We currently assume that PetscInt addition does not overflow, this is obviously wrong but requires many more checks. | |||
2124 | ||||
2125 | Level: advanced | |||
2126 | ||||
2127 | .seealso: PetscBLASInt, PetscMPIInt, PetscInt, PetscBLASIntCast(), PetscIntMult64(), PetscIntSumError() | |||
2128 | @*/ | |||
2129 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscIntMultError(PetscInt a,PetscInt b,PetscInt *result) | |||
2130 | { | |||
2131 | PetscInt64 r; | |||
2132 | ||||
2133 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscsys.h"; petscstack ->line[petscstack->currentsize] = 2133; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2134 | r = PetscInt64Mult(a,b)((PetscInt64)(a))*((PetscInt64)(b)); | |||
2135 | #if !defined(PETSC_USE_64BIT_INDICES) | |||
2136 | if (r > PETSC_MAX_INT2147483647) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"Product of two integer %d %d overflow, you must ./configure PETSc with --with-64-bit-indices for the case you are running",a,b)return PetscError(((MPI_Comm)0x44000001),2136,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,56,PETSC_ERROR_INITIAL,"Product of two integer %d %d overflow, you must ./configure PETSc with --with-64-bit-indices for the case you are running" ,a,b); | |||
2137 | #endif | |||
2138 | if (result) *result = (PetscInt) r; | |||
2139 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2140 | } | |||
2141 | ||||
2142 | /*@C | |||
2143 | ||||
2144 | PetscIntSumError - Computes the sum of two positive PetscInt and generates an error with overflow. | |||
2145 | ||||
2146 | Not Collective | |||
2147 | ||||
2148 | Input Parameter: | |||
2149 | + a - the PetscInt value | |||
2150 | - b - the second value | |||
2151 | ||||
2152 | Output Parameter:ma | |||
2153 | . c - the result as a PetscInt value, or NULL if you do not want the result, you just want to check if it overflows | |||
2154 | ||||
2155 | Use PetscInt64Mult() to compute the product of two 32 bit PetscInt and store in a PetscInt64 | |||
2156 | Use PetscIntMultTruncate() to compute the product of two PetscInt and truncate it to fit in a PetscInt | |||
2157 | ||||
2158 | Not available from Fortran | |||
2159 | ||||
2160 | Level: advanced | |||
2161 | ||||
2162 | .seealso: PetscBLASInt, PetscMPIInt, PetscInt, PetscBLASIntCast(), PetscInt64Mult() | |||
2163 | @*/ | |||
2164 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscIntSumError(PetscInt a,PetscInt b,PetscInt *result) | |||
2165 | { | |||
2166 | PetscInt64 r; | |||
2167 | ||||
2168 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscsys.h"; petscstack ->line[petscstack->currentsize] = 2168; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2169 | r = ((PetscInt64)a) + ((PetscInt64)b); | |||
2170 | #if !defined(PETSC_USE_64BIT_INDICES) | |||
2171 | if (r > PETSC_MAX_INT2147483647) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"Sum of two integer %d %d overflow, you must ./configure PETSc with --with-64-bit-indices for the case you are running",a,b)return PetscError(((MPI_Comm)0x44000001),2171,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,56,PETSC_ERROR_INITIAL,"Sum of two integer %d %d overflow, you must ./configure PETSc with --with-64-bit-indices for the case you are running" ,a,b); | |||
2172 | #endif | |||
2173 | if (result) *result = (PetscInt) r; | |||
2174 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2175 | } | |||
2176 | ||||
2177 | /* | |||
2178 | The IBM include files define hz, here we hide it so that it may be used as a regular user variable. | |||
2179 | */ | |||
2180 | #if defined(hz) | |||
2181 | # undef hz | |||
2182 | #endif | |||
2183 | ||||
2184 | #include <limits.h> | |||
2185 | ||||
2186 | /* The number of bits in a byte */ | |||
2187 | ||||
2188 | #define PETSC_BITS_PER_BYTE8 CHAR_BIT8 | |||
2189 | ||||
2190 | /* For arrays that contain filenames or paths */ | |||
2191 | ||||
2192 | #if defined(PETSC_HAVE_SYS_PARAM_H1) | |||
2193 | # include <sys/param.h> | |||
2194 | #endif | |||
2195 | #if defined(PETSC_HAVE_SYS_TYPES_H1) | |||
2196 | # include <sys/types.h> | |||
2197 | #endif | |||
2198 | #if defined(MAXPATHLEN4096) | |||
2199 | # define PETSC_MAX_PATH_LEN4096 MAXPATHLEN4096 | |||
2200 | #elif defined(MAX_PATH) | |||
2201 | # define PETSC_MAX_PATH_LEN4096 MAX_PATH | |||
2202 | #elif defined(_MAX_PATH) | |||
2203 | # define PETSC_MAX_PATH_LEN4096 _MAX_PATH | |||
2204 | #else | |||
2205 | # define PETSC_MAX_PATH_LEN4096 4096 | |||
2206 | #endif | |||
2207 | ||||
2208 | /*MC | |||
2209 | ||||
2210 | PETSC_VERSION - This manual page provides information about how PETSc documents and uses its version information. This information is available to both C/C++ | |||
2211 | and Fortran compilers when petscsys.h is included. | |||
2212 | ||||
2213 | ||||
2214 | The current PETSc version and the API for accessing it are defined in petscversion.h | |||
2215 | ||||
2216 | The complete version number is given as the triple PETSC_VERSION_MAJOR.PETSC_VERSION_MINOR.PETSC_VERSION_SUBMINOR (in short hand x.y.z) | |||
2217 | ||||
2218 | A change in the minor version number (y) indicates possible/likely changes in the PETSc API. Note this is different than with the semantic versioning convention | |||
2219 | where only a change in the major version number (x) indicates a change in the API. | |||
2220 | ||||
2221 | A subminor greater than zero indicates a patch release. Version x.y.z maintains source and binary compatibility with version x.y.w for all z and w | |||
2222 | ||||
2223 | Use the macros PETSC_VERSION_EQ(x,y,z), PETSC_VERSION_LT(x,y,z), PETSC_VERSION_LE(x,y,z), PETSC_VERSION_GT(x,y,z), | |||
2224 | PETSC_VERSION_GE(x,y,z) to determine if the current version is equal to, less than, less than or equal to, greater than or greater than or equal to a given | |||
2225 | version number (x.y.z). | |||
2226 | ||||
2227 | PETSC_RELEASE_DATE is the date the x.y version was released (i.e. the version before any patch releases) | |||
2228 | ||||
2229 | PETSC_VERSION_DATE is the date the x.y.z version was released | |||
2230 | ||||
2231 | PETSC_VERSION_GIT is the last git commit to the repository given in the form vx.y.z-wwwww | |||
2232 | ||||
2233 | PETSC_VERSION_DATE_GIT is the date of the last git commit to the repository | |||
2234 | ||||
2235 | Level: intermediate | |||
2236 | ||||
2237 | PETSC_VERSION_() and PETSC_VERSION_PATCH are deprecated and will eventually be removed. For several releases PETSC_VERSION_PATCH is always 0 | |||
2238 | ||||
2239 | M*/ | |||
2240 | ||||
2241 | /*MC | |||
2242 | ||||
2243 | UsingFortran - To use PETSc with Fortran you must use both PETSc include files and modules. At the beginning | |||
2244 | of every function and module definition you need something like | |||
2245 | ||||
2246 | $ | |||
2247 | $#include "petsc/finclude/petscXXX.h" | |||
2248 | $ use petscXXX | |||
2249 | ||||
2250 | You can declare PETSc variables using either of the following. | |||
2251 | ||||
2252 | $ XXX variablename | |||
2253 | $ type(tXXX) variablename | |||
2254 | ||||
2255 | For example, | |||
2256 | ||||
2257 | $#include "petsc/finclude/petscvec.h" | |||
2258 | $ use petscvec | |||
2259 | $ | |||
2260 | $ Vec b | |||
2261 | $ type(tVec) x | |||
2262 | ||||
2263 | Level: beginner | |||
2264 | ||||
2265 | M*/ | |||
2266 | ||||
2267 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetArchType(char[],size_t); | |||
2268 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetHostName(char[],size_t); | |||
2269 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetUserName(char[],size_t); | |||
2270 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetProgramName(char[],size_t); | |||
2271 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSetProgramName(const char[]); | |||
2272 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetDate(char[],size_t); | |||
2273 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetVersion(char[], size_t); | |||
2274 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetVersionNumber(PetscInt*,PetscInt*,PetscInt*,PetscInt*); | |||
2275 | ||||
2276 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortInt(PetscInt,PetscInt[]); | |||
2277 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortedRemoveDupsInt(PetscInt*,PetscInt[]); | |||
2278 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortRemoveDupsInt(PetscInt*,PetscInt[]); | |||
2279 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFindInt(PetscInt, PetscInt, const PetscInt[], PetscInt*); | |||
2280 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFindMPIInt(PetscMPIInt, PetscInt, const PetscMPIInt[], PetscInt*); | |||
2281 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortIntWithPermutation(PetscInt,const PetscInt[],PetscInt[]); | |||
2282 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortStrWithPermutation(PetscInt,const char*[],PetscInt[]); | |||
2283 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortIntWithArray(PetscInt,PetscInt[],PetscInt[]); | |||
2284 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortIntWithArrayPair(PetscInt,PetscInt[],PetscInt[],PetscInt[]); | |||
2285 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortMPIInt(PetscInt,PetscMPIInt[]); | |||
2286 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortRemoveDupsMPIInt(PetscInt*,PetscMPIInt[]); | |||
2287 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortMPIIntWithArray(PetscMPIInt,PetscMPIInt[],PetscMPIInt[]); | |||
2288 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortMPIIntWithIntArray(PetscMPIInt,PetscMPIInt[],PetscInt[]); | |||
2289 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortIntWithScalarArray(PetscInt,PetscInt[],PetscScalar[]); | |||
2290 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortIntWithDataArray(PetscInt,PetscInt[],void*,size_t,void*); | |||
2291 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortReal(PetscInt,PetscReal[]); | |||
2292 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortRealWithArrayInt(PetscInt,PetscReal[],PetscInt[]); | |||
2293 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortRealWithPermutation(PetscInt,const PetscReal[],PetscInt[]); | |||
2294 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortRemoveDupsReal(PetscInt*,PetscReal[]); | |||
2295 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFindReal(PetscReal,PetscInt,const PetscReal[],PetscReal,PetscInt*); | |||
2296 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortSplit(PetscInt,PetscInt,PetscScalar[],PetscInt[]); | |||
2297 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSortSplitReal(PetscInt,PetscInt,PetscReal[],PetscInt[]); | |||
2298 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscProcessTree(PetscInt,const PetscBool [],const PetscInt[],PetscInt*,PetscInt**,PetscInt**,PetscInt**,PetscInt**); | |||
2299 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMergeIntArrayPair(PetscInt,const PetscInt[],const PetscInt[],PetscInt,const PetscInt[],const PetscInt[],PetscInt*,PetscInt**,PetscInt**); | |||
2300 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMergeIntArray(PetscInt,const PetscInt[],PetscInt,const PetscInt[],PetscInt*,PetscInt**); | |||
2301 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMergeMPIIntArray(PetscInt,const PetscMPIInt[],PetscInt,const PetscMPIInt[],PetscInt*,PetscMPIInt**); | |||
2302 | ||||
2303 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSetDisplay(void); | |||
2304 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetDisplay(char[],size_t); | |||
2305 | ||||
2306 | /*J | |||
2307 | PetscRandomType - String with the name of a PETSc randomizer | |||
2308 | ||||
2309 | Level: beginner | |||
2310 | ||||
2311 | Notes: | |||
2312 | To use SPRNG or RANDOM123 you must have ./configure PETSc | |||
2313 | with the option --download-sprng or --download-random123 | |||
2314 | ||||
2315 | .seealso: PetscRandomSetType(), PetscRandom, PetscRandomCreate() | |||
2316 | J*/ | |||
2317 | typedef const char* PetscRandomType; | |||
2318 | #define PETSCRAND"rand" "rand" | |||
2319 | #define PETSCRAND48"rand48" "rand48" | |||
2320 | #define PETSCSPRNG"sprng" "sprng" | |||
2321 | #define PETSCRANDER48"rander48" "rander48" | |||
2322 | #define PETSCRANDOM123"random123" "random123" | |||
2323 | ||||
2324 | /* Logging support */ | |||
2325 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscClassId PETSC_RANDOM_CLASSID; | |||
2326 | ||||
2327 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomInitializePackage(void); | |||
2328 | ||||
2329 | /* Dynamic creation and loading functions */ | |||
2330 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscFunctionList PetscRandomList; | |||
2331 | ||||
2332 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomRegister(const char[],PetscErrorCode (*)(PetscRandom)); | |||
2333 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomSetType(PetscRandom, PetscRandomType); | |||
2334 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomSetFromOptions(PetscRandom); | |||
2335 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomGetType(PetscRandom, PetscRandomType*); | |||
2336 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscRandomViewFromOptions(PetscRandom A,PetscObject obj,const char name[]) {return PetscObjectViewFromOptions((PetscObject)A,obj,name);} | |||
2337 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomView(PetscRandom,PetscViewer); | |||
2338 | ||||
2339 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomCreate(MPI_Comm,PetscRandom*); | |||
2340 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomGetValue(PetscRandom,PetscScalar*); | |||
2341 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomGetValueReal(PetscRandom,PetscReal*); | |||
2342 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomGetInterval(PetscRandom,PetscScalar*,PetscScalar*); | |||
2343 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomSetInterval(PetscRandom,PetscScalar,PetscScalar); | |||
2344 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomSetSeed(PetscRandom,unsigned long); | |||
2345 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomGetSeed(PetscRandom,unsigned long *); | |||
2346 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomSeed(PetscRandom); | |||
2347 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRandomDestroy(PetscRandom*); | |||
2348 | ||||
2349 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetFullPath(const char[],char[],size_t); | |||
2350 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetRelativePath(const char[],char[],size_t); | |||
2351 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetWorkingDirectory(char[],size_t); | |||
2352 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetRealPath(const char[],char[]); | |||
2353 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetHomeDirectory(char[],size_t); | |||
2354 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTestFile(const char[],char,PetscBool *); | |||
2355 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTestDirectory(const char[],char,PetscBool *); | |||
2356 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMkdir(const char[]); | |||
2357 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscMkdtemp(char[]); | |||
2358 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscRMTree(const char[]); | |||
2359 | ||||
2360 | PETSC_STATIC_INLINEstatic inline PetscBool PetscBinaryBigEndian(void) {long _petsc_v = 1; return ((char*)&_petsc_v)[0] ? PETSC_FALSE : PETSC_TRUE;} | |||
2361 | ||||
2362 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBinaryRead(int,void*,PetscInt,PetscInt*,PetscDataType); | |||
2363 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBinarySynchronizedRead(MPI_Comm,int,void*,PetscInt,PetscInt*,PetscDataType); | |||
2364 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBinaryWrite(int,void*,PetscInt,PetscDataType,PetscBool); | |||
2365 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBinarySynchronizedWrite(MPI_Comm,int,void*,PetscInt,PetscDataType,PetscBool); | |||
2366 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBinaryOpen(const char[],PetscFileMode,int *); | |||
2367 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBinaryClose(int); | |||
2368 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSharedTmp(MPI_Comm,PetscBool *); | |||
2369 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSharedWorkingDirectory(MPI_Comm,PetscBool *); | |||
2370 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGetTmp(MPI_Comm,char[],size_t); | |||
2371 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFileRetrieve(MPI_Comm,const char[],char[],size_t,PetscBool *); | |||
2372 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscLs(MPI_Comm,const char[],char[],size_t,PetscBool *); | |||
2373 | #if defined(PETSC_USE_SOCKET_VIEWER1) | |||
2374 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscOpenSocket(const char[],int,int*); | |||
2375 | #endif | |||
2376 | ||||
2377 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBinarySeek(int,off_t,PetscBinarySeekType,off_t*); | |||
2378 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBinarySynchronizedSeek(MPI_Comm,int,off_t,PetscBinarySeekType,off_t*); | |||
2379 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscByteSwap(void *,PetscDataType,PetscInt); | |||
2380 | ||||
2381 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSetDebugTerminal(const char[]); | |||
2382 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSetDebugger(const char[],PetscBool ); | |||
2383 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSetDefaultDebugger(void); | |||
2384 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSetDebuggerFromString(const char*); | |||
2385 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscAttachDebugger(void); | |||
2386 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscStopForDebugger(void); | |||
2387 | ||||
2388 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGatherNumberOfMessages(MPI_Comm,const PetscMPIInt[],const PetscMPIInt[],PetscMPIInt*); | |||
2389 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGatherMessageLengths(MPI_Comm,PetscMPIInt,PetscMPIInt,const PetscMPIInt[],PetscMPIInt**,PetscMPIInt**); | |||
2390 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGatherMessageLengths2(MPI_Comm,PetscMPIInt,PetscMPIInt,const PetscMPIInt[],const PetscMPIInt[],PetscMPIInt**,PetscMPIInt**,PetscMPIInt**); | |||
2391 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPostIrecvInt(MPI_Comm,PetscMPIInt,PetscMPIInt,const PetscMPIInt[],const PetscMPIInt[],PetscInt***,MPI_Request**); | |||
2392 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPostIrecvScalar(MPI_Comm,PetscMPIInt,PetscMPIInt,const PetscMPIInt[],const PetscMPIInt[],PetscScalar***,MPI_Request**); | |||
2393 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscCommBuildTwoSided(MPI_Comm,PetscMPIInt,MPI_Datatype,PetscMPIInt,const PetscMPIInt*,const void*,PetscMPIInt*,PetscMPIInt**,void*) | |||
2394 | PetscAttrMPIPointerWithType(6,3); | |||
2395 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscCommBuildTwoSidedF(MPI_Comm,PetscMPIInt,MPI_Datatype,PetscMPIInt,const PetscMPIInt[],const void*,PetscMPIInt*,PetscMPIInt**,void*,PetscMPIInt, | |||
2396 | PetscErrorCode (*send)(MPI_Comm,const PetscMPIInt[],PetscMPIInt,PetscMPIInt,void*,MPI_Request[],void*), | |||
2397 | PetscErrorCode (*recv)(MPI_Comm,const PetscMPIInt[],PetscMPIInt,void*,MPI_Request[],void*),void *ctx) | |||
2398 | PetscAttrMPIPointerWithType(6,3); | |||
2399 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscCommBuildTwoSidedFReq(MPI_Comm,PetscMPIInt,MPI_Datatype,PetscMPIInt,const PetscMPIInt[],const void*,PetscMPIInt*,PetscMPIInt**,void*,PetscMPIInt, | |||
2400 | MPI_Request**,MPI_Request**, | |||
2401 | PetscErrorCode (*send)(MPI_Comm,const PetscMPIInt[],PetscMPIInt,PetscMPIInt,void*,MPI_Request[],void*), | |||
2402 | PetscErrorCode (*recv)(MPI_Comm,const PetscMPIInt[],PetscMPIInt,void*,MPI_Request[],void*),void *ctx) | |||
2403 | PetscAttrMPIPointerWithType(6,3); | |||
2404 | ||||
2405 | PETSC_EXTERNextern __attribute__((visibility ("default"))) const char *const PetscBuildTwoSidedTypes[]; | |||
2406 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscCommBuildTwoSidedSetType(MPI_Comm,PetscBuildTwoSidedType); | |||
2407 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscCommBuildTwoSidedGetType(MPI_Comm,PetscBuildTwoSidedType*); | |||
2408 | ||||
2409 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSSEIsEnabled(MPI_Comm,PetscBool*,PetscBool*); | |||
2410 | ||||
2411 | PETSC_EXTERNextern __attribute__((visibility ("default"))) MPI_Comm PetscObjectComm(PetscObject); | |||
2412 | ||||
2413 | PETSC_EXTERNextern __attribute__((visibility ("default"))) const char *const PetscSubcommTypes[]; | |||
2414 | ||||
2415 | struct _n_PetscSubcomm { | |||
2416 | MPI_Comm parent; /* parent communicator */ | |||
2417 | MPI_Comm dupparent; /* duplicate parent communicator, under which the processors of this subcomm have contiguous rank */ | |||
2418 | MPI_Comm child; /* the sub-communicator */ | |||
2419 | PetscMPIInt n; /* num of subcommunicators under the parent communicator */ | |||
2420 | PetscMPIInt color; /* color of processors belong to this communicator */ | |||
2421 | PetscMPIInt *subsize; /* size of subcommunicator[color] */ | |||
2422 | PetscSubcommType type; | |||
2423 | char *subcommprefix; | |||
2424 | }; | |||
2425 | ||||
2426 | PETSC_STATIC_INLINEstatic inline MPI_Comm PetscSubcommParent(PetscSubcomm scomm) {return scomm->parent;} | |||
2427 | PETSC_STATIC_INLINEstatic inline MPI_Comm PetscSubcommChild(PetscSubcomm scomm) {return scomm->child;} | |||
2428 | PETSC_STATIC_INLINEstatic inline MPI_Comm PetscSubcommContiguousParent(PetscSubcomm scomm) {return scomm->dupparent;} | |||
2429 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSubcommCreate(MPI_Comm,PetscSubcomm*); | |||
2430 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSubcommDestroy(PetscSubcomm*); | |||
2431 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSubcommSetNumber(PetscSubcomm,PetscInt); | |||
2432 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSubcommSetType(PetscSubcomm,PetscSubcommType); | |||
2433 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSubcommSetTypeGeneral(PetscSubcomm,PetscMPIInt,PetscMPIInt); | |||
2434 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSubcommView(PetscSubcomm,PetscViewer); | |||
2435 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSubcommSetFromOptions(PetscSubcomm); | |||
2436 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSubcommSetOptionsPrefix(PetscSubcomm,const char[]); | |||
2437 | ||||
2438 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscHeapCreate(PetscInt,PetscHeap*); | |||
2439 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscHeapAdd(PetscHeap,PetscInt,PetscInt); | |||
2440 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscHeapPop(PetscHeap,PetscInt*,PetscInt*); | |||
2441 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscHeapPeek(PetscHeap,PetscInt*,PetscInt*); | |||
2442 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscHeapStash(PetscHeap,PetscInt,PetscInt); | |||
2443 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscHeapUnstash(PetscHeap); | |||
2444 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscHeapDestroy(PetscHeap*); | |||
2445 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscHeapView(PetscHeap,PetscViewer); | |||
2446 | ||||
2447 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscProcessPlacementView(PetscViewer); | |||
2448 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscShmCommGet(MPI_Comm,PetscShmComm*); | |||
2449 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscShmCommGlobalToLocal(PetscShmComm,PetscMPIInt,PetscMPIInt*); | |||
2450 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscShmCommLocalToGlobal(PetscShmComm,PetscMPIInt,PetscMPIInt*); | |||
2451 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscShmCommGetMpiShmComm(PetscShmComm,MPI_Comm*); | |||
2452 | ||||
2453 | /* routines to better support OpenMP multithreading needs of some PETSc third party libraries */ | |||
2454 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscOmpCtrlCreate(MPI_Comm,PetscInt,PetscOmpCtrl*); | |||
2455 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscOmpCtrlGetOmpComms(PetscOmpCtrl,MPI_Comm*,MPI_Comm*,PetscBool*); | |||
2456 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscOmpCtrlDestroy(PetscOmpCtrl*); | |||
2457 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscOmpCtrlBarrier(PetscOmpCtrl); | |||
2458 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscOmpCtrlOmpRegionOnMasterBegin(PetscOmpCtrl); | |||
2459 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscOmpCtrlOmpRegionOnMasterEnd(PetscOmpCtrl); | |||
2460 | ||||
2461 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSegBufferCreate(size_t,size_t,PetscSegBuffer*); | |||
2462 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSegBufferDestroy(PetscSegBuffer*); | |||
2463 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSegBufferGet(PetscSegBuffer,size_t,void*); | |||
2464 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSegBufferExtractAlloc(PetscSegBuffer,void*); | |||
2465 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSegBufferExtractTo(PetscSegBuffer,void*); | |||
2466 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSegBufferExtractInPlace(PetscSegBuffer,void*); | |||
2467 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSegBufferGetSize(PetscSegBuffer,size_t*); | |||
2468 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSegBufferUnuse(PetscSegBuffer,size_t); | |||
2469 | ||||
2470 | ||||
2471 | /* Type-safe wrapper to encourage use of PETSC_RESTRICT. Does not use PetscFunctionBegin because the error handling | |||
2472 | * prevents the compiler from completely erasing the stub. This is called in inner loops so it has to be as fast as | |||
2473 | * possible. */ | |||
2474 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscSegBufferGetInts(PetscSegBuffer seg,size_t count,PetscInt *PETSC_RESTRICT__restrict *slot) {return PetscSegBufferGet(seg,count,(void**)slot);} | |||
2475 | ||||
2476 | extern PetscOptionsHelpPrinted PetscOptionsHelpPrintedSingleton; | |||
2477 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscOptionsHelpPrintedDestroy(PetscOptionsHelpPrinted*); | |||
2478 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscOptionsHelpPrintedCreate(PetscOptionsHelpPrinted*); | |||
2479 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscOptionsHelpPrintedCheck(PetscOptionsHelpPrinted,const char*,const char*,PetscBool*); | |||
2480 | ||||
2481 | #include <stdarg.h> | |||
2482 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscVSNPrintf(char*,size_t,const char[],size_t*,va_list); | |||
2483 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode (*PetscVFPrintf)(FILE*,const char[],va_list); | |||
2484 | ||||
2485 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscSegBuffer PetscCitationsList; | |||
2486 | ||||
2487 | /*@C | |||
2488 | PetscCitationsRegister - Register a bibtex item to obtain credit for an implemented algorithm used in the code. | |||
2489 | ||||
2490 | Not Collective - only what is registered on rank 0 of PETSC_COMM_WORLD will be printed | |||
2491 | ||||
2492 | Input Parameters: | |||
2493 | + cite - the bibtex item, formated to displayed on multiple lines nicely | |||
2494 | - set - a boolean variable initially set to PETSC_FALSE; this is used to insure only a single registration of the citation | |||
2495 | ||||
2496 | Level: intermediate | |||
2497 | ||||
2498 | Not available from Fortran | |||
2499 | ||||
2500 | Options Database: | |||
2501 | . -citations [filename] - print out the bibtex entries for the given computation | |||
2502 | @*/ | |||
2503 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscCitationsRegister(const char cit[],PetscBool *set) | |||
2504 | { | |||
2505 | size_t len; | |||
2506 | char *vstring; | |||
2507 | PetscErrorCode ierr; | |||
2508 | ||||
2509 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscsys.h"; petscstack ->line[petscstack->currentsize] = 2509; petscstack-> petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2510 | if (set && *set) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2511 | ierr = PetscStrlen(cit,&len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2511,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2512 | ierr = PetscSegBufferGet(PetscCitationsList,len,&vstring);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2512,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2513 | ierr = PetscArraycpy(vstring,cit,len)((sizeof(*(vstring)) != sizeof(*(cit))) || PetscMemcpy(vstring ,cit,(len)*sizeof(*(vstring))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2513,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2514 | if (set) *set = PETSC_TRUE; | |||
2515 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2516 | } | |||
2517 | ||||
2518 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscURLShorten(const char[],char[],size_t); | |||
2519 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGoogleDriveAuthorize(MPI_Comm,char[],char[],size_t); | |||
2520 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGoogleDriveRefresh(MPI_Comm,const char[],char[],size_t); | |||
2521 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGoogleDriveUpload(MPI_Comm,const char[],const char []); | |||
2522 | ||||
2523 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBoxAuthorize(MPI_Comm,char[],char[],size_t); | |||
2524 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscBoxRefresh(MPI_Comm,const char[],char[],char[],size_t); | |||
2525 | ||||
2526 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscGlobusGetTransfers(MPI_Comm,const char[],char[],size_t); | |||
2527 | ||||
2528 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTextBelt(MPI_Comm,const char[],const char[],PetscBool*); | |||
2529 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTellMyCell(MPI_Comm,const char[],const char[],PetscBool*); | |||
2530 | ||||
2531 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPullJSONValue(const char[],const char[],char[],size_t,PetscBool*); | |||
2532 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscPushJSONValue(char[],const char[],const char[],size_t); | |||
2533 | ||||
2534 | ||||
2535 | #if defined(PETSC_USE_DEBUG1) | |||
2536 | /* | |||
2537 | Verify that all processes in the communicator have called this from the same line of code | |||
2538 | */ | |||
2539 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscAllreduceBarrierCheck(MPI_Comm,PetscMPIInt,int,const char*,const char *); | |||
2540 | ||||
2541 | /*MC | |||
2542 | MPIU_Allreduce - a PETSc replacement for MPI_Allreduce() that tries to determine if the call from all the MPI processes occur from the | |||
2543 | same place in the PETSc code. This helps to detect bugs where different MPI processes follow different code paths | |||
2544 | resulting in inconsistent and incorrect calls to MPI_Allreduce(). | |||
2545 | ||||
2546 | Collective | |||
2547 | ||||
2548 | Synopsis: | |||
2549 | #include <petscsys.h> | |||
2550 | PetscErrorCode MPIU_Allreduce(void *indata,void *outdata,PetscMPIInt count,MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); | |||
2551 | ||||
2552 | Input Parameters: | |||
2553 | + indata - pointer to the input data to be reduced | |||
2554 | . count - the number of MPI data items in indata and outdata | |||
2555 | . datatype - the MPI datatype, for example MPI_INT | |||
2556 | . op - the MPI operation, for example MPI_SUM | |||
2557 | - comm - the MPI communicator on which the operation occurs | |||
2558 | ||||
2559 | Output Parameter: | |||
2560 | . outdata - the reduced values | |||
2561 | ||||
2562 | Notes: | |||
2563 | In optimized mode this directly calls MPI_Allreduce() | |||
2564 | ||||
2565 | Level: developer | |||
2566 | ||||
2567 | .seealso: MPI_Allreduce() | |||
2568 | M*/ | |||
2569 | #define MPIU_Allreduce(a,b,c,d,e,fcomm)(PetscAllreduceBarrierCheck(fcomm,c,2569,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((fcomm)),0) || MPI_Allreduce((a),(b),(c),(d),(e),(fcomm)))) (PetscAllreduceBarrierCheck(fcomm,c,__LINE__2569,PETSC_FUNCTION_NAME__func__,__FILE__"/sandbox/petsc/petsc.next-tmp/include/petscsys.h") || MPI_Allreduce(a,b,c,d,e,fcomm)((petsc_allreduce_ct += PetscMPIParallelComm((fcomm)),0) || MPI_Allreduce ((a),(b),(c),(d),(e),(fcomm)))) | |||
2570 | #else | |||
2571 | #define MPIU_Allreduce(a,b,c,d,e,fcomm)(PetscAllreduceBarrierCheck(fcomm,c,2571,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscsys.h" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((fcomm)),0) || MPI_Allreduce((a),(b),(c),(d),(e),(fcomm)))) MPI_Allreduce(a,b,c,d,e,fcomm)((petsc_allreduce_ct += PetscMPIParallelComm((fcomm)),0) || MPI_Allreduce ((a),(b),(c),(d),(e),(fcomm))) | |||
2572 | #endif | |||
2573 | ||||
2574 | #if defined(PETSC_HAVE_MPI_WIN_CREATE_FEATURE) | |||
2575 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MPIU_Win_allocate_shared(MPI_Aint,PetscMPIInt,MPI_Info,MPI_Comm,void*,MPI_Win*); | |||
2576 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MPIU_Win_shared_query(MPI_Win,PetscMPIInt,MPI_Aint*,PetscMPIInt*,void*); | |||
2577 | #endif | |||
2578 | ||||
2579 | /* | |||
2580 | Returned from PETSc functions that are called from MPI, such as related to attributes | |||
2581 | */ | |||
2582 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscMPIInt PETSC_MPI_ERROR_CLASS; | |||
2583 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscMPIInt PETSC_MPI_ERROR_CODE; | |||
2584 | ||||
2585 | #endif |